Example #1
0
 /**
  * @param SourceItem $sourceItem
  *
  * @return null|string
  */
 protected function getPreviewImageUrl(SourceItem $sourceItem)
 {
     $imageFileName = 'pageType.' . self::PREVIEW_IMAGE_EXTENSION;
     $imageFilePath = FS::joinPath($sourceItem->getDirectory(), self::PREVIEW_IMAGE_SUBDIRECTORY, $imageFileName);
     if (!file_exists($imageFilePath)) {
         return null;
     }
     return $sourceItem->getUrl() . '/' . self::PREVIEW_IMAGE_SUBDIRECTORY . '/' . $imageFileName;
 }
Example #2
0
 /**
  * @param SourceItem $sourceItem
  * @param string     $newId
  * @param string     $subdirectory
  *
  * @return SourceItem
  */
 public function createSubdirSourceItem(SourceItem $sourceItem, $newId, $subdirectory)
 {
     return new SourceItem($newId, FS::joinPath($sourceItem->getDirectory(), $subdirectory, $newId), $sourceItem->getUrl() . '/' . $subdirectory . '/' . $newId, $sourceItem->getType(), $sourceItem->isReadonly(), false);
 }
Example #3
0
 /**
  * @param SourceItem $sourceItem
  *
  * @throws ModuleNotWritable
  */
 protected function checkIfModuleIsWritable(SourceItem $sourceItem)
 {
     if ($sourceItem->isReadonly()) {
         throw new ModuleNotWritable(114, __METHOD__, __LINE__, array('id' => $sourceItem->getId(), 'type' => $sourceItem->getType(), 'directory' => $sourceItem->getDirectory()));
     }
 }
Example #4
0
 /**
  * @param SourceItem $sourceItem
  *
  * @return int
  * @throws \Exception
  */
 protected function getLastModifyTime(SourceItem $sourceItem)
 {
     $manifestFileName = $this->getManifestFileName();
     return $this->getFileModifyTime($sourceItem->getDirectory(), $manifestFileName);
 }