Пример #1
0
function ScanQueue()
{
    $users = new usersMenus();
    $GLOBALS["SAMBA_INSTALLED"] = $users->SAMBA_INSTALLED;
    $unix = new unix();
    $path = "/var/log/artica-postfix/xapian";
    $SartOn = time();
    $files = $unix->DirFiles($path);
    if (count($files) == 0) {
        return;
    }
    cpulimitProcessName("omindex");
    while (list($num, $file) = each($files)) {
        $toScan = "{$path}/{$file}";
        if (ScanFile($toScan)) {
            @unlink($toScan);
        }
    }
    $SartOff = time();
    $time = distanceOfTimeInWords($SartOn, $SartOff);
    $countdir = count($GLOBALS["DIRS"]);
    cpulimitProcessNameKill("omindex");
    $echo = "InstantSearch {items}: {skipped}: {$GLOBALS["SKIPPED"]} {files}<br>{indexed}: {$GLOBALS["INDEXED"]} {files}<br>{duration}:{$time}";
    if ($GLOBALS["INDEXED"] > 0) {
        @file_put_contents("/usr/share/artica-postfix/ressources/logs/xapian.results", $echo);
        @chmod("/usr/share/artica-postfix/ressources/logs/xapian.results", 0777);
    }
    echo $echo . "\n";
}
Пример #2
0
function ScanQueue()
{
    $unix = new unix();
    $GLOBALS["omindex"] = $unix->find_program("omindex");
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $pid = $unix->get_pid_from_file($pidfile);
    if ($unix->process_exists($pid)) {
        writelogs("Already instance executed pid:{$olpid}", __FUNCTION__, __FILE__, __LINE__);
        die;
    }
    @file_put_contents($pidfile, getmypid());
    $users = new usersMenus();
    $GLOBALS["SAMBA_INSTALLED"] = $users->SAMBA_INSTALLED;
    $path = "{$GLOBALS["ARTICALOGDIR"]}/xapian";
    $SartOn = time();
    $files = $unix->DirFiles($path);
    if (count($files) == 0) {
        return;
    }
    cpulimitProcessName("omindex");
    while (list($num, $file) = each($files)) {
        $toScan = "{$path}/{$file}";
        if (ScanFile($toScan)) {
            @unlink($toScan);
        }
    }
    $SartOff = time();
    $time = distanceOfTimeInWords($SartOn, $SartOff);
    $countdir = count($GLOBALS["DIRS"]);
    cpulimitProcessNameKill("omindex");
    $echo = "InstantSearch {items}: {skipped}: {$GLOBALS["SKIPPED"]} {files}<br>{indexed}: {$GLOBALS["INDEXED"]} {files}<br>{duration}:{$time}";
    if ($GLOBALS["INDEXED"] > 0) {
        @file_put_contents("/usr/share/artica-postfix/ressources/logs/xapian.results", $echo);
        @chmod("/usr/share/artica-postfix/ressources/logs/xapian.results", 0777);
    }
    echo $echo . "\n";
}