예제 #1
0
 /**
  * @param \Claroline\CoreBundle\Entity\Resource\ResourceIcon $icon
  */
 public function removeImageFromThumbDir(ResourceIcon $icon, Workspace $workspace = null)
 {
     if (preg_match('#^thumbnails#', $icon->getRelativeUrl())) {
         $pathName = $this->rootDir . '/../web/' . $icon->getRelativeUrl();
         if (file_exists($pathName)) {
             unlink($pathName);
             if (!is_null($workspace)) {
                 $dir = $this->thumbDir . DIRECTORY_SEPARATOR . $workspace->getCode();
                 if (is_dir($dir) && $this->isDirectoryEmpty($dir)) {
                     rmdir($dir);
                 }
             }
         }
     }
 }
예제 #2
0
 public function refresh(ResourceIcon $icon)
 {
     $shortcut = $icon->getShortcutIcon();
     $newUrl = $this->createShortcutFromRelativeUrl($icon->getRelativeUrl());
     $shortcut->setRelativeUrl($newUrl);
     $this->om->persist($shortcut);
     $this->om->flush();
 }