本文整理汇总了PHP中mysql_squid_builder::DELETE_TABLE方法的典型用法代码示例。如果您正苦于以下问题:PHP mysql_squid_builder::DELETE_TABLE方法的具体用法?PHP mysql_squid_builder::DELETE_TABLE怎么用?PHP mysql_squid_builder::DELETE_TABLE使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mysql_squid_builder
的用法示例。
在下文中一共展示了mysql_squid_builder::DELETE_TABLE方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: repair_table_days
function repair_table_days()
{
$q = new mysql_squid_builder();
echo "Delete table tables_day\n";
$q->DELETE_TABLE("tables_day");
echo "Check databases...\n";
$q->CheckTables();
$array = $q->LIST_TABLES_dansguardian_events();
while (list($tablename, $none) = each($array)) {
echo $tablename . "\n";
$time = $q->TIME_FROM_DANSGUARDIAN_EVENTS_TABLE($tablename);
$date = date("Y-m-d", $time);
$q->QUERY_SQL("INSERT IGNORE INTO tables_day (tablename,zDate) VALUES ('{$tablename}','{$date}')");
}
}
示例2: clean_squid_stats_dbs
function clean_squid_stats_dbs()
{
$sock = new sockets();
$DisableArticaProxyStatistics = $sock->GET_INFO("DisableArticaProxyStatistics");
$CleanArticaSquidDatabases = $sock->GET_INFO("CleanArticaSquidDatabases");
if (!is_numeric($DisableArticaProxyStatistics)) {
$DisableArticaProxyStatistics = 0;
}
if (!is_numeric($CleanArticaSquidDatabases)) {
$CleanArticaSquidDatabases = 0;
}
if (!$GLOBALS["FORCE"]) {
if ($CleanArticaSquidDatabases == 0) {
echo "Option is not activated...\n";
return;
}
}
$q = new mysql_squid_builder();
$tables = $q->LIST_TABLES_DAYS();
$rows = 0;
$count_tables = 0;
while (list($num, $table) = each($tables)) {
$rows = $rows + $q->COUNT_ROWS($table);
if ($GLOBALS["VERBOSE"]) {
echo " Delete table {$table} {$rows} rows \n";
}
$count_tables++;
$q->DELETE_TABLE($table);
}
$tables = $q->LIST_TABLES_DAYS_BLOCKED();
while (list($num, $table) = each($tables)) {
$rows = $rows + $q->COUNT_ROWS($table);
if ($GLOBALS["VERBOSE"]) {
echo " Delete table {$table} {$rows} rows \n";
}
$count_tables++;
$q->DELETE_TABLE($table);
}
$tables = $q->LIST_TABLES_MEMBERS();
while (list($num, $table) = each($tables)) {
$rows = $rows + $q->COUNT_ROWS($table);
if ($GLOBALS["VERBOSE"]) {
echo " Delete table {$table} {$rows} rows \n";
}
$count_tables++;
$q->DELETE_TABLE($table);
}
$tables = $q->LIST_TABLES_MONTH();
while (list($num, $table) = each($tables)) {
$rows = $rows + $q->COUNT_ROWS($table);
if ($GLOBALS["VERBOSE"]) {
echo " Delete table {$table} {$rows} rows \n";
}
$count_tables++;
$q->DELETE_TABLE($table);
}
$tables = $q->LIST_TABLES_WEEKS();
while (list($num, $table) = each($tables)) {
$rows = $rows + $q->COUNT_ROWS($table);
if ($GLOBALS["VERBOSE"]) {
echo " Delete table {$table} {$rows} rows \n";
}
$count_tables++;
$q->DELETE_TABLE($table);
}
$q = new mysql_catz();
$tables = $q->LIST_TABLES_CATEGORIES();
while (list($num, $table) = each($tables)) {
$rows = $rows + $q->COUNT_ROWS($table);
if ($GLOBALS["VERBOSE"]) {
echo " Delete table {$table} {$rows} rows \n";
}
$count_tables++;
$q->DELETE_TABLE($table);
}
$q = new mysql();
if ($q->DATABASE_EXISTS("catz")) {
$q->DELETE_DATABASE("catz");
}
if ($count_tables > 0) {
mysql_admin_mysql(1, "Restarting MySQL service...", null, __FILE__, __LINE__);
shell_exec("/etc/init.d/mysql restart");
}
$sock->TOP_NOTIFY("{$count_tables} statistics tables as been deleted with {$rows} rows", "info");
//print_r($tables);
}
示例3: purge
//.........这里部分代码省略.........
}
}
$tableTMP = "quotaday_" . date("Ymd", $DayTime) . "";
if ($q->TABLE_EXISTS($tableTMP)) {
$tablesB[$tableTMP] = true;
} else {
if ($GLOBALS["VERBOSE"]) {
echo "{$tableTMP} no such table, continue\n";
}
}
$tableTMP = date("Ymd", $DayTime) . "_catfam";
if ($q->TABLE_EXISTS($tableTMP)) {
$tablesB[$tableTMP] = true;
} else {
if ($GLOBALS["VERBOSE"]) {
echo "{$tableTMP} no such table, continue\n";
}
}
$c = array();
while (list($a, $b) = each($tablesB)) {
$c[] = $a;
}
reset($tablesB);
echo "Backup tables: " . @implode(", ", $c) . "\n";
if (count($tablesB) > 0) {
$cmdline = "{$mysqldump_prefix}" . @implode(" ", $c) . " >{$container}";
if ($GLOBALS["VERBOSE"]) {
echo "\n*******\n{$cmdline}\n*******\n";
}
$resultsZ = array();
exec($cmdline, $resultsZ);
if (!TestDump($resultsZ, $container)) {
ufdbguard_admin_events("Fatal Error: day: Dump failed {$day}", __FUNCTION__, __FILE__, __LINE__, "backup");
KillMountPoint();
return;
}
$size = @filesize($container);
chdir($ArticaProxyStatisticsBackupFolder);
$cmdline = "{$tar} cfz {$container}.tar.gz {$container} 2>&1";
$resultsZ = array();
exec($cmdline, $resultsZ);
while (list($a, $b) = each($resultsZ)) {
echo "Compress: `{$b}`\n";
}
if (!$unix->TARGZ_TEST_CONTAINER("{$container}.tar.gz")) {
squid_admin_purge(0, "Error {$container} failed", __FILE__, __LINE__);
ufdbguard_admin_events("Fatal Error: tar {$container} failed", __FUNCTION__, __FILE__, __LINE__, "backup");
@unlink($container);
@unlink("{$container}.tar.gz");
KillMountPoint();
return;
}
$TotalSize = $TotalSize + $size;
@unlink($container);
reset($tablesB);
while (list($tablename, $line) = each($tablesB)) {
if ($GLOBALS["VERBOSE"]) {
echo "Delete table `{$tablename}`\n";
}
if (!$q->DELETE_TABLE($tablename)) {
if ($GLOBALS["VERBOSE"]) {
echo "Delete {$tablename} failed {$q->mysql_error} ...\n";
}
ufdbguard_admin_events("Fatal Error: Delete {$tablename} failed {$q->mysql_error} ", __FUNCTION__, __FILE__, __LINE__, "backup");
KillMountPoint();
return;
}
$DeleteTables++;
}
}
if ($GLOBALS["VERBOSE"]) {
echo "Delete table `{$TableKey}` from tables_day\n";
}
$q->QUERY_SQL("DELETE FROM tables_day WHERE tablename='{$TableKey}'");
}
$container = "{$ArticaProxyStatisticsBackupFolder}/squidlogs.FULL.sql";
$resultsZ = array();
$cmd = "{$mysqldump_prefix} >{$container}";
exec($cmd, $resultsZ);
chdir($ArticaProxyStatisticsBackupFolder);
$cmdline = "{$tar} cfz {$container}.tar.gz {$container} 2>&1";
exec($cmdline);
if (!$unix->TARGZ_TEST_CONTAINER("{$container}.tar.gz")) {
squid_admin_purge(0, "Error {$container}.tar.gz, not a valid compressed file", __FILE__, __LINE__);
ufdbguard_admin_events("Error {$container}.tar.gz, not a valid compressed file", __FUNCTION__, __FILE__, __LINE__, "backup");
@unlink("{$container}.tar.gz");
} else {
$size = @filesize($container);
$TotalSize = $TotalSize + $size;
@unlink("{$container}");
}
if ($DeleteTables > 0) {
$TotalSize = FormatBytes($TotalSize / 1024);
$took = $unix->distanceOfTimeInWords($t, time(), true);
squid_admin_purge(2, "Success backup and purge {$DeleteTables} table(s) ({$TotalSize})", "took:{$took}", __FILE__, __LINE__);
ufdbguard_admin_events("Success backup and purge {$DeleteTables} table(s) ({$TotalSize}) took:{$took}", __FUNCTION__, __FILE__, __LINE__, "backup");
}
CleanQuotas();
KillMountPoint();
}
示例4: backupTable
function backupTable($tablename, $filename)
{
if (isset($GLOBALS["ALREADYDONETABLE"][$tablename])) {
return true;
}
$GLOBALS["ALREADYDONETABLE"][$tablename] = true;
$unix = new unix();
$q = new mysql_squid_builder();
if (!$q->TABLE_EXISTS($tablename)) {
return true;
}
$q->BD_CONNECT();
$dump = new phpMyDumper("squidlogs", $q->mysql_connection, $filename, true, $tablename);
if (!$dump->doDump()) {
ufdbguard_admin_events("Fatal, unable to dump database {$ligne["tablename"]}", __FUNCTION__, __FILE__, __LINE__, "backup");
return false;
}
$filesize = $unix->file_size($filename);
if ($filesize < 200) {
ufdbguard_admin_events("Fatal, {$filesize} bytes it seems there is an issue on {$tablename} table", __FUNCTION__, __FILE__, __LINE__, "backup");
return false;
}
$q->QUERY_SQL("INSERT INTO webstats_backup (`tablename`,`filepath`,`filesize`) \n\tVALUES('{$tablename}','{$filename}','{$filesize}')");
if (!$q->ok) {
ufdbguard_admin_events("Fatal, MySQL error {$q->mysql_error} on webstats_backup", __FUNCTION__, __FILE__, __LINE__, "backup");
return false;
}
$q->DELETE_TABLE($tablename);
return true;
}
示例5: build_report
function build_report($ID, $nopid = false)
{
if (!is_numeric($ID)) {
ufdbguard_admin_events("Not a numeric ID", __FUNCTION__, __FILE__, __LINE__, "reports");
return;
}
$t = time();
$unix = new unix();
$tablename = "WebTrackMem{$ID}";
$tableBlock = "WebTrackMeB{$ID}";
if (!$nopid) {
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".{$ID}.pid";
$pid = @file_get_contents($pidfile);
if ($pid < 100) {
$pid = null;
}
if ($unix->process_exists($pid, basename(__FILE__))) {
ufdbguard_admin_events("Already executed pid {$pid}", __FUNCTION__, __FILE__, __LINE__, "reports");
if ($GLOBALS["VERBOSE"]) {
echo "Already executed pid {$pid}\n";
}
return;
}
}
if ($GLOBALS["VERBOSE"]) {
echo "Building report {$ID}\n";
}
$q = new mysql_squid_builder();
if ($q->TABLE_EXISTS($tablename)) {
$q->DELETE_TABLE($tablename);
}
if ($q->TABLE_EXISTS($tableBlock)) {
$q->DELETE_TABLE($tableBlock);
}
if (!$q->CreateMemberReportTable($tablename)) {
ufdbguard_admin_events("could not create table {$tablename}", __FUNCTION__, __FILE__, __LINE__, "reports");
return;
}
if (!$q->CreateMemberReportBlockTable($tableBlock)) {
ufdbguard_admin_events("could not create table {$tablename}", __FUNCTION__, __FILE__, __LINE__, "reports");
return;
}
$rp = new squid_report($ID);
$LIST_TABLES_dansguardian_events = $q->LIST_TABLES_dansguardian_events();
progress(10, $ID);
$counttables = count($LIST_TABLES_dansguardian_events);
$prefix = "INSERT IGNORE INTO {$tablename} (`zMD5`,`sitename`,`familysite`,`{$rp->userfield}`,`zDate`,`size`,`hits`,`category`) VALUES ";
while (list($sourcetable, $ligne) = each($LIST_TABLES_dansguardian_events)) {
$c++;
$sql = $rp->BuildQuery($sourcetable);
$results = $q->QUERY_SQL($sql);
if (!$q->ok) {
ufdbguard_admin_events("{$q->mysql_error}\n{$sql}", __FUNCTION__, __FILE__, __LINE__, "reports");
return;
}
if ($GLOBALS["VERBOSE"]) {
echo "Parsing {$sourcetable} \n{$sql}\n-> `" . mysql_num_rows($results) . "` rows\n";
}
if (mysql_num_rows($results) == 0) {
continue;
}
$purc = round($c / $counttables, 2) * 100;
progress($purc, $ID);
$f = array();
while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
$md5 = md5(serialize($ligne));
$sitename = $ligne["sitename"];
$familysite = $q->GetFamilySites($sitename);
if (!isset($GLOBALS["CATEGORY"][$sitename])) {
$GLOBALS["CATEGORY"][$sitename] = $q->GET_CATEGORIES($sitename);
}
$category = $GLOBALS["CATEGORY"][$sitename];
$source = addslashes($ligne["source"]);
$zDate = $ligne["zDate"];
$size = $ligne["size"];
$hits = $ligne["hits"];
$category = addslashes($category);
$f[] = "('{$md5}','{$sitename}','{$familysite}','{$source}','{$zDate}','{$size}','{$hits}','{$category}')";
}
if (count($f) == 0) {
continue;
}
$q->QUERY_SQL($prefix . @implode(",", $f));
if (!$q->ok) {
ufdbguard_admin_events("{$q->mysql_error}", __FUNCTION__, __FILE__, __LINE__, "reports");
return;
}
if (system_is_overloaded(__FILE__)) {
sleep(5);
}
}
if ($rp->csv == 1) {
SaveCSV($ID);
}
$LIST_TABLES_BLOCKED = $q->LIST_TABLES_BLOCKED();
$prefix = "INSERT IGNORE INTO {$tableBlock} (`zMD5`,`zDate`,`hits`,`website`,`category`,`rulename`,`event`,`why`,`explain`,`blocktype`,`{$rp->userfield}`) VALUES ";
while (list($sourcetable, $ligne) = each($LIST_TABLES_BLOCKED)) {
$c++;
if ($GLOBALS["VERBOSE"]) {
echo "Parsing {$sourcetable}\n";
//.........这里部分代码省略.........