$c++; if ($GLOBALS["VERBOSE"]) { echo "Update {$table}\n"; } $q->QUERY_SQL("UPDATE {$table} SET category='{$categories}' WHERE sitename='{$website}'"); if (!$q->ok) { ufdbguard_admin_events($q->mysql_error, __FUNCTION__, __FILE__, __LINE__, "categorize"); } } if (systemMaxOverloaded()) { $took = $unix->distanceOfTimeInWords($t, time()); ufdbguard_admin_events("Fatal: VERY Overloaded system, aborting task (after:{$took} TTL)", __FUNCTION__, __FILE__, __LINE__, "categorize"); return; } $took = $unix->distanceOfTimeInWords($t, time()); cloudlogs("[{$D}/{$MAX}]: Delete {$ligne["zmd5"]} {$website}"); $q->QUERY_SQL("DELETE FROM categorize_changes WHERE `zmd5`='{$ligne["zmd5"]}'"); ufdbguard_admin_events("{$website}/{$categories} has been re-categorized in {$c} week tables {$b} days tables and {$a} hours tables ({$took})", __FUNCTION__, __FILE__, __LINE__, "categorize"); } echo "Finish...\n"; function cloudlogs($text = null) { $logFile = "/var/log/cleancloud.log"; $time = date("Y-m-d H:i:s"); $PID = getmypid(); if (!is_dir(dirname($logFile))) { mkdir(dirname($logFile)); } if (is_file($logFile)) { $size = filesize($logFile); if ($size > 1000000) {
$www = trim(strtolower($www)); echo "{$www} "; $category = $q->GET_CATEGORIES($www, true, true, true); if ($category != null) { $Catgorized++; echo " {$Catgorized}/{$c} Already categorized as {$category}\n"; continue; } $category = $q->GET_CATEGORIES($www); if ($category != null) { $Catgorized++; echo " {$Catgorized}/{$c} New categorized as {$category} {$GLOBALS["CATZWHY"]}\n"; cloudlogs("{$Catgorized}/{$c} {$www} New categorized as {$category} {$GLOBALS["CATZWHY"]}"); continue; } cloudlogs("{$Catgorized}/{$c} {$www} unknown"); echo " {$Catgorized}/{$c} Unknown\n"; } @fclose($handle); @unlink($filename); function crypted() { $ipClass = new IP(); $array = unserialize(base64_decode(@file_get_contents("/root/notcategorized.db"))); $MAINZ = unserialize(@file_get_contents("/root/translated")); $NODETECT = unserialize(@file_get_contents("/root/nodetect")); while (list($uuid, $MAINARRAY) = each($array)) { $max = count($MAINARRAY); $i = 1; while (list($sitename, $ligne) = each($MAINARRAY)) { echo "{$i}/{$max}\n";