本文整理汇总了PHP中KalturaLog::warning方法的典型用法代码示例。如果您正苦于以下问题:PHP KalturaLog::warning方法的具体用法?PHP KalturaLog::warning怎么用?PHP KalturaLog::warning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KalturaLog
的用法示例。
在下文中一共展示了KalturaLog::warning方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseOutput
protected function parseOutput($output)
{
$amf = array();
$outputLower = strtolower($output);
$jsonObj = json_decode($outputLower);
if (!is_null($jsonObj)) {
// Check for json decode errors caused by inproper utf8 encoding.
if (json_last_error() != JSON_ERROR_NONE) {
$jsonObj = json_decode(utf8_encode($outputLower));
}
$jsonObj = $jsonObj->packets;
foreach ($jsonObj as $tmp) {
// the first data packet is of smaller size of 205 chars
if (strlen($tmp->data) > self::MinAMFSizeToTryParse) {
$amfTs = $this->getTimestampFromAMF($tmp->data);
$amfPts = $tmp->pts;
if ($this->shouldSaveAMF($amf, $amfTs, $amfPts)) {
$amfData = $amfPts . ';' . $amfTs;
array_push($amf, $amfData);
}
}
}
KalturaLog::debug('amf array: ' . print_r($amf, true));
} else {
KalturaLog::warning('failed to json_decode. returning an empty AMF array');
}
return $amf;
}
示例2: createThumnail
public function createThumnail($position = null, $width = null, $height = null, $frameCount = 1, $targetType = "image2", $dar = null, $vidDur = null)
{
if (!isset($frameCount)) {
$frameCount = 1;
}
if (!isset($targetType)) {
$targetType = "image2";
}
KalturaLog::debug("position[{$position}], width[{$width}], height[{$height}], frameCount[{$frameCount}], frameCount[{$frameCount}], dar[{$dar}], vidDur[{$vidDur}]");
if (isset($dar) && $dar > 0 && isset($height)) {
$width = floor(round($height * $dar) / 2) * 2;
}
// TODO - calculate the width and height according to dar
$cmdArr = $this->getCommand($position, $width, $height, $frameCount, $targetType, $vidDur);
$cmd = $cmdArr[0];
$rv = null;
KalturaLog::info("Executing: {$cmd}");
$logFilePath = "{$this->targetPath}.log";
$logFileDir = dirname($logFilePath);
if (!file_exists($logFileDir)) {
mkdir(dirname($logFilePath), 0665, true);
}
file_put_contents($logFilePath, $cmd, FILE_APPEND);
$output = system($cmd, $rv);
KalturaLog::debug("Returned value: '{$rv}'");
if ($rv == 0 && $this->parseOutput($output) == true) {
return true;
}
KalturaLog::warning("First attempt failed due to ffmpeg crash or 'missing-keyframe' issue.\nSecond attempt with 'slow-thumb-capture' mode");
$cmd = $cmdArr[1];
if (isset($cmd)) {
if ($position > 30) {
KalturaLog::err("Can not run 2nd attempt - 'slow-thumb-capture' is allowed up to 30 sec position");
} else {
$rv = null;
KalturaLog::info("Executing: {$cmd}");
file_put_contents($logFilePath, $cmd, FILE_APPEND);
$output = system($cmd, $rv);
KalturaLog::debug("Returned value: '{$rv}'");
if ($rv == 0 && $this->parseOutput($output) == true) {
}
//return true;
}
}
return $rv ? false : true;
}
示例3: apply
/**
* @param KalturaRelatedFilter $filter
* @param KalturaObject $parentObject
* @return boolean
* @throws KalturaAPIException
*/
public function apply(KalturaRelatedFilter $filter, KalturaObject $parentObject)
{
$filterProperty = $this->filterProperty;
$parentProperty = $this->parentProperty;
KalturaLog::debug("Mapping " . get_class($parentObject) . "::{$parentProperty}[{$parentObject->{$parentProperty}}] to " . get_class($filter) . "::{$filterProperty}");
if (!property_exists($parentObject, $parentProperty)) {
throw new KalturaAPIException(KalturaErrors::PROPERTY_IS_NOT_DEFINED, $parentProperty, get_class($parentObject));
}
if (!property_exists($filter, $filterProperty)) {
throw new KalturaAPIException(KalturaErrors::PROPERTY_IS_NOT_DEFINED, $filterProperty, get_class($filter));
}
if (is_null($parentObject->{$parentProperty}) && !$this->allowNull) {
KalturaLog::warning("Parent property [" . get_class($parentObject) . "::{$parentProperty}] is null");
return false;
}
$filter->{$filterProperty} = $parentObject->{$parentProperty};
return true;
}
示例4: getLocalPath
public function getLocalPath($localPath, $remotePath, &$errDescription)
{
KalturaLog::info("Translating remote path [{$remotePath}] to local path [{$localPath}]");
if (file_exists($localPath)) {
if (!$this->fileCacheTimeout) {
return true;
}
clearstatcache();
if (filemtime($localPath) > time() - $this->fileCacheTimeout) {
return true;
}
@unlink($localPath);
}
$res = $this->fetchFile($remotePath, $localPath, $errDescription);
if (!$res) {
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
KalturaLog::warning("Going to flush DNS: ");
$output = system("ipconfig /flushdns", $rc);
KalturaLog::warning($output);
}
}
return $res;
}
示例5: deleteAllButKeepSmallest
protected function deleteAllButKeepSmallest(array $flavors)
{
$smallestFlavor = $this->findSmallestFlavor($flavors);
if (is_null($smallestFlavor)) {
KalturaLog::warning('Smallest flavor was not found, cannot continue');
return;
}
$this->deleteFlavorsKeepingConfiguredList($flavors, array($smallestFlavor->flavorParamsId));
}
示例6: moveDataFile
protected function moveDataFile(KalturaConvertLiveSegmentJobData $data, $localTempAmfFilePath, $sharedTempAmfFilePath)
{
KalturaLog::debug('moving file from ' . $localTempAmfFilePath . ' to ' . $sharedTempAmfFilePath);
kFile::moveFile($localTempAmfFilePath, $sharedTempAmfFilePath, true);
clearstatcache();
$fileSize = kFile::fileSize($sharedTempAmfFilePath);
$this->setFilePermissions($sharedTempAmfFilePath);
if (!$this->checkFileExists($sharedTempAmfFilePath, $fileSize)) {
KalturaLog::warning('failed to move file to ' . $sharedTempAmfFilePath);
} else {
$data->destDataFilePath = $sharedTempAmfFilePath;
}
}
示例7: adjustAssetParams
public function adjustAssetParams($entryId, array &$flavors)
{
$entry = entryPeer::retrieveByPK($entryId);
if (!isset($entry)) {
KalturaLog::warning("Bad entry id ({$entryId}).");
return;
}
$partnerId = $entry->getPartnerId();
$profile = MetadataProfilePeer::retrieveBySystemName(self::TRANSCODING_METADATA_PROF_SYSNAME, $partnerId);
if (!isset($profile)) {
KalturaLog::log("No Transcoding Metadata Profile (sysName:" . self::TRANSCODING_METADATA_PROF_SYSNAME . ", partner:{$partnerId}). Nothing to adjust");
return;
}
$metadata = MetadataPeer::retrieveByObject($profile->getId(), MetadataObjectType::ENTRY, $entryId);
if (!isset($metadata)) {
KalturaLog::log("No Metadata for entry({$entryId}), metadata profile (id:" . $profile->getId() . "). Nothing to adjust");
return;
}
KalturaLog::log("Entry ({$entryId}) has following metadata fields:" . print_r($metadata, 1));
// Retrieve the associated XML file
$key = $metadata->getSyncKey(Metadata::FILE_SYNC_METADATA_DATA);
if (!isset($key)) {
KalturaLog::log("Entry({$entryId}) metadata object misses file sync key! Nothing to adjust");
return;
}
$xmlStr = kFileSyncUtils::file_get_contents($key, true, false);
if (!isset($xmlStr)) {
KalturaLog::log("Entry({$entryId}) metadata object misses valid file sync! Nothing to adjust");
return;
}
KalturaLog::log("Adjusting: entry({$entryId}),metadata profile(" . self::TRANSCODING_METADATA_PROF_SYSNAME . "),xml==>{$xmlStr}");
$watermarkSettingsStr = null;
$imageEntry = null;
$imageUrl = null;
// Retrieve the custom metadata fields from the asocieted XML
$xml = new SimpleXMLElement($xmlStr);
$fldName = self::TRANSCODING_METADATA_WATERMMARK_SETTINGS;
if (isset($xml->{$fldName})) {
$watermarkSettingsStr = (string) $xml->{$fldName};
KalturaLog::log("Found metadata - {$fldName}({$watermarkSettingsStr})");
}
$fldName = self::TRANSCODING_METADATA_WATERMMARK_IMAGE_ENTRY;
if (isset($xml->{$fldName})) {
$imageEntry = (string) $xml->{$fldName};
KalturaLog::log("Found metadata - {$fldName}({$imageEntry})");
}
$fldName = self::TRANSCODING_METADATA_WATERMMARK_IMAGE_URL;
if (isset($xml->{$fldName})) {
$imageUrl = (string) $xml->{$fldName};
KalturaLog::log("Found metadata - {$fldName}({$imageUrl})");
}
/*
* The imageEntry is preffered if both imageEntry and url are set,
* in such case - remove the url
*/
if (isset($imageEntry) && isset($imageUrl)) {
KalturaLog::log("Found both " . self::TRANSCODING_METADATA_WATERMMARK_IMAGE_URL . "({$imageEntry}) and {$fldName}({$imageUrl}). Removing {$fldName}");
$imageUrl = null;
//
}
/*
* If custom-metadate contains 'full' WM settings ('watermarkSettingsStr' is set),
* adjust it to custom meta imageEntry/imageUrl values,
* if those provided.
*/
if (isset($watermarkSettingsStr)) {
$watermarkSettings = json_decode($watermarkSettingsStr);
$this->adjustWatermarSettings($watermarkSettings, $imageEntry, $imageUrl);
}
/*
* Loop through the flavor params to update the WM settings,
* if it is required.
*/
foreach ($flavors as $k => $flavor) {
KalturaLog::log("Processing flavor id:" . $flavor->getId());
$wmDataObj = null;
/*
* The 'full' WM settings in the custom metadata overides any exitings WM settings
*/
if (isset($watermarkSettings)) {
$wmDataObj = clone $watermarkSettings;
} else {
/*
* No 'full' settings.
* Adjust the existing flavor WM data with custom metadata imageEntry/imageUrl
*/
$wmDataStr = $flavor->getWatermarkData();
if (isset($wmDataStr)) {
$wmDataObj = json_decode($wmDataStr);
if ($this->adjustWatermarSettings($wmDataObj, $imageEntry, $imageUrl) == false) {
continue;
}
}
}
if (isset($wmDataObj)) {
$toJson = json_encode($wmDataObj);
$flavor->setWatermarkData($toJson);
$flavors[$k] = $flavor;
KalturaLog::log("Set flavor (" . $flavor->getId() . ") WM to {$toJson}");
}
//.........这里部分代码省略.........
示例8: createPackage
/**
* Build a packaged tarball for the client library.
* @param $outputPath The path the client library files are located at.
* @param $generatorName The name of the client library.
*/
function createPackage($outputPath, $generatorName, $generatedDate, $overrideGenDate = null)
{
KalturaLog::info("Trying to package");
$output = shell_exec("tar --version");
if ($output === null) {
KalturaLog::warning("Skipping packaging, \"tar\" command not found! On Windows, tar can be installed using Cygwin, and it should be added to the path");
} else {
if ($overrideGenDate == null) {
$overrideGenDate = $generatedDate;
}
$fileName = "{$generatorName}_{$overrideGenDate}.tar.gz";
$gzipOutputPath = "../" . $fileName;
$cmd = "tar -czf \"{$gzipOutputPath}\" ../" . $generatorName;
$oldDir = getcwd();
$outputPath = realpath($outputPath);
KalturaLog::debug("Changing dir to [{$outputPath}]");
chdir($outputPath);
KalturaLog::info("Executing: {$cmd}");
passthru($cmd);
if (file_exists($gzipOutputPath)) {
KalturaLog::info("Package created successfully: {$gzipOutputPath}");
} else {
KalturaLog::err("Failed to create package");
}
KalturaLog::debug("Restoring dir to [{$oldDir}]");
chdir($oldDir);
}
}
示例9: multiGetAndTouch
/**
* @param array $keys
* @param mixed $var
*/
public function multiGetAndTouch(array $keys)
{
try {
$metas = $this->bucket->get($keys);
KalturaLog::debug("key [" . print_r($keys, true) . "]");
$values = array();
foreach ($keys as $key) {
$meta = $metas[$key];
if ($meta->error) {
KalturaLog::warning($meta->error->getMessage());
}
$values[$key] = $meta->value;
}
return $values;
} catch (CouchbaseException $e) {
}
return false;
}
示例10: addRecalculateResponseProfileCacheJob
/**
* @param int $partnerId
* @param string $protocol http or https
* @param SessionType $ksType
* @param array $userRoles
* @param string $objectType class name
* @param string $objectId
* @param string $startObjectKey
* @param string $endObjectKey
*/
public static function addRecalculateResponseProfileCacheJob($partnerId, $protocol, $ksType, array $userRoles, $objectType, $objectId = null, $startObjectKey = null, $endObjectKey = null)
{
KalturaLog::debug("Recalculating cache partner[{$partnerId}] protocol[{$protocol}] ks[{$ksType}] roles[" . implode(', ', $userRoles) . "] object[{$objectType}] id [{$objectId}] start[{$startObjectKey}] end[{$endObjectKey}]");
$jobData = new kRecalculateResponseProfileCacheJobData();
$jobData->setProtocol($protocol);
$jobData->setKsType($ksType);
$jobData->setUserRoles($userRoles);
$jobData->setObjectType($objectType);
$jobData->setObjectId($objectId);
$jobData->setStartObjectKey($startObjectKey);
$jobData->setEndObjectKey($endObjectKey);
$batchJob = new BatchJob();
$batchJob->setPartnerId($partnerId);
if (is_subclass_of($objectType, 'entry')) {
$batchJob->setObjectId($objectId);
$batchJob->setEntryId($objectId);
$batchJob->setObjectType(BatchJobObjectType::ENTRY);
} elseif (is_subclass_of($objectType, 'category')) {
$batchJob->setObjectId($objectId);
$batchJob->setObjectType(BatchJobObjectType::CATEGORY);
} else {
KalturaLog::warning("Object type [{$objectType}] is not expected to need cache recalculation");
return null;
}
return self::addJob($batchJob, $jobData, BatchJobType::RECALCULATE_CACHE, RecalculateCacheType::RESPONSE_PROFILE);
}
示例11: isCacheValid
private function isCacheValid(kLiveMediaServer $kMediaServer)
{
$cacheType = self::getCacheType();
$cacheStore = kCacheManager::getSingleLayerCache($cacheType);
if (!$cacheStore) {
KalturaLog::warning("Cache store [{$cacheType}] not found");
$lastUpdate = time() - $kMediaServer->getTime();
$expiry = kConf::get('media_server_cache_expiry', 'local', self::DEFAULT_CACHE_EXPIRY);
return $lastUpdate <= $expiry;
}
$key = $this->getId() . '_' . $kMediaServer->getHostname() . '_' . $kMediaServer->getIndex();
KalturaLog::debug("Get cache key [{$key}] from store [{$cacheType}]");
return $cacheStore->get($key);
}
示例12: getExternalStorageUrl
private static function getExternalStorageUrl(Partner $partner, asset $asset, FileSyncKey $key, $servePlayManifest = false, $playManifestClientTag = null, $storageId = null)
{
if (!$partner->getStorageServePriority() || $partner->getStorageServePriority() == StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_ONLY) {
return null;
}
if (is_null($storageId) && $partner->getStorageServePriority() == StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_FIRST) {
if (kFileSyncUtils::getReadyInternalFileSyncForKey($key)) {
// check if having file sync on kaltura dcs
return null;
}
}
$fileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($key, $storageId);
if (!$fileSync) {
return null;
}
$storage = StorageProfilePeer::retrieveByPK($fileSync->getDc());
if (!$storage) {
return null;
}
if ($servePlayManifest) {
// in case of an https request, if a delivery profile which supports https doesn't exist use an http cdn api host
if (infraRequestUtils::getProtocol() == infraRequestUtils::PROTOCOL_HTTPS && DeliveryProfilePeer::getRemoteDeliveryByStorageId(DeliveryProfileDynamicAttributes::init($fileSync->getDc(), $asset->getEntryId(), PlaybackProtocol::HTTP, "https"))) {
$url = requestUtils::getApiCdnHost();
} else {
$url = infraRequestUtils::PROTOCOL_HTTP . "://" . kConf::get("cdn_api_host");
}
$url .= $asset->getPlayManifestUrl($playManifestClientTag, $storageId);
} else {
$urlManager = DeliveryProfilePeer::getRemoteDeliveryByStorageId(DeliveryProfileDynamicAttributes::init($fileSync->getDc(), $asset->getEntryId()));
if ($urlManager) {
$dynamicAttrs = new DeliveryProfileDynamicAttributes();
$dynamicAttrs->setFileExtension($asset->getFileExt());
$dynamicAttrs->setStorageId($fileSync->getDc());
$urlManager->setDynamicAttributes($dynamicAttrs);
$url = ltrim($urlManager->getFileSyncUrl($fileSync), '/');
if (strpos($url, "://") === false) {
$url = rtrim($urlManager->getUrl(), "/") . "/" . $url;
}
} else {
KalturaLog::warning("Couldn't determine delivery profile for storage id");
$url = null;
}
}
return $url;
}
示例13: getSegmentStartTime
private static function getSegmentStartTime($amfArray)
{
if (count($amfArray) == 0) {
KalturaLog::warning("getSegmentStartTime got an empty AMFs array - returning 0 as segment end time");
return 0;
}
return ($amfArray[0]->ts - $amfArray[0]->pts) / 1000;
}
示例14: multiGetAndTouch
/**
* @param array $keys
* @param mixed $var
*/
public function multiGetAndTouch(array $keys)
{
try {
$metas = $this->bucket->get($keys);
if ($this->debug) {
KalturaLog::debug("key [" . implode(', ', $keys) . "], metas [" . print_r($metas, true) . "]");
}
$values = array();
foreach ($keys as $key) {
$meta = $metas[$key];
if ($meta->error) {
KalturaLog::warning($meta->error->getMessage());
}
$values[$key] = $meta->value;
}
return $values;
} catch (CouchbaseException $e) {
if ($e->getCode() == self::ERROR_CODE_THE_KEY_DOES_NOT_EXIST_IN_THE_SERVER) {
return false;
}
throw $e;
}
}
示例15: concat
protected function concat(KalturaBatchJob $job, KalturaConcatJobData $data)
{
$this->updateJob($job, "Files concatenation started", KalturaBatchJobStatus::PROCESSING);
$jobData = $job->data;
$ffmpegBin = KBatchBase::$taskConfig->params->ffmpegCmd;
$ffprobeBin = isset(KBatchBase::$taskConfig->params->ffprobeCmd) ? KBatchBase::$taskConfig->params->ffprobeCmd : "ffprobe";
$mediaInfoBin = isset(KBatchBase::$taskConfig->params->mediaInfoCmd) ? KBatchBase::$taskConfig->params->mediaInfoCmd : "mediainfo";
$fileName = "{$job->entryId}_{$data->flavorAssetId}.mp4";
$localTempFilePath = $this->localTempPath . DIRECTORY_SEPARATOR . $fileName;
$sharedTempFilePath = $this->sharedTempPath . DIRECTORY_SEPARATOR . $fileName;
$srcFiles = array();
foreach ($data->srcFiles as $srcFile) {
/* @var $srcFile KalturaString */
$srcFiles[] = $srcFile->value;
}
$result = $this->concatFiles($ffmpegBin, $ffprobeBin, $srcFiles, $localTempFilePath, $data->offset, $data->duration);
if (!$result) {
return $this->closeJob($job, KalturaBatchJobErrorTypes::RUNTIME, null, "Failed to concat files", KalturaBatchJobStatus::FAILED);
}
try {
// get the concatenated duration
$mediaInfoParser = new KMediaInfoMediaParser($localTempFilePath, $mediaInfoBin);
$data->concatenatedDuration = $mediaInfoParser->getMediaInfo()->videoDuration;
} catch (Exception $ex) {
KalturaLog::warning('failed to get concatenatedDuration ' . print_r($ex));
}
return $this->moveFile($job, $data, $localTempFilePath, $sharedTempFilePath);
}