Пример #1
0
 /**
  * Handle the command.
  *
  * @param FileRepositoryInterface   $files
  * @param FolderRepositoryInterface $folders
  */
 public function handle(FileRepositoryInterface $files, FolderRepositoryInterface $folders)
 {
     $folder = $folders->findBySlug(dirname($this->file->getPath()));
     $file = $files->findByNameAndFolder(basename($this->file->getPath()), $folder);
     if ($file) {
         $files->delete($file);
     }
 }
Пример #2
0
 /**
  * Handle the command.
  *
  * @param FileRepositoryInterface $files
  */
 public function handle(FileRepositoryInterface $files)
 {
     foreach ($this->folder->getFiles() as $file) {
         if ($this->folder->isForceDeleting()) {
             $files->forceDelete($file);
         } else {
             $files->delete($file);
         }
     }
 }
Пример #3
0
 /**
  * Fire just before saving a folder.
  *
  * @param EntryInterface|FolderInterface $entry
  */
 public function deleting(EntryInterface $entry)
 {
     $this->manager->deleteDir($entry->diskPath());
     // Delete contained files.
     foreach ($entry->getFiles() as $file) {
         $this->files->delete($file);
     }
     // Delete contained folders.
     foreach ($entry->getChildren() as $folder) {
         $this->folders->delete($folder);
     }
 }
Пример #4
0
 /**
  * Fire the command.
  *
  * @param FileRepositoryInterface $files
  */
 public function fire(FileRepositoryInterface $files)
 {
     $missing = false;
     /* @var FileInterface|EloquentModel $file */
     foreach ($files->all() as $file) {
         if (!$file->resource()) {
             $missing = true;
             if (!$this->option('pretend')) {
                 $files->delete($file);
             }
             $this->info($file->path() . ' ' . (!$this->option('pretend') ? 'deleted' : 'missing') . '.');
         }
     }
     if (!$missing) {
         $this->info('Files database is clean.');
     }
 }
Пример #5
0
 /**
  * Handle the command.
  *
  * @param FileRepositoryInterface $files
  */
 public function handle(FileRepositoryInterface $files)
 {
     foreach ($this->folder->getFiles() as $file) {
         $files->delete($file);
     }
 }