本文整理汇总了PHP中unix::COUNT_FILES方法的典型用法代码示例。如果您正苦于以下问题:PHP unix::COUNT_FILES方法的具体用法?PHP unix::COUNT_FILES怎么用?PHP unix::COUNT_FILES使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unix
的用法示例。
在下文中一共展示了unix::COUNT_FILES方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: youtube_next_dir
function youtube_next_dir($dir)
{
$unix = new unix();
$countDefile = $unix->COUNT_FILES($dir);
youtube_events("{$dir} -> {$countDefile} files on Line: ", __LINE__);
if ($countDefile == 0) {
youtube_events("youtube_next_dir():: {$dir}: no files... remove... ", __LINE__);
@rmdir($dir);
return;
}
$FINAL = array();
if (!($handle = opendir($dir))) {
youtube_events("youtube_next_dir():: Fatal: {$dir} no such directory", __LINE__);
ufdbguard_admin_events("Fatal: {$dir} no such directory", __FUNCTION__, __FILE__, __LINE__, "stats");
return;
}
$c = 0;
while (false !== ($filename = readdir($handle))) {
if ($filename == ".") {
continue;
}
if ($filename == "..") {
continue;
}
$targetFile = "{$dir}/{$filename}";
$arrayFile = unserialize(@file_get_contents($targetFile));
if (!is_array($arrayFile)) {
youtube_events("youtube_next_dir()::{$targetFile} not an array, aborting", __LINE__);
@unlink($targetFile);
continue;
}
if ($GLOBALS["VERBOSE"]) {
print_r($arrayFile);
}
while (list($index, $RTTSIZEARRAY) = each($arrayFile)) {
$NewArray = youtube_array_to_sql($RTTSIZEARRAY);
if (!is_array($NewArray)) {
youtube_events("youtube_next_dir():: youtube_array_to_sql() return not an array for {$targetFile}", __LINE__);
@unlink($targetFile);
continue;
}
youtube_events("youtube_next_dir():: {$NewArray[0]} -> {$NewArray[1]}", __LINE__);
$FINAL[$NewArray[0]][] = $NewArray[1];
}
$c++;
@unlink($targetFile);
}
youtube_events("youtube_inject() " . count($FINAL) . " elements for {$c} scanned files...", __LINE__);
youtube_inject($FINAL);
if ($c > 0) {
events("youtube_next_dir():: {$c} deleted files...");
}
}
示例2: ParseSubDir
function ParseSubDir($dir)
{
$unix = new unix();
$q = new mysql_squid_builder();
$countDefile = $unix->COUNT_FILES($dir);
events("{$dir} -> {$countDefile} files on Line: ", __LINE__);
if ($countDefile == 0) {
events("ParseSubDir():: {$dir}: no files... remove... ", __LINE__);
@rmdir($dir);
return;
}
$FINAL = array();
if (!($handle = opendir($dir))) {
events("ParseSubDir():: Fatal: {$dir} no such directory", __LINE__);
return;
}
$DUSTBIN["mx.yahoo.com"] = true;
$DUSTBIN["row.bc.yahoo.com"] = true;
$DUSTBIN["us.bc.yahoo.com"] = true;
$DUSTBIN["xiti.com"] = true;
$c = 0;
while (false !== ($filename = readdir($handle))) {
if ($filename == ".") {
continue;
}
if ($filename == "..") {
continue;
}
$targetFile = "{$dir}/{$filename}";
$arrayFile = unserialize(@file_get_contents($targetFile));
if (!is_array($arrayFile)) {
@unlink($targetFile);
continue;
}
if ($GLOBALS["VERBOSE"]) {
echo "{$targetFile}\n";
}
while (list($index, $array) = each($arrayFile)) {
$words = mysql_escape_string2(trim($array["WORDS"]));
if ($words == null) {
continue;
}
$sitename = $array["SITENAME"];
$familysite = $q->GetFamilySites($sitename);
if (isset($DUSTBIN[$sitename])) {
continue;
}
if (isset($DUSTBIN[$familysite])) {
continue;
}
$ipaddr = $array["ipaddr"];
$zDate = $array["date"];
$uid = mysql_escape_string2($array["uid"]);
$MAC = mysql_escape_string2($array["mac"]);
$hostname = mysql_escape_string2($array["hostname"]);
$time = strtotime($zDate);
$prefix = date("YmdH", $time);
$zmd5 = md5(serialize($array));
$account = 0;
$line = "('{$zmd5}','{$sitename}','{$zDate}','{$ipaddr}','{$hostname}','{$uid}','{$MAC}','{$account}','{$familysite}','{$words}')";
if ($GLOBALS["VERBOSE"]) {
echo "{$prefix} -> {$line}\n";
}
$f[$prefix][] = $line;
}
@unlink($targetFile);
}
if (count($f) > 0) {
inject_array($f);
}
}
示例3: ParseRTTSizeDir
function ParseRTTSizeDir($dir)
{
$pidtime = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".ParseQueue.time";
$unix = new unix();
events("ParseRTTSizeDir():: count files on {$dir} Line: " . __LINE__);
$countDefile = $unix->COUNT_FILES($dir);
events("ParseRTTSizeDir():: {$dir} {$countDefile} files on Line: " . __LINE__);
if ($countDefile == 0) {
events("ParseRTTSizeDir():: {$dir}: remove... on Line: " . __LINE__);
@rmdir($dir);
return;
}
events("ParseRTTSizeDir(): scanning {$dir}");
$q = new mysql_squid_builder();
$q->CreateUserSizeRTTTable();
if (!$q->TABLE_EXISTS("UserSizeRTT")) {
events("ParseRTTSizeDir():: Fatal UserSizeRTT no such table, die()");
ufdbguard_admin_events("Fatal UserSizeRTT no such table, die();", __FUNCTION__, __FILE__, __LINE__, "stats");
return;
}
if (!($handle = opendir($dir))) {
ufdbguard_admin_events("Fatal: {$dir} no such directory", __FUNCTION__, __FILE__, __LINE__, "stats");
return;
}
$c = 0;
$d = 0;
$D = 0;
while (false !== ($filename = readdir($handle))) {
if ($filename == ".") {
continue;
}
if ($filename == "..") {
continue;
}
$targetFile = "{$dir}/{$filename}";
$arrayFile = unserialize(@file_get_contents($targetFile));
$countDeArrayFile = count($arrayFile);
if (!is_array($arrayFile)) {
@unlink($targetFile);
continue;
}
while (list($index, $RTTSIZEARRAY) = each($arrayFile)) {
$d++;
$D++;
if ($d > 500) {
events("RTTSizeArray():: {$countDeArrayFile}/{$D} items...(" . basename($targetFile) . ")");
$d = 0;
}
RTTSizeArray($RTTSIZEARRAY, "{$countDeArrayFile}/{$D}");
@file_put_contents($pidtime, time());
usleep(100);
}
if (!RTTSizeInjectArray()) {
continue;
}
$c++;
$D = 0;
@unlink($targetFile);
}
if ($c > 0) {
events("ParseRTTSizeDir({$dir}):: {$c} deleted files...");
}
}
示例4: loadavg_logs
function loadavg_logs()
{
include_once dirname(__FILE__) . '/ressources/class.mysql.inc';
$unix = new unix();
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$pid = @file_get_contents($pidfile);
if ($unix->process_exists($pid)) {
echo "Already running pid {$pid}\n";
return;
}
$q = new mysql();
if (!$q->DATABASE_EXISTS("artica_events")) {
if ($GLOBALS["VERBOSE"]) {
echo "Stop !\n";
}
events_Loadavg("loadavg_logs:: artica_events database does not exists... try to build one" . __LINE__);
$q->BuildTables();
}
if (!$q->DATABASE_EXISTS("artica_events")) {
if ($GLOBALS["VERBOSE"]) {
echo "Stop !\n";
}
events_Loadavg("loadavg_logs:: artica_events database cannot continue" . __LINE__);
return;
}
if ($GLOBALS["VERBOSE"]) {
echo "Scan {$GLOBALS["ARTICALOGDIR"]}/loadavg/*\n";
}
$COUNT = $unix->COUNT_FILES("{$GLOBALS["ARTICALOGDIR"]}/loadavg");
if ($COUNT > 5000) {
if (!($handle = opendir("{$GLOBALS["ARTICALOGDIR"]}/loadavg"))) {
return;
}
while (false !== ($filename = readdir($handle))) {
if ($filename == ".") {
continue;
}
if ($filename == "..") {
continue;
}
$filename = "{$GLOBALS["ARTICALOGDIR"]}/loadavg/{$filename}";
@unlink($filename);
}
return;
}
if (!($handle = opendir("{$GLOBALS["ARTICALOGDIR"]}/loadavg"))) {
@mkdir("{$GLOBALS["ARTICALOGDIR"]}/loadavg", 0755, true);
return;
}
while (false !== ($filename = readdir($handle))) {
if ($filename == ".") {
continue;
}
if ($filename == "..") {
continue;
}
$filename = "{$GLOBALS["ARTICALOGDIR"]}/loadavg/{$filename}";
if ($unix->file_time_min($filename) > 240) {
@unlink($filename);
continue;
}
$time = basename($filename);
$load = @file_get_contents($filename);
$date = date('Y-m-d H:i:s', $time);
$sql = "INSERT IGNORE INTO loadavg (`stime`,`load`) VALUES ('{$date}','{$load}');";
$q->QUERY_SQL($sql, "artica_events");
if (!$q->ok) {
events_Loadavg("loadavg_logs:: {$q->mysql_error} line:" . __LINE__);
continue;
}
events_Loadavg("loadavg_logs:: success {$filename}" . __LINE__);
@unlink($filename);
}
}
示例5: count_tables_hours
function count_tables_hours()
{
$dir = "/var/lib/mysql/postfixlog";
$unix = new unix();
return $unix->COUNT_FILES($dir);
}
示例6: thumbnail_parse_dir
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;
}
}
}