exit; } if (isset($_GET["full-ufdbg-version"])) { root_ufdbg_version(); exit; } if (isset($_GET["recategorize-task"])) { recategorize_task(); exit; } if (isset($_GET["recategorize-day"])) { recategorize_day(); exit; } if (isset($_GET["recategorize-week"])) { recategorize_week(); exit; } if (isset($_GET["cron-tail-injector-plus"])) { cron_tail_injector_plus(); exit; } if (isset($_GET["cron-tail-injector-moins"])) { cron_tail_injector_moins(); exit; } if (isset($_GET["cachelogs"])) { cachelogs(); exit; } if (isset($_GET["cache-smtp-logs"])) {
function not_categorized_day_resync() { $sql = "SELECT DATE_FORMAT(zDate,'%Y%m%d') AS `tprefix`, DATE_FORMAT(zDate,'%Y%u') AS `tprefixW`, `tablename` FROM tables_day WHERE `not_categorized`>0 ORDER BY zDate DESC"; if ($GLOBALS["VERBOSE"]) { echo "not_categorized_day_resync\n"; } $results = $GLOBALS["Q"]->QUERY_SQL($sql); if (!$GLOBALS["Q"]->ok) { if ($GLOBALS["VERBOSE"]) { echo "{$GLOBALS["Q"]->mysql_error}\n"; } ufdbguard_admin_events("Fatal {$GLOBALS["Q"]->mysql_error}", __FUNCTION__, __FILE__, __LINE__, "stats"); return; } $num_rows = mysql_num_rows($results); if ($num_rows == 0) { if ($GLOBALS["VERBOSE"]) { echo "No item\n"; } return; } while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $tablename = $ligne["tablename"]; $table_day = "{$ligne["tprefix"]}_hour"; $table_week = "{$ligne["tprefixW"]}_week"; if ($GLOBALS["Q"]->TABLE_EXISTS("{$table_week}")) { $WEEKZ[$table_week] = true; } if (!$GLOBALS["Q"]->TABLE_EXISTS("{$table_day}")) { if ($GLOBALS["VERBOSE"]) { echo "{$table_day} no such table\n"; } $GLOBALS["Q"]->QUERY_SQL("UPDATE tables_day SET not_categorized=0 WHERE tablename='{$tablename}'"); continue; } $sql = "SELECT sitename,category FROM {$table_day} GROUP BY sitename,category HAVING LENGTH(category)=0 "; $results2 = $GLOBALS["Q"]->QUERY_SQL($sql); if (!$GLOBALS["Q"]->ok) { if ($GLOBALS["VERBOSE"]) { echo "{$GLOBALS["Q"]->mysql_error}\n"; } ufdbguard_admin_events("Fatal {$GLOBALS["Q"]->mysql_error}", __FUNCTION__, __FILE__, __LINE__, "stats"); return; } $NotCategorized = mysql_num_rows($results2); if ($GLOBALS["VERBOSE"]) { echo "{$table_day} {$NotCategorized} Websites...\n"; } $GLOBALS["Q"]->QUERY_SQL("UPDATE tables_day SET not_categorized={$NotCategorized} WHERE tablename='{$tablename}'"); } while (list($tableweek, $ligne) = each($WEEKZ)) { recategorize_week($tableweek, true, true); } }