• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP kDataCenterMgr类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中kDataCenterMgr的典型用法代码示例。如果您正苦于以下问题:PHP kDataCenterMgr类的具体用法?PHP kDataCenterMgr怎么用?PHP kDataCenterMgr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了kDataCenterMgr类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: save

 public function save(PropelPDO $con = null)
 {
     KalturaLog::log("BatchJob [{$this->getJobType()}][{$this->getJobSubType()}]: save()");
     $is_new = $this->isNew();
     if ($this->isNew()) {
         $this->setDc(kDataCenterMgr::getCurrentDcId());
         // if the status not set upon creation
         if (is_null($this->status) || !$this->isColumnModified(BatchJobPeer::STATUS)) {
             //echo "sets the status to " . self::BATCHJOB_STATUS_PENDING . "\n";
             $this->setStatus(self::BATCHJOB_STATUS_PENDING);
         }
     }
     $res = parent::save($con);
     if ($is_new && !$this->root_job_id && $this->id) {
         // set the root to point to itself
         $this->setRootJobId($this->id);
         $res = parent::save($con);
     }
     /*		
      * 	remove - no need to use file indicators any more
     		// when new object or status is pending - add the indicator for the batch job to start running
     		if ( $is_new || ( $this->getStatus() == self::BATCHJOB_STATUS_PENDING ) )
     		{
     			self::addIndicator( $this->getId() , $this->getJobType() );
     			KalturaLog::log ( "BatchJob: Added indicator for BatchJob [" . $this->getId() . "] of type [{$this->getJobType() }]" );
     			//debugUtils::st();			
     		}
     		else
     		{
     			KalturaLog::log ( "BatchJob: Didn't add an indicator for BatchJob [" . $this->getId() . "]" );
     		}
     */
     return $res;
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:34,代码来源:BatchJob.php


示例2: toObject

 public function toObject($object_to_fill = null, $props_to_skip = array())
 {
     $this->validateForUsage($object_to_fill, $props_to_skip);
     $dbUploadToken = UploadTokenPeer::retrieveByPK($this->token);
     if (is_null($dbUploadToken)) {
         throw new KalturaAPIException(KalturaErrors::UPLOAD_TOKEN_NOT_FOUND);
     }
     if (!$object_to_fill) {
         $object_to_fill = new kUploadedFileTokenResource();
     }
     $object_to_fill->setToken($this->token);
     if ($dbUploadToken->getStatus() != UploadToken::UPLOAD_TOKEN_FULL_UPLOAD) {
         $object_to_fill->setIsReady(false);
         return $object_to_fill;
     }
     try {
         $entryFullPath = kUploadTokenMgr::getFullPathByUploadTokenId($this->token);
     } catch (kCoreException $ex) {
         if ($ex->getCode() == kUploadTokenException::UPLOAD_TOKEN_INVALID_STATUS) {
         }
         throw new KalturaAPIException(KalturaErrors::UPLOAD_TOKEN_INVALID_STATUS_FOR_ADD_ENTRY);
         throw $ex;
     }
     if (!file_exists($entryFullPath)) {
         $remoteDCHost = kUploadTokenMgr::getRemoteHostForUploadToken($this->token, kDataCenterMgr::getCurrentDcId());
         if ($remoteDCHost) {
             kFileUtils::dumpApiRequest($remoteDCHost);
         } else {
             throw new KalturaAPIException(KalturaErrors::UPLOADED_FILE_NOT_FOUND_BY_TOKEN);
         }
     }
     $object_to_fill->setLocalFilePath($entryFullPath);
     return $object_to_fill;
 }
开发者ID:DBezemer,项目名称:server,代码行数:34,代码来源:KalturaUploadedFileTokenResource.php


示例3: toObject

 public function toObject($object_to_fill = null, $props_to_skip = array())
 {
     if (!$this->isNull('currentDc')) {
         $this->dcEqual = kDataCenterMgr::getCurrentDcId();
     }
     return parent::toObject($object_to_fill, $props_to_skip);
 }
开发者ID:DBezemer,项目名称:server,代码行数:7,代码来源:KalturaDropFolderFilter.php


示例4: preInsert

 public function preInsert(PropelPDO $con = null)
 {
     if ($this->getPartnerId() === Partner::MEDIA_SERVER_PARTNER_ID) {
         $this->setDc(kDataCenterMgr::getCurrentDcId());
     }
     return parent::preInsert($con);
 }
开发者ID:DBezemer,项目名称:server,代码行数:7,代码来源:MediaServerNode.php


示例5: balanceJobsload

 /**
  * Entry point to job balancing.
  * - Move jobs from status '0' to status '11' in case there are too many pending jobs
  * - move jobs back from status '11' to status '0' in case the load is over.
  * 
  */
 public static function balanceJobsload()
 {
     $minPendingJobs = self::getSuspenderMinPendingJobs();
     $maxPendingJobs = self::getSuspenderMaxPendingJobs();
     $dcId = kDataCenterMgr::getCurrentDcId();
     $loadedKeys = array();
     // Suspend Jobs
     $c = self::createJobBalanceQuery($dcId, $minPendingJobs);
     $stmt = BatchJobLockPeer::doSelectStmt($c);
     $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
     foreach ($rows as $row) {
         $partnerId = $row['PARTNER_ID'];
         $jobType = $row['JOB_TYPE'];
         $jobSubType = $row['JOB_SUB_TYPE'];
         $loadedKeys[] = $partnerId . "#" . $jobType . "#" . $jobSubType;
         $jobCount = $row[BatchJobLockPeer::COUNT];
         if ($jobCount > $maxPendingJobs) {
             self::suspendJobs($jobCount - $maxPendingJobs, $dcId, $partnerId, $jobType, $jobSubType);
         }
     }
     // Unsuspend jobs
     $c = self::createReturnBalancedJobsQuery($dcId);
     $stmt = BatchJobLockSuspendPeer::doSelectStmt($c);
     $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
     foreach ($rows as $row) {
         $partnerId = $row['PARTNER_ID'];
         $jobType = $row['JOB_TYPE'];
         $jobSubType = $row['JOB_SUB_TYPE'];
         $key = $partnerId . "#" . $jobType . "#" . $jobSubType;
         if (!in_array($key, $loadedKeys)) {
             self::unsuspendJobs($maxPendingJobs - $minPendingJobs, $dcId, $partnerId, $jobType, $jobSubType);
         }
     }
 }
开发者ID:DBezemer,项目名称:server,代码行数:40,代码来源:kJobsSuspender.php


示例6: validateEntry

 public function validateEntry(entry $dbEntry)
 {
     parent::validateEntry($dbEntry);
     $this->validatePropertyNotNull('resources');
     $dc = null;
     foreach ($this->resources as $resource) {
         $resource->validateEntry($dbEntry);
         if (!$resource instanceof KalturaDataCenterContentResource) {
             continue;
         }
         $theDc = $resource->getDc();
         if (is_null($theDc)) {
             continue;
         }
         if (is_null($dc)) {
             $dc = $theDc;
         } elseif ($dc != $theDc) {
             throw new KalturaAPIException(KalturaErrors::RESOURCES_MULTIPLE_DATA_CENTERS);
         }
     }
     if (!is_null($dc) && $dc != kDataCenterMgr::getCurrentDcId()) {
         $remoteHost = kDataCenterMgr::getRemoteDcExternalUrlByDcId($dc);
         kFileUtils::dumpApiRequest($remoteHost);
     }
 }
开发者ID:DBezemer,项目名称:server,代码行数:25,代码来源:KalturaAssetsParamsResourceContainers.php


示例7: shouldConsumeAddedEvent

 public function shouldConsumeAddedEvent(BaseObject $object)
 {
     if ($object instanceof FileSync && $object->getStatus() == FileSync::FILE_SYNC_STATUS_PENDING && $object->getFileType() == FileSync::FILE_SYNC_FILE_TYPE_FILE && $object->getDc() != kDataCenterMgr::getCurrentDcId() && $this->shouldSyncFileObjectType($object->getObjectType(), $object->getObjectSubType())) {
         return true;
     }
     return false;
 }
开发者ID:AdiTal,项目名称:server,代码行数:7,代码来源:kMultiCentersSynchronizer.php


示例8: createPeriodicSyncPoints

 /**
  * Creates perioding metadata sync-point events on a live stream
  * 
  * @action createPeriodicSyncPoints
  * @actionAlias liveStream.createPeriodicSyncPoints
  * @param string $entryId Kaltura live-stream entry id
  * @param int $interval Events interval in seconds 
  * @param int $duration Duration in seconds
  * 
  * @throws KalturaErrors::ENTRY_ID_NOT_FOUND
  * @throws KalturaErrors::NO_MEDIA_SERVER_FOUND
  * @throws KalturaErrors::MEDIA_SERVER_SERVICE_NOT_FOUND
  */
 function createPeriodicSyncPoints($entryId, $interval, $duration)
 {
     $entryDc = substr($entryId, 0, 1);
     if ($entryDc != kDataCenterMgr::getCurrentDcId()) {
         $remoteDCHost = kDataCenterMgr::getRemoteDcExternalUrlByDcId($entryDc);
         kFileUtils::dumpApiRequest($remoteDCHost, true);
     }
     $dbEntry = entryPeer::retrieveByPK($entryId);
     if (!$dbEntry || $dbEntry->getType() != KalturaEntryType::LIVE_STREAM || !in_array($dbEntry->getSource(), array(KalturaSourceType::LIVE_STREAM, KalturaSourceType::LIVE_STREAM_ONTEXTDATA_CAPTIONS))) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
     }
     /* @var $dbEntry LiveStreamEntry */
     $mediaServers = $dbEntry->getMediaServers();
     if (!count($mediaServers)) {
         throw new KalturaAPIException(KalturaErrors::NO_MEDIA_SERVER_FOUND, $entryId);
     }
     foreach ($mediaServers as $key => $kMediaServer) {
         if ($kMediaServer && $kMediaServer instanceof kLiveMediaServer) {
             $mediaServer = $kMediaServer->getMediaServer();
             $mediaServerCuePointsService = $mediaServer->getWebService(MediaServer::WEB_SERVICE_CUE_POINTS);
             KalturaLog::debug("Sending sync points for DC [" . $mediaServer->getDc() . "] ");
             if ($mediaServerCuePointsService && $mediaServerCuePointsService instanceof KalturaMediaServerCuePointsService) {
                 KalturaLog::debug("Call createTimeCuePoints on DC [" . $mediaServer->getDc() . "] ");
                 $mediaServerCuePointsService->createTimeCuePoints($entryId, $interval, $duration);
             } else {
                 KalturaLog::debug("Media server service not found on DC: [" . $mediaServer->getDc() . "] ");
             }
         }
     }
 }
开发者ID:AdiTal,项目名称:server,代码行数:43,代码来源:LiveCuePointService.php


示例9: retrieveByLocalServer

 /**
  * Retrieve the server object of the current data center
  *
  * @param      string $server server name
  * @param      PropelPDO $con the connection to use
  * @return     SphinxLogServer
  */
 public static function retrieveByLocalServer($server, PropelPDO $con = null)
 {
     $criteria = new Criteria();
     $criteria->add(SphinxLogServerPeer::SERVER, $server);
     $criteria->add(SphinxLogServerPeer::DC, kDataCenterMgr::getCurrentDcId());
     return SphinxLogServerPeer::doSelectOne($criteria, $con);
 }
开发者ID:DBezemer,项目名称:server,代码行数:14,代码来源:SphinxLogServerPeer.php


示例10: getStorageProfile

 protected static function getStorageProfile($storageProfileId = null)
 {
     if (is_null($storageProfileId)) {
         return kDataCenterMgr::getCurrentStorageProfile();
     }
     return StorageProfilePeer::retrieveByPK($storageProfileId);
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:7,代码来源:kPathManager.php


示例11: objectAdded

 /**
  * @param BaseObject $object
  * @return bool true if should continue to the next consumer
  */
 public function objectAdded(BaseObject $object)
 {
     if (!$object instanceof FileSync || $object->getStatus() != FileSync::FILE_SYNC_STATUS_PENDING || $object->getFileType() != FileSync::FILE_SYNC_FILE_TYPE_FILE || $object->getDc() == kDataCenterMgr::getCurrentDcId()) {
         return true;
     }
     $c = new Criteria();
     $c->addAnd(FileSyncPeer::OBJECT_ID, $object->getObjectId());
     $c->addAnd(FileSyncPeer::VERSION, $object->getVersion());
     $c->addAnd(FileSyncPeer::OBJECT_TYPE, $object->getObjectType());
     $c->addAnd(FileSyncPeer::OBJECT_SUB_TYPE, $object->getObjectSubType());
     $c->addAnd(FileSyncPeer::ORIGINAL, '1');
     $original_filesync = FileSyncPeer::doSelectOne($c);
     if (!$original_filesync) {
         KalturaLog::err('Original filesync not found for object_id[' . $object->getObjectId() . '] version[' . $object->getVersion() . '] type[' . $object->getObjectType() . '] subtype[' . $object->getObjectSubType() . ']');
         return true;
     }
     $sourceFileUrl = $original_filesync->getExternalUrl();
     if (!$sourceFileUrl) {
         KalturaLog::err('External URL not found for filesync id [' . $object->getId() . ']');
         return true;
     }
     $job = kMultiCentersManager::addFileSyncImportJob($this->getEntryId($object), $object->getPartnerId(), $object->getId(), $sourceFileUrl);
     $job->setDc($object->getDc());
     $job->save();
     return true;
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:30,代码来源:kMultiCentersSynchronizer.php


示例12: retrieveByFileSyncKey

 /**
  * 
  * @param FileSyncKey $key
  * @return FileSync
  */
 public static function retrieveByFileSyncKey(FileSyncKey $key, $current_dc_only = false)
 {
     $c = self::getCriteriaForFileSyncKey($key);
     if ($current_dc_only) {
         $c->add(self::DC, kDataCenterMgr::getCurrentDcId());
     }
     return self::doSelectOne($c);
 }
开发者ID:DBezemer,项目名称:server,代码行数:13,代码来源:FileSyncPeer.php


示例13: dumpApiRequest

 function dumpApiRequest($entryId, $onlyIfAvailable = true)
 {
     $entryDc = substr($entryId, 0, 1);
     if ($entryDc != kDataCenterMgr::getCurrentDcId()) {
         $remoteDCHost = kDataCenterMgr::getRemoteDcExternalUrlByDcId($entryDc);
         kFileUtils::dumpApiRequest($remoteDCHost, $onlyIfAvailable);
     }
 }
开发者ID:DBezemer,项目名称:server,代码行数:8,代码来源:KalturaLiveEntryService.php


示例14: toObject

 public function toObject($object_to_fill = null, $props_to_skip = array())
 {
     if (!$this->isNull('currentDc')) {
         if ($this->currentDc == KalturaNullableBoolean::TRUE_VALUE) {
             $this->dcEqual = kDataCenterMgr::getCurrentDcId();
         }
     }
     return parent::toObject($object_to_fill, $props_to_skip);
 }
开发者ID:DBezemer,项目名称:server,代码行数:9,代码来源:KalturaFileSyncFilter.php


示例15: getDc

 public function getDc()
 {
     $content = myContentStorage::getFSContentRootPath();
     $entryFullPath = "{$content}/content/webcam/{$this->token}.flv";
     if (file_exists($entryFullPath)) {
         return kDataCenterMgr::getCurrentDcId();
     }
     return 1 - kDataCenterMgr::getCurrentDcId();
     // other dc
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:10,代码来源:KalturaWebcamTokenResource.php


示例16: execute

 /**
  * Serves multiple files for synchronization between datacenters 
  */
 public function execute()
 {
     $fileSyncIds = $this->getRequestParameter("ids");
     $hash = $this->getRequestParameter("hash");
     // validate hash
     $currentDc = kDataCenterMgr::getCurrentDc();
     $currentDcId = $currentDc["id"];
     $expectedHash = md5($currentDc["secret"] . $fileSyncIds);
     if ($hash !== $expectedHash) {
         $error = "Invalid hash - ids [{$fileSyncIds}] got [{$hash}] expected [{$expectedHash}]";
         KalturaLog::err($error);
         KExternalErrors::dieError(KExternalErrors::INVALID_TOKEN);
     }
     // load file syncs
     $fileSyncs = FileSyncPeer::retrieveByPks(explode(',', $fileSyncIds));
     if ($fileSyncs) {
         KalturaMonitorClient::initApiMonitor(false, 'extwidget.serveMultiFile', $fileSyncs[0]->getPartnerId());
     }
     // resolve file syncs
     $filePaths = array();
     foreach ($fileSyncs as $fileSync) {
         if ($fileSync->getDc() != $currentDcId) {
             $error = "FileSync id [" . $fileSync->getId() . "] does not belong to this DC";
             KalturaLog::err($error);
             KExternalErrors::dieError(KExternalErrors::BAD_QUERY);
         }
         // resolve if file_sync is link
         $fileSyncResolved = kFileSyncUtils::resolve($fileSync);
         // check if file sync path leads to a file or a directory
         $resolvedPath = $fileSyncResolved->getFullPath();
         if (is_dir($resolvedPath)) {
             $error = "FileSync id [" . $fileSync->getId() . "] is a directory";
             KalturaLog::err($error);
             KExternalErrors::dieError(KExternalErrors::BAD_QUERY);
         }
         if (!file_exists($resolvedPath)) {
             $error = "Path [{$resolvedPath}] for fileSync id [" . $fileSync->getId() . "] does not exist";
             KalturaLog::err($error);
             continue;
         }
         $filePaths[$fileSync->getId()] = $resolvedPath;
     }
     $boundary = md5(uniqid('', true));
     header('Content-Type: multipart/form-data; boundary=' . $boundary);
     foreach ($filePaths as $id => $filePath) {
         echo "--{$boundary}\n";
         echo "Content-Type: application/octet-stream\n";
         echo "Content-Disposition: form-data; name=\"{$id}\"\n\n";
         readfile($filePath);
         echo "\n";
     }
     echo "--{$boundary}--\n";
     KExternalErrors::dieGracefully();
 }
开发者ID:DBezemer,项目名称:server,代码行数:57,代码来源:serveMultiFileAction.class.php


示例17: validateKs

 public static function validateKs($job)
 {
     $dcParams = kDataCenterMgr::getCurrentDc();
     $token = $dcParams["secret"];
     $createdString = md5($job->getId() . $token);
     $ks = kCurrentContext::$ks_object;
     if ($createdString == $ks->additional_data) {
         return true;
     }
     return false;
 }
开发者ID:DBezemer,项目名称:server,代码行数:11,代码来源:IntegrationService.php


示例18: calculateId

 private static function calculateId()
 {
     $dc = kDataCenterMgr::getCurrentDc();
     for ($i = 0; $i < 10; ++$i) {
         $id = $dc["id"] . '_' . kString::generateStringId();
         $existing_object = entryPeer::retrieveByPk($id);
         if (!$existing_object) {
             return $id;
         }
     }
     die;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:12,代码来源:syndicationFeed.php


示例19: execute

 /**
  * Will forward to the regular swf player according to the widget_id 
  */
 public function execute()
 {
     requestUtils::handleConditionalGet();
     $file_sync_id = $this->getRequestParameter("id");
     $hash = $this->getRequestParameter("hash");
     $file_name = $this->getRequestParameter("fileName");
     if ($file_name) {
         $file_name = base64_decode($file_name);
     }
     kDataCenterMgr::serveFileToRemoteDataCenter($file_sync_id, $hash, $file_name);
     die;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:15,代码来源:servefileAction.class.php


示例20: calculateId

 public function calculateId()
 {
     $dc = kDataCenterMgr::getCurrentDc();
     for ($i = 0; $i < 10; $i++) {
         $id = $dc["id"] . '_' . md5(microtime(true));
         $existingObject = UploadTokenPeer::retrieveByPk($id);
         if (!$existingObject) {
             return $id;
         }
     }
     throw new Exception("Could not calculate unique id for upload token");
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:12,代码来源:UploadToken.php



注:本文中的kDataCenterMgr类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP kEntitlementUtils类代码示例发布时间:2022-05-23
下一篇:
PHP kCurrentContext类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap