Esempio n. 1
0
 /**
  * Delete File
  *
  * @param string $filename Path File
  *
  * @return bool
  */
 public function deleteFile($filename)
 {
     if ($this->isDir($filename)) {
         return false;
     }
     return $this->storage->delete($filename);
 }
 /**
  * deletes all saved image data for given hash
  *
  * @param string $hash
  * @return mixed
  */
 public function remove($hash)
 {
     $hash = $this->isHashValid($hash);
     foreach (array_keys(config('image-service.filters')) as $filterName) {
         $path = implode('/', [config('image-service.path'), $filterName, $hash]);
         if ($this->filesystem->exists($path)) {
             $this->filesystem->delete($path);
         }
     }
 }
Esempio n. 3
0
 /**
  * Delete a single file from request.
  *
  * @param \Illuminate\Http\Request $request
  * @return \Illuminate\Http\JsonResponse
  */
 protected function deleteFile(Request $request)
 {
     try {
         $file = $request->input('s');
         $this->storage->delete($file);
         return $this->notifySuccess($file . ' successfully deleted!');
     } catch (\ErrorException $e) {
         return $this->notifyError($e->getMessage());
     }
 }
Esempio n. 4
0
 /**
  * Deletes the current attachment as well as the file.
  *
  * @param Filesystem $filesystem
  *
  * @throws \Exception
  *
  * @return bool
  */
 public function handle(Filesystem $filesystem)
 {
     try {
         if ($filesystem->delete($this->attachment->getStorageFilePath())) {
             return $this->attachment->delete();
         }
     } catch (FileNotFoundException $e) {
         //
     }
     return false;
 }
Esempio n. 5
0
 /**
  * Delete the file at a given path.
  *
  * @param  string|array $paths
  *
  * @return bool
  */
 public function delete($paths)
 {
     if (is_string($paths)) {
         $paths = [$paths];
     }
     if (is_array($paths)) {
         for ($i = 0; $i < count($paths); $i++) {
             $paths[$i] = $this->getPathPrefix($paths[$i]);
         }
     }
     return $this->drive->delete($paths);
 }
 /**
  * @param Filesystem $filesystem
  * @return CommandResult
  */
 public function handle(Filesystem $filesystem)
 {
     // check if user has permission
     if (!$this->disablePermissionChecking) {
         if (!$this->user->hasAnyPermission(['media.delete'])) {
             return new CommandResult(false, "Not enough permission.", null, 403);
         }
     }
     if (is_null($this->paths)) {
         return new CommandResult(false, "No file path given.", null, 400);
     }
     // begin delete
     if (!$filesystem->delete($this->paths)) {
         return new CommandResult(false, "Failed to delete file.", null, 400);
     }
     // all good
     return new CommandResult(true, "File(s) successfully deleted.", null, 200);
 }
 /**
  * @param $paths
  * @return bool|mixed
  */
 public function delete($paths)
 {
     return $this->storage->delete($paths);
 }
 /**
  * @inheritdoc
  */
 public function deleteFile(File $file, array $options)
 {
     return $this->filesystem->delete($this->getFilePath($file, $options));
 }
Esempio n. 9
0
 /**
  * @return void
  */
 protected function cleanAttachments()
 {
     $this->storage->delete(array_keys($this->attachments));
 }
Esempio n. 10
0
 /**
  * Remove old chunks.
  *
  * @param string $filePath
  *
  * @return void
  */
 protected function removeOldData($filePath)
 {
     if ($this->storage->exists($filePath) && $this->storage->lastModified($filePath) < time() - $this->maxFileAge) {
         $this->storage->delete($filePath);
     }
 }
 /**
  * Handle the action of deleting a file.
  *
  * @param  DeleteFileCommand $command
  * @return void
  */
 public function handle(DeleteFileCommand $command)
 {
     $path = str_replace(storage_path('app/'), '', $command->file->path);
     $command->file->delete();
     $this->filesystem->delete($path);
 }
Esempio n. 12
0
 /**
  * Delete the backup from the disk.
  */
 public function delete()
 {
     $this->disk->delete($this->path);
     consoleOutput()->info("Deleted backup `{$this->path}`.");
 }
 /**
  * Remove icon from the server
  *
  * @param Category $category
  */
 public function removeIcon(Category $category)
 {
     $this->filesystem->delete($category->icon);
 }