Exemple #1
0
 public function rollbackVersion($desired_version)
 {
     // don't duplicate if staying in hte same version
     $current_version = $this->getVersion();
     if ($desired_version == $current_version) {
         return $current_version;
     }
     $source_syc_key = $this->getSyncKey(self::FILE_SYNC_ENTRY_SUB_TYPE_DATA, $desired_version);
     /*
     		// check that the file of the desired version really exists
     		$content =  myContentStorage::getFSContentRootPath();
     		$path = $content . $this->getDataPath( $desired_version ); // replaced__getDataPath
     
     		if ( ! file_exists( $path ))
     		{
     			return null;
     		}
     */
     // increment the counter of the file
     $this->setData(parent::getData());
     $target_syc_key = $this->getSyncKey(self::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
     /*
     		$new_path = $content . $this->getDataPath( ); //replaced__getDataPath
     
     		// make a copy
     		kFile::moveFile( $path , $new_path , true , true );
     */
     kFileSyncUtils::copy($source_syc_key, $target_syc_key);
     $this->save();
     // return the new version
     return $this->getVersion();
 }