Пример #1
0
 public function addfile($file_pattern)
 {
     $subtasks = [];
     $subtasks_checked = [];
     if (is_array($file_pattern)) {
         foreach ($file_pattern as $pattern) {
             $files = glob(realpath($this->task->directory . $pattern));
             $subtasks = array_merge($subtasks, $files);
         }
     } else {
         $subtasks = glob($this->task->directory . $file_pattern);
     }
     foreach ($subtasks as $subtask) {
         if (strpos($subtask, $this->task->directory) == 0 && !is_dir($subtask)) {
             array_push($subtasks_checked, substr($subtask, strlen($this->task->directory)));
         }
     }
     return Subtask::addSubtask($this->task->task_id, $subtasks_checked);
 }