Esempio n. 1
0
 public function setFileStorageLocation(StorageLocation $newLocation)
 {
     $fh = Loader::helper('concrete/file');
     $currentLocation = $this->getFileStorageLocationObject();
     if ($newLocation->getID() == $currentLocation->getID()) {
         return false;
     }
     $currentFilesystem = $currentLocation->getFileSystemObject();
     $newFileSystem = $newLocation->getFileSystemObject();
     $list = $this->getVersionList();
     try {
         foreach ($list as $fv) {
             $contents = $fv->getFileContents();
             $newFileSystem->put($fh->prefix($fv->getPrefix(), $fv->getFilename()), $contents);
             $currentFilesystem->delete($fh->prefix($fv->getPrefix(), $fv->getFilename()));
         }
     } catch (\Exception $e) {
         throw new \Exception($e->getMessage());
     }
     $this->storageLocation = $newLocation;
     $this->save();
 }
 /**
  * {@inheritDoc}
  */
 public function getID()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getID', array());
     return parent::getID();
 }