示例#1
0
 /**
  * creates a metafile instance
  * requires either id or path stored in db
  *
  * @param string $path of metafile
  * @param integer $id of metafile
  */
 private function __construct($path = NULL, $id = NULL, $dbEntry = NULL)
 {
     if (isset($path)) {
         $this->data = $this->getDbEntryByPath($path);
     } else {
         if (isset($id)) {
             $this->data = $this->getDbEntryById($id);
         } else {
             if (isset($dbEntry)) {
                 $this->data = $dbEntry;
             }
         }
     }
     $this->id = $this->data['filesID'];
     $this->filesystemFile = FilesystemFile::getInstance(Application::getInstance()->extendToAbsoluteAssetsPath($this->data['FullPath']));
     $this->metaFolder = MetaFolder::getInstance($this->filesystemFile->getFolder()->getPath());
     // when record features an obscured_filename, the FilesystemFile is bound to this obscured filename, while the metafile always references the non-obscured filename
     $this->isObscured = $this->data['File'] !== $this->filesystemFile->getFilename();
 }
示例#2
0
 /**
  * creates metafolder from current filesystemfolder
  */
 public function createMetaFolder()
 {
     try {
         return MetaFolder::getInstance($this->getPath());
     } catch (MetaFolderException $e) {
         return MetaFolder::create($this);
     }
 }