/** * @param flavorAsset $flavorAsset * @return boolean true if the given flavor asset is configured to be exported or false otherwise */ public function shouldExportFlavorAsset(flavorAsset $flavorAsset, $skipFlavorAssetStatusValidation = false) { if (!$skipFlavorAssetStatusValidation && !$flavorAsset->isLocalReadyStatus()) { return false; } if (!$this->isFlavorAssetConfiguredForExport($flavorAsset)) { return false; } $scope = $this->getScope(); $scope->setEntryId($flavorAsset->getEntryId()); if (!$this->fulfillsRules($scope)) { KalturaLog::log('Storage profile export rules are not fulfilled'); return false; } return true; }
/** * @param flavorAsset $flavorAsset * @return boolean true if the given flavor asset is configured to be exported or false otherwise */ public function shouldExportFlavorAsset(flavorAsset $flavorAsset, $skipFlavorAssetStatusValidation = false) { KalturaLog::debug('Checking if flavor asset [' . $flavorAsset->getId() . '] should be exported to [' . $this->getId() . ']'); if (!$skipFlavorAssetStatusValidation && !$flavorAsset->isLocalReadyStatus()) { KalturaLog::debug('Flavor is not ready for export'); return false; } if (!$this->isFlavorAssetConfiguredForExport($flavorAsset)) { KalturaLog::debug('Flavor asset is not configured for export'); return false; } $scope = $this->getScope(); $scope->setEntryId($flavorAsset->getEntryId()); if (!$this->fulfillsRules($scope)) { KalturaLog::debug('Storage profile export rules are not fulfilled'); return false; } KalturaLog::debug('Flavor should be exported'); return true; }
/** * @param flavorAsset $flavorAsset * @param FileSyncKey $srcSyncKey */ protected function attachFileSync(flavorAsset $flavorAsset, FileSyncKey $srcSyncKey) { $flavorAsset->incrementVersion(); $flavorAsset->save(); $newSyncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET); kFileSyncUtils::createSyncFileLinkForKey($newSyncKey, $srcSyncKey); $fileSync = kFileSyncUtils::getLocalFileSyncForKey($newSyncKey, false); $fileSync = kFileSyncUtils::resolve($fileSync); if (!$flavorAsset->isLocalReadyStatus()) { $flavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_QUEUED); } $flavorAsset->setSize($fileSync->getFileSize()); $flavorAsset->save(); }