function last_days() { $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $timefile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time"; if ($GLOBALS["VERBOSE"]) { echo "last_days Loading done...\nTimeFile:{$timefile}\n"; } $unix = new unix(); if (!$GLOBALS["VERBOSE"]) { if (SquidStatisticsTasksOverTime()) { stats_admin_events(1, "Statistics overtime... Aborting", null, __FILE__, __LINE__); return; } } $pid = @file_get_contents($pidfile); if (!$GLOBALS["FORCE"]) { if ($pid < 100) { $pid = null; } if ($unix->process_exists($pid, basename(__FILE__))) { if ($GLOBALS["VERBOSE"]) { echo "Already executed pid {$pid}\n"; } return; } $timeexec = $unix->file_time_min($timefile); if ($timeexec < 7200) { if ($GLOBALS["VERBOSE"]) { echo "{$timeexec} <> 7200...\n"; } return; } } $q = new mysql_squid_builder(); $mypid = getmypid(); @file_put_contents($pidfile, $mypid); @file_put_contents($timefile, time()); $current_table = date("Ymd") . "_hour"; $t = time(); $sql = "SELECT DATE_FORMAT(zDate,'%Y%m%d') AS `suffix` FROM tables_day \n\t\t\tWHERE DAY(zDate)<DAY(NOW()) AND YEAR(zDate) = YEAR(NOW()) AND MONTH(zDate) = MONTH(NOW()) AND zDate>DATE_SUB(NOW(),INTERVAL 7 DAY)"; $results = $q->QUERY_SQL($sql); $num = mysql_num_rows($results); if ($num == 0) { return; } while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $current_table = $ligne["suffix"] . "_hour"; if (!$q->TABLE_EXISTS($current_table)) { if ($GLOBALS["VERBOSE"]) { echo "{$current_table} no such table\n"; } continue; } if ($GLOBALS["VERBOSE"]) { echo "Processing {$current_table}\n"; } if (!$GLOBALS["VERBOSE"]) { if (SquidStatisticsTasksOverTime()) { stats_admin_events(1, "Statistics overtime... Aborting", null, __FILE__, __LINE__); return; } } _xprocess_table($current_table, true); $f[] = $current_table; } $took = $unix->distanceOfTimeInWords($t, time(), true); stats_admin_events(2, "Processing categorization of {$num} tables {$took}", @implode("\n", $f), __FILE__, __LINE__); }
function week_uris_blocked($asPid = false) { $unix = new unix(); $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $pid = @file_get_contents($pidfile); $myfile = basename(__FILE__); if ($unix->process_exists($pid, $myfile)) { return; } $tStart = time(); if ($GLOBALS["VERBOSE"]) { echo "Create current week table\n"; } $GLOBALS["Q"]->CreateWeekBlockedTable(); if (!$GLOBALS["REBUILD"]) { if ($GLOBALS["VERBOSE"]) { echo "Rebuild is not ordered\n"; } } if ($GLOBALS["REBUILD"]) { if ($GLOBALS["VERBOSE"]) { echo "Rebuild tables...\n"; } $GLOBALS["Q"]->QUERY_SQL("UPDATE tables_day SET weekbdone=0 WHERE weekbdone=1"); } $sql = "SELECT tablename,DATE_FORMAT( zDate, '%Y%m%d' ) AS tablesource,\n\t DAYOFWEEK(zDate) as DayNumber,WEEK( zDate ) AS tweek,\n\t YEAR( zDate ) AS tyear FROM tables_day WHERE weekbdone=0 AND zDate < DATE_SUB( NOW( ) , INTERVAL 1 DAY ) ORDER BY zDate"; $unix = new unix(); $results = $GLOBALS["Q"]->QUERY_SQL($sql); if (!$GLOBALS["Q"]->ok) { stats_admin_events(0, "[Weekly]: Fatal MySQL error on `tables_day`", "{$GLOBALS["Q"]->mysql_error}", __FILE__, __LINE__); return; } $c = 0; $FailedTables = 0; if ($GLOBALS["VERBOSE"]) { echo mysql_num_rows($results) . " rows\n"; } while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { if ($GLOBALS["VERBOSE"]) { echo "\n*********** WEEK {$ligne["tweek"]} of year {$ligne["tyear"]} ***********\n"; } continue; $week_table = "{$ligne["tyear"]}{$ligne["tweek"]}_blocked_week"; if ($GLOBALS["VERBOSE"]) { echo "Week Table:{$week_table} - > CreateWeekBlockedTable('{$ligne["tyear"]}{$ligne["tweek"]}')\n"; } if (!$GLOBALS["Q"]->CreateWeekBlockedTable("{$ligne["tyear"]}{$ligne["tweek"]}")) { ufdbguard_admin_events("Fatal: {$GLOBALS["Q"]->mysql_error} on `{$week_table}` (CREATE)", __FUNCTION__, __FILE__, __LINE__, "stats"); continue; } $DayNumber = $ligne["DayNumber"]; $tablesource = "{$ligne["tablesource"]}_blocked"; $tablesources[] = $tablesource; if ($GLOBALS["VERBOSE"]) { echo "Table source :{$week_table} - > _week_uris_blocked_perform({$tablesource},{$week_table},{$DayNumber})\n"; } $t = time(); if (_week_uris_blocked_perform($tablesource, $week_table, $DayNumber)) { $GLOBALS["Q"]->QUERY_SQL("UPDATE tables_day SET weekbdone=1 WHERE tablename='{$ligne["tablename"]}'"); $c++; } else { $FailedTables++; } if (SquidStatisticsTasksOverTime()) { stats_admin_events(1, "Statistics overtime... Aborting", null, __FILE__, __LINE__); return; } } $took = $unix->distanceOfTimeInWords($tStart, time(), true); if ($FailedTables > 0) { stats_admin_events(2, "[Weekly]: blocked events done ( {$took} ) {$FailedTables} Failed tables", "Tables:\n" . @implode("\n", $tablesources), __FILE__, __LINE__); } }
function members_uid() { $GLOBALS["Q"] = new mysql_squid_builder(); if ($GLOBALS["VERBOSE"]) { "echo Loading...\n"; } $unix = new unix(); if ($GLOBALS["VERBOSE"]) { "echo Loading done...\n"; } $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $timefile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time"; $pid = @file_get_contents($pidfile); if (!$GLOBALS["FORCE"]) { if ($pid < 100) { $pid = null; } $unix = new unix(); if ($unix->process_exists($pid, basename(__FILE__))) { if ($GLOBALS["VERBOSE"]) { echo "Already executed pid {$pid}\n"; } return; } $timeexec = $unix->file_time_min($timefile); if (!$GLOBALS["SCHEDULED"]) { if ($timeexec < 540) { return; } } $mypid = getmypid(); @file_put_contents($pidfile, $mypid); } @unlink($timefile); @file_put_contents($timefile, time()); if (isset($GLOBALS["members_uid_executed"])) { return; } $GLOBALS["members_uid_executed"] = true; $q = new mysql_squid_builder(); $sql = "SELECT tablename,zDate FROM `tables_day` WHERE members_uid=0 AND zDate<DATE_SUB(NOW(),INTERVAL 1 DAY)"; $results = $q->QUERY_SQL($sql); if (!$q->ok) { if ($GLOBALS["VERBOSE"]) { echo "############# ERROR #########\n{$q->mysql_error}\\Line:" . __LINE__ . "\n#############\n"; } } if (mysql_num_rows($results) > 0) { while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $date = $ligne["zDate"]; $time = strtotime($date . " 00:00:00"); if (SquidStatisticsTasksOverTime()) { stats_admin_events(1, "Statistics overtime... Aborting", null, __FILE__, __LINE__); return; } $tablename = $ligne["tablename"]; if ($q->TABLE_EXISTS($tablename)) { if (members_uid_from_dansguardian_events($tablename, $time)) { $q->QUERY_SQL("UPDATE tables_day SET members_uid=1 WHERE tablename='{$tablename}'"); if (SquidStatisticsTasksOverTime()) { stats_admin_events(1, "Statistics overtime... Aborting", null, __FILE__, __LINE__); return; } continue; } } $hourtable = date("Ymd", $time) . "_hour"; if ($q->TABLE_EXISTS($hourtable)) { if (members_uid_from_hourtable($hourtable, $time)) { $q->QUERY_SQL("UPDATE tables_day SET members_uid=1 WHERE tablename='{$tablename}'"); if (SquidStatisticsTasksOverTime()) { stats_admin_events(1, "Statistics overtime... Aborting", null, __FILE__, __LINE__); return; } continue; } } if ($GLOBALS["VERBOSE"]) { echo "############# ERROR #########\nNO TABLE FOR {$date}\n#############\n"; } } } }
function start($xtime = 0) { if ($GLOBALS["VERBOSE"]) { "echo Loading...\n"; } $unix = new unix(); $pids = $unix->PIDOF_PATTERN_ALL(basename(__FILE__)); if (count($pids) > 5) { die; } if ($xtime == 0) { if ($GLOBALS["VERBOSE"]) { "echo Loading done...\n"; } $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $timefile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time"; $pid = @file_get_contents($pidfile); if (!$GLOBALS["FORCE"]) { if ($pid < 100) { $pid = null; } $unix = new unix(); if ($unix->process_exists($pid, basename(__FILE__))) { if ($GLOBALS["VERBOSE"]) { echo "Already executed pid {$pid}\n"; } return; } $timeexec = $unix->file_time_min($timefile); if ($timeexec < 720) { return; } $mypid = getmypid(); @file_put_contents($pidfile, $mypid); } } @unlink($timefile); @file_put_contents($timefile, time()); $nohup = $unix->find_program("nohup"); $php = $unix->LOCATE_PHP5_BIN(); if ($xtime > 0) { $dateRequested = date("Y-m-d", $xtime); $dateRequested_sql = " WHERE zDate='{$dateRequested}'"; if (SquidStatisticsTasksOverTime()) { stats_admin_events(1, "Statistics overtime... Aborting ( requested for {$dateRequested} ) ", null, __FILE__, __LINE__); return; } } $sql = "SELECT\n\tDATE_FORMAT(zDate,'%Y%m%d') as tprefix,DATE_FORMAT(zDate,'%Y-%m-%d') as CurDay,tablename FROM tables_day{$dateRequested_sql} \n\tORDER BY zDate DESC"; $q = new mysql_squid_builder(); $results = $q->QUERY_SQL($sql); //bigint(100) if ($q->FIELD_TYPE("tables_day", "totalBlocked", "syslogs") == "bigint(100)") { $q->QUERY_SQL('ALTER TABLE `tables_day` CHANGE `size` `size` BIGINT( 255 ) NOT NULL'); $q->QUERY_SQL('ALTER TABLE `tables_day` CHANGE `totalBlocked` `totalBlocked` BIGINT( 255 ) NOT NULL'); $q->QUERY_SQL('ALTER TABLE `tables_day` CHANGE `requests` `requests` BIGINT( 255 ) NOT NULL'); $q->QUERY_SQL('ALTER TABLE `tables_day` CHANGE `totalsize` `totalsize` BIGINT( 255 ) NOT NULL'); $q->QUERY_SQL('ALTER TABLE `tables_day` CHANGE `size_cached` `size_cached` BIGINT( 255 ) NOT NULL'); } if (!$q->FIELD_EXISTS("tables_day", "totalKeyWords")) { $q->QUERY_SQL("ALTER TABLE `tables_day` ADD `totalKeyWords` BIGINT( 255 ) NOT NULL NOT NULL,ADD INDEX ( `totalKeyWords`)"); if (!$q->ok) { squid_admin_mysql(0, $q->mysql_error, null, __FILE__, __LINE__); echo $q->mysql_error; return; } } if (!$q->FIELD_EXISTS("tables_day", "DangerousCatz")) { $q->QUERY_SQL("ALTER TABLE `tables_day` ADD `DangerousCatz` smallint( 1 ) NOT NULL NOT NULL,ADD INDEX ( `DangerousCatz`)"); } if (!$q->ok) { echo "{$q->mysql_error}.<hr>{$sql}</hr>"; } while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $tablename = $ligne["tablename"]; $hourtable = $ligne["tprefix"] . "_hour"; if ($ligne["tprefix"] == date("Ymd")) { continue; } $KeyWordsTable = "searchwordsD_" . $ligne["tprefix"]; $members_table = "{$ligne["tprefix"]}_members"; $youtube_table = "youtubeday_{$ligne["tprefix"]}"; $myXtime = strtotime($ligne["CurDay"] . "00:00:00"); if ($q->TABLE_EXISTS($hourtable)) { $sql = "SELECT SUM(size) as tsize, SUM(hits) as thits FROM {$hourtable}"; $ligne2 = mysql_fetch_array($q->QUERY_SQL($sql)); $size = $ligne2["tsize"]; $hits = $ligne2["thits"]; $sizeL = FormatBytes($size / 1024); if ($GLOBALS["VERBOSE"]) { echo "{$tablename} - {$sizeL} / {$hits} {$hourtable} [ {$sql} ]\n"; } $sql = "UPDATE tables_day SET totalsize='{$size}',requests='{$hits}' WHERE tablename='{$tablename}'"; $q->QUERY_SQL($sql); if (!$q->ok) { if ($GLOBALS["VERBOSE"]) { echo $q->mysql_error . "\n"; } } $sql = "SELECT COUNT(`sitename`) as tcount FROM {$hourtable} WHERE LENGTH(`category`)=0"; if ($GLOBALS["VERBOSE"]) { echo $sql . "\n"; } $ligne2 = mysql_fetch_array($q->QUERY_SQL($sql)); $max = $ligne2["tcount"]; $sql = "UPDATE tables_day SET `not_categorized`={$max} WHERE tablename='{$tablename}'"; $q->QUERY_SQL($sql); } if ($q->TABLE_EXISTS($members_table)) { $MembersField = which_filter($members_table, true); if ($GLOBALS["VERBOSE"]) { echo "Table members Calculate Members by {$MembersField}\n"; } if ($MembersField != null) { $MembersCount = CalculateElements($members_table, $MembersField); $sql = "UPDATE tables_day SET `MembersCount`={$MembersCount} WHERE tablename='{$tablename}'"; if ($GLOBALS["VERBOSE"]) { echo $sql . "\n"; } $q->QUERY_SQL($sql); } } if ($q->TABLE_EXISTS($youtube_table)) { $sql = "SELECT youtubeid FROM {$youtube_table} GROUP BY youtubeid"; $results2 = $q->QUERY_SQL($sql); if (!$q->ok) { echo $q->mysql_error . "\n"; return; } $YouTubeHits = mysql_num_rows($results2); $sql = "UPDATE tables_day SET `YouTubeHits`={$YouTubeHits} WHERE tablename='{$tablename}'"; $q->QUERY_SQL($sql); } if ($q->TABLE_EXISTS($KeyWordsTable)) { $sql = "SELECT `words` FROM {$KeyWordsTable} GROUP BY `words`"; $results2 = $q->QUERY_SQL($sql); if (!$q->ok) { echo $q->mysql_error . "\n"; return; } $CountOfWords = mysql_num_rows($results2); $sql = "UPDATE tables_day SET totalKeyWords='{$CountOfWords}' WHERE tablename='{$tablename}'"; $q->QUERY_SQL($sql); } } }
function __re_categorize_subtables($oldT1 = 0, $websites) { $unix = new unix(); if (!$GLOBALS["FORCE"]) { if (SquidStatisticsTasksOverTime()) { stats_admin_events(1, "Statistics overtime... Aborting", null, __FILE__, __LINE__); return; } } $sock = new sockets(); $RecategorizeSecondsToWaitOverload = $sock->GET_INFO("RecategorizeSecondsToWaitOverload"); $RecategorizeMaxExecutionTime = $sock->GET_INFO("RecategorizeSecondsToWaitOverload"); if (!is_numeric($RecategorizeSecondsToWaitOverload)) { $RecategorizeSecondsToWaitOverload = 30; } if (!is_numeric($RecategorizeMaxExecutionTime)) { $RecategorizeMaxExecutionTime = 210; } if ($oldT1 > 1) { $t = $oldT1; } else { $t = time(); } $tables_days = $GLOBALS["Q"]->LIST_TABLES_DAYS(); $tables_hours = $GLOBALS["Q"]->LIST_TABLES_HOURS(); $tables_week = $GLOBALS["Q"]->LIST_TABLES_WEEKS(); $tables_blocked_week = $GLOBALS["Q"]->LIST_TABLES_WEEKS_BLOCKED(); $tables_blocked_days = $GLOBALS["Q"]->LIST_TABLES_DAYS_BLOCKED(); $CountUpdatedTables = 0; while (list($website, $category) = each($websites)) { if ($website == null) { continue; } if ($category == null) { continue; } reset($tables_days); reset($tables_hours); reset($tables_week); while (list($num, $tablename) = each($tables_days)) { $category = addslashes($category); $CountUpdatedTables++; $GLOBALS["Q"]->QUERY_SQL("UPDATE {$tablename} SET category='{$category}' WHERE familysite='{$website}'"); if (!$GLOBALS["Q"]->ok) { writelogs_squid("Fatal: mysql error on table {$tablename} {$GLOBALS["Q"]->mysql_error}", __FUNCTION__, __FILE__, __LINE__, "categorize"); return; } } while (list($num, $tablename) = each($tables_hours)) { $category = addslashes($category); $CountUpdatedTables++; $GLOBALS["Q"]->QUERY_SQL("UPDATE {$tablename} SET category='{$category}' WHERE sitename='{$website}'"); if (!$GLOBALS["Q"]->ok) { writelogs_squid("Fatal: mysql error on table {$tablename} {$GLOBALS["Q"]->mysql_error}", __FUNCTION__, __FILE__, __LINE__, "categorize"); return; } } while (list($num, $tablename) = each($tables_week)) { $category = addslashes($category); $CountUpdatedTables++; $GLOBALS["Q"]->QUERY_SQL("UPDATE {$tablename} SET category='{$category}' WHERE sitename='{$website}'"); if (!$GLOBALS["Q"]->ok) { writelogs_squid("Fatal: mysql error on table {$tablename} {$GLOBALS["Q"]->mysql_error}", __FUNCTION__, __FILE__, __LINE__, "categorize"); return; } } while (list($num, $tablename) = each($tables_blocked_days)) { $category = addslashes($category); $CountUpdatedTables++; $GLOBALS["Q"]->QUERY_SQL("UPDATE {$tablename} SET category='{$category}' WHERE website='{$website}'"); if (!$GLOBALS["Q"]->ok) { writelogs_squid("Fatal: mysql error on table {$tablename} {$GLOBALS["Q"]->mysql_error}", __FUNCTION__, __FILE__, __LINE__, "categorize"); return; } } while (list($num, $tablename) = each($tables_blocked_week)) { $category = addslashes($category); $CountUpdatedTables++; $GLOBALS["Q"]->QUERY_SQL("UPDATE {$tablename} SET category='{$category}' WHERE website='{$website}'"); if (!$GLOBALS["Q"]->ok) { writelogs_squid("Fatal: mysql error on table {$tablename} {$GLOBALS["Q"]->mysql_error}", __FUNCTION__, __FILE__, __LINE__, "categorize"); return; } } if (SquidStatisticsTasksOverTime()) { stats_admin_events(1, "Statistics overtime... Aborting", null, __FILE__, __LINE__); return; } $distanceInSeconds = round(abs(time() - $t)); $distanceInMinutes = round($distanceInSeconds / 60); if ($distanceInMinutes > $RecategorizeMaxExecutionTime) { $took = $unix->distanceOfTimeInWords($t, time()); writelogs_squid("Re-categorized websites task aborted (Max execution time {$RecategorizeMaxExecutionTime}Mn) ({$took})", __FUNCTION__, __FILE__, __LINE__, "categorize"); return; } } $took = $unix->distanceOfTimeInWords($t, time()); stats_admin_events(2, count($websites) . "re-categorized websites updated in `{$CountUpdatedTables}` MySQL tables ({$took})", __FUNCTION__, __FILE__, __LINE__, "stats"); }
function thumbnail_parse_dir($directory) { $unix = new unix(); $countDefile = $unix->COUNT_FILES($directory); $sock = new sockets(); $DisableLocalStatisticsTasks = $sock->GET_INFO("DisableLocalStatisticsTasks"); if (!is_numeric($DisableLocalStatisticsTasks)) { $DisableLocalStatisticsTasks = 0; } events_tail("{$directory} {$countDefile} files on Line: " . __LINE__); if ($countDefile == 0) { events("thumbnail_parse_dir():: {$directory}: remove... on Line: " . __LINE__); @rmdir($directory); return; } if (!($handle = opendir($directory))) { ufdbguard_admin_events("Fatal: {$directory} no such directory", __FUNCTION__, __FILE__, __LINE__, "stats"); return; } $c = 0; $d = 0; while (false !== ($filename = readdir($handle))) { if ($filename == ".") { continue; } if ($filename == "..") { continue; } $targetFile = "{$directory}/{$filename}"; $d++; if ($DisableLocalStatisticsTasks == 1) { @unlink($targetFile); continue; } $arrayFile = unserialize(@file_get_contents($targetFile)); if (!is_array($arrayFile)) { @unlink($targetFile); continue; } while (list($sitename, $RTTSIZEARRAY) = each($arrayFile)) { thumbnail_site($sitename); } $c++; @unlink($targetFile); if ($d > 100) { if (SquidStatisticsTasksOverTime()) { stats_admin_events(1, "Statistics overtime... Aborting", null, __FILE__, __LINE__); return; } $d = 0; } } }
function OverStatsTime() { if (SquidStatisticsTasksOverTime()) { stats_admin_events(1, "Statistics overtime... Aborting", null, __FILE__, __LINE__); StampDone(1000, "OverTime"); return true; } }
function websites_uid() { $GLOBALS["Q"] = new mysql_squid_builder(); if ($GLOBALS["VERBOSE"]) { "echo Loading...\n"; } $unix = new unix(); if ($GLOBALS["VERBOSE"]) { "echo Loading done...\n"; } $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $timefile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time"; $pid = @file_get_contents($pidfile); if (!$GLOBALS["FORCE"]) { if ($pid < 100) { $pid = null; } $unix = new unix(); if ($unix->process_exists($pid, basename(__FILE__))) { if ($GLOBALS["VERBOSE"]) { echo "Already executed pid {$pid}\n"; } return; } $timeexec = $unix->file_time_min($timefile); if ($timeexec < 540) { return; } $mypid = getmypid(); @file_put_contents($pidfile, $mypid); } if (isset($GLOBALS["websites_uid_executed"])) { return; } $GLOBALS["websites_uid_executed"] = true; $q = new mysql_squid_builder(); $sql = "SELECT tablename,zDate FROM `tables_day` WHERE websites_uid=0 AND zDate<DATE_SUB(NOW(),INTERVAL 1 DAY)"; $results = $q->QUERY_SQL($sql); if (!$q->ok) { if (preg_match("#Unknown column#", $q->mysql_error)) { $q->CheckTables(); $results = $q->QUERY_SQL($sql); } } if (!$q->ok) { if ($GLOBALS["VERBOSE"]) { echo "############# ERROR #########\n{$q->mysql_error}\\Line:" . __LINE__ . "\n#############\n"; } return; } $c = 0; if (mysql_num_rows($results) == 0) { return; } $TOT = mysql_num_rows($results); while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $date = $ligne["zDate"]; $c++; $time = strtotime($date . " 00:00:00"); $tablename = $ligne["tablename"]; $but = null; $hourtable = date("Ymd", $time) . "_hour"; if (!$q->TABLE_EXISTS($hourtable)) { if ($q->TABLE_EXISTS($tablename)) { $but = " but {$tablename} exists.."; } if ($GLOBALS["VERBOSE"]) { echo "############# ERROR #########\n{$hourtable} no such table ({$date}) {$but}\n#############\n"; } continue; } events("websites_uid_from_hourtable({$hourtable},{$time})"); percentage("Statistics by Users/Websites: {$date} {$c}/{$TOT}", 71); if (websites_uid_from_hourtable($hourtable, $time)) { $q->QUERY_SQL("UPDATE tables_day SET websites_uid=1 WHERE tablename='{$tablename}'"); if (SquidStatisticsTasksOverTime()) { stats_admin_events(1, "Statistics overtime... Aborting", null, __FILE__, __LINE__); return; } continue; } else { if ($GLOBALS["VERBOSE"]) { echo "Return false for {$hourtable} injection\n"; } } } if (SquidStatisticsTasksOverTime()) { stats_admin_events(1, "Statistics overtime... Aborting", null, __FILE__, __LINE__); return; } }