Example #1
0
 /**
  * @param File $file
  * @param Version $version
  * @return bool
  */
 public function unpublishVersion(File $file, Version $version)
 {
     $event = new PublisherEvent($file, array($version));
     $this->eventDispatcher->dispatch(Events::FILE_BEFORE_UNPUBLISH, $event);
     if ($this->versionUnpublisher($file, $version)) {
         $this->fileRepository->update($file);
         $event = new PublisherEvent($file, array($version));
         $this->eventDispatcher->dispatch(Events::FILE_AFTER_UNPUBLISH, $event);
         return true;
     }
     return false;
 }
Example #2
0
 public function provideAllVersions(File $file)
 {
     $versionable = $this->getApplicableVersionable($file);
     $versions = $this->createAllTemporaryVersions($file);
     foreach ($versions as $version => $tmp) {
         $version = Version::get($version);
         $this->storage->storeVersion($versionable, $version, $tmp);
         $versionable->addVersion($version);
         unlink($tmp);
     }
     $this->fileRepository->update($file);
     $event = new VersionProviderEvent($this, $file, array_keys($versions));
     $this->eventDispatcher->dispatch(Events::VERSIONS_PROVIDED, $event);
 }
Example #3
0
 /**
  * Updates a folder
  *
  * @param Folder $folder Folder
  */
 public function update(Folder $folder)
 {
     $route = $this->buildRoute($folder);
     $folder->setUrl($route);
     $this->backend->updateFolder($folder);
     foreach ($this->findFiles($folder) as $file) {
         $this->fileRepository->update($file);
     }
     foreach ($this->findSubFolders($folder) as $subFolder) {
         $this->update($subFolder);
     }
     $event = new FolderEvent($folder);
     $this->eventDispatcher->dispatch(Events::FOLDER_AFTER_UPDATE, $event);
     return $folder;
 }