本文整理汇总了PHP中unix::DIRSIZE_KO方法的典型用法代码示例。如果您正苦于以下问题:PHP unix::DIRSIZE_KO方法的具体用法?PHP unix::DIRSIZE_KO怎么用?PHP unix::DIRSIZE_KO使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unix
的用法示例。
在下文中一共展示了unix::DIRSIZE_KO方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: localdbsize
function localdbsize()
{
$unix = new unix();
$cachefile = "/usr/share/artica-postfix/LocalDatabases/dbsize.xp";
if (is_file($cachefile)) {
$time = $unix->file_time_min($cachefile);
if ($time > 30) {
@unlink($cachefile);
}
}
if (!is_file($cachefile)) {
$size = $unix->DIRSIZE_KO("/usr/share/artica-postfix/LocalDatabases");
if ($size > 1000) {
@file_put_contents($cachefile, $size);
}
} else {
$size = @file_get_contents($cachefile);
}
echo "<articadatascgi>{$size}</articadatascgi>";
}
示例2: InfluxDbSize
function InfluxDbSize()
{
$dir = "/home/ArticaStatsDB";
$unix = new unix();
$size = $unix->DIRSIZE_KO($dir);
$partition = $unix->DIRPART_INFO($dir);
$TOT = $partition["TOT"];
$percent = $size / $TOT * 100;
$percent = round($percent, 3);
if ($GLOBALS["VERBOSE"]) {
echo "{$dir}: {$size} Partition {$TOT}\n";
}
$ARRAY["PERCENTAGE"] = $percent;
$ARRAY["SIZEKB"] = $size;
$ARRAY["PART"] = $TOT;
if ($GLOBALS["VERBOSE"]) {
print_r($ARRAY);
}
@unlink("/usr/share/artica-postfix/ressources/logs/web/InfluxDB.state");
@file_put_contents("/usr/share/artica-postfix/ressources/logs/web/InfluxDB.state", serialize($ARRAY));
}
示例3: status
function status($aspid = false)
{
$unix = new unix();
if (!$aspid) {
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
$time = $unix->PROCCESS_TIME_MIN($pid);
if ($GLOBALS["OUTPUT"]) {
echo "service Already Artica task running PID {$pid} since {$time}mn\n";
}
return;
}
@file_put_contents($pidfile, getmypid());
}
$filetime = "/etc/artica-postfix/settings/Daemons/SargDirStatus";
$sock = new sockets();
$SargOutputDir = $sock->GET_INFO("SargOutputDir");
if ($SargOutputDir == null) {
$SargOutputDir = "/var/www/html/squid-reports";
}
$SIZE = $unix->DIRSIZE_KO($SargOutputDir);
$FILES = $unix->DIR_COUNT_OF_FILES($SargOutputDir);
$AIV = $unix->DIRECTORY_FREEM($SargOutputDir);
$array["SIZE"] = $SIZE;
$array["FILES"] = $FILES;
$array["FREE"] = $AIV;
$array["F_FREE"] = $unix->DIRECTORY_FREE_FILES($SargOutputDir);
@unlink($filetime);
@file_put_contents($filetime, serialize($array));
@chmod($filetime, 0755);
}
示例4: restore_process_array
function restore_process_array()
{
$unix = new unix();
$pid = $unix->PIDOF_PATTERN("exec.zarafa-db.php --restorefrom");
if ($unix->process_exists($pid)) {
$WORKDIR = trim(@file_get_contents("/etc/artica-postfix/settings/Daemons/ZarafaDedicateMySQLWorkDir"));
if ($WORKDIR == null) {
$WORKDIR = "/home/zarafa-db";
}
$time = $unix->PROCCESS_TIME_MIN($pid);
$ARRAY["PID"] = $pid;
$ARRAY["TIME"] = $time;
$ARRAY["SIZE"] = $unix->DIRSIZE_KO("{$WORKDIR}/data/zarafa");
echo "<articadatascgi>" . base64_encode(serialize($ARRAY)) . "</articadatascgi>";
}
}
示例5: build
//.........这里部分代码省略.........
$size = @filesize("/var/log/squid/access.log");
$size = $size / 1024;
$size = $size / 1024;
$syslog->events("/var/log/squid/access.log........: {$size}M", __FUNCTION__, __LINE__);
$syslog->events("Analyze /var/log/squid directory for cache.log", __FUNCTION__, __LINE__);
if (!($handle = opendir("/var/log/squid"))) {
$syslog->events("Unable to open /var/log/squid directory.", __FUNCTION__, __LINE__);
return;
}
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$path = "/var/log/squid/{$file}";
if (is_dir($path)) {
continue;
}
if (!preg_match("#^cache\\.log\\.[0-9]+\$#", $file)) {
continue;
}
@mkdir("{$LogRotateCache}", 0755, true);
$size = @filesize($path);
$size = $size / 1024;
$size = $size / 1024;
$destfile = "{$LogRotateCache}/{$file}." . time() . ".log";
if (!@copy($path, $destfile)) {
$syslog->events("Unable to copy {$path} to {$destfile}", __FUNCTION__, __LINE__);
@unlink($destfile);
continue;
}
$syslog->events("Removed {$path}", __FUNCTION__, __LINE__);
@unlink($path);
}
}
$syslog->events("Analyze /var/log/squid directory for access.log", __FUNCTION__, __LINE__);
if (!($handle = opendir("/var/log/squid"))) {
$syslog->events("Unable to open /var/log/squid directory.", __FUNCTION__, __LINE__);
return;
}
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$path = "/var/log/squid/{$file}";
if (is_dir($path)) {
continue;
}
if (!preg_match("#^access\\.log\\.[0-9]+\$#", $file)) {
continue;
}
@mkdir("{$LogRotatePath}", 0755, true);
$size = @filesize($path);
$size = $size / 1024;
$size = $size / 1024;
$destfile = "{$LogRotateAccess}/{$file}." . time() . ".log";
if (!@copy($path, $destfile)) {
$syslog->events("Unable to copy {$path} to {$destfile}", __FUNCTION__, __LINE__);
@unlink($destfile);
continue;
}
$syslog->events("Removed {$path}", __FUNCTION__, __LINE__);
@unlink($path);
}
}
@mkdir($LogRotateAccess, 0755, true);
$syslog->events("Analyze {$LogRotateAccess} for access.log", __FUNCTION__, __LINE__);
if (!($handle = opendir($LogRotateAccess))) {
$syslog->events("Unable to open {$LogRotateAccess} directory.", __FUNCTION__, __LINE__);
return;
}
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$path = "{$LogRotateAccess}/{$file}";
echo "OPEN {$path}\n";
if (is_dir($path)) {
continue;
}
if (!preg_match("#^access\\.log#", $file)) {
continue;
}
range_fichier_source($path, $BackupMaxDaysDir);
}
}
$q = new mysql();
$sql = "CREATE TABLE IF NOT EXISTS `backuped_logs` (\n\t\t\t `path` CHAR(255) NOT NULL,\n\t\t\t `zDate` DATETIME,\n\t\t\t `size` INT UNSIGNED NOT NULL,\n\t\t\t PRIMARY KEY (`path`),\n\t\t\t KEY `zDate` (`zDate`)\n\t\t\t) ENGINE = MYISAM;";
$q->QUERY_SQL($sql, "artica_events");
$syslog->events("Analyze /home/logrotate/work for access.log", __FUNCTION__, __LINE__);
analyze_directory("/home/logrotate/work", $BackupMaxDaysDir);
analyze_cache_directory($LogRotateCache, $BackupMaxDaysDir);
analyze_cache_directory("/home/logrotate/work", $BackupMaxDaysDir);
analyze_cache_directory("/home/squid/cache-logs", $BackupMaxDaysDir);
if ($SquidRotateMergeFiles == 1) {
Merge_files();
}
if ($BackupSquidLogsUseNas == 1) {
BackupToNas($BackupMaxDaysDir);
$q->QUERY_SQL("TRUNCATE TABLE backuped_logs", "artica_events");
} else {
analyze_destination_directory($BackupMaxDaysDir);
}
@file_put_contents("/etc/artica-postfix/settings/Daemons/BackupMaxDaysDirCurrentSize", $unix->DIRSIZE_KO($BackupMaxDaysDir));
@chmod("/etc/artica-postfix/settings/Daemons/BackupMaxDaysDirCurrentSize", 0777);
return;
}
示例6: ArticaSettingsrestore
function ArticaSettingsrestore()
{
$unix = new unix();
$tmp = $unix->FILE_TEMP();
events("restore Artica settings operations");
events("restore Artica settings operations");
$size = $unix->DIRSIZE_KO("{$_GET["PATH_RESTORE"]}/etc-artica-postfix");
events("restore Artica settingssize={$size} Ko");
if ($size == 0) {
events("restore Artica settings failed, directory {$_GET["PATH_RESTORE"]}/etc-artica-postfix...");
return null;
}
shell_exec("/bin/cp -rf {$_GET["PATH_RESTORE"]}/etc-artica-postfix/artica-postfix/* /etc/artica-postfix/");
shell_exec("/usr/share/artica-postfix/bin/process1 --force " . md5(date('Y-m-d H:i:s')));
@unlink("/etc/artica-postfix/FROM_ISO");
@unlink("/etc/artica-postfix/artica-postfix.pid");
@unlink("/etc/artica-postfix/mon.pid");
shell_exec("/etc/init.d/artica-postfix restart daemon");
@unlink("/etc/artica-postfix/settings/Daemons/SystemCpuNumber");
events("restore Artica settings done...");
}
示例7: build
//.........这里部分代码省略.........
continue;
}
$syslog->events("Removed {$path}", __FUNCTION__, __LINE__);
@unlink($path);
continue;
}
$syslog->events("Analyze {$file} ^access\\.log\\.[0-9]+\$", __FUNCTION__, __LINE__);
if (!preg_match("#^access\\.log\\.[0-9]+\$#", $file)) {
continue;
}
@mkdir("{$LogRotatePath}", 0755, true);
$destfile = "{$LogRotateAccess}/{$file}." . time() . ".log";
if (!@copy($path, $destfile)) {
$syslog->events("Unable to copy {$path} to {$destfile}", __FUNCTION__, __LINE__);
@unlink($destfile);
continue;
}
$syslog->events("Removed {$path}", __FUNCTION__, __LINE__);
@unlink($path);
}
}
$syslog->events("Analyze {$LogRotateAccess} for access.log", __FUNCTION__, __LINE__);
if (!($handle = opendir($LogRotateAccess))) {
$syslog->events("Unable to open {$LogRotateAccess} directory.", __FUNCTION__, __LINE__);
return;
}
$ROTATED = false;
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$path = "{$LogRotateAccess}/{$file}";
echo "OPEN {$path}\n";
if (is_dir($path)) {
continue;
}
if (!preg_match("#^access\\.log#", $file)) {
continue;
}
range_fichier_source($path, $BackupMaxDaysDir);
$ROTATED = true;
}
}
if ($handle = opendir($LogRotateTail)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$path = "{$LogRotateTail}/{$file}";
echo "OPEN {$path}\n";
if (is_dir($path)) {
continue;
}
if (!preg_match("#^squidtail\\.log#", $file)) {
continue;
}
range_fichier_tail($path, $BackupMaxDaysDir);
$ROTATED = true;
}
}
}
if (!$ROTATED) {
return;
}
$q = new mysql();
$sql = "CREATE TABLE IF NOT EXISTS `backuped_logs` (\n\t\t\t `path` CHAR(255) NOT NULL,\n\t\t\t `zDate` DATETIME,\n\t\t\t `size` INT UNSIGNED NOT NULL,\n\t\t\t PRIMARY KEY (`path`),\n\t\t\t KEY `zDate` (`zDate`)\n\t\t\t) ENGINE = MYISAM;";
$q->QUERY_SQL($sql, "artica_events");
$syslog->events("Analyze /home/logrotate/work for access.log", __FUNCTION__, __LINE__);
build_progress_rotation("Scanning /home/logrotate/work", 45);
analyze_directory("/home/logrotate/work", $BackupMaxDaysDir);
$BackupMaxDaysDir2 = $sock->GET_INFO("BackupMaxDaysDir");
if ($BackupMaxDaysDir2 == null) {
$BackupMaxDaysDir2 = "/home/logrotate_backup";
}
if ($BackupMaxDaysDir2 != $BackupMaxDaysDir) {
build_progress_rotation("Scanning {$BackupMaxDaysDir2}", 46);
$syslog->events("{$BackupMaxDaysDir2} is different of {$BackupMaxDaysDir}", __FUNCTION__, __LINE__);
analyze_directory($BackupMaxDaysDir2, $BackupMaxDaysDir);
}
build_progress_rotation("Scanning /home/logrotate/merged", 47);
analyze_garbage_directory("/home/logrotate/merged", $BackupMaxDaysDir, 1440);
build_progress_rotation("Scanning {$LogRotateCache}", 48);
analyze_cache_directory($LogRotateCache, $BackupMaxDaysDir);
build_progress_rotation("Scanning /home/logrotate/work", 49);
analyze_cache_directory("/home/logrotate/work", $BackupMaxDaysDir);
build_progress_rotation("Scanning /home/squid/cache-logs", 49);
analyze_cache_directory("/home/squid/cache-logs", $BackupMaxDaysDir);
if ($GLOBALS["VERBOSE"]) {
echo "TRUNCATE TABLE backuped_logs !!!\n";
}
$q->QUERY_SQL("TRUNCATE TABLE backuped_logs", "artica_events");
if ($BackupSquidLogsUseNas == 1) {
build_progress_rotation("Backup to N.A.S", 50);
BackupToNas($BackupMaxDaysDir);
build_progress_rotation("Backup to N.A.S BigData backups", 50);
BackupToNas($InFluxBackupDatabaseDir, false);
} else {
build_progress_rotation("Scanning {$BackupMaxDaysDir}", 50);
analyze_destination_directory($BackupMaxDaysDir);
}
@file_put_contents("/etc/artica-postfix/settings/Daemons/BackupMaxDaysDirCurrentSize", $unix->DIRSIZE_KO($BackupMaxDaysDir));
@chmod("/etc/artica-postfix/settings/Daemons/BackupMaxDaysDirCurrentSize", 0777);
return;
}
示例8: critical_paths_locations
function critical_paths_locations()
{
$unix = new unix();
$f["/var/log/squid"] = true;
$f["/home/logs-backup"] = true;
$f["/home/c-icap/blacklists"] = true;
$f["/var/log/artica-postfix"] = true;
while (list($path, $val) = each($f)) {
$newpath = $path;
if (is_link($newpath)) {
$newpath = readlink($newpath);
}
$size = $unix->DIRSIZE_KO($newpath);
$ARRAY[$path]["SIZE"] = $size;
$ARRAY[$path]["PATH"] = $newpath;
}
echo "<articadatascgi>" . base64_encode(serialize($ARRAY)) . "</articadatascgi>";
}
示例9: sizes_backup
function sizes_backup()
{
$sock = new sockets();
$WordpressBackupParams = unserialize(base64_decode($sock->GET_INFO("WordpressBackupParams")));
if (!isset($WordpressBackupParams["FTP_ENABLE"])) {
$WordpressBackupParams["FTP_ENABLE"] = 0;
}
if (!isset($WordpressBackupParams["DEST"])) {
$WordpressBackupParams["DEST"] = "/home/wordpress-backup";
}
if ($WordpressBackupParams["DEST"] == null) {
$WordpressBackupParams["DEST"] = "/home/wordpress-backup";
}
if (!is_dir($WordpressBackupParams["DEST"])) {
return;
}
$unix = new unix();
$size = $unix->DIRSIZE_KO($WordpressBackupParams["DEST"]);
@file_put_contents("/etc/artica-postfix/settings/Daemons/WordpressBackupSize", $size);
@chmod("/etc/artica-postfix/settings/Daemons/WordpressBackupSize", 0755);
}
示例10: purge
function purge($aspid = false)
{
$unix = new unix();
$sock = new sockets();
$workdir = "/var/lib/c_icap/temporary";
if (is_link($workdir)) {
$workdir = readlink($workdir);
}
if (!is_dir($workdir)) {
return;
}
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$pidTime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
$rm = $unix->find_program("rm");
if ($GLOBALS["VERBOSE"]) {
echo "pidfile: {$pidfile}\n";
echo "pidTime: {$pidTime}\n";
}
if (!$aspid) {
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
$time = $unix->PROCCESS_TIME_MIN($pid);
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: c-icap service Already Artica task running PID {$pid} since {$time}mn\n";
}
return;
}
}
if (!$GLOBALS["FORCE"]) {
if (isset($GLOBALS["SCHEDULE"])) {
$Time = $unix->file_time_min($pidTime);
if ($GLOBALS["VERBOSE"]) {
echo "Time:{$Time}Mn\n";
}
if ($Time < 20) {
if ($GLOBALS["VERBOSE"]) {
echo "Time:{$Time}Mn < 20 -> Die();\n";
}
return;
}
}
}
if ($GLOBALS["FORCE"]) {
$Time = $unix->file_time_min($pidTime);
if ($Time < 1) {
if ($GLOBALS["VERBOSE"]) {
echo "Time:{$Time}Mn < 1 -> Die();\n";
}
return;
}
}
@unlink($pidTime);
@file_put_contents($pidTime, time());
$MaxCICAPWorkTimeMin = $sock->GET_INFO("MaxCICAPWorkTimeMin");
$MaxCICAPWorkSize = $sock->GET_INFO("MaxCICAPWorkSize");
if (!is_numeric($MaxCICAPWorkTimeMin)) {
$MaxCICAPWorkTimeMin = 1440;
}
if (!is_numeric($MaxCICAPWorkSize)) {
$MaxCICAPWorkSize = 5000;
}
$size = round($unix->DIRSIZE_KO($workdir) / 1024, 2);
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: c-icap service `{$workdir}` {$size}MB/{$MaxCICAPWorkSize}\n";
}
@file_put_contents($pidfile, getmypid());
$squidbin = $unix->LOCATE_SQUID_BIN();
$sync = $unix->find_program("sync");
if ($size > $MaxCICAPWorkSize) {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: c-icap service {$size}MB exceed size!\n";
}
squid_admin_mysql(0, "C-ICAP: `{$workdir}` {$size}MB exceed size!", "Artica will remove all files..\n", __FILE__, __LINE__);
shell_exec("{$rm} {$workdir}/*");
shell_exec($sync);
stop(true);
start(true);
squid_admin_mysql(2, "Reconfiguring proxy service\n", __FILE__, __LINE__);
shell_exec("/etc/init.d/squid reload --script=" . basename(__FILE__));
return;
}
if ($GLOBALS["ALL"]) {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: c-icap service {$size}MB exceed size!\n";
}
squid_admin_mysql(0, "C-ICAP: `{$workdir}` {$size}MB exceed size!", "Artica will remove all files..\n", __FILE__, __LINE__);
shell_exec("{$rm} {$workdir}/*");
shell_exec($sync);
stop(true);
start(true);
squid_admin_mysql(2, "Reconfiguring proxy service\n", __FILE__, __LINE__);
shell_exec("/etc/init.d/squid reload --script=" . basename(__FILE__));
return;
}
if (!($handle = opendir($workdir))) {
return;
}
while (false !== ($file = readdir($handle))) {
if ($file == ".") {
continue;
//.........这里部分代码省略.........