Beispiel #1
0
 public function remake($files = array())
 {
     $files = array_merge($files, $this->files_need_update());
     $files = array_keys(array_flip($files));
     if (!$this->mutex->acquire()) {
         return false;
     }
     $maker = new Maker($this);
     foreach ($this->files as $name => $file) {
         if ($file->type() == CROSSLINK && !in_array($nme, $files)) {
             $files[] = $name;
         }
     }
     if ($files) {
         $files = $maker->update($files);
     }
     $this->errors = $maker->errors();
     // those that have failed to make will be deleted
     foreach ($this->errors as $name => $error) {
         $file = $this->files[$name];
         if ($file) {
             if ($file->is_target()) {
                 $file->delete($this->path());
             }
         } else {
             $path = $this->project_path . $name;
             if (file_exists($path)) {
                 unlink($path);
             }
         }
     }
     foreach ($files as $name) {
         if (!isset($this->errors[$name])) {
             if (!isset($this->files[$name])) {
                 continue;
             }
             $file = $this->files[$name];
             if ($file->is_target()) {
                 $file->set_last_made_time($this->path());
             }
         }
     }
     $this->modified = true;
     // should not remake when saving. otherwise infinite loop
     $this->save_project();
     $this->mutex->release();
     return true;
 }