當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FileSyncPeer::doSelect方法代碼示例

本文整理匯總了PHP中FileSyncPeer::doSelect方法的典型用法代碼示例。如果您正苦於以下問題:PHP FileSyncPeer::doSelect方法的具體用法?PHP FileSyncPeer::doSelect怎麽用?PHP FileSyncPeer::doSelect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在FileSyncPeer的用法示例。


在下文中一共展示了FileSyncPeer::doSelect方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: validateEntry

 public function validateEntry(entry $dbEntry)
 {
     parent::validateEntry($dbEntry);
     $this->validatePropertyNotNull('entryId');
     $srcEntry = entryPeer::retrieveByPK($this->entryId);
     if (!$srcEntry) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $this->entryId);
     }
     if ($srcEntry->getMediaType() == KalturaMediaType::IMAGE) {
         return parent::validateEntry($dbEntry);
     }
     $srcFlavorAsset = null;
     if (is_null($this->flavorParamsId)) {
         $srcFlavorAsset = assetPeer::retrieveOriginalByEntryId($this->entryId);
         if (!$srcFlavorAsset) {
             throw new KalturaAPIException(KalturaErrors::ORIGINAL_FLAVOR_ASSET_IS_MISSING);
         }
     } else {
         $srcFlavorAsset = assetPeer::retrieveByEntryIdAndParams($this->entryId, $this->flavorParamsId);
         if (!$srcFlavorAsset) {
             throw new KalturaAPIException(KalturaErrors::FLAVOR_ASSET_ID_NOT_FOUND, $this->assetId);
         }
     }
     $key = $srcFlavorAsset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
     $c = FileSyncPeer::getCriteriaForFileSyncKey($key);
     $c->addAnd(FileSyncPeer::FILE_TYPE, array(FileSync::FILE_SYNC_FILE_TYPE_FILE, FileSync::FILE_SYNC_FILE_TYPE_LINK), Criteria::IN);
     $fileSyncs = FileSyncPeer::doSelect($c);
     foreach ($fileSyncs as $fileSync) {
         $fileSync = kFileSyncUtils::resolve($fileSync);
         if ($fileSync->getFileType() == FileSync::FILE_SYNC_FILE_TYPE_FILE) {
             return;
         }
     }
     throw new KalturaAPIException(KalturaErrors::FILE_DOESNT_EXIST);
 }
開發者ID:EfncoPlugins,項目名稱:Media-Management-based-on-Kaltura,代碼行數:35,代碼來源:KalturaEntryResource.php

示例2: resumeEvents

 private function resumeEvents($flavorAsset)
 {
     $syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     $c = FileSyncPeer::getCriteriaForFileSyncKey($syncKey);
     $fileSyncList = FileSyncPeer::doSelect($c);
     foreach ($fileSyncList as $fileSync) {
         // resume file sync added event
         kEventsManager::continueEvent(new kObjectAddedEvent($fileSync), 'kVirusScanFlowManager');
     }
     // resume flavor asset added event consumption
     kEventsManager::continueEvent(new kObjectAddedEvent($flavorAsset), 'kVirusScanFlowManager');
 }
開發者ID:richhl,項目名稱:kalturaCE,代碼行數:12,代碼來源:kVirusScanFlowManager.php

示例3: syncableDeleted

 /**
  * @param string $id
  * @param int $type
  */
 protected function syncableDeleted($id, $type)
 {
     $c = new Criteria();
     $c->add(FileSyncPeer::OBJECT_ID, $id);
     $c->add(FileSyncPeer::OBJECT_TYPE, $type);
     $c->add(FileSyncPeer::STATUS, array(FileSync::FILE_SYNC_STATUS_PURGED, FileSync::FILE_SYNC_STATUS_DELETED), Criteria::NOT_IN);
     $fileSyncs = FileSyncPeer::doSelect($c);
     foreach ($fileSyncs as $fileSync) {
         $key = kFileSyncUtils::getKeyForFileSync($fileSync);
         kFileSyncUtils::deleteSyncFileForKey($key);
     }
 }
開發者ID:EfncoPlugins,項目名稱:Media-Management-based-on-Kaltura,代碼行數:16,代碼來源:kObjectDeleteHandler.php

示例4: getAllReadyInternalFileSyncsForKey

function getAllReadyInternalFileSyncsForKey(FileSyncKey $key)
{
    $c = new Criteria();
    $c = FileSyncPeer::getCriteriaForFileSyncKey($key);
    $c->addAnd(FileSyncPeer::FILE_TYPE, FileSync::FILE_SYNC_FILE_TYPE_FILE);
    $c->addAnd(FileSyncPeer::STATUS, FileSync::FILE_SYNC_STATUS_READY);
    $results = FileSyncPeer::doSelect($c);
    $assocResults = array();
    foreach ($results as $curResult) {
        $assocResults[$curResult->getDc()] = $curResult;
    }
    return $assocResults;
}
開發者ID:DBezemer,項目名稱:server,代碼行數:13,代碼來源:moveConvertJobs.php

示例5: deleteObject

function deleteObject(FileSync $fileSync)
{
    $object = kFileSyncUtils::retrieveObjectForFileSync($fileSync);
    $key = $object->getSyncKey($fileSync->getObjectSubType());
    if ($key->version != $fileSync->getVersion()) {
        return;
    }
    switch ($fileSync->getObjectType()) {
        case FileSyncObjectType::UICONF:
            $object->setStatus(uiConf::UI_CONF_STATUS_DELETED);
            $object->save();
            break;
        case FileSyncObjectType::ENTRY:
            myEntryUtils::deleteEntry($object);
            try {
                $wrapper = objectWrapperBase::getWrapperClass($object);
                $wrapper->removeFromCache("entry", $object->getId());
            } catch (Exception $e) {
                KalturaLog::err($e);
            }
            break;
        case FileSyncObjectType::ASSET:
            $object->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_DELETED);
            $object->setDeletedAt(time());
            $object->save();
            break;
        case FileSyncObjectType::METADATA:
            $object->setStatus(Metadata::STATUS_DELETED);
            $object->save();
            break;
        default:
            return;
    }
    if ($fileSync->getFileType() == FileSync::FILE_SYNC_FILE_TYPE_LINK) {
        return;
    }
    $criteria = new Criteria();
    $criteria->add(FileSyncPeer::DC, $fileSync->getDc());
    $criteria->add(FileSyncPeer::FILE_TYPE, FileSync::FILE_SYNC_FILE_TYPE_LINK);
    $criteria->add(FileSyncPeer::LINKED_ID, $fileSync->getId());
    $links = FileSyncPeer::doSelect($criteria);
    foreach ($links as $link) {
        deleteObject($link);
    }
}
開發者ID:DBezemer,項目名稱:server,代碼行數:45,代碼來源:validateFileSyncs.php

示例6: validateForUsage

 public function validateForUsage($sourceObject, $propertiesToSkip = array())
 {
     parent::validateForUsage($sourceObject, $propertiesToSkip);
     $this->validatePropertyNotNull('assetId');
     $srcFlavorAsset = assetPeer::retrieveById($this->assetId);
     if (!$srcFlavorAsset) {
         throw new KalturaAPIException(KalturaErrors::FLAVOR_ASSET_ID_NOT_FOUND, $resource->assetId);
     }
     $key = $srcFlavorAsset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
     $c = FileSyncPeer::getCriteriaForFileSyncKey($key);
     $c->addAnd(FileSyncPeer::FILE_TYPE, array(FileSync::FILE_SYNC_FILE_TYPE_FILE, FileSync::FILE_SYNC_FILE_TYPE_LINK), Criteria::IN);
     $fileSyncs = FileSyncPeer::doSelect($c);
     foreach ($fileSyncs as $fileSync) {
         $fileSync = kFileSyncUtils::resolve($fileSync);
         if ($fileSync->getFileType() == FileSync::FILE_SYNC_FILE_TYPE_FILE) {
             return;
         }
     }
     throw new KalturaAPIException(KalturaErrors::FILE_DOESNT_EXIST);
 }
開發者ID:DBezemer,項目名稱:server,代碼行數:20,代碼來源:KalturaAssetResource.php

示例7: listAction

 /**
  * List file syce objects by filter and pager
  *
  * @action list
  * @param KalturaFileSyncFilter $filter
  * @param KalturaFilterPager $pager
  * @return KalturaFileSyncListResponse
  */
 function listAction(KalturaFileSyncFilter $filter = null, KalturaFilterPager $pager = null)
 {
     if (!$filter) {
         $filter = new KalturaFileSyncFilter();
     }
     if (!$pager) {
         $pager = new KalturaFilterPager();
     }
     $fileSyncFilter = new FileSyncFilter();
     $filter->toObject($fileSyncFilter);
     $c = new Criteria();
     $fileSyncFilter->attachToCriteria($c);
     $totalCount = FileSyncPeer::doCount($c);
     $pager->attachToCriteria($c);
     $dbList = FileSyncPeer::doSelect($c);
     $list = KalturaFileSyncArray::fromDbArray($dbList, $this->getResponseProfile());
     $response = new KalturaFileSyncListResponse();
     $response->objects = $list;
     $response->totalCount = $totalCount;
     return $response;
 }
開發者ID:AdiTal,項目名稱:server,代碼行數:29,代碼來源:FileSyncService.php

示例8: getRemotePathsAction

 /**
  * Get remote storage existing paths for the asset
  * 
  * @action getRemotePaths
  * @param string $id
  * @return KalturaRemotePathListResponse
  * @throws KalturaAttachmentErrors::ATTACHMENT_ASSET_ID_NOT_FOUND
  * @throws KalturaAttachmentErrors::ATTACHMENT_ASSET_IS_NOT_READY
  */
 public function getRemotePathsAction($id)
 {
     $assetDb = assetPeer::retrieveById($id);
     if (!$assetDb || !$assetDb instanceof AttachmentAsset) {
         throw new KalturaAPIException(KalturaAttachmentErrors::ATTACHMENT_ASSET_ID_NOT_FOUND, $id);
     }
     if ($assetDb->getStatus() != asset::ASSET_STATUS_READY) {
         throw new KalturaAPIException(KalturaAttachmentErrors::ATTACHMENT_ASSET_IS_NOT_READY);
     }
     $c = new Criteria();
     $c->add(FileSyncPeer::OBJECT_TYPE, FileSyncObjectType::ASSET);
     $c->add(FileSyncPeer::OBJECT_SUB_TYPE, asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
     $c->add(FileSyncPeer::OBJECT_ID, $id);
     $c->add(FileSyncPeer::VERSION, $assetDb->getVersion());
     $c->add(FileSyncPeer::PARTNER_ID, $assetDb->getPartnerId());
     $c->add(FileSyncPeer::STATUS, FileSync::FILE_SYNC_STATUS_READY);
     $c->add(FileSyncPeer::FILE_TYPE, FileSync::FILE_SYNC_FILE_TYPE_URL);
     $fileSyncs = FileSyncPeer::doSelect($c);
     $listResponse = new KalturaRemotePathListResponse();
     $listResponse->objects = KalturaRemotePathArray::fromFileSyncArray($fileSyncs);
     $listResponse->totalCount = count($listResponse->objects);
     return $listResponse;
 }
開發者ID:EfncoPlugins,項目名稱:Media-Management-based-on-Kaltura,代碼行數:32,代碼來源:AttachmentAssetService.php

示例9: prepareDistributionJob

 /**
  * @param EntryDistribution $entryDistribution
  * @param DistributionProfile $distributionProfile
  * @param int $dc
  * @return bool true if the job could be created
  */
 protected static function prepareDistributionJob(EntryDistribution $entryDistribution, DistributionProfile $distributionProfile, &$dc)
 {
     // prepare ids list of all the assets
     $assetIds = explode(',', implode(',', array($entryDistribution->getThumbAssetIds(), $entryDistribution->getFlavorAssetIds())));
     $assets = assetPeer::retrieveByIds($assetIds);
     $assetObjects = array();
     foreach ($assets as $asset) {
         /* @var $asset asset */
         $assetObjects[$asset->getId()] = array('asset' => $asset, 'downloadUrl' => null);
     }
     // lists all files from all assets
     $c = new Criteria();
     $c->add(FileSyncPeer::OBJECT_TYPE, FileSyncObjectType::ASSET);
     $c->add(FileSyncPeer::OBJECT_SUB_TYPE, asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
     $c->add(FileSyncPeer::OBJECT_ID, $assetIds, Criteria::IN);
     $c->add(FileSyncPeer::PARTNER_ID, $entryDistribution->getPartnerId());
     $c->add(FileSyncPeer::STATUS, FileSync::FILE_SYNC_STATUS_READY);
     $fileSyncs = FileSyncPeer::doSelect($c);
     $dcs = array();
     foreach ($fileSyncs as $fileSync) {
         /* @var $fileSync FileSync */
         $assetId = $fileSync->getObjectId();
         if (!isset($assetObjects[$assetId])) {
             // the object is not in the list of assets
             continue;
         }
         $asset = $assetObjects[$assetId]['asset'];
         /* @var $asset asset */
         if ($asset->getVersion() != $fileSync->getVersion()) {
             // the file sync is not of the current asset version
             continue;
         }
         $fileSync = kFileSyncUtils::resolve($fileSync);
         // use the best URL as the source for download in case it will be needed
         if ($fileSync->getFileType() == FileSync::FILE_SYNC_FILE_TYPE_URL) {
             if (!is_null($assetObjects[$assetId]['downloadUrl']) && $fileSync->getDc() != $distributionProfile->getRecommendedStorageProfileForDownload()) {
                 continue;
             }
             $downloadUrl = $fileSync->getExternalUrl($entryDistribution->getEntryId());
             if (!$downloadUrl) {
                 continue;
             }
             $assetObjects[$assetId]['downloadUrl'] = $downloadUrl;
             continue;
         }
         // populates the list of files in each dc
         $fileSyncDc = $fileSync->getDc();
         if (!isset($dcs[$fileSyncDc])) {
             $dcs[$fileSyncDc] = array();
         }
         $dcs[$fileSyncDc][$assetId] = $fileSync->getId();
     }
     if (isset($dcs[$dc]) && count($dcs[$dc]) == count($assets)) {
         KalturaLog::debug("All files exist in the preferred dc [{$dc}]");
         return true;
     }
     // check if all files exist on any of the remote dcs
     $otherDcs = kDataCenterMgr::getAllDcs(true);
     foreach ($otherDcs as $remoteDc) {
         $remoteDcId = $remoteDc['id'];
         if (!isset($dcs[$remoteDcId]) && count($dcs[$remoteDcId]) != count($assets)) {
             continue;
         }
         $dc = $remoteDcId;
         KalturaLog::debug("All files exist in none-preferred dc [{$dc}]");
         return true;
     }
     if ($entryDistribution->getStatus() == EntryDistributionStatus::IMPORT_SUBMITTING || $entryDistribution->getStatus() == EntryDistributionStatus::IMPORT_UPDATING) {
         KalturaLog::debug("Entry distribution already importing");
         return false;
     }
     // create all needed import jobs
     $destinationDc = $distributionProfile->getRecommendedDcForDownload();
     $dcExistingFiles = $dcs[$destinationDc];
     foreach ($assetObjects as $assetId => $assetObject) {
         if (is_null($assetObject['downloadUrl'])) {
             KalturaLog::debug("Download URL not found for asset [{$assetId}]");
             continue;
         }
         $asset = $assetObject['asset'];
         /* @var $asset asset */
         if (isset($dcExistingFiles[$assetId])) {
             continue;
         }
         $jobData = new kImportJobData();
         $jobData->setCacheOnly(true);
         self::addImportJob($destinationDc, $assetObject['downloadUrl'], $asset);
     }
     return false;
 }
開發者ID:EfncoPlugins,項目名稱:Media-Management-based-on-Kaltura,代碼行數:96,代碼來源:kContentDistributionManager.php

示例10: deleteOldFileSyncVersions

 private function deleteOldFileSyncVersions(FileSync $newFileSync)
 {
     KalturaLog::debug('Deleting old file_sync versions for [' . $newFileSync->getId() . ']');
     if (kConf::hasParam('num_of_old_file_sync_versions_to_keep')) {
         $keepCount = kConf::get('num_of_old_file_sync_versions_to_keep');
         if (!is_numeric($newFileSync->getVersion())) {
             return;
         }
         $intVersion = intval($newFileSync->getVersion());
         $c = new Criteria();
         $c->add(FileSyncPeer::OBJECT_ID, $newFileSync->getObjectId());
         $c->add(FileSyncPeer::OBJECT_TYPE, $newFileSync->getObjectType());
         $c->add(FileSyncPeer::OBJECT_SUB_TYPE, $newFileSync->getObjectSubType());
         $c->add(FileSyncPeer::STATUS, array(FileSync::FILE_SYNC_STATUS_PURGED, FileSync::FILE_SYNC_STATUS_DELETED), Criteria::NOT_IN);
         $c->setLimit(40);
         //we limit the number of files to delete in one run so there will be no out of memory issues
         $fileSyncs = FileSyncPeer::doSelect($c);
         foreach ($fileSyncs as $fileSync) {
             if (is_numeric($fileSync->getVersion())) {
                 $currentIntVersion = intval($fileSync->getVersion());
                 if ($intVersion - $keepCount > $currentIntVersion) {
                     $key = kFileSyncUtils::getKeyForFileSync($fileSync);
                     self::deleteSyncFileForKey($key);
                 }
             }
         }
     }
 }
開發者ID:DBezemer,項目名稱:server,代碼行數:28,代碼來源:kFileSyncUtils.class.php

示例11: getRemotePaths

 protected function getRemotePaths($entryId, $entryType = null)
 {
     $dbEntry = entryPeer::retrieveByPK($entryId);
     if (!$dbEntry || $entryType !== null && $dbEntry->getType() != $entryType) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
     }
     if ($dbEntry->getStatus() != entryStatus::READY) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_NOT_READY, $entryId);
     }
     $c = new Criteria();
     $c->add(FileSyncPeer::OBJECT_TYPE, FileSyncObjectType::ENTRY);
     $c->add(FileSyncPeer::OBJECT_SUB_TYPE, entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
     $c->add(FileSyncPeer::OBJECT_ID, $entryId);
     $c->add(FileSyncPeer::VERSION, $dbEntry->getVersion());
     $c->add(FileSyncPeer::PARTNER_ID, $dbEntry->getPartnerId());
     $c->add(FileSyncPeer::STATUS, FileSync::FILE_SYNC_STATUS_READY);
     $c->add(FileSyncPeer::FILE_TYPE, FileSync::FILE_SYNC_FILE_TYPE_URL);
     $fileSyncs = FileSyncPeer::doSelect($c);
     $listResponse = new KalturaRemotePathListResponse();
     $listResponse->objects = KalturaRemotePathArray::fromDbArray($fileSyncs, $this->getResponseProfile());
     $listResponse->totalCount = count($listResponse->objects);
     return $listResponse;
 }
開發者ID:DBezemer,項目名稱:server,代碼行數:23,代碼來源:KalturaEntryService.php

示例12: while

$lastFileSyncId = null;
$loopLimit = 500;
while ($moreFileSyncs) {
    // ----------------------------
    //  get next remote file syncs
    // ----------------------------
    $exportedFileSyncsCriteria = new Criteria();
    $exportedFileSyncsCriteria->setLimit($loopLimit);
    $exportedFileSyncsCriteria->addAscendingOrderByColumn(FileSyncPeer::ID);
    $exportedFileSyncsCriteria->addAnd(FileSyncPeer::DC, $storageProfileId, Criteria::EQUAL);
    $exportedFileSyncsCriteria->addAnd(FileSyncPeer::STATUS, FileSync::FILE_SYNC_STATUS_READY, Criteria::EQUAL);
    $exportedFileSyncsCriteria->addAnd(FileSyncPeer::PARTNER_ID, $partnerId, Criteria::EQUAL);
    if ($lastFileSyncId) {
        $exportedFileSyncsCriteria->addAnd(FileSyncPeer::ID, $lastFileSyncId, Criteria::GREATER_THAN);
    }
    $exportedFileSyncs = FileSyncPeer::doSelect($exportedFileSyncsCriteria, myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL3));
    // -----------------------------------------------
    //  delete the local dcs copies of each file sync
    // -----------------------------------------------
    foreach ($exportedFileSyncs as $exportedFileSync) {
        $lastFileSyncId = $exportedFileSync->getId();
        $syncKey = kFileSyncUtils::getKeyForFileSync($exportedFileSync);
        echo 'Deleting file sync key - ' . serialize($syncKey) . PHP_EOL;
        kFileSyncUtils::deleteSyncFileForKey($syncKey, false, true);
        // 3rd param = true -> only delete from local dcs
    }
    // --------------------------
    //  check if loop should end
    // --------------------------
    if (count($exportedFileSyncs) < $loopLimit) {
        $moreFileSyncs = false;
開發者ID:DBezemer,項目名稱:server,代碼行數:31,代碼來源:deleteExportedStorageFromLocal.php

示例13: while

$criteriaTemplate->setLimit($countLimitEachLoop);
$criteria = clone $criteriaTemplate;
if ($lastId) {
    $criteria->add(FileSyncPeer::ID, $lastId, Criteria::GREATER_THAN);
}
$fileSyncs = FileSyncPeer::doSelect($criteria, $con);
while (count($fileSyncs)) {
    foreach ($fileSyncs as $fileSync) {
        /* @var $fileSync FileSync */
        $lastId = $fileSync->getId();
        $linksCriteria = new Criteria();
        $linksCriteria->add(FileSyncPeer::DC, $fileSync->getDc());
        $linksCriteria->add(FileSyncPeer::FILE_TYPE, array(FileSync::FILE_SYNC_FILE_TYPE_FILE, FileSync::FILE_SYNC_FILE_TYPE_LINK), Criteria::IN);
        $linksCriteria->add(FileSyncPeer::LINKED_ID, $fileSync->getId());
        $linksCriteria->add(FileSyncPeer::STATUS, $fileSync->getStatus(), Criteria::NOT_IN);
        $links = FileSyncPeer::doSelect($linksCriteria, $con);
        KalturaStatement::setDryRun($dryRun);
        // change the status to current source file sync status
        foreach ($links as $link) {
            $link = cast($link, 'MigrationFileSync');
            /* @var $link FileSync */
            $link->setStatus($fileSync->getStatus());
            $link->save();
        }
        KalturaStatement::setDryRun(false);
    }
    $criteria = clone $criteriaTemplate;
    $criteria->add(FileSyncPeer::ID, $lastId, Criteria::GREATER_THAN);
    $fileSyncs = FileSyncPeer::doSelect($criteria, $con);
    usleep(100);
}
開發者ID:EfncoPlugins,項目名稱:Media-Management-based-on-Kaltura,代碼行數:31,代碼來源:1.fixFileSyncLinksStatus.php

示例14: initFlavorAssetArray

 protected function initFlavorAssetArray()
 {
     if (!$this->shouldInitFlavorAssetsArray()) {
         return;
     }
     $oneOnly = false;
     if ($this->deliveryAttributes->getFormat() == PlaybackProtocol::HTTP || $this->deliveryAttributes->getFormat() == "url" || $this->deliveryAttributes->getFormat() == "rtsp") {
         $oneOnly = true;
     }
     // get initial flavor list by input
     $flavorAssets = array();
     if ($this->flavorIds) {
         $flavorAssets = assetPeer::retrieveReadyByEntryId($this->entryId, $this->flavorIds);
         $flavorAssets = $this->removeNotAllowedFlavors($flavorAssets);
         $flavorAssets = $this->removeMaxBitrateFlavors($flavorAssets);
     }
     if (!$flavorAssets || !count($flavorAssets)) {
         $flavorAssets = assetPeer::retrieveReadyFlavorsByEntryId($this->entryId);
         $flavorAssets = $this->deliveryAttributes->filterFlavorsByTags($flavorAssets);
         $flavorAssets = $this->removeNotAllowedFlavors($flavorAssets);
         $flavorAssets = $this->removeMaxBitrateFlavors($flavorAssets);
     }
     if ($this->deliveryAttributes->getFormat() == PlaybackProtocol::SILVER_LIGHT) {
         $this->initSilverLightManifest($flavorAssets);
         return;
     }
     if ($this->deliveryAttributes->getFormat() == PlaybackProtocol::HDS || $this->deliveryAttributes->getFormat() == PlaybackProtocol::APPLE_HTTP) {
         // try to look for a smil manifest, if it was found, we will use it for hds and hls
         if ($this->initSmilManifest($flavorAssets)) {
             return;
         }
     }
     // get flavors availability
     $servePriority = $this->entry->getPartner()->getStorageServePriority();
     $localFlavors = array();
     $remoteFlavorsByDc = array();
     $remoteFileSyncs = array();
     foreach ($flavorAssets as $flavorAsset) {
         $flavorId = $flavorAsset->getId();
         $key = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
         $c = new Criteria();
         $c = FileSyncPeer::getCriteriaForFileSyncKey($key);
         $c->addAnd(FileSyncPeer::STATUS, FileSync::FILE_SYNC_STATUS_READY);
         switch ($servePriority) {
             case StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_ONLY:
                 $c->addAnd(FileSyncPeer::FILE_TYPE, FileSync::FILE_SYNC_FILE_TYPE_URL, Criteria::NOT_EQUAL);
                 break;
             case StorageProfile::STORAGE_SERVE_PRIORITY_EXTERNAL_ONLY:
                 $c->add(FileSyncPeer::FILE_TYPE, FileSync::FILE_SYNC_FILE_TYPE_URL);
                 break;
         }
         if ($this->deliveryAttributes->getStorageId()) {
             $c->addAnd(FileSyncPeer::DC, $this->deliveryAttributes->getStorageId());
         }
         $fileSyncs = FileSyncPeer::doSelect($c);
         foreach ($fileSyncs as $fileSync) {
             if ($fileSync->getFileType() == FileSync::FILE_SYNC_FILE_TYPE_URL) {
                 $dc = $fileSync->getDc();
                 $remoteFlavorsByDc[$dc][$flavorId] = $flavorAsset;
                 $remoteFileSyncs[$dc][$flavorId] = $fileSync;
             } else {
                 $localFlavors[$flavorId] = $flavorAsset;
             }
         }
     }
     // filter out any invalid / disabled storage profiles
     if ($remoteFileSyncs) {
         $storageProfileIds = array_keys($remoteFileSyncs);
         $storageProfiles = StorageProfilePeer::retrieveExternalByPartnerId($this->entry->getPartnerId(), $storageProfileIds);
         $activeStorageProfileIds = array();
         foreach ($storageProfiles as $storageProfile) {
             $activeStorageProfileIds[] = $storageProfile->getId();
         }
         foreach ($storageProfileIds as $storageProfileId) {
             if (in_array($storageProfileId, $activeStorageProfileIds)) {
                 continue;
             }
             unset($remoteFlavorsByDc[$storageProfileId]);
             unset($remoteFileSyncs[$storageProfileId]);
         }
     }
     // choose the storage profile with the highest number of flavors
     $maxDc = null;
     $maxDcFlavorCount = 0;
     $remoteFlavors = array();
     foreach ($remoteFlavorsByDc as $dc => $curDcFlavors) {
         $curDcFlavorCount = count($curDcFlavors);
         if ($curDcFlavorCount <= $maxDcFlavorCount) {
             continue;
         }
         $maxDc = $dc;
         $maxDcFlavorCount = $curDcFlavorCount;
         $remoteFlavors = $curDcFlavors;
     }
     // choose the flavor set according to the serve priority
     if ($this->shouldUseLocalFlavors($localFlavors, $remoteFlavors)) {
         $this->deliveryAttributes->setStorageId(null);
         $this->deliveryAttributes->setFlavorAssets($localFlavors);
     } else {
         if ($maxDc) {
//.........這裏部分代碼省略.........
開發者ID:AdiTal,項目名稱:server,代碼行數:101,代碼來源:playManifestAction.class.php

示例15: convertLinksToFiles

 /**
  * gets a source file of current DC, will make sure all links points to that source
  * are converted to files on all DCs
  *
  * @param FileSyncKey $key
  * @return void
  */
 public static function convertLinksToFiles(FileSyncKey $key)
 {
     // fetch sources from all DCs
     $c = new Criteria();
     $c = FileSyncPeer::getCriteriaForFileSyncKey($key);
     $fileSyncList = FileSyncPeer::doSelect($c);
     foreach ($fileSyncList as $fileSync) {
         // for each source, find its links and fix them
         $c = new Criteria();
         $c->add(FileSyncPeer::LINKED_ID, $fileSync->getId());
         $c->addAnd(FileSyncPeer::FILE_TYPE, FileSync::FILE_SYNC_FILE_TYPE_LINK);
         $c->addAnd(FileSyncPeer::DC, $fileSync->getDc());
         $c->addAnd(FileSyncPeer::STATUS, FileSync::FILE_SYNC_STATUS_READY);
         $links = FileSyncPeer::doSelect($c);
         foreach ($links as $link) {
             $link->setStatus($fileSync->getStatus());
             $link->setFileRoot($fileSync->getFileRoot());
             $link->setFilePath($fileSync->getFilePath());
             $link->setFileType(FileSync::FILE_SYNC_FILE_TYPE_FILE);
             $link->save();
         }
     }
 }
開發者ID:richhl,項目名稱:kalturaCE,代碼行數:30,代碼來源:kFileSyncUtils.class.php


注:本文中的FileSyncPeer::doSelect方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。