本文整理汇总了PHP中KalturaLog::err方法的典型用法代码示例。如果您正苦于以下问题:PHP KalturaLog::err方法的具体用法?PHP KalturaLog::err怎么用?PHP KalturaLog::err使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KalturaLog
的用法示例。
在下文中一共展示了KalturaLog::err方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendAPICall
private function sendAPICall($url, $options = null, $noDecoding = false)
{
KalturaLog::debug("sending API call - {$url}");
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if ($options) {
curl_setopt_array($ch, $options);
}
$result = curl_exec($ch);
if (($errString = curl_error($ch)) !== '' || ($errNum = curl_errno($ch)) !== 0) {
KalturaLog::err('problem with curl - ' . $errString . ' error num - ' . $errNum);
curl_close($ch);
throw new Exception("curl error with url " . $url);
}
if (!$noDecoding) {
$stringResult = $result;
$result = json_decode($result);
if (json_last_error() !== JSON_ERROR_NONE) {
KalturaLog::err("bad response from service provider");
curl_close($ch);
throw new Exception("json decode error with response - " . $stringResult);
}
}
KalturaLog::debug('result is - ' . var_dump($result));
curl_close($ch);
return $result;
}
示例2: execute
public function execute()
{
$ksStr = $this->getP("ks");
if ($ksStr) {
$ksObj = null;
try {
$ksObj = ks::fromSecureString($ksStr);
} catch (Exception $e) {
}
if ($ksObj) {
$partner = PartnerPeer::retrieveByPK($ksObj->partner_id);
if (!$partner) {
KExternalErrors::dieError(KExternalErrors::PARTNER_NOT_FOUND);
}
if (!$partner->validateApiAccessControl()) {
KExternalErrors::dieError(KExternalErrors::SERVICE_ACCESS_CONTROL_RESTRICTED);
}
$ksObj->kill();
}
KalturaLog::info("Killing session with ks - [{$ksStr}], decoded - [" . base64_decode($ksStr) . "]");
} else {
KalturaLog::err('logoutAction called with no KS');
}
setcookie('pid', "", 0, "/");
setcookie('subpid', "", 0, "/");
setcookie('kmcks', "", 0, "/");
return sfView::NONE;
//redirection to kmc/kmc is done from java script
}
示例3: 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;
}
示例4: callService
/**
*
* @param int $offset
* @param int $itemCountPerPage
*/
protected function callService($offset, $itemCountPerPage)
{
$client = Infra_ClientHelper::getClient();
if ($this->impersonatedPartnerId) {
Infra_ClientHelper::impersonate($this->impersonatedPartnerId);
}
$pager = new Kaltura_Client_Type_FilterPager();
$pager->pageIndex = (int) ($offset / $itemCountPerPage) + 1;
$pager->pageSize = $itemCountPerPage;
$action = $this->action;
$params = $this->args;
$params[] = $pager;
try {
$response = call_user_func_array(array($this->service, $action), $params);
} catch (Kaltura_Client_Exception $e) {
KalturaLog::err($e->getMessage());
return array();
}
$this->totalCount = $response->totalCount;
$this->total = $response->total;
if (!$response->objects) {
return array();
}
return $response->objects;
}
示例5: run
public function run($jobs = null)
{
$filter = new KalturaLiveStreamEntryFilter();
$filter->isLive = KalturaNullableBoolean::TRUE_VALUE;
$filter->orderBy = KalturaLiveStreamEntryOrderBy::CREATED_AT_ASC;
$filter->moderationStatusIn = KalturaEntryModerationStatus::PENDING_MODERATION . ',' . KalturaEntryModerationStatus::APPROVED . ',' . KalturaEntryModerationStatus::REJECTED . ',' . KalturaEntryModerationStatus::FLAGGED_FOR_REVIEW . ',' . KalturaEntryModerationStatus::AUTO_APPROVED;
$pager = new KalturaFilterPager();
$pager->pageSize = 500;
$pager->pageIndex = 1;
$entries = self::$kClient->liveStream->listAction($filter, $pager);
while (count($entries->objects)) {
foreach ($entries->objects as $entry) {
try {
/* @var $entry KalturaLiveEntry */
self::impersonate($entry->partnerId);
self::$kClient->liveStream->validateRegisteredMediaServers($entry->id);
self::unimpersonate();
$filter->createdAtGreaterThanOrEqual = $entry->createdAt;
} catch (KalturaException $e) {
self::unimpersonate();
KalturaLog::err("Caught exception with message [" . $e->getMessage() . "]");
}
}
$pager->pageIndex++;
$entries = self::$kClient->liveStream->listAction($filter, $pager);
}
}
示例6: deleteFilesPHP
protected function deleteFilesPHP($searchPath, $minutesOld, $simulateOnly)
{
$secondsOld = $minutesOld * 60;
$files = glob($searchPath);
KalturaLog::info("Found [" . count($files) . "] to scan");
$now = time();
KalturaLog::info("Deleting files that are " . $secondsOld . " seconds old (modified before " . date('c', $now - $secondsOld) . ")");
$deletedCount = 0;
foreach ($files as $file) {
$filemtime = filemtime($file);
if ($filemtime > $now - $secondsOld) {
continue;
}
if ($simulateOnly) {
KalturaLog::info("Simulating: Deleting file [{$file}], it's last modification time was " . date('c', $filemtime));
continue;
}
KalturaLog::info("Deleting file [{$file}], it's last modification time was " . date('c', $filemtime));
$res = @unlink($file);
if (!$res) {
KalturaLog::err("Error: problem while deleting [{$file}]");
continue;
}
$deletedCount++;
}
}
示例7: 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;
}
示例8: copyLiveMetadata
protected function copyLiveMetadata(baseEntry $object, $liveEntryId)
{
$recordedEntryId = $object->getId();
$partnerId = $object->getPartnerId();
$metadataProfiles = MetadataProfilePeer::retrieveAllActiveByPartnerId($partnerId, MetadataObjectType::ENTRY);
foreach ($metadataProfiles as $metadataProfile) {
$originMetadataObj = MetadataPeer::retrieveByObject($metadataProfile->getId(), MetadataObjectType::ENTRY, $liveEntryId);
if ($originMetadataObj) {
$metadataProfileId = $metadataProfile->getId();
$metadataProfileVersion = $metadataProfile->getVersion();
$destMetadataObj = new Metadata();
$destMetadataObj->setPartnerId($partnerId);
$destMetadataObj->setMetadataProfileId($metadataProfileId);
$destMetadataObj->setMetadataProfileVersion($metadataProfileVersion);
$destMetadataObj->setObjectType(MetadataObjectType::ENTRY);
$destMetadataObj->setObjectId($recordedEntryId);
$destMetadataObj->setStatus(KalturaMetadataStatus::VALID);
$originMetadataKey = $originMetadataObj->getSyncKey(Metadata::FILE_SYNC_METADATA_DATA);
$originXml = kFileSyncUtils::file_get_contents($originMetadataKey, true, false);
// validate object exists
$object = kMetadataManager::getObjectFromPeer($destMetadataObj);
if ($object) {
$destMetadataObj->save();
} else {
KalturaLog::err('invalid object type');
continue;
}
$destMetadataKey = $destMetadataObj->getSyncKey(Metadata::FILE_SYNC_METADATA_DATA);
kFileSyncUtils::file_put_contents($destMetadataKey, $originXml);
}
}
}
示例9: applyCondition
/**
* Adds conditions, matches and where clauses to the query
* @param IKalturaIndexQuery $query
*/
public function applyCondition(IKalturaDbQuery $query)
{
switch ($this->getComparison()) {
case KalturaSearchConditionComparison::EQUAL:
$comparison = ' = ';
break;
case KalturaSearchConditionComparison::GREATER_THAN:
$comparison = ' > ';
break;
case KalturaSearchConditionComparison::GREATER_THAN_OR_EQUAL:
$comparison = ' >= ';
break;
case KalturaSearchConditionComparison::LESS_THAN:
$comparison = " < ";
break;
case KalturaSearchConditionComparison::LESS_THAN_OR_EQUAL:
$comparison = " <= ";
break;
case KalturaSearchConditionComparison::NOT_EQUAL:
$comparison = " <> ";
break;
default:
KalturaLog::ERR("Missing comparison type");
return;
}
$field = $this->getField();
$value = $this->getValue();
$fieldValue = $this->getFieldValue($field);
if (is_null($fieldValue)) {
KalturaLog::err('Unknown field [' . $field . ']');
return;
}
$newCondition = $fieldValue . $comparison . KalturaCriteria::escapeString($value);
$query->addCondition($newCondition);
}
示例10: __construct
/**
* @param KSchedularTaskConfig $taskConfig
*/
public function __construct(KSchedularTaskConfig $taskConfig = null)
{
/*
* argv[0] - the script name
* argv[1] - serialized KSchedulerConfig config
*/
global $argv, $g_context;
$this->sessionKey = uniqid('sess');
$this->start = microtime(true);
if (is_null($taskConfig)) {
$this->taskConfig = unserialize(base64_decode($argv[1]));
} else {
$this->taskConfig = $taskConfig;
}
if (!$this->taskConfig) {
die("Task config not supplied");
}
date_default_timezone_set($this->taskConfig->getTimezone());
// clear seperator between executions
KalturaLog::debug('___________________________________________________________________________________');
KalturaLog::info(file_get_contents(dirname(__FILE__) . "/../VERSION.txt"));
if (!$this->taskConfig instanceof KSchedularTaskConfig) {
KalturaLog::err('config is not a KSchedularTaskConfig');
die;
}
KalturaLog::debug("set_time_limit({$this->taskConfig->maximumExecutionTime})");
set_time_limit($this->taskConfig->maximumExecutionTime);
}
示例11: __construct
public function __construct($message, $code = null, $data = null)
{
KalturaLog::err("Code: [{$code}] Message: [{$message}]");
$this->message = $message;
$this->code = $code;
$this->data = $data;
}
示例12: init
protected static function init()
{
if (!kConf::hasParam('monitor_uri')) {
return null;
}
$uri = kConf::get('monitor_uri');
$pathInfo = parse_url($uri);
if (isset($pathInfo['host']) && $pathInfo['port']) {
$host = $pathInfo['host'];
if (isset($pathInfo['scheme'])) {
$host = $pathInfo['scheme'] . "://{$host}";
}
$errno = null;
$errstr = null;
self::$stream = fsockopen($host, $pathInfo['port'], $errno, $errstr, 1);
if (self::$stream) {
return true;
}
if (class_exists('KalturaLog')) {
KalturaLog::err("Open socket failed: {$errstr}");
}
}
self::$stream = fopen($uri, 'a');
if (self::$stream) {
return true;
}
self::$stream = false;
// prevent init from being called again
return false;
}
示例13: execute
/**
* Will return a JS library for integrating the KSR (similar to HTML5 in concept)
* uiconfId specifies from which uiconf to fetch different settings that should be replaced in the JS
*/
public function execute()
{
// make sure output is not parsed as HTML
header("Content-type: application/x-javascript");
$uiconfId = $this->getRequestParameter("uiconfId");
// replace all $_GET with $this->getRequestParameter()
// load uiconf from DB.
$this->uiconfObj = uiConfPeer::retrieveByPK($uiconfId);
if (!$this->uiconfObj) {
KExternalErrors::dieError(KExternalErrors::UI_CONF_NOT_FOUND);
}
$ui_conf_swf_url = $this->uiconfObj->getSwfUrl();
if (!$ui_conf_swf_url) {
KExternalErrors::dieError(KExternalErrors::ILLEGAL_UI_CONF, "SWF URL not found in UI conf");
}
@libxml_use_internal_errors(true);
try {
$this->uiconfXmlObj = new SimpleXMLElement(trim($this->uiconfObj->getConfFile()));
} catch (Exception $e) {
KalturaLog::err("malformed uiconf XML - base64 encoded: [" . base64_encode(trim($this->uiconfObj->getConfFile())) . "]");
}
if (!$this->uiconfXmlObj instanceof SimpleXMLElement) {
// no xml or invalid XML, so throw exception
throw new Exception('uiconf XML is invalid');
}
// unsupress the xml errors
@libxml_use_internal_errors(false);
$this->_initReplacementTokens();
$this->_prepareLibJs();
$this->_prepareJs();
echo $this->jsResult;
die;
}
示例14: validateForSubmission
public function validateForSubmission(EntryDistribution $entryDistribution, $action)
{
$validationErrors = parent::validateForSubmission($entryDistribution, $action);
$inListOrNullFields = array(FacebookDistributionField::CALL_TO_ACTION_TYPE_VALID_VALUES => explode(',', self::CALL_TO_ACTION_TYPE_VALID_VALUES));
if (count($entryDistribution->getFlavorAssetIds())) {
$flavorAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getFlavorAssetIds()));
} else {
$flavorAssets = assetPeer::retrieveReadyFlavorsByEntryId($entryDistribution->getEntryId());
}
$validVideo = false;
foreach ($flavorAssets as $flavorAsset) {
$validVideo = $this->validateVideo($flavorAsset);
if ($validVideo) {
// even one valid video is enough
break;
}
}
if (!$validVideo) {
KalturaLog::err("No valid video found for entry [" . $entryDistribution->getEntryId() . "]");
$validationErrors[] = $this->createCustomValidationError($action, DistributionErrorType::INVALID_DATA, 'flavorAsset', ' No valid flavor found');
}
$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;
}
if ($allFieldValues[FacebookDistributionField::SCHEDULE_PUBLISHING_TIME] && $allFieldValues[FacebookDistributionField::SCHEDULE_PUBLISHING_TIME] > time() && !dateUtils::isWithinTimeFrame($allFieldValues[FacebookDistributionField::SCHEDULE_PUBLISHING_TIME], FacebookConstants::FACEBOOK_MIN_POSTPONE_POST_IN_SECONDS, FacebookConstants::FACEBOOK_MAX_POSTPONE_POST_IN_SECONDS)) {
KalturaLog::err("Scheduled time to publish defies the facebook restriction of six minute to six months from now got" . $allFieldValues[FacebookDistributionField::SCHEDULE_PUBLISHING_TIME]);
$validationErrors[] = $this->createCustomValidationError($action, DistributionErrorType::INVALID_DATA, 'sunrise', 'Distribution sunrise is invalid (should be 6 minutes to 6 months from now)');
}
$validationErrors = array_merge($validationErrors, $this->validateInListOrNull($inListOrNullFields, $allFieldValues, $action));
return $validationErrors;
}
示例15: distribute
protected function distribute(KalturaBatchJob $job, KalturaDistributionJobData $data)
{
if ($job->queueTime + self::$taskConfig->params->maxTimeBeforeFail < time()) {
return $this->closeJob($job, KalturaBatchJobErrorTypes::APP, KalturaBatchJobAppErrors::CLOSER_TIMEOUT, 'Timed out', KalturaBatchJobStatus::FAILED);
}
try {
$this->engine = $this->getDistributionEngine($job->jobSubType, $data);
if (!$this->engine) {
KalturaLog::err('Cannot create DistributeEngine of type [' . $job->jobSubType . ']');
$this->closeJob($job, KalturaBatchJobErrorTypes::APP, null, 'Error: Cannot create DistributeEngine of type [' . $job->jobSubType . ']', KalturaBatchJobStatus::FAILED);
return $job;
}
$job = $this->updateJob($job, "Engine found [" . get_class($this->engine) . "]", KalturaBatchJobStatus::QUEUED);
$closed = $this->execute($data);
if ($closed) {
return $this->closeJob($job, null, null, null, KalturaBatchJobStatus::FINISHED, $data);
}
return $this->closeJob($job, null, null, null, KalturaBatchJobStatus::ALMOST_DONE, $data);
} catch (KalturaDistributionException $ex) {
$job = $this->closeJob($job, KalturaBatchJobErrorTypes::APP, $ex->getCode(), "Error: " . $ex->getMessage(), KalturaBatchJobStatus::RETRY, $job->data);
} catch (Exception $ex) {
$job = $this->closeJob($job, KalturaBatchJobErrorTypes::RUNTIME, $ex->getCode(), "Error: " . $ex->getMessage(), KalturaBatchJobStatus::FAILED, $job->data);
}
return $job;
}