本文整理汇总了PHP中unix::file_size方法的典型用法代码示例。如果您正苦于以下问题:PHP unix::file_size方法的具体用法?PHP unix::file_size怎么用?PHP unix::file_size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unix
的用法示例。
在下文中一共展示了unix::file_size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: inject_extracted_attach
function inject_extracted_attach($filepath)
{
if ($GLOBALS["VERBOSE"]) {
echo "Injecting {$filepath}\n";
}
$unix = new unix();
$MYSQL_DATA_DIR = $unix->MYSQL_DATA_DIR();
if (!is_dir($MYSQL_DATA_DIR)) {
@mkdir($MYSQL_DATA_DIR, 0755, true);
@chown($MYSQL_DATA_DIR, "mysql");
@chgrp($MYSQL_DATA_DIR, "mysql");
}
$basename = basename($filepath);
$tempfile = "{$MYSQL_DATA_DIR}/{$basename}";
$last_modified = filemtime($filepath);
$filetime = date("Y-m-d H:i:s", $last_modified);
$filesize = $unix->file_size($filepath);
@copy($filepath, $tempfile);
@chmod($tempfile, 0777);
$q = new mysql_mimedefang_builder();
$sql = "SELECT `filename` FROM `storage` WHERE `filename`='{$basename}'";
$ligne = mysql_fetch_array($q->QUERY_SQL($sql));
if (strlen(trim($ligne["filename"])) > 0) {
if ($GLOBALS["VERBOSE"]) {
echo "Skipped {$basename}, already exists in database\n";
}
@unlink($filepath);
return;
}
$sql = "INSERT INTO `storage` (`filename`,`filetime`,`filesize`,`filedata`) VALUES ('{$basename}','{$filetime}','{$filesize}',LOAD_FILE('{$filepath}'))";
$q->QUERY_SQL($sql);
if (!$q->ok) {
system_admin_events("Fatal: {$q->mysql_error}.", __FUNCTION__, __FILE__, __LINE__, "postfix");
$returned = false;
} else {
$returned = true;
@unlink($filepath);
}
@unlink($tempfile);
return $returned;
}
示例2: streamget
function streamget()
{
$sock = new sockets();
$unix = new unix();
$SquidGuardStorageDir = $sock->GET_INFO("SquidGuardStorageDir");
$EnableRemoteStatisticsAppliance = $sock->GET_INFO("EnableRemoteStatisticsAppliance");
if (!is_numeric($EnableRemoteStatisticsAppliance)) {
$EnableRemoteStatisticsAppliance = 0;
}
$hostname = $unix->FULL_HOSTNAME();
$PREFIX = "INSERT IGNORE INTO `youtubecache`(`filename`,`filesize`,`urlsrc`,`zDate`,`zMD5`,`proxyname`) VALUES ";
$q = new mysql_squid_builder();
if (!($handle = opendir($SquidGuardStorageDir))) {
events_tail("streamget:: -> glob failed {$SquidGuardStorageDir} in Line: " . __LINE__);
return;
}
while (false !== ($filename = readdir($handle))) {
if ($filename == ".") {
continue;
}
if ($filename == "..") {
continue;
}
$fullFileName = "{$SquidGuardStorageDir}/{$filename}";
$time = null;
if (strpos($filename, ".url") > 0) {
continue;
}
if (strpos($filename, ".log") > 0) {
continue;
}
$filesize = $unix->file_size($fullFileName);
$time = filemtime($fullFileName);
$zdate = date("Y-m-d H:i:s", $time);
$url = null;
if (is_file($fullFileName . ".url")) {
$url = @file_get_contents($fullFileName . ".url");
}
if ($GLOBALS["VERBOSE"]) {
echo "\n\nFile:{$fullFileName}\nSize:{$filesize}\ndate:{$zdate}\nurl:{$url}\n";
}
$md5 = md5($filename . $hostname);
$f[] = "('{$fullFileName}','{$filesize}','{$url}','{$zdate}','{$md5}','{$hostname}')";
}
if (count($f) > 0) {
$sql = $PREFIX . " " . @implode(",", $f);
if ($EnableRemoteStatisticsAppliance == 0) {
$q->QUERY_SQL($sql);
if (!$q->ok) {
events_tail("streamget:: Fatal {$q->mysql_error}");
}
} else {
if ($GLOBALS["VERBOSE"]) {
echo "streamget_send_remote() with hostname {$hostname}\n";
}
streamget_send_remote($sql, $hostname);
}
}
}
示例3: ScanUpdateUtilityLogs
function ScanUpdateUtilityLogs($force = false)
{
$unix = new unix();
$sock = new sockets();
$unix = new unix();
$timefile = "/etc/artica-postfix/pids/ScanUpdateUtilityLogs.time";
$pidfile = "/etc/artica-postfix/pids/ScanUpdateUtilityLogs.pid";
if (!$force) {
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
$time = $unix->PROCCESS_TIME_MIN($pid);
if ($GLOBALS["VERBOSE"]) {
echo "Already process exists {$pid}\n";
}
return;
}
@file_put_contents($pidfile, getmypid());
$time = $unix->file_time_min($timefile);
if ($timefile < 10) {
if ($GLOBALS["VERBOSE"]) {
echo "Only each 10mn\n";
}
return;
}
}
@unlink($timefile);
@file_put_contents($timefile, time());
$UpdateUtilityStorePath = $sock->GET_INFO("UpdateUtilityStorePath");
if ($UpdateUtilityStorePath == null) {
$UpdateUtilityStorePath = "/home/kaspersky/UpdateUtility";
}
$UpdateUtilityUseLoop = $sock->GET_INFO("UpdateUtilityUseLoop");
if (!is_numeric($UpdateUtilityUseLoop)) {
$UpdateUtilityUseLoop = 0;
}
if ($UpdateUtilityUseLoop == 1) {
$UpdateUtilityStorePath = "/automounts/UpdateUtility";
}
if ($GLOBALS["VERBOSE"]) {
echo "Scanning /var/log/artica-postfix/UpdateUtility-*.log...\n";
}
foreach (glob("/var/log/artica-postfix/UpdateUtility-*.log") as $filename) {
$timefile = $unix->file_time_min($filename);
$time = filemtime($filename);
$details = @file_get_contents($filename);
$f = explode("\n", $details);
$isSuccess = 1;
$files = 0;
$size = 0;
$rp_finish = false;
if ($timefile > 720) {
$rp_finish = true;
}
while (list($key, $line) = each($f)) {
if (preg_match("#New file installed '(.*?)'#", $line, $re)) {
$nextFile = "{$UpdateUtilityStorePath}/databases/Updates/{$re[1]}";
if (!is_file($nextFile)) {
if ($GLOBALS["VERBOSE"]) {
echo "{$nextFile}, no such file\n";
}
$nextFile = "{$UpdateUtilityStorePath}/TempFolder/temporaryFolder/{$re[1]}";
}
if (!is_file($nextFile)) {
if ($GLOBALS["VERBOSE"]) {
echo "{$nextFile}, no such file\n";
}
continue;
}
$files++;
$size = $size + $unix->file_size($nextFile);
continue;
}
if (preg_match("#Segmentation fault#", $line)) {
$isSuccess = 0;
continue;
$rp_finish = true;
}
if (preg_match("#Bus error#", $line)) {
$isSuccess = 0;
continue;
$rp_finish = true;
}
if (preg_match("#Report finished at#", $line, $re)) {
$rp_finish = true;
continue;
}
if (preg_match("#Insufficient disk space#i", $line, $re)) {
$isSuccess = 0;
continue;
$rp_finish = true;
}
if (preg_match("#Failed to#i", $line, $re)) {
$isSuccess = 0;
continue;
}
if (preg_match("#not retranslated#i", $line, $re)) {
$isSuccess = 0;
continue;
$rp_finish = true;
}
//.........这里部分代码省略.........
示例4: replic_host
function replic_host($servername)
{
$t = time();
$unix = new unix();
$free = new freeweb($servername);
$instanceid = $free->mysql_instance_id;
$localdatabase = $free->mysql_database;
if (!isset($free->Params["ROUNDCUBE"]["ENABLE_REPLIC"])) {
if ($GLOBALS["VERBOSE"]) {
echo "{$servername}: ROUNDCUBE/ENABLE_REPLIC no set\n";
}
return null;
}
if ($free->Params["ROUNDCUBE"]["ENABLE_REPLIC"] == 0) {
if ($GLOBALS["VERBOSE"]) {
echo "{$servername}: ROUNDCUBE/ENABLE_REPLIC set to disabled\n";
}
return null;
}
$ARTICA_PORT = $free->Params["ROUNDCUBE"]["ARTICA_PORT"];
$ARTICA_ADMIN = $free->Params["ROUNDCUBE"]["ARTICA_ADMIN"];
$ARTICA_PASSWORD = $free->Params["ROUNDCUBE"]["ARTICA_PASSWORD"];
$ARTICA_HOST = $free->Params["ROUNDCUBE"]["ARTICA_HOST"];
$ARTICA_RMWEB = $free->Params["ROUNDCUBE"]["ARTICA_RMWEB"];
if ($GLOBALS["VERBOSE"]) {
echo "Send order to get database dump {$ARTICA_HOST}:{$ARTICA_PORT}\n";
}
$auth = array("username" => $ARTICA_ADMIN, "password" => md5($ARTICA_PASSWORD));
$auth = base64_encode(serialize($auth));
$curl = new ccurl("https://{$ARTICA_HOST}:{$ARTICA_PORT}/exec.gluster.php");
$curl->noproxyload = true;
$curl->parms["AUTH"] = $auth;
$curl->parms["RDCUBE-REPLIC"] = $ARTICA_RMWEB;
if (!$curl->get()) {
if ($GLOBALS["VERBOSE"]) {
echo "Error replicate roundcube to {$ARTICA_HOST}:{$ARTICA_PORT} with error {$curl->error}\n";
}
system_admin_events("Error replicate roundcube to {$ARTICA_HOST}:{$ARTICA_PORT} with error {$curl->error}", __FUNCTION__, __FILE__, __LINE__, "roundcube");
return;
}
preg_match("#<INFOS>(.*?)</INFOS>#is", $curl->data, $re);
if ($GLOBALS["VERBOSE"]) {
echo "{$curl->data}\n";
}
if (!preg_match("#<FILENAME>(.*?)</FILENAME>#is", $curl->data, $re)) {
preg_match("#<ERROR>(.*?)</ERROR>#is", $curl->data, $re);
if ($GLOBALS["VERBOSE"]) {
echo "Error replicate roundcube to {$ARTICA_HOST}:{$ARTICA_PORT} with error {$re[1]}\n";
}
system_admin_events("Error replicate roundcube to {$ARTICA_HOST}:{$ARTICA_PORT} with error {$re[1]}", __FUNCTION__, __FILE__, __LINE__, "roundcube");
return;
}
$filepath = $re[1];
$filename = basename($filepath);
$curl = new ccurl("https://{$ARTICA_HOST}:{$ARTICA_PORT}/{$filepath}");
if (!$curl->GetFile("/tmp/{$filename}")) {
if ($GLOBALS["VERBOSE"]) {
echo "Error get roundcube database from {$filepath} with error {$curl->error}\n";
}
system_admin_events("Error get roundcube database from {$filepath} with error {$curl->error}", __FUNCTION__, __FILE__, __LINE__, "roundcube");
return;
}
$filesize = $unix->file_size("/tmp/{$filename}");
if ($GLOBALS["VERBOSE"]) {
echo "Downloading {$filename} done with {$filesize} bytes\n";
}
if (!$unix->uncompress("/tmp/{$filename}", "/tmp/{$filename}.sql")) {
@unlink("/tmp/{$filename}");
if ($GLOBALS["VERBOSE"]) {
echo "Error uncompress {$filepath}\n";
}
system_admin_events("Error uncompress {$filepath}", __FUNCTION__, __FILE__, __LINE__, "roundcube");
return;
}
@unlink("/tmp/{$filename}");
$mysqlbin = $unix->find_program("mysql");
if ($instanceid > 0) {
$q = new mysql_multi($instance_id);
if ($q->mysql_password != null) {
$password = " --password={$q->mysql_password} ";
}
$cmdline = "{$mysqlbin} --batch --force --user={$q->mysql_admin}{$password} --socket={$q->SocketPath} --database={$localdatabase} </tmp/{$filename}.sql 2>&1";
} else {
$q = new mysql();
if ($q->mysql_server == "127.0.0.1") {
$servcmd = " --socket=/var/run/mysqld/mysqld.sock ";
} else {
$servcmd = " --host={$q->mysql_server} --port={$q->mysql_port} ";
}
if ($q->mysql_password != null) {
$password = " --password={$q->mysql_password} ";
}
$cmdline = "{$mysqlbin} --batch --force --user={$q->mysql_admin}{$password} {$servcmd} --database={$localdatabase} </tmp/{$filename}.sql 2>&1";
}
if ($GLOBALS["VERBOSE"]) {
echo $cmdline . "\n";
}
shell_exec($cmdline);
$took = $unix->distanceOfTimeInWords($t, time(), true);
system_admin_events("Success import from {$filename} to {$localdatabase} took {$took}", __FUNCTION__, __FILE__, __LINE__, "roundcube");
//.........这里部分代码省略.........
示例5: Dumpimport
function Dumpimport($innodb_file_pertable = 0)
{
system_admin_events("Create pointer to block Artica ", __FUNCTION__, __FILE__, __LINE__, "mysql");
@mkdir("/home/mysqldump", 0755, true);
$tmpfile = "/home/mysqldump/all-database.sql";
$tmpError = "/home/mysqldump/all-database.errors";
$t1 = time();
$sock = new sockets();
$sock->SET_INFO("DisableMySqlTemp", 0);
$unix = new unix();
$q = new mysql();
$mysql_admin = $q->mysql_admin;
$MYSQL_DATA_DIR = $unix->MYSQL_DATA_DIR();
if (trim($mysql_admin) == null) {
system_admin_events("Error, unable to get mysql_admin credentials", __FUNCTION__, __FILE__, __LINE__, "mysql");
die;
}
if (!is_file($tmpfile)) {
system_admin_events("Error, {$tmpfile} no such file", __FUNCTION__, __FILE__, __LINE__, "mysql");
die;
}
$password = $q->mysql_password;
if ($password != null) {
$passwordcmdline = " --password={$password}";
}
$mysqlbin = $unix->find_program("mysql");
if (!is_file($mysqlbin)) {
system_admin_events("Error, mysqldump no such binary, aborting", __FUNCTION__, __FILE__, __LINE__, "mysql");
die;
}
$BaseDir = $MYSQL_DATA_DIR;
$files = $unix->DirFiles($BaseDir);
system_admin_events("Info, stopping mysql", __FUNCTION__, __FILE__, __LINE__, "mysql");
@file_put_contents("/etc/artica-postfix/mysql.stop", time());
shell_exec("/etc/init.d/artica-postfix stop mysql");
while (list($index, $line) = each($files)) {
$fsize = FormatBytes($unix->file_size("{$BaseDir}/{$line}"));
if (preg_match("#ib_logfile#", $line)) {
system_admin_events("Info, removing {$BaseDir}/{$line}", __FUNCTION__, __FILE__, __LINE__, "mysql");
@unlink("/{$BaseDir}/{$line}");
$deleted[] = $line . ": {$fsize}";
continue;
}
if (preg_match("#ibdata#", $line)) {
system_admin_events("Info, removing {$BaseDir}/{$line}", __FUNCTION__, __FILE__, __LINE__, "mysql");
@unlink("/{$BaseDir}/{$line}");
$deleted[] = $line . ": {$fsize}";
continue;
}
$skipped[] = $line . ": {$fsize}";
}
if ($innodb_file_pertable == 1) {
system_admin_events("Info, innodb_file_per_table is enabled", __FUNCTION__, __FILE__, __LINE__, "mysql");
$sock->SET_INFO("InnodbFilePerTable", 1);
$php5 = $unix->LOCATE_PHP5_BIN();
shell_exec("{$php5} " . dirname(__FILE__) . "/exec.mysql.build.php");
system_admin_events("Deleting, ibdata1,ib_logfile0,ib_logfile1 is enabled", __FUNCTION__, __FILE__, __LINE__, "mysql");
@unlink("{$MYSQL_DATA_DIR}/ibdata1");
@unlink("{$MYSQL_DATA_DIR}/ib_logfile0");
@unlink("{$MYSQL_DATA_DIR}/ib_logfile1");
}
@unlink("/etc/artica-postfix/mysql.stop");
system_admin_events("Info, Cleaning Mysql directory: delete files\n" . @implode($deleted, "\n") . "Skipped files:\n" . @implode($skipped, "\n"), __FUNCTION__, __FILE__, __LINE__, "mysql");
system_admin_events("Info, starting mysql", __FUNCTION__, __FILE__, __LINE__, "mysql");
exec("/etc/init.d/artica-postfix start mysql 2>&1", $results);
system_admin_events("Info, starting mysql done\n" . @implode("\n", $results), __FUNCTION__, __FILE__, __LINE__, "mysql");
unset($results);
system_admin_events("Stamp artica to not trying to inject to mysql", __FUNCTION__, __FILE__, __LINE__, "mysql");
sleep(2);
for ($i = 0; $i < 50; $i++) {
$q = new mysql();
$sleep = true;
if (!$q->DATABASE_EXISTS("artica_backup")) {
$sleep = true;
}
$pid = @file_get_contents("/var/run/mysqld/mysqld.pid");
if ($unix->process_exists($pid)) {
echo "MySQL server running PID {$pid}\n";
$sleep = false;
} else {
$sleep = true;
}
if ($sleep) {
echo "Sleeping 1s pid:{$pid} not running, artica_backup not available...\n";
continue;
}
break;
}
if (!$unix->process_exists($pid)) {
$pid = @file_get_contents("/var/run/mysqld/mysqld.pid");
echo "MySQL server not running...\n";
system_admin_events("Task aborted, MySQL did not running...", __FUNCTION__, __FILE__, __LINE__, "mysql");
return;
}
$t = time();
@unlink($tmpError);
$cmd = "{$mysqlbin} --batch --force --user={$mysql_admin}{$passwordcmdline} < {$tmpfile} >{$tmpError} 2>&1";
if ($GLOBALS["VERBOSE"]) {
echo "{$cmd}\n";
}
//.........这里部分代码省略.........
示例6: UFDBGUARD_STATUS
function UFDBGUARD_STATUS()
{
$Narray = array();
$unix = new unix();
$array = explode("\n", @file_get_contents("/etc/ufdbguard/ufdbGuard.conf"));
while (list($index, $line) = each($array)) {
if (preg_match("#domainlist.+?(.+)\\/domains#", $line, $re)) {
$datas_path = "/var/lib/squidguard/{$re[1]}/domains";
$path = "/var/lib/squidguard/{$re[1]}/domains.ufdb";
$size = $unix->file_size($path);
$Narray[$path] = $size;
}
}
@file_put_contents("/usr/share/artica-postfix/ressources/logs/ufdbguard.db.size.txt", serialize($Narray));
chmod("/usr/share/artica-postfix/ressources/logs/ufdbguard.db.size.txt", 777);
return $Narray;
}
示例7: UFDBGUARD_STATUS
function UFDBGUARD_STATUS()
{
$sock = new sockets();
$EnableRemoteStatisticsAppliance = $sock->GET_INFO("EnableRemoteStatisticsAppliance");
if (!is_numeric($EnableRemoteStatisticsAppliance)) {
$EnableRemoteStatisticsAppliance = 0;
}
if ($EnableRemoteStatisticsAppliance == 1) {
return;
}
$Narray = array();
$unix = new unix();
$array = explode("\n", @file_get_contents("/etc/ufdbguard/ufdbGuard.conf"));
while (list($index, $line) = each($array)) {
if (preg_match("#domainlist.+?(.+)\\/domains#", $line, $re)) {
$datas_path = "/var/lib/squidguard/{$re[1]}/domains";
$path = "/var/lib/squidguard/{$re[1]}/domains.ufdb";
$size = $unix->file_size($path);
$Narray[$path] = $size;
}
}
@file_put_contents("/usr/share/artica-postfix/ressources/logs/ufdbguard.db.size.txt", serialize($Narray));
chmod("/usr/share/artica-postfix/ressources/logs/ufdbguard.db.size.txt", 777);
return $Narray;
}
示例8: SafeBoxIncreaseSize
function SafeBoxIncreaseSize($uid)
{
$unix = new unix();
$safe = new safebox($uid);
$mapper = "/dev/mapper/{$uid}";
$SafeBox = $safe->crypted_filepath;
$file_size = $unix->file_size($SafeBox) / 1024;
$file_size = $file_size / 1000;
$file_size = $file_size / 1000;
$file_size = round($file_size);
$increase = $safe->CryptedHomeSize - $file_size;
writelogs("{$SafeBox} ({$uid}) {$file_size}Go increase it to {$increase}Go", __FUNCTION__, __FILE__, __LINE__);
if ($increase < 0) {
writelogs("Failed negative size", __FUNCTION__, __FILE__, __LINE__);
return;
}
$cmd = $unix->find_program("dd") . " conv=notrunc oflag=append if=/dev/zero bs=1G count={$increase} of={$SafeBox}";
exec($cmd, $results);
logsArray($results, __FUNCTION__, __LINE__);
if (!mountLoop($SafeBox)) {
writelogs("Failed to mount loop", __FUNCTION__, __FILE__, __LINE__);
return false;
}
if (!_CryptOpen($SafeBox, $GLOBALS["CRYPT_PASSWORD"])) {
writelogs("Failed to open {$SafeBox}", __FUNCTION__, __FILE__, __LINE__);
}
$cmd = $unix->find_program("cryptsetup") . " resize {$uid}";
writelogs("{$cmd}", __FUNCTION__, __FILE__, __LINE__);
exec($cmd, $results);
logsArray($results, __FUNCTION__, __LINE__);
$cmd = $unix->find_program("e2fsck") . " -f /dev/mapper/{$uid}";
writelogs("{$cmd}", __FUNCTION__, __FILE__, __LINE__);
exec($cmd, $results);
logsArray($results, __FUNCTION__, __LINE__);
$cmd = $unix->find_program("resize2fs") . " -p /dev/mapper/{$uid}";
writelogs("{$cmd}", __FUNCTION__, __FILE__, __LINE__);
exec($cmd, $results);
logsArray($results, __FUNCTION__, __LINE__);
return true;
}
示例9: check_all_squid
function check_all_squid()
{
$sock = new sockets();
$unix = new unix();
$syslog = new mysql_storelogs();
$php5 = $unix->LOCATE_PHP5_BIN();
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$timefile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
$pid = file_get_contents("{$pidfile}");
if (system_is_overloaded(basename(__FILE__))) {
die;
}
if ($unix->process_exists($pid, basename(__FILE__))) {
$timeMin = $unix->PROCCESS_TIME_MIN($pid);
if ($timeMin > 240) {
system_admin_events("Too many TTL, {$pid} will be killed", __FUNCTION__, __FILE__, __LINE__, "logrotate");
$kill = $unix->find_program("kill");
unix_system_kill_force($pid);
} else {
die;
}
}
$time = $unix->file_time_min($timefile);
if ($time < 300) {
return;
}
@file_put_contents($pidfile, getmypid());
@file_put_contents($timefile, time());
$php = $unix->LOCATE_PHP5_BIN();
$bzip2 = $unix->find_program("bzip2");
$ALREADYCOMP["gz"] = true;
$ALREADYCOMP["bz2"] = true;
$LogRotateCompress = 1;
$LogRotatePath = $sock->GET_INFO("LogRotatePath");
$ApacheLogRotate = $sock->GET_INFO("ApacheLogRotate");
if (!is_numeric($ApacheLogRotate)) {
$ApacheLogRotate = 1;
}
if ($LogRotatePath == null) {
$LogRotatePath = "/home/logrotate";
}
$LogsRotateDefaultSizeRotation = $sock->GET_INFO("LogsRotateDefaultSizeRotation");
if (!is_numeric($LogsRotateDefaultSizeRotation)) {
$LogsRotateDefaultSizeRotation = 100;
}
foreach (glob("/var/log/squid/*") as $filename) {
if (is_dir($filename)) {
continue;
}
$size = $unix->file_size($filename);
$time = $unix->file_time_min($filename);
$size = round($size / 1024 / 1000, 2);
if ($size > $LogsRotateDefaultSizeRotation) {
if ($filename == "/var/log/squid/access.log") {
events("{$filename} -> is a production log for Squid, launch the rotation procedure.");
squid_admin_mysql(1, "{$filename} {$size}M exceed {$LogsRotateDefaultSizeRotation}M, launch rotation", null, __FILE__, __LINE__);
shell_exec("{$php} /usr/share/artica-postfix/exec.squid.php --rotate");
continue;
}
$TOROT[$filename] = true;
events("{$filename} -> Add to queue {$size}M exceed {$LogsRotateDefaultSizeRotation}M");
continue;
}
if ($time > 1440) {
if ($filename == "/var/log/squid/access.log") {
events("{$filename} -> is a production log for Squid, launch the rotation procedure.");
squid_admin_mysql(1, "{$filename} {$size}M exceed {$LogsRotateDefaultSizeRotation}M, launch rotation", null, __FILE__, __LINE__);
shell_exec("{$php} /usr/share/artica-postfix/exec.squid.php --rotate");
continue;
}
events("{$filename} -> Add to queue {$time}mn exceed 1440mn");
$TOROT[$filename] = true;
continue;
}
}
if (count($TOROT) == 0) {
return;
}
while (list($filename, $none) = each($TOROT)) {
$extension = pathinfo($filename, PATHINFO_EXTENSION);
$filedate = date('Y-m-d H:i:s', filemtime($filename));
$basename = basename($filename);
if (preg_match("#sarg\\.#", $filename)) {
shell_exec("{$php5} " . dirname(__FILE__) . "/exec.sarg.php --rotate {$basename} >/dev/null 2>&1 &");
continue;
}
if (preg_match("#access\\.log\\.[0-9]+\$#", $filename)) {
continue;
}
if ($extension != "gz") {
if (!$unix->compress($filename, "{$filename}.gz")) {
continue;
}
$filename = $filename . ".gz";
$extension = "gz";
}
echo "[{$filedate}]: {$filename} ({$extension})\n";
if ($syslog->ROTATE_TOMYSQL($filename, $filedate)) {
@unlink($filename);
}
//.........这里部分代码省略.........
示例10: backup_md5
function backup_md5($md5)
{
$sock = new sockets();
$unix = new unix();
$q = new mysql();
$backend_root = "/root/.offlineimap";
$pidfile = "/var/run/offlineimap-{$md5}.pid";
$pid = @file_get_contents($pidfile);
if ($unix->process_exists($pid)) {
$timemin = $unix->PROCCESS_TIME_MIN($pid);
$timefile = buildlogs("PID {$pid} running since {$timemin}mn , aborting", __FUNCTION__, __LINE__);
LogsToMysqlMD5($md5);
return;
}
$mypid = getmypid();
@file_put_contents($pidfile, $mypid);
if ($GLOBALS["VERBOSE"]) {
echo "{$pidfile} -> {$mypid}\n";
}
$OfflineImapBackupTool = $sock->GET_INFO("OfflineImapBackupTool");
if (!is_numeric($OfflineImapBackupTool)) {
$OfflineImapBackupTool = 0;
}
$sql = "SELECT * FROM mbxs_backup WHERE zmd5='{$md5}'";
$ligne = @mysql_fetch_array($q->QUERY_SQL($sql, 'artica_backup'));
if (!$q->ok) {
buildlogs("{$q->mysql_error}", __FUNCTION__, __LINE__);
LogsToMysqlMD5($md5);
return;
}
$uid = $ligne["uid"];
$account = $ligne["account"];
$imapserv = $ligne["imapserv"];
$MySqlQuery = $ligne;
$OfflineImapWKDir = $sock->GET_INFO("OfflineImapWKDir");
$OfflineImapBackupDir = $sock->GET_INFO("OfflineImapBackupDir");
if ($OfflineImapBackupDir == null) {
$OfflineImapBackupDir = "%HOME%/mailbackups";
}
if ($OfflineImapWKDir == null) {
$OfflineImapWKDir = "/home/artica/mailbackups";
}
if ($OfflineImapBackupTool == 0) {
buildlogs("This feature is disabled, aborting", __FUNCTION__, __LINE__);
LogsToMysqlMD5($md5);
return;
}
$fileZ = build_remote_backup_settings($MySqlQuery);
$fileConf = $fileZ[0];
$TargetDir = $fileZ[1];
$logfile = "/var/log/" . basename($unix->FILE_TEMP());
if (!is_file($fileConf)) {
LogsToMysqlMD5($md5);
return;
}
if (!is_dir($TargetDir)) {
buildlogs("{$TargetDir} no such directory", __FUNCTION__, __LINE__);
LogsToMysqlMD5($md5);
return;
}
$offlineimap = $unix->find_program("offlineimap");
$tar = $unix->find_program("tar");
$rm = $unix->find_program("rm");
$NICE = EXEC_NICE();
$t = time();
$CacheLocal = "{$backend_root}/Account-{$ligne["uid"]}";
$CacheRemote = "{$backend_root}/Account-{$ligne["account"]}";
if (is_dir($CacheLocal)) {
shell_exec("{$rm} -rf {$CacheLocal}");
}
if (is_dir($CacheRemote)) {
shell_exec("{$rm} -rf {$CacheRemote}");
}
$cmd = "{$NICE}{$offlineimap} -u basic -c {$fileConf} -l {$logfile} 2>&1";
exec($cmd, $results);
if (count($results) > 0) {
while (list($num, $ligne) = each($results)) {
buildlogs($ligne, __FUNCTION__, __LINE__);
}
}
$results = explode("\n", @file_get_contents($logfile));
if (count($results) > 0) {
while (list($num, $ligne) = each($results)) {
buildlogs($ligne, __FUNCTION__, __LINE__);
}
}
@unlink($logfile);
$offlimap = new offlineimap();
$FinalDir = $offlimap->maildir_parse($OfflineImapBackupDir, $uid);
@mkdir($FinalDir, 0755, true);
$FinalFile = "{$FinalDir}/" . date("YmdH") . "-{$account}@{$imapserv}.tar.bz2";
chdir($TargetDir);
$cmd = "{$tar} -cjf {$FinalFile} *";
shell_exec($cmd);
chdir("/root");
$cmd = "{$rm} -rf {$TargetDir}/";
shell_exec($cmd);
$FinalFileSize = $unix->file_size_human($FinalFile);
buildlogs("{$FinalFile}: {$FinalFileSize}", __FUNCTION__, __LINE__);
buildlogs("Execution done took:" . $unix->distanceOfTimeInWords($t, time()), __FUNCTION__, __LINE__);
//.........这里部分代码省略.........
示例11: scan
function scan($aspid = false)
{
$unix = new unix();
$sock = new sockets();
$q = new mysql_squid_builder();
if (!$aspid) {
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$pid = @file_get_contents($pidfile);
if ($pid < 100) {
$pid = null;
}
if ($unix->process_exists($pid, basename(__FILE__))) {
$timepid = $unix->PROCCESS_TIME_MIN($pid);
events("Already executed pid {$pid} since {$timepid}Mn");
return;
}
@file_put_contents($pidfile, time());
}
if (!tests_nas()) {
return;
}
$SquidOldLogsNAS = unserialize(base64_decode($sock->GET_INFO("SquidOldLogsNAS")));
$mountPoint = "/mnt/SquidImportLogs";
$NasFolder = $SquidOldLogsNAS["folder"];
$NasFolder = str_replace('\\', '/', $NasFolder);
$NasFolder = str_replace('//', '/', $NasFolder);
if (strpos($NasFolder, "/") > 0) {
$f = explode("/", $NasFolder);
unset($f[0]);
$NasFolder = @implode("/", $f);
}
$WORKDIR = "{$mountPoint}/{$NasFolder}";
$WORKDIR = str_replace("//", "/", $WORKDIR);
if (!is_dir($WORKDIR)) {
events("!!! Fatal {$WORKDIR}, nu such directory...");
return;
}
if (!($handle = opendir($WORKDIR))) {
return;
}
$countDeFiles = 0;
$array = array();
if (!$q->FIELD_EXISTS("accesslogs_import", "lnumbers")) {
$q->QUERY_SQL("ALTER IGNORE TABLE `accesslogs_import` ADD `lnumbers` BIGINT UNSIGNED ,ADD INDEX( `lnumbers` )");
}
while (false !== ($filename = readdir($handle))) {
if ($filename == ".") {
continue;
}
if ($filename == "..") {
continue;
}
$targetFile = "{$WORKDIR}/{$filename}";
$countDeFiles++;
$md5 = md5_file($targetFile);
events("{$targetFile} MD5:{$md5}");
$ligne = mysql_fetch_array($q->QUERY_SQL("SELECT filename FROM accesslogs_import WHERE zmd5='{$md5}'"));
if (!$q->ok) {
echo $q->mysql_error;
killNas();
return;
}
if ($GLOBALS["VERBOSE"]) {
echo "{$md5} = {$ligne["filename"]}\n";
}
$ext = $unix->file_ext($targetFile);
if ($ext == "gz") {
@mkdir("/home/squid/wkdir", 0755, true);
if ($GLOBALS["VERBOSE"]) {
echo "Uncompress {$targetFile}\n";
}
$unix->uncompress($targetFile, "/home/squid/wkdir/{$filename}");
$date = GetDateOfFile("/home/squid/wkdir/{$filename}");
$lnumbers = $unix->COUNT_LINES_OF_FILE("/home/squid/wkdir/{$filename}");
@unlink("/home/squid/wkdir/{$filename}");
} else {
$date = GetDateOfFile($targetFile);
$lnumbers = $unix->COUNT_LINES_OF_FILE($targetFile);
}
if ($date == null) {
events("{$targetFile} = No date");
continue;
}
if ($lnumbers == 0) {
events("{$targetFile} = No Lines");
continue;
}
if (trim($ligne["filename"]) != null) {
$q->QUERY_SQL("UPDATE accesslogs_import SET zDate='{$date}', lnumbers='{$lnumbers}' WHERE zmd5='{$md5}'");
if (!$q->ok) {
events("{$q->mysql_error}");
killNas();
return;
}
continue;
}
$size = $unix->file_size($targetFile);
events("Found new file to analyze {$targetFile} - {$md5} ({$date}) " . round($size / 1024 / 1024) . "MB");
$q->QUERY_SQL("INSERT INTO accesslogs_import (zmd5,filename,zDate,size,status,percent,lnumbers) VALUES ('{$md5}','{$filename}','{$date}','{$size}',0,0,{$lnumbers})");
if (!$q->ok) {
//.........这里部分代码省略.........
示例12: ScanDirs
function ScanDirs()
{
$sock = new sockets();
$ZarafaBackupParams = unserialize(base64_decode($sock->GET_INFO("ZarafaBackupParams")));
if ($ZarafaBackupParams["DEST"] == null) {
$ZarafaBackupParams["DEST"] = "/home/zarafa-backup";
}
if (!is_numeric($ZarafaBackupParams["DELETE_OLD_BACKUPS"])) {
$ZarafaBackupParams["DELETE_OLD_BACKUPS"] = 1;
}
if (!is_numeric($ZarafaBackupParams["DELETE_BACKUPS_OLDER_THAN_DAYS"])) {
$ZarafaBackupParams["DELETE_BACKUPS_OLDER_THAN_DAYS"] = 10;
}
$unix = new unix();
$directories = $unix->dirdir($ZarafaBackupParams["DEST"]);
while (list($directory, $ext) = each($directories)) {
if (is_file("{$directory}/zarafa.gz")) {
$Gooddirs[$directory] = true;
}
}
$q = new mysql();
$q->QUERY_SQL("TRUNCATE TABLE zarafa_backup", "artica_backup");
$prefix = "INSERT INTO zarafa_backup (`filepath`,`filesize`,`ztime`,`zDate`) VALUES ";
while (list($directory, $ext) = each($Gooddirs)) {
$date = null;
$stamp = "{$directory}/took.txt";
$datestamp = "{$directory}/time.txt";
$size = $unix->file_size("{$directory}/zarafa.gz");
if (is_file($datestamp)) {
$date = @file_get_contents($datestamp);
}
if ($date == null) {
$date = date("Y-m-d H:i:s", filemtime("{$directory}/zarafa.gz"));
}
if (is_file($stamp)) {
$took = @file_get_contents($stamp);
}
if ($GLOBALS["VERBOSE"]) {
$sizeDBG = round($size / 1024 / 1000, 2);
echo "Found: Container saved on: {$date} took:{$took} {$directory}/zarafa.gz Size:{$sizeDBG} MB\n";
}
$directory = mysql_escape_string2($directory);
$f[] = "('{$directory}','{$size}','{$took}','{$date}')";
}
if (count($f) > 0) {
$sql = "{$prefix}" . @implode(",", $f);
$q->QUERY_SQL($sql, "artica_backup");
if (!$q->ok) {
system_admin_events("Fatal {$q->mysql_error}", __FUNCTION__, __FILE__, __LINE__, "backup");
}
}
echo count($f) . " container(s) found...\n";
}
示例13: moveolds2
function moveolds2()
{
$sock = new sockets();
$LogsDirectoryStorage = $sock->GET_INFO("LogsDirectoryStorage");
if (trim($LogsDirectoryStorage) == null) {
$LogsDirectoryStorage = "/home/logs-backup";
}
$unix = new unix();
$mv = $unix->find_program("mv");
$php5 = $unix->LOCATE_PHP5_BIN();
$nohup = $unix->find_program("nohup");
if ($GLOBALS["VERBOSE"]) {
echo "Scanning /var/log....\n";
}
$d = $unix->DirFiles("/var/log", "(.+)-[0-9]+");
@mkdir("{$LogsDirectoryStorage}/olds", 0755, true);
$delete = 0;
$size = 0;
$CountDeFiles = count($d);
while (list($num, $path) = each($d)) {
$time = $unix->file_time_min("/var/log/{$path}");
if ($time > 7200) {
$delete++;
$size = $size + $unix->file_size("/var/log/{$path}");
$targetFile = "{$LogsDirectoryStorage}/olds/{$path}";
if (is_file("{$targetFile}")) {
$targetFile = $targetFile . "." . time();
}
shell_exec("{$mv} /var/log/{$path} {$targetFile}");
}
}
if ($delete > 0) {
$size = FormatBytes($size / 1024);
system_admin_events("Moving {$delete}/{$CountDeFiles} old log file to {$LogsDirectoryStorage}/olds ({$size})", __FUNCTION__, __FILE__, __LINE__, "logrotate");
}
$delete = 0;
$size = 0;
if ($GLOBALS["VERBOSE"]) {
echo "Scanning /var/log/artica-postfix/loadavg....\n";
}
$d = $unix->DirFiles("/var/log/artica-postfix/loadavg");
$CountDeFiles = count($d);
while (list($num, $path) = each($d)) {
usleep(700);
$time = $unix->file_time_min("/var/log/artica-postfix/loadavg/{$path}");
if ($time > 7200) {
$size = $size + $unix->file_size("/var/log/artica-postfix/loadavg/{$path}");
@unlink("/var/log/artica-postfix/loadavg/{$path}");
$delete++;
}
}
if ($delete > 0) {
$size = FormatBytes($size / 1024);
system_admin_events("{$delete}/{$CountDeFiles} deleted old files in /var/log/artica-postfix/loadavg ({$size} free)", __FUNCTION__, __FILE__, __LINE__, "logrotate");
}
// Page Peeker
if ($GLOBALS["VERBOSE"]) {
echo "Scanning /var/log/artica-postfix/pagepeeker....\n";
}
$delete = 0;
$size = 0;
$d = $unix->DirFiles("/var/log/artica-postfix/pagepeeker");
$CountDeFiles = count($d);
if ($GLOBALS["VERBOSE"]) {
echo "Scanning /var/log/artica-postfix/pagepeeker -> {$CountDeFiles} files....\n";
}
while (list($num, $path) = each($d)) {
usleep(700);
$time = $unix->file_time_min("/var/log/artica-postfix/pagepeeker/{$path}");
if ($time > 7200) {
$size = $size + $unix->file_size("/var/log/artica-postfix/pagepeeker/{$path}");
@unlink("/var/log/artica-postfix/pagepeeker/{$path}");
$delete++;
}
}
if ($delete > 0) {
$size = FormatBytes($size / 1024);
system_admin_events("{$CountDeFiles}/{$delete} deleted old files in /var/log/artica-postfix/pagepeeker ({$size} free)", __FUNCTION__, __FILE__, __LINE__, "logrotate");
}
}
示例14: update_remote_file
function update_remote_file($BASE_URI, $filename, $md5, $prc)
{
if (!isset($GLOBALS["UFDB_SIZE"])) {
$GLOBALS["UFDB_SIZE"] = 0;
}
WriteMyLogs("update_remote_file({$BASE_URI},{$filename},{$md5})", __FUNCTION__, __FILE__, __LINE__);
$STATUS = unserialize(@file_get_contents("/etc/artica-postfix/TLSE_LAST_DOWNLOAD"));
$indexuri = "{$BASE_URI}/{$filename}";
$unix = new unix();
$q = new mysql_squid_builder();
$tar = $unix->find_program("tar");
$rm = $unix->find_program("rm");
$ln = $unix->find_program("ln");
$ufdbGenTable = $unix->find_program("ufdbGenTable");
$Conversion = $q->TLSE_CONVERTION();
$ufdb = new compile_ufdbguard();
$curl = new ccurl($indexuri);
$curl->Timeout = 360;
echo "Downloading {$indexuri}\n";
$cache_temp = "/tmp/{$filename}";
if (!$curl->GetFile($cache_temp)) {
build_progress("Fatal error downloading {$indexuri} {$curl->error}", $prc);
echo "Fatal error downloading {$indexuri} {$curl->error}\n";
$errorDetails = @implode("\n", $GLOBALS["CURLDEBUG"]);
artica_update_event(0, "Web filtering databases, unable to download {$indexuri}", "Fatal error downloading {$indexuri} {$curl->error}\n{$errorDetails}", __FILE__, __LINE__);
return;
}
$filesize = $unix->file_size($cache_temp);
$GLOBALS["UFDB_SIZE"] = $GLOBALS["UFDB_SIZE"] + $filesize;
@mkdir("/var/lib/ftpunivtlse1fr", 755, true);
$categoryname = str_replace(".tar.gz", "", $filename);
$categoryDISK = $categoryname;
if (isset($Conversion[$categoryname])) {
$categoryDISK = $Conversion[$categoryname];
}
$STATUS["LAST_DOWNLOAD"]["TIME"] = time();
$STATUS["LAST_DOWNLOAD"]["CATEGORY"] = $categoryname;
$STATUS["LAST_DOWNLOAD"]["SIZE"] = $GLOBALS["CURL_LAST_SIZE_DOWNLOAD"] / 1024;
@file_put_contents("/etc/artica-postfix/TLSE_LAST_DOWNLOAD", serialize($STATUS));
$categoryDISK = str_replace("/", "_", $categoryDISK);
if (is_link("/var/lib/ftpunivtlse1fr/{$categoryname}")) {
if ($GLOBALS["VERBOSE"]) {
echo "/var/lib/ftpunivtlse1fr/{$categoryname} is a link of " . @readlink("/var/lib/ftpunivtlse1fr/{$categoryname}") . "\n";
}
if ($GLOBALS["VERBOSE"]) {
echo "Removing /var/lib/ftpunivtlse1fr/{$categoryname}/\n";
}
shell_exec("{$rm} -rf /var/lib/ftpunivtlse1fr/{$categoryname}");
}
if (is_dir("/var/lib/ftpunivtlse1fr/{$categoryname}")) {
if ($GLOBALS["VERBOSE"]) {
echo "Removing /var/lib/ftpunivtlse1fr/{$categoryname}/\n";
}
shell_exec("{$rm} -rf /var/lib/ftpunivtlse1fr/{$categoryname}");
}
if ($GLOBALS["VERBOSE"]) {
echo "Creating /var/lib/ftpunivtlse1fr/{$categoryname}/\n";
}
@mkdir("/var/lib/ftpunivtlse1fr/{$categoryname}", 0755, true);
if ($GLOBALS["VERBOSE"]) {
echo "Extracting {$cache_temp} to /var/lib/ftpunivtlse1fr/\n";
}
shell_exec("{$tar} -xf {$cache_temp} -C /var/lib/ftpunivtlse1fr/");
if (!is_file("/var/lib/ftpunivtlse1fr/{$categoryname}/domains")) {
build_progress("Fatal!!: {$categoryname}/domains no such file", $prc);
ufdbevents("Fatal!!: /var/lib/ftpunivtlse1fr/{$categoryname}/domains no such file", __FUNCTION__, __FILE__, __LINE__);
return;
}
$CountDeSitesFile = CountDeSitesFile("/var/lib/ftpunivtlse1fr/{$categoryname}/domains");
if ($GLOBALS["VERBOSE"]) {
echo "/var/lib/ftpunivtlse1fr/{$categoryname}/domains -> {$CountDeSitesFile} websites\n";
}
if ($CountDeSitesFile == 0) {
build_progress("Fatal!!: {$categoryname}/domains corrupted, no website", $prc);
ufdbevents("Fatal!!: /var/lib/ftpunivtlse1fr/{$categoryname}/domains corrupted, no website", __FUNCTION__, __FILE__, __LINE__, "Toulouse DB");
shell_exec("{$rm} -rf /var/lib/ftpunivtlse1fr/{$categoryname}");
return;
}
if (trim(strtolower($categoryDISK)) != trim(strtolower($categoryname))) {
if (is_dir("/var/lib/ftpunivtlse1fr/{$categoryDISK}")) {
shell_exec("{$rm} -rf /var/lib/ftpunivtlse1fr/{$categoryDISK}");
}
shell_exec("ln -sf /var/lib/ftpunivtlse1fr/{$categoryDISK} /var/lib/ftpunivtlse1fr/{$categoryname}");
}
$q->QUERY_SQL("DELETE FROM ftpunivtlse1fr WHERE filename='{$filename}'");
if (!$q->ok) {
ufdbevents("Fatal!!: {$q->mysql_error}", __FUNCTION__, __FILE__, __LINE__, "Toulouse DB");
return;
}
$q->QUERY_SQL("INSERT INTO ftpunivtlse1fr (`filename`,`zmd5`,`websitesnum`) VALUES ('{$filename}','{$md5}','{$CountDeSitesFile}')");
if (!$q->ok) {
ufdbevents("Fatal!!: {$q->mysql_error}", __FUNCTION__, __FILE__, __LINE__, "Toulouse DB");
return;
}
$GLOBALS["UFDB_COUNT_OF_DOWNLOADED"] = $GLOBALS["UFDB_COUNT_OF_DOWNLOADED"] + 1;
build_progress("{$categoryname} {$CountDeSitesFile} websites", $prc);
$GLOBALS["squid_admin_mysql"][] = "Success updating category `{$categoryname}` with {$CountDeSitesFile} websites";
if ($GLOBALS["VERBOSE"]) {
echo "ufdbGenTable={$ufdbGenTable}\n";
}
//.........这里部分代码省略.........
示例15: scan_artica_databases
function scan_artica_databases()
{
$unix = new unix();
$URIBASE = $unix->MAIN_URI();
$tmpdir = $unix->TEMP_DIR();
$curl = new ccurl("{$URIBASE}/catz/index.txt");
if (!$curl->GetFile("{$tmpdir}/index.txt")) {
squid_admin_mysql(0, "BLACKLISTS: Failed to retreive {$URIBASE}/catz/index.txt ", $curl->error, __FUNCTION__, __LINE__);
artica_update_event(0, "BLACKLISTS: Failed to retreive {$URIBASE}/catz/index.txt ", $curl->error, __FUNCTION__, __LINE__);
echo "BLACKLISTS: Failed to retreive {$URIBASE}/catz/index.txt ({$curl->error})\n";
return;
}
$fIndex = unserialize(base64_decode(@file_get_contents("{$tmpdir}/index.txt")));
//print_r($fIndex);
$time = $fIndex["TIME"];
$q = new mysql_squid_builder();
//webfilters_databases_disk
$prefix = "INSERT IGNORE INTO webfilters_databases_disk (`filename`,`size`,`category`,`filtime`) VALUES ";
$unix = new unix();
$dirs = $unix->dirdir($GLOBALS["WORKDIR_LOCAL"]);
if ($GLOBALS["VERBOSE"]) {
echo "Scanning " . count($dirs) . " files last pattern was " . date("Y-m-d H:i:s", $time) . "\n";
}
$sizz = 0;
while (list($path, $path2) = each($dirs)) {
$size = $unix->file_size("{$path2}/domains.ufdb");
$category = basename($path);
$sizz = $sizz + $size;
if ($GLOBALS["VERBOSE"]) {
echo "{$category} `{$path2}/domains.ufdb` = " . $size / 1024 . " Kb\n";
}
$category = $q->filaname_tocat("{$path2}/domains.ufdb");
$filtime = filemtime("{$path2}/domains.ufdb");
$f[] = "('{$path2}/domains.ufdb','{$size}','{$category}','{$filtime}')";
}
if ($GLOBALS["VERBOSE"]) {
echo "scanned " . count($f) . " files\n";
}
if (count($f) > 0) {
$sql = $prefix . @implode(",", $f);
if (!$q->TABLE_EXISTS("webfilters_databases_disk")) {
$q->CheckTables();
}
$q->QUERY_SQL("TRUNCATE TABLE webfilters_databases_disk");
$q->CheckTables();
$q->QUERY_SQL($sql);
if (!$q->ok) {
squid_admin_mysql(0, "{$q->mysql_error}", null, __FUNCTION__, __LINE__);
artica_update_event(0, "{$q->mysql_error}", null, __FUNCTION__, __LINE__);
}
}
}