本文整理汇总了PHP中StorageProfilePeer类的典型用法代码示例。如果您正苦于以下问题:PHP StorageProfilePeer类的具体用法?PHP StorageProfilePeer怎么用?PHP StorageProfilePeer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了StorageProfilePeer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getStorageProfile
protected static function getStorageProfile($storageProfileId = null)
{
if (is_null($storageProfileId)) {
return kDataCenterMgr::getCurrentStorageProfile();
}
return StorageProfilePeer::retrieveByPK($storageProfileId);
}
示例2: getTokenizer
/**
* @return kUrlTokenizer
*/
public function getTokenizer()
{
$secret = null;
switch ($this->protocol) {
case StorageProfile::PLAY_FORMAT_HTTP:
if (@$this->params['http_auth_salt']) {
$storageProfile = StorageProfilePeer::retrieveByPK($this->storageProfileId);
if ($storageProfile) {
// get parameters
$window = $this->params['http_auth_seconds'];
$secret = $this->params['http_auth_salt'];
$useDummyHost = false;
$httpBaseUrl = rtrim($storageProfile->getDeliveryHttpBaseUrl(), '/');
}
}
break;
case StorageProfile::PLAY_FORMAT_RTMP:
if (@$this->params['rtmp_auth_salt']) {
$window = $this->params['rtmp_auth_seconds'];
$secret = $this->params['rtmp_auth_salt'];
$useDummyHost = true;
$httpBaseUrl = '';
}
break;
}
if ($secret) {
if (is_null($window) || !is_int($window)) {
$window = self::DEFAULT_ACCESS_WINDOW_SECONDS;
}
return new kMirrorImageUrlTokenizer($window, $secret, $useDummyHost, $httpBaseUrl);
}
return null;
}
示例3: retrieveExternalByPartnerId
public static function retrieveExternalByPartnerId($partnerId, $con = null)
{
$criteria = new Criteria(StorageProfilePeer::DATABASE_NAME);
$criteria->add(StorageProfilePeer::PARTNER_ID, $partnerId);
$criteria->add(StorageProfilePeer::STATUS, array(StorageProfile::STORAGE_STATUS_AUTOMATIC, StorageProfile::STORAGE_STATUS_MANUAL), Criteria::IN);
return StorageProfilePeer::doSelect($criteria, $con);
}
示例4: clearMemory
public function clearMemory()
{
accessControlPeer::clearInstancePool();
BatchJobPeer::clearInstancePool();
BulkUploadResultPeer::clearInstancePool();
categoryPeer::clearInstancePool();
EmailIngestionProfilePeer::clearInstancePool();
entryPeer::clearInstancePool();
FileSyncPeer::clearInstancePool();
flavorAssetPeer::clearInstancePool();
flavorParamsConversionProfilePeer::clearInstancePool();
flavorParamsOutputPeer::clearInstancePool();
flavorParamsPeer::clearInstancePool();
kshowPeer::clearInstancePool();
mediaInfoPeer::clearInstancePool();
moderationFlagPeer::clearInstancePool();
moderationPeer::clearInstancePool();
notificationPeer::clearInstancePool();
roughcutEntryPeer::clearInstancePool();
SchedulerConfigPeer::clearInstancePool();
SchedulerPeer::clearInstancePool();
SchedulerStatusPeer::clearInstancePool();
SchedulerWorkerPeer::clearInstancePool();
StorageProfilePeer::clearInstancePool();
syndicationFeedPeer::clearInstancePool();
TrackEntryPeer::clearInstancePool();
uiConfPeer::clearInstancePool();
UploadTokenPeer::clearInstancePool();
// TODO clear default filters
// TODO call all memory cleaner plugins
if (function_exists('gc_collect_cycles')) {
// php 5.3 and above
gc_collect_cycles();
}
}
示例5: getCurrentStorageProfile
/**
* @return StorageProfile
*/
public static function getCurrentStorageProfile()
{
if (self::$currentStorageProfile) {
return self::$currentStorageProfile;
}
self::$currentStorageProfile = StorageProfilePeer::retrieveByPK(self::getCurrentDcId());
return self::$currentStorageProfile;
}
示例6: validateEntry
public function validateEntry(entry $dbEntry)
{
parent::validateEntry($dbEntry);
$this->validatePropertyNotNull('storageProfileId');
$storageProfile = StorageProfilePeer::retrieveByPK($this->storageProfileId);
if (!$storageProfile) {
throw new KalturaAPIException(KalturaErrors::STORAGE_PROFILE_ID_NOT_FOUND, $this->storageProfileId);
}
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:9,代码来源:KalturaRemoteStorageResource.php
示例7: validateForUsage
public function validateForUsage($sourceObject, $propertiesToSkip = array())
{
parent::validateForUsage($sourceObject, $propertiesToSkip);
$this->validatePropertyNotNull('storageProfileId');
$storageProfile = StorageProfilePeer::retrieveByPK($this->storageProfileId);
if (!$storageProfile) {
throw new KalturaAPIException(KalturaErrors::STORAGE_PROFILE_ID_NOT_FOUND, $this->storageProfileId);
}
}
示例8: getUrlManagerByStorageProfile
/**
* @param int $storageProfileId
* @return kUrlManager
*/
public static function getUrlManagerByStorageProfile($storageProfileId)
{
$class = 'kUrlManager';
$storageProfile = StorageProfilePeer::retrieveByPK($storageProfileId);
if ($storageProfile && $storageProfile->getUrlManagerClass() && class_exists($storageProfile->getUrlManagerClass())) {
$class = $storageProfile->getUrlManagerClass();
}
KalturaLog::log("Uses url manager [{$class}]");
return new $class($storageProfileId);
}
示例9: doGetFileSyncUrl
protected function doGetFileSyncUrl(FileSync $fileSync)
{
$storageProfile = StorageProfilePeer::retrieveByPK($this->params->getStorageId());
/* @var $storageProfile KontikiStorageProfile */
$kontikiAPIWrapper = new KontikiAPIWrapper($storageProfile->getStorageUrl());
$playbackResource = $kontikiAPIWrapper->getPlaybackResource(KontikiPlugin::SERVICE_TOKEN_PREFIX . base64_encode($storageProfile->getServiceToken()), $fileSync->getFilePath());
if (!$playbackResource) {
return null;
}
return strval($playbackResource->urn) . ";realmId:" . strval($playbackResource->realmId) . ";realmTicket:" . strval($playbackResource->realmTicket);
}
示例10: getExternalUrl
public function getExternalUrl($entryId, $format = PlaybackProtocol::HTTP)
{
$storage = StorageProfilePeer::retrieveByPK($this->getDc());
if (!$storage || $storage->getProtocol() == StorageProfile::STORAGE_KALTURA_DC) {
return kDataCenterMgr::getInternalRemoteUrl($this);
}
$urlManager = DeliveryProfilePeer::getRemoteDeliveryByStorageId(DeliveryProfileDynamicAttributes::init($this->getDc(), $entryId, PlaybackProtocol::HTTP, infraRequestUtils::getProtocol()));
if (is_null($urlManager) && infraRequestUtils::getProtocol() != 'http') {
$urlManager = DeliveryProfilePeer::getRemoteDeliveryByStorageId(DeliveryProfileDynamicAttributes::init($this->getDc(), $entryId));
}
if (is_null($urlManager)) {
return null;
}
$url = $urlManager->getFileSyncUrl($this);
$baseUrl = $urlManager->getUrl();
$url = ltrim($url, "/");
if (strpos($url, "://") === false) {
$url = rtrim($baseUrl, "/") . "/" . $url;
}
return $url;
}
示例11: doGetFileSyncUrl
protected function doGetFileSyncUrl(FileSync $fileSync)
{
$storage = StorageProfilePeer::retrieveByPK($fileSync->getDc());
if (!$storage) {
return parent::doGetFileSyncUrl($fileSync);
}
$partnerPath = myPartnerUtils::getUrlForPartner($fileSync->getPartnerId(), $fileSync->getPartnerId() * 100);
$objectSubType = $fileSync->getObjectSubType();
if ($fileSync->getObjectType() == FileSyncObjectType::ENTRY && $objectSubType == entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM) {
return $this->doGetServeIsmUrl($fileSync, $partnerPath, $storage);
}
//To Remove - Until the migration process from asset sub type 3 to asset sub type 1 will be completed we need to support both formats
if ($fileSync->getObjectType() == FileSyncObjectType::FLAVOR_ASSET && $objectSubType == flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ISM) {
return $this->doGetServeIsmUrl($fileSync, $partnerPath, $storage);
}
if ($fileSync->getObjectType() == FileSyncObjectType::FLAVOR_ASSET && $objectSubType == flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET) {
$asset = assetPeer::retrieveById($fileSync->getObjectId());
if ($asset->hasTag(assetParams::TAG_ISM_MANIFEST)) {
return $this->doGetServeIsmUrl($fileSync, $partnerPath, $storage);
}
}
return parent::doGetFileSyncUrl($fileSync);
}
示例12: setDeliveryId
/**
* Parameters
* --------------
*/
function setDeliveryId($partnerId, $storageId, $deliveryIds)
{
// don't add to database if one of the parameters is missing or is an empty string
if (!$partnerId && !$storageId || !$deliveryIds) {
die('Missing parameter');
}
if ($partnerId) {
$partner = PartnerPeer::retrieveByPK($partnerId);
if (!$partner) {
die("No such partner with id [{$partnerId}]." . PHP_EOL);
}
$partner->setDeliveryProfileIds($deliveryIds);
$partner->save();
}
if ($storageId) {
$storage = StorageProfilePeer::retrieveByPK($storageId);
if (!$storageId) {
die("No such storage profile with id [{$storageId}]." . PHP_EOL);
}
$storage->setDeliveryProfileIds($deliveryIds);
$storage->save();
}
}
示例13: attachRemoteStorageResource
/**
* @param IRemoteStorageResource $resource
* @param entry $dbEntry
* @param asset $dbAsset
* @return asset
* @throws KalturaErrors::ORIGINAL_FLAVOR_ASSET_NOT_CREATED
* @throws KalturaErrors::STORAGE_PROFILE_ID_NOT_FOUND
*/
protected function attachRemoteStorageResource(IRemoteStorageResource $resource, entry $dbEntry, asset $dbAsset = null)
{
$resources = $resource->getResources();
$fileExt = $resource->getFileExt();
$dbEntry->setSource(KalturaSourceType::URL);
// TODO - move image handling to media service
if ($dbEntry->getMediaType() == KalturaMediaType::IMAGE) {
$syncKey = $dbEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
foreach ($resources as $currentResource) {
$storageProfile = StorageProfilePeer::retrieveByPK($currentResource->getStorageProfileId());
$fileSync = kFileSyncUtils::createReadyExternalSyncFileForKey($syncKey, $currentResource->getUrl(), $storageProfile);
}
$dbEntry->setStatus(entryStatus::READY);
$dbEntry->save();
return null;
}
$dbEntry->save();
$isNewAsset = false;
if (!$dbAsset) {
$isNewAsset = true;
$dbAsset = kFlowHelper::createOriginalFlavorAsset($this->getPartnerId(), $dbEntry->getId());
}
if (!$dbAsset) {
KalturaLog::err("Flavor asset not created for entry [" . $dbEntry->getId() . "]");
if ($dbEntry->getStatus() == entryStatus::NO_CONTENT) {
$dbEntry->setStatus(entryStatus::ERROR_CONVERTING);
$dbEntry->save();
}
throw new KalturaAPIException(KalturaErrors::ORIGINAL_FLAVOR_ASSET_NOT_CREATED);
}
$syncKey = $dbAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
foreach ($resources as $currentResource) {
$storageProfile = StorageProfilePeer::retrieveByPK($currentResource->getStorageProfileId());
$fileSync = kFileSyncUtils::createReadyExternalSyncFileForKey($syncKey, $currentResource->getUrl(), $storageProfile);
}
$dbAsset->setFileExt($fileExt);
if ($dbAsset instanceof flavorAsset && !$dbAsset->getIsOriginal()) {
$dbAsset->setStatus(asset::FLAVOR_ASSET_STATUS_READY);
}
$dbAsset->save();
if ($isNewAsset) {
kEventsManager::raiseEvent(new kObjectAddedEvent($dbAsset));
}
kEventsManager::raiseEvent(new kObjectDataChangedEvent($dbAsset));
if ($dbAsset instanceof flavorAsset && !$dbAsset->getIsOriginal()) {
kBusinessPostConvertDL::handleConvertFinished(null, $dbAsset);
}
return $dbAsset;
}
示例14: doGetFileSyncUrl
/**
* @param FileSync $fileSync
* @return string
*/
protected function doGetFileSyncUrl(FileSync $fileSync)
{
$fileSync = kFileSyncUtils::resolve($fileSync);
$storage = StorageProfilePeer::retrieveByPK($fileSync->getDc());
if (!$storage) {
return parent::doGetFileSyncUrl($fileSync);
}
$serverUrl = $storage->getDeliveryIisBaseUrl();
$partnerPath = myPartnerUtils::getUrlForPartner($fileSync->getPartnerId(), $fileSync->getPartnerId() * 100);
if ($this->protocol == StorageProfile::PLAY_FORMAT_APPLE_HTTP && isset($this->params["hd_ios"])) {
$path = $fileSync->getFilePath();
$urlSuffix = str_replace('\\', '/', $path) . "/index_0_av.m3u8";
$urlPrefix = "http://" . $this->params["hd_ios"] . '/i/';
return $urlPrefix . ltrim($urlSuffix, '/');
}
if ($this->protocol == "hdnetworksmil" && isset($this->params["hd_flash"])) {
$path = $fileSync->getFilePath();
$urlSuffix = str_replace('\\', '/', $path);
$urlPrefix = "http://" . $this->params["hd_flash"];
return $urlPrefix . '/' . ltrim($urlSuffix, '/');
}
if ($fileSync->getObjectSubType() != entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM) {
return parent::doGetFileSyncUrl($fileSync);
}
$serverUrl = myPartnerUtils::getIisHost($fileSync->getPartnerId(), "http");
$path = $partnerPath . '/serveIsm/objectId/' . $fileSync->getObjectId() . '_' . $fileSync->getObjectSubType() . '_' . $fileSync->getVersion() . '.' . pathinfo(kFileSyncUtils::resolve($fileSync)->getFilePath(), PATHINFO_EXTENSION) . '/manifest';
$matches = null;
if (preg_match('/(https?:\\/\\/[^\\/]+)(.*)/', $serverUrl, $matches)) {
$path = $matches[2] . $path;
}
$path = str_replace('//', '/', $path);
return $path;
}
示例15: validateStorageId
public function validateStorageId($partnerId)
{
if (is_null($this->storageId) || $this->storageId instanceof KalturaNullField) {
return;
}
$storage = StorageProfilePeer::retrieveByPK($this->storageId);
if (!$storage) {
throw new KalturaAPIException(KalturaErrors::SYNDICATION_FEED_INVALID_STORAGE_ID);
}
$partner = PartnerPeer::retrieveByPK($partnerId);
// storage doesn't belong to the partner
if ($storage->getPartnerId() != $partner->getId()) {
throw new KalturaAPIException(KalturaErrors::SYNDICATION_FEED_INVALID_STORAGE_ID);
}
// partner configured to use kaltura data centers only
if ($partner->getStorageServePriority() == StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_ONLY) {
throw new KalturaAPIException(KalturaErrors::SYNDICATION_FEED_KALTURA_DC_ONLY);
}
}