Exemple #1
0
 /**
  * Deletes the files of the media item
  *
  * {inheritDoc}
  *
  * @param \Aimeos\MShop\Media\Item\Iface $item Media item whose files should be deleted
  * @param string $fsname Name of the file system to delete the files from
  */
 public function delete(\Aimeos\MShop\Media\Item\Iface $item, $fsname = 'fs-media')
 {
     $fs = $this->context->getFilesystemManager()->get($fsname);
     $path = $item->getUrl();
     if ($path !== '' && $fs->has($path)) {
         $fs->rm($path);
     }
     $item->setUrl(null);
     $path = $item->getPreview();
     if ($path !== '' && $fs->has($path)) {
         $fs->rm($path);
     }
     $item->setPreview(null);
 }
Exemple #2
0
 /**
  * Deletes the files of the media item
  *
  * {inheritDoc}
  *
  * @param \Aimeos\MShop\Media\Item\Iface $item Media item whose files should be deleted
  * @param string $fsname Name of the file system to delete the files from
  */
 public function delete(\Aimeos\MShop\Media\Item\Iface $item, $fsname = 'fs-media')
 {
     $fs = $this->context->getFilesystemManager()->get($fsname);
     $path = $item->getUrl();
     if ($path !== '' && $fs->has($path)) {
         $fs->rm($path);
     }
     $item->setUrl(null);
     try {
         $path = $item->getPreview();
         if ($path !== '' && $fs->has($path)) {
             $fs->rm($path);
         }
     } catch (\Exception $e) {
     }
     // Can be a mime icon with relative path
     $item->setPreview(null);
 }