public static function calcObjectNewVersion($object_id, $version, $object_type, $object_sub_type) { if (self::wasFileSyncLimitationReached($object_id, $version, $object_type, $object_sub_type)) { throw new kCoreException("File sync limitation per single object per day was reached for object id " . $object_id, kCoreException::MAX_FILE_SYNCS_FOR_OBJECT_PER_DAY_REACHED, $object_id); } return kDataCenterMgr::incrementVersion($version); }
/** * Increment an internal version counter in order to invalidate cached thumbnails (see getThumbnailUrl()) */ public function onAssetContentModified() { $assetCacheVersion = kDataCenterMgr::incrementVersion($this->getAssetCacheVersion()); $this->setAssetCacheVersion($assetCacheVersion); return $assetCacheVersion; }
public function incrementConfigVersion() { $version = kDataCenterMgr::incrementVersion($this->getVersion()); return $this->putInCustomData(self::CUSTOM_DATA_FIELD_CONFIG_VERSION, $version); }
public function incrementDeleteDataVersion() { $version = kDataCenterMgr::incrementVersion($this->getDeleteDataVersion()); return $this->putInCustomData(self::CUSTOM_DATA_FIELD_DELETE_DATA_VERSION, $version); }
public function incrementPostFileVersion() { $version = kDataCenterMgr::incrementVersion($this->getPostFileVersion()); return $this->putInCustomData(self::CUSTOM_DATA_POST_FILE_VERSION, $version); }
/** * This function generates a random file name consisting of a random number and * a given file extension. If the new filename begins with a '&' or '^' character, the new * file is a kaltura template and it's appended to the previous filename UGC part. * This way the old UGC version is mantained. look above at getGeneralEntityPath documentation. * The random number is in the interval [100000,900000]. * The 900000 upper limit provides space for storing 100000 versions * without expanding the file name length. * @param string $fileName = the original fileName from which the extension is cut. * @param string $previousFileName = in case a previous file exists, the old random is incremented * @return string the randomized file name */ public static function generateRandomFileName($fileName, $previousFileName = NULL) { if ($fileName === null) { return null; } if ($previousFileName) { $c = strstr($previousFileName, '^') ? '^' : '&'; $parts = explode($c, $previousFileName); } else { $parts = array(''); } if (strlen($fileName) && ($fileName[0] == '&' || $fileName[0] == '^')) { return $parts[0] . $fileName; } if (strlen($parts[0])) { // a previous UGC found, increment version $version = kDataCenterMgr::incrementVersion(pathinfo($parts[0], PATHINFO_BASENAME)); } else { $version = rand(myContentStorage::MIN_OBFUSCATOR_VALUE, myContentStorage::MAX_OBFUSCATOR_VALUE); } return $version . '.' . strtolower(pathinfo($fileName, PATHINFO_EXTENSION)); }
public function incrementResultsTransformerVersion() { $version = kDataCenterMgr::incrementVersion($this->getResultsTransformerVersion()); return $this->putInCustomData(self::CUSTOM_DATA_FIELD_RESULTS_TRANSFORMER_VERSION, $version); }