本文整理汇总了PHP中KalturaLog类的典型用法代码示例。如果您正苦于以下问题:PHP KalturaLog类的具体用法?PHP KalturaLog怎么用?PHP KalturaLog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KalturaLog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: myServiceConfig
public function myServiceConfig($file_name, $service_name = null, $useDefualt = true)
{
$path = $this->getPath();
KalturaLog::debug("Path [{$path}] File [{$file_name}] Service [{$service_name}]");
$config_table_list = array();
if ($file_name == $this->getDefaultName()) {
} else {
if ($file_name) {
$config_table_list[] = $path . $file_name;
}
}
if (self::$secondary_config_tables) {
// add the secondary before the end
$config_table_list = array_merge($config_table_list, self::$secondary_config_tables);
}
// always append the defualt to the end
if ($useDefualt) {
$config_table_list[] = $path . $this->getDefaultName();
}
// don't use the common path feature - add it to each config file separatly
$this->config_chain = new kConfigTableChain($config_table_list, null);
$tables = $this->config_chain->getTables();
self::$default_config_table = end($tables);
$this->all_config_tables = $tables;
if ($service_name) {
$this->setServiceName($service_name);
}
}
示例2: 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;
}
示例3: validateForSubmission
public function validateForSubmission(EntryDistribution $entryDistribution, $action)
{
$validationErrors = parent::validateForSubmission($entryDistribution, $action);
//validation of flavor format
$flavorAsset = null;
$flavorAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getFlavorAssetIds()));
// if we have specific flavor assets for this distribution, grab the first one
if (count($flavorAssets)) {
$flavorAsset = reset($flavorAssets);
$fileExt = $flavorAsset->getFileExt();
$allowedExts = explode(',', self::FLAVOR_VALID_FORMATS);
if (!in_array($fileExt, $allowedExts)) {
KalturaLog::debug('flavor asset id [' . $flavorAsset->getId() . '] does not have a valid extension [' . $fileExt . ']');
$errorMsg = 'Flavor format must be one of [' . self::FLAVOR_VALID_FORMATS . ']';
$validationError = $this->createValidationError($action, DistributionErrorType::INVALID_DATA);
$validationError->setValidationErrorType(DistributionValidationErrorType::CUSTOM_ERROR);
$validationError->setValidationErrorParam($errorMsg);
$validationError->setDescription($errorMsg);
$validationErrors[] = $validationError;
}
}
$inListOrNullFields = array(IdeticDistributionField::GENRE => explode(',', self::GENRE_VALID_VALUES));
$allFieldValues = $this->getAllFieldValues($entryDistribution);
if (!$allFieldValues || !is_array($allFieldValues)) {
KalturaLog::err('Error getting field values from entry distribution id [' . $entryDistribution->getId() . '] profile id [' . $this->getId() . ']');
return $validationErrors;
}
$validationErrors = array_merge($validationErrors, $this->validateInListOrNull($inListOrNullFields, $allFieldValues, $action));
//validating Slot is a whole number
$validationErrors = array_merge($validationErrors, $this->validateIsWholeNumber(IdeticDistributionField::SLOT, $allFieldValues, $action));
return $validationErrors;
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:32,代码来源:IdeticDistributionProfile.php
示例4: run
public function run($jobs = null)
{
if (KBatchBase::$taskConfig->isInitOnly()) {
return $this->init();
}
if (is_null($jobs)) {
$jobs = KBatchBase::$kClient->batch->getExclusiveAlmostDone($this->getExclusiveLockKey(), KBatchBase::$taskConfig->maximumExecutionTime, $this->getMaxJobsEachRun(), $this->getFilter(), static::getType());
}
KalturaLog::info(count($jobs) . " jobs to close");
if (!count($jobs) > 0) {
KalturaLog::info("Queue size: 0 sent to scheduler");
$this->saveSchedulerQueue(static::getType());
return null;
}
foreach ($jobs as &$job) {
try {
self::setCurrentJob($job);
$job = $this->exec($job);
} catch (KalturaException $kex) {
KBatchBase::unimpersonate();
$job = $this->closeJob($job, KalturaBatchJobErrorTypes::KALTURA_API, $kex->getCode(), "Error: " . $kex->getMessage(), KalturaBatchJobStatus::FAILED);
} catch (KalturaClientException $kcex) {
KBatchBase::unimpersonate();
$job = $this->closeJob($job, KalturaBatchJobErrorTypes::KALTURA_CLIENT, $kcex->getCode(), "Error: " . $kcex->getMessage(), KalturaBatchJobStatus::RETRY);
} catch (Exception $ex) {
KBatchBase::unimpersonate();
$job = $this->closeJob($job, KalturaBatchJobErrorTypes::RUNTIME, $ex->getCode(), "Error: " . $ex->getMessage(), KalturaBatchJobStatus::FAILED);
}
self::unsetCurrentJob();
}
return $jobs;
}
示例5: writeFilterForType
private function writeFilterForType(KalturaTypeReflector $type)
{
$map = KAutoloader::getClassMap();
if (!isset($map[$type->getType()])) {
return;
}
$filterClassName = $type->getType() . "Filter";
$filterBaseClassName = $type->getType() . "BaseFilter";
$filterPath = dirname($map[$type->getType()]) . "/filters/{$filterClassName}.php";
if (file_exists($filterPath)) {
KalturaLog::notice("Filter already exists [{$filterPath}]");
return;
}
$this->_txt = "";
$parentType = $type;
while (1) {
$parentType = $parentType->getParentTypeReflector();
if ($parentType === null || $parentType->isFilterable()) {
break;
}
}
$partnetClassName = $parentType ? $parentType->getType() . "Filter" : "KalturaFilter";
$subpackage = ($type->getPackage() == 'api' ? '' : 'api.') . 'filters';
$this->appendLine("<?php");
$this->appendLine("/**");
$this->appendLine(" * @package " . $type->getPackage());
$this->appendLine(" * @subpackage {$subpackage}");
$this->appendLine(" */");
$this->appendLine("class {$filterClassName} extends {$filterBaseClassName}");
$this->appendLine("{");
$this->appendLine("}");
$this->writeToFile($filterPath, $this->_txt);
}
示例6: doConnect
protected function doConnect($http_server, &$http_port)
{
// try connecting to server
if (!$http_port || $http_port == 0) {
$http_port = 80;
}
$http_server .= $http_server . ':' . $http_port;
try {
$url_parts = parse_url($http_server);
if (isset($url_parts["scheme"])) {
if ($url_parts["scheme"] != "http" && $url_parts["scheme"] != "https") {
KalturaLog::err("URL [{$http_server}] is not http");
return false;
}
} else {
$http_server = 'http://' . $http_server;
}
} catch (Exception $exception) {
$http_server = 'http://' . $http_server;
}
$this->server = $http_server;
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_USERAGENT, $this->userAgent);
curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($this->ch, CURLOPT_NOSIGNAL, true);
curl_setopt($this->ch, CURLOPT_FORBID_REUSE, true);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($this->ch, CURLOPT_HEADER, false);
curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, false);
return $this->ch;
}
示例7: getIdByStrId
public static function getIdByStrId($strId)
{
// try to get strId to id mapping form cache
$cacheKey = 'UserRolePeer_role_str_id_' . $strId;
if (kConf::get('enable_cache') && function_exists('apc_fetch') && function_exists('apc_store')) {
$id = apc_fetch($cacheKey);
// try to fetch from cache
if ($id) {
KalturaLog::debug("UserRole str_id [{$strId}] mapped to id [{$id}] - fetched from cache");
return $id;
}
}
// not found in cache - get from database
$c = new Criteria();
$c->addSelectColumn(UserRolePeer::ID);
$c->addAnd(UserRolePeer::STR_ID, $strId, Criteria::EQUAL);
$c->setLimit(1);
$stmt = UserRolePeer::doSelectStmt($c);
$id = $stmt->fetch(PDO::FETCH_COLUMN);
if ($id) {
// store the found id in cache for later use
if (kConf::get('enable_cache') && function_exists('apc_fetch') && function_exists('apc_store')) {
$success = apc_store($cacheKey, $id, kConf::get('apc_cache_ttl'));
if ($success) {
KalturaLog::debug("UserRole str_id [{$strId}] mapped to id [{$id}] - stored in cache");
}
}
}
if (!$id) {
KalturaLog::log("UserRole with str_id [{$strId}] not found in DB!");
}
return $id;
}
示例8: parseCreatedFiles
protected function parseCreatedFiles()
{
$xmlPath = $this->outDir . DIRECTORY_SEPARATOR . $this->destFileName . '.ism';
KalturaLog::info("Parse created files from ism[{$xmlPath}]");
// in case of wma
if (!file_exists($xmlPath)) {
KalturaLog::info("ism file[{$xmlPath}] doesn't exist");
$wmaPath = $this->outDir . DIRECTORY_SEPARATOR . $this->destFileName . '.wma';
if (file_exists($wmaPath)) {
KalturaLog::info("wma file[{$wmaPath}] found");
$this->outFilesPath[0] = $wmaPath;
}
return;
}
$xml = file_get_contents($xmlPath);
$xml = mb_convert_encoding($xml, 'ASCII', 'UTF-16');
KalturaLog::debug("ism content:\n{$xml}");
$arr = null;
if (preg_match('/(<smil[\\s\\w\\W]+<\\/smil>)/', $xml, $arr)) {
$xml = $arr[1];
}
file_put_contents($xmlPath, $xml);
//echo $xml;
$doc = new DOMDocument();
$doc->loadXML($xml);
$videoEntities = $doc->getElementsByTagName('video');
foreach ($videoEntities as $videoEntity) {
$src = $this->outDir . DIRECTORY_SEPARATOR . $videoEntity->getAttribute("src");
$bitrate = $videoEntity->getAttribute("systemBitrate") / 1000;
KalturaLog::info("Media found in ism bitrate[{$bitrate}] source[{$src}]");
$this->outFilesPath[$bitrate] = $src;
}
}
示例9: checkIsLive
public function checkIsLive($url)
{
KalturaLog::info('url to check:' . $url);
$parts = parse_url($url);
parse_str($parts['query'], $query);
$token = $query[$this->getParamName()];
$data = $this->urlExists($url, array($this->getHdsManifestContentType()));
if (!$data) {
KalturaLog::Info("URL [{$url}] returned no valid data. Exiting.");
return false;
}
KalturaLog::info('Velocix HDS manifest data:' . $data);
$dom = new KDOMDocument();
$dom->loadXML($data);
$element = $dom->getElementsByTagName('baseURL')->item(0);
if (!$element) {
KalturaLog::Info("No base url was given");
return false;
}
$baseUrl = $element->nodeValue;
foreach ($dom->getElementsByTagName('media') as $media) {
$href = $media->getAttribute('href');
$streamUrl = $baseUrl . $href;
$streamUrl .= $token ? '?' . $this->getParamName() . "={$token}" : '';
if ($this->urlExists($streamUrl, array(), '0-0') !== false) {
KalturaLog::info('is live:' . $streamUrl);
return true;
}
}
return false;
}
示例10: doFromObject
public function doFromObject($dbObject, KalturaDetachedResponseProfile $responseProfile = null)
{
/* @var $dbObject kHttpNotificationDataText */
parent::doFromObject($dbObject, $responseProfile);
if ($this->shouldGet('content', $responseProfile)) {
$contentType = get_class($dbObject->getContent());
KalturaLog::debug("Loading KalturaStringValue from type [{$contentType}]");
switch ($contentType) {
case 'kStringValue':
$this->content = new KalturaStringValue();
break;
case 'kEvalStringField':
$this->content = new KalturaEvalStringField();
break;
default:
$this->content = KalturaPluginManager::loadObject('KalturaStringValue', $contentType);
break;
}
if ($this->content) {
$this->content->fromObject($dbObject->getContent());
}
}
if ($this->shouldGet('data', $responseProfile)) {
$this->data = $dbObject->getData();
}
}
示例11: addAction
/**
* Allows you to add an cue point object associated with an entry
*
* @action add
* @param KalturaCuePoint $cuePoint
* @return KalturaCuePoint
*/
function addAction(KalturaCuePoint $cuePoint)
{
$dbCuePoint = $cuePoint->toInsertableObject();
if ($cuePoint->systemName) {
$existingCuePoint = CuePointPeer::retrieveBySystemName($cuePoint->entryId, $cuePoint->systemName);
if ($existingCuePoint) {
throw new KalturaAPIException(KalturaCuePointErrors::CUE_POINT_SYSTEM_NAME_EXISTS, $cuePoint->systemName, $existingCuePoint->getId());
}
}
/* @var $dbCuePoint CuePoint */
$dbCuePoint->setPartnerId($this->getPartnerId());
$dbCuePoint->setPuserId(is_null($cuePoint->userId) ? $this->getKuser()->getPuserId() : $cuePoint->userId);
$dbCuePoint->setStatus(CuePointStatus::READY);
if ($this->getCuePointType()) {
$dbCuePoint->setType($this->getCuePointType());
}
$created = $dbCuePoint->save();
if (!$created) {
KalturaLog::err("Cue point not created");
return null;
}
$cuePoint = KalturaCuePoint::getInstance($dbCuePoint->getType());
if (!$cuePoint) {
KalturaLog::err("API Cue point not instantiated");
return null;
}
$cuePoint->fromObject($dbCuePoint, $this->getResponseProfile());
return $cuePoint;
}
示例12: applyFilterFields
protected function applyFilterFields(baseObjectFilter $filter)
{
/* @var $filter cuePointFilter */
// Reduce the cache expiry when fetching live stream cuepoints
$entryId = $filter->get('_in_entry_id');
if ($entryId && strpos($entryId, ',') === false) {
$entry = entryPeer::retrieveByPK($entryId);
if ($entry && $entry->getType() == entryType::LIVE_STREAM) {
kApiCache::setExpiry(self::LIVE_ENTRY_CUE_POINT_CACHE_EXPIRY_SECONDS);
}
}
if ($filter->get('_free_text')) {
$this->sphinxSkipped = false;
$freeTexts = $filter->get('_free_text');
KalturaLog::debug("Attach free text [{$freeTexts}]");
$this->addFreeTextToMatchClauseByMatchFields($freeTexts, CuePointFilter::FREE_TEXT_FIELDS);
}
$filter->unsetByName('_free_text');
if ($filter->get('_eq_is_public')) {
$this->sphinxSkipped = false;
$isPublic = $filter->get('_eq_is_public');
$this->addCondition('is_public' . " = " . $isPublic);
}
$filter->unsetByName('_eq_is_public');
return parent::applyFilterFields($filter);
}
示例13: getSecureHdUrl
/**
* @return array
*/
protected function getSecureHdUrl()
{
$params = array();
if ($this->getSupportClipping()) {
$seekStart = $this->params->getSeekFromTime();
$seekEnd = $this->params->getClipTo();
if ($seekStart != -1) {
$params['start'] = floor($this->params->getSeekFromTime() / 1000);
$this->params->setSeekFromTime(-1);
} else {
if ($seekEnd) {
$params['start'] = 0;
}
}
if ($seekEnd) {
$params['end'] = ceil($this->params->getClipTo() / 1000);
$this->params->setClipTo(null);
}
}
$flavors = $this->buildHttpFlavorsArray();
$flavors = $this->sortFlavors($flavors);
$flavor = AkamaiDeliveryUtils::getHDN2ManifestUrl($flavors, $this->params->getMediaProtocol(), $this->getUrl(), '/master.m3u8', '/i', $params);
if (!$flavor) {
KalturaLog::info(get_class() . ' failed to find flavor');
return null;
}
return $flavor;
}
示例14: testAdd
/**
* Tests EntryDistributionService->addAction()
* @param KalturaEntryDistribution $entryDistribution
* @return int
* @dataProvider provideData
*/
public function testAdd(KalturaEntryDistribution $entryDistribution)
{
try {
$resultEntryDistribution = $this->client->entryDistribution->add($entryDistribution);
$this->assertType('KalturaEntryDistribution', $resultEntryDistribution);
$this->assertNotNull($resultEntryDistribution->id);
KalturaLog::debug("Returns Entry Distribution ID [{$resultEntryDistribution->id}]");
return $resultEntryDistribution->id;
} catch (KalturaException $e) {
KalturaLog::err("Add EntryDistribution Exception code [" . $e->getCode() . "] message [" . $e->getMessage() . "]");
if ($e->getCode() != 'ENTRY_DISTRIBUTION_ALREADY_EXISTS') {
throw $e;
}
}
$entryDistributionFilter = new KalturaEntryDistributionFilter();
$entryDistributionFilter->entryIdIn = $entryDistribution->entryId;
$entryDistributionFilter->distributionProfileIdEqual = $entryDistribution->distributionProfileId;
$entryDistributionList = $this->client->entryDistribution->listAction($entryDistributionFilter);
$this->assertType('KalturaEntryDistributionListResponse', $entryDistributionList);
$this->assertNotEquals($entryDistributionList->totalCount, 0);
$this->assertEquals($entryDistributionList->totalCount, count($entryDistributionList->objects));
$resultEntryDistribution = reset($entryDistributionList->objects);
$this->assertType('KalturaEntryDistribution', $resultEntryDistribution);
$this->assertNotNull($resultEntryDistribution->id);
KalturaLog::debug("Returns Entry Distribution ID [{$resultEntryDistribution->id}]");
return $resultEntryDistribution->id;
}
示例15: getTotalVodTimeOffset
/**
* Get the total VOD offset for a given time. Total = the sum of all VOD delta times throughout the segments.
* @return int|null The offset that should be subtracted from the given time, or
* null to indicate that this time signature is in the gap between the end
* of a VOD segment and the end of the live segment (marked with x's below).
* <pre>
* Live Start VOD End Live End
* ^ ^ ^
* | |xxxxxxxxxxx|
* +------------------+-----------+
* </pre>
*/
public function getTotalVodTimeOffset($time)
{
$numSegments = count($this->segments);
$totalVodOffset = 0;
// Initially zero because there's no time drift in the first segment.
$i = 0;
$dbgPrevSegment = null;
while ($i < $numSegments) {
$segment = $this->segments[$i];
$liveStart = $segment[self::LIVE_START];
$vodAdjustedEndTime = $this->getVodAdjustedEndTime($segment);
if ($time <= $vodAdjustedEndTime) {
if ($time >= $liveStart) {
return $totalVodOffset;
} else {
KalturaLog::debug("Time [{$time}] <= {$vodAdjustedEndTime} but not >= {$liveStart}. Segment data: {$this->segmentAsString($dbgPrevSegment)}");
return null;
}
} else {
// Add up this segment's offset and move on to the next segment
$totalVodOffset += $segment[self::VOD_TO_LIVE_DELTA_TIME];
$dbgPrevSegment = $segment;
$i++;
}
}
// The time signature is greater than the total VOD duration
KalturaLog::debug("Couldn't get offset for time [{$time}]. Segment data: {$this->segmentAsString($segment)}");
return null;
}