本文整理汇总了PHP中KalturaLog::debug方法的典型用法代码示例。如果您正苦于以下问题:PHP KalturaLog::debug方法的具体用法?PHP KalturaLog::debug怎么用?PHP KalturaLog::debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KalturaLog
的用法示例。
在下文中一共展示了KalturaLog::debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteFilesPHP
protected function deleteFilesPHP($searchPath, $minutesOld, $simulateOnly)
{
$secondsOld = $minutesOld * 60;
$files = glob($searchPath);
KalturaLog::debug("Found [" . count($files) . "] to scan");
$now = time();
KalturaLog::debug("The time now is: " . date('c', $now));
KalturaLog::debug("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::debug("Simulating: Deleting file [{$file}], it's last modification time was " . date('c', $filemtime));
continue;
}
KalturaLog::debug("Deleting file [{$file}], it's last modification time was " . date('c', $filemtime));
$res = @unlink($file);
if (!$res) {
KalturaLog::debug("Error: problem while deleting [{$file}]");
continue;
}
$deletedCount++;
}
KalturaLog::debug("Deleted {$deletedCount} files");
}
示例2: apply
public function apply(KalturaRelatedFilter $filter, KalturaObject $parentObject)
{
$filterProperty = $this->filterProperty;
$parentProperty = $this->parentProperty;
KalturaLog::debug("Mapping XPath {$parentProperty} to " . get_class($filter) . "::{$filterProperty}");
if (!$parentObject instanceof KalturaMetadata) {
throw new KalturaAPIException(KalturaErrors::INVALID_OBJECT_TYPE, get_class($parentObject));
}
if (!property_exists($filter, $filterProperty)) {
throw new KalturaAPIException(KalturaErrors::PROPERTY_IS_NOT_DEFINED, $filterProperty, get_class($filter));
}
$xml = $parentObject->xml;
$doc = new KDOMDocument();
$doc->loadXML($xml);
$xpath = new DOMXPath($doc);
$metadataElements = $xpath->query($parentProperty);
if ($metadataElements->length == 1) {
$filter->{$filterProperty} = $metadataElements->item(0)->nodeValue;
} elseif ($metadataElements->length > 1) {
$values = array();
foreach ($metadataElements as $element) {
$values[] = $element->nodeValue;
}
$filter->{$filterProperty} = implode(',', $values);
} elseif (!$this->allowNull) {
return false;
}
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: recalculate
private function recalculate(KalturaBatchJob $job, KalturaRecalculateCacheJobData $data)
{
KalturaLog::debug("Recalculate job id [{$job->id}]");
$engine = KRecalculateCacheEngine::getInstance($job->jobSubType);
$recalculatedObjects = $engine->recalculate($data);
return $this->closeJob($job, null, null, "Recalculated {$recalculatedObjects} cache objects", KalturaBatchJobStatus::FINISHED);
}
示例5: entryCreated
/**
* @param entry $object
* @return bool true if should continue to the next consumer
*/
public function entryCreated(entry $object)
{
$mediaType = null;
if ($object->getType() == entryType::AUTOMATIC) {
KalturaLog::debug("entry id [" . $object->getId() . "] type [" . $object->getType() . "] source link [" . $object->getSourceLink() . "]");
$mediaType = $object->getMediaType();
if (isset(self::$fileExtensions[$mediaType])) {
$object->setType(entryType::DOCUMENT);
} elseif (is_null($mediaType) || $mediaType == entry::ENTRY_MEDIA_TYPE_ANY || $mediaType == entry::ENTRY_MEDIA_TYPE_AUTOMATIC) {
$this->setDocumentType($object);
}
}
if ($object->getType() != entryType::DOCUMENT) {
KalturaLog::debug("entry id [" . $object->getId() . "] type [" . $object->getType() . "]");
return true;
}
if (is_null($mediaType) || $mediaType == entry::ENTRY_MEDIA_TYPE_ANY || $mediaType == entry::ENTRY_MEDIA_TYPE_AUTOMATIC) {
$this->setDocumentType($object);
}
if ($object instanceof DocumentEntry) {
KalturaLog::debug("entry id [" . $object->getId() . "] already handled");
return true;
}
KalturaLog::debug("Handling object [" . get_class($object) . "] type [" . $object->getType() . "] id [" . $object->getId() . "] status [" . $object->getStatus() . "]");
if ($object->getConversionProfileId()) {
$object->setStatus(entryStatus::PRECONVERT);
$object->save();
}
return true;
}
示例6: 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();
}
}
示例7: 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::debug("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;
}
示例8: getExclusiveFile
public static function getExclusiveFile($path, $process_id = 1, $log_number_of_files = false)
{
$indicators = glob($path . "/*" . self::INDICATOR_SUFFIX);
$count = count($indicators);
if ($count > 0 || $log_number_of_files) {
KalturaLog::debug("[" . $count . "] indicator in directory [" . $path . "]");
}
if ($indicators == null || count($indicators) == 0) {
return null;
}
foreach ($indicators as $indicator) {
$new_indicator = $indicator . "-{$process_id}";
$move_res = @rename($indicator, $new_indicator);
// only one server will actually move the indicator ...
if ($move_res) {
$file = str_replace(kConversionCommand::INDICATOR_SUFFIX, "", $indicator);
$file_name = basename($file);
// now remove the indicator
//unlink( $new_indicator );
// move to in-proc
$in_proc = self::inProcFromIndicator($indicator);
@rename($new_indicator, $in_proc);
return array($file, $file_name, $in_proc);
} else {
KalturaLog::debug("[{$indicator}] grabbed by other process");
}
// keep on trying ...
}
return null;
}
示例9: doOperation
protected function doOperation()
{
KalturaLog::debug('start ISM Manifest merge');
if (!$this->data->srcFileSyncs) {
return true;
}
$ismFilePath = $this->outFilePath . ".ism";
$ismcFilePath = $this->outFilePath . ".ismc";
$ismcStr = $this->mergeIsmcManifests($this->data->srcFileSyncs);
file_put_contents($ismcFilePath, $ismcStr);
$ismStr = $this->mergeIsmManifests($this->data->srcFileSyncs, $ismcFilePath);
file_put_contents($ismFilePath, $ismStr);
$destFileSyncDescArr = array();
$fileSyncDesc = new KalturaDestFileSyncDescriptor();
$fileSyncDesc->fileSyncLocalPath = $ismFilePath;
$fileSyncDesc->fileSyncObjectSubType = 1;
//".ism";
$destFileSyncDescArr[] = $fileSyncDesc;
$fileSyncDesc = new KalturaDestFileSyncDescriptor();
$fileSyncDesc->fileSyncLocalPath = $ismcFilePath;
$fileSyncDesc->fileSyncObjectSubType = 4;
//".ismc";
$destFileSyncDescArr[] = $fileSyncDesc;
$this->data->extraDestFileSyncs = $destFileSyncDescArr;
$this->data->destFileSyncLocalPath = null;
$this->outFilePath = null;
return true;
}
示例10: 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::debug(get_class() . ' failed to find flavor');
return null;
}
return $flavor;
}
示例11: getLicenseAction
/**
* Get license for encrypted content playback
*
* @action getLicense
* @param string $flavorAssetId
* @param string $referrer 64base encoded
* @return string $response
*
*/
public function getLicenseAction($flavorAssetId, $referrer = null)
{
KalturaResponseCacher::disableCache();
KalturaLog::debug('get license for flavor asset: ' . $flavorAssetId);
try {
$requestParams = requestUtils::getRequestParams();
if (!array_key_exists(WidevineLicenseProxyUtils::ASSETID, $requestParams)) {
KalturaLog::err('assetid is missing on the request');
return WidevineLicenseProxyUtils::createErrorResponse(KalturaWidevineErrorCodes::WIDEVINE_ASSET_ID_CANNOT_BE_NULL, 0);
}
$wvAssetId = $requestParams[WidevineLicenseProxyUtils::ASSETID];
$this->validateLicenseRequest($flavorAssetId, $wvAssetId, $referrer);
$privileges = null;
$isAdmin = false;
if (kCurrentContext::$ks_object) {
$privileges = kCurrentContext::$ks_object->getPrivileges();
$isAdmin = kCurrentContext::$ks_object->isAdmin();
}
$response = WidevineLicenseProxyUtils::sendLicenseRequest($requestParams, $privileges, $isAdmin);
} catch (KalturaWidevineLicenseProxyException $e) {
KalturaLog::err($e);
$response = WidevineLicenseProxyUtils::createErrorResponse($e->getWvErrorCode(), $wvAssetId);
} catch (Exception $e) {
KalturaLog::err($e);
$response = WidevineLicenseProxyUtils::createErrorResponse(KalturaWidevineErrorCodes::GENERAL_ERROR, $wvAssetId);
}
WidevineLicenseProxyUtils::printLicenseResponseStatus($response);
return $response;
}
示例12: getSuitableProfile
/**
* Will return the first virus scan profile of the entry's partner, that defines an entry filter suitable for the given entry.
* @param int $entryId
* @return VirusScanProfile the suitable profile object, or null if none found
*/
public static function getSuitableProfile($entryId)
{
$entry = entryPeer::retrieveByPK($entryId);
if (!$entry) {
KalturaLog::err('Cannot find entry with id [' . $entryId . ']');
return null;
}
if ($entry->getSource() == entry::ENTRY_MEDIA_SOURCE_WEBCAM) {
return null;
}
$cProfile = new Criteria();
$cProfile->addAnd(VirusScanProfilePeer::PARTNER_ID, $entry->getPartnerId());
$cProfile->addAnd(VirusScanProfilePeer::STATUS, VirusScanProfileStatus::ENABLED, Criteria::EQUAL);
$profiles = VirusScanProfilePeer::doSelect($cProfile);
if (!$profiles) {
KalturaLog::debug('No virus scan profiles found for partner [' . $entry->getPartnerId() . ']');
return null;
}
foreach ($profiles as $profile) {
$virusEntryFilter = $profile->getEntryFilterObject();
if ($virusEntryFilter->matches($entry)) {
KalturaLog::debug('Returning profile with id [' . $profile->getId() . ']');
return $profile;
}
}
return null;
}
示例13: __construct
/**
* @param int $taskIndex
* @param string $logDir
* @param string $phpPath
* @param string $tasksetPath
* @param KSchedularTaskConfig $taskConfig
*/
public function __construct($taskIndex, $logDir, $phpPath, $tasksetPath, KSchedularTaskConfig $taskConfig)
{
$taskConfig->setTaskIndex($taskIndex);
$logName = str_replace('kasync', '', strtolower($taskConfig->name));
$logDate = date('Y-m-d');
$logFile = "{$logDir}/{$logName}-{$taskIndex}-{$logDate}.log";
$sysLogFile = "{$taskConfig->name}.{$taskIndex}";
$this->taskConfig = $taskConfig;
$taskConfigStr = base64_encode(serialize($taskConfig));
$cmdLine = '';
$cmdLine .= is_null($taskConfig->affinity) ? '' : "{$tasksetPath} -c " . ($taskConfig->affinity + $taskIndex) . ' ';
$cmdLine = "{$phpPath} ";
$cmdLine .= "{$taskConfig->scriptPath} ";
$cmdLine .= "{$taskConfigStr} ";
$cmdLine .= "'[" . mt_rand() . "]' ";
if ($taskConfig->getUseSyslog()) {
$cmdLine .= "2>&1 | logger -t {$sysLogFile}";
} else {
$cmdLine .= ">> {$logFile} 2>&1";
}
$descriptorspec = array();
// stdin is a pipe that the child will read from
// $descriptorspec = array(0 => array("pipe", "r")); // stdin is a pipe that the child will read from
// 1 => array ( "file" ,$logFile , "a" ) ,
// 2 => array ( "file" ,$logFile , "a" ) ,
// 1 => array("pipe", "w"), // stdout is a pipe that the child will write to
// 2 => array("pipe", "w"), // stdout is a pipe that the child will write to
// 2 => array("file", "{$work_dir}/error-output.txt", "a") // stderr is a file to write to
$other_options = array('suppress_errors' => FALSE, 'bypass_shell' => FALSE);
KalturaLog::debug("Now executing [{$cmdLine}], [{$other_options}]");
$process = proc_open($cmdLine, $descriptorspec, $pipes, null, null, $other_options);
$this->pipes = $pipes;
$this->handle = $process;
$this->dieTime = time() + $taskConfig->maximumExecutionTime + 5;
}
示例14: 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::debug("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
}
示例15: 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;
}