Exemplo n.º 1
0
     }
     $folder = new DirectoryIterator(get_ini('UPLOAD_FOLDER') . 'archived/');
     foreach ($folder as $file) {
         if ($file->isFile() && !$file->isDot() && time() - $file->getMTime() > get_ini('UPLOAD_ARCHIVED_FILE_LIFE')) {
             unlink($file->getPathname());
         }
     }
     $lastCollectorTime = time();
 }
 //echo 'There is '.$proc->runningCount().' process available.'."\n";
 // Load process if some are available
 $q0 = get_link()->prepare("SELECT count(*) AS PENDINGCOUNT FROM " . get_ini('BDD_PREFIX') . "core_processus WHERE status = 'pending' AND (deleted_date = 0 AND TIMEOUT>:current_date)");
 $q0->execute(array('current_date' => time()));
 $r0 = $q0->fetch(PDO::FETCH_OBJ);
 $pendingProc = $r0->PENDINGCOUNT;
 while ($procM->getRunningCount() <= get_ini('MAX_PROCESS') && $pendingProc > 0) {
     $pendingProc--;
     // Process result file first
     $q0 = get_link()->prepare("SELECT MIN(id) AS ID FROM " . get_ini('BDD_PREFIX') . "core_processus WHERE status = 'pending' AND cmd LIKE '%result%' AND (deleted_date = 0 AND TIMEOUT>:current_date)");
     $q0->execute(array('current_date' => time()));
     $r0 = $q0->fetch(PDO::FETCH_OBJ);
     if (isset($r0->ID)) {
         $currentProc = $r0->ID;
     } else {
         $q0 = get_link()->prepare("SELECT MIN(id) AS ID FROM " . get_ini('BDD_PREFIX') . "core_processus WHERE status = 'pending' AND (deleted_date = 0 AND TIMEOUT>:current_date)");
         $q0->execute(array('current_date' => time()));
         $r0 = $q0->fetch(PDO::FETCH_OBJ);
         if (isset($r0->ID)) {
             $currentProc = $r0->ID;
         } else {
             $currentProc = 0;