Пример #1
0
 /**
  * Process the archives found in the incoming folders
  * 
  * @param string $detection
  * @param string $type
  * @param bool $help
  * @param bool $clearlock
  * @return void 
  */
 public function actionProcess($detection = '', $type = '', $help = false, $clearlock = false)
 {
     if (!in_array($detection, array('', 'detected', 'clean'))) {
         $help = true;
     }
     if (!in_array($type, array('', 'daily', 'monthly', 'bogus', 'url'))) {
         $help = true;
     }
     if ($help) {
         echo "\r\nUSAGE EXAMPLE:\r\n    archives process                                        // extracts all files from all archives\r\n    archives process --type=daily                           // extracts all files from daily archives (both detected and clean)\r\n    archives process --detection=clean --type=monthly       // extracts all files from clean monthly archives\r\n\r\nOPTIONS:\r\n    detection = [clean|detected]\r\n    type = [daily|monthly|bogus|url]\r\n";
         die;
     }
     if (!$this->handleFolderLock(VIREX_INCOMING_PATH, $clearlock)) {
         return;
     }
     $this->pending_actions();
     $errors_count = 0;
     if ($detection) {
         $dees = array($detection);
     } else {
         $dees = array('detected', 'clean');
     }
     if ($type) {
         $tees = array($type);
     } else {
         $tees = array('daily', 'monthly', 'url', 'bogus');
     }
     $archiver = new AFileArchive();
     $urchiver = new AUrlArchive();
     foreach ($tees as $tee) {
         foreach ($dees as $dee) {
             if ($tee == 'url') {
                 $files = $urchiver->return_all();
             }
             if (in_array($tee, array('daily', 'monthly'))) {
                 $files = $archiver->process_archives($dee, $tee);
                 $this->show_files($files, ucfirst($tee) . ' ' . $dee);
             }
         }
     }
     $this->actionSendemails();
     ALogger::end_step();
     $this->clearLock(VIREX_INCOMING_PATH);
 }