本文整理汇总了PHP中KalturaLog::alert方法的典型用法代码示例。如果您正苦于以下问题:PHP KalturaLog::alert方法的具体用法?PHP KalturaLog::alert怎么用?PHP KalturaLog::alert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KalturaLog
的用法示例。
在下文中一共展示了KalturaLog::alert方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createSphinxConnection
function createSphinxConnection($sphinxServer, $port = 9312)
{
$dsn = "mysql:host={$sphinxServer};port={$port};";
try {
$con = new PDO($dsn);
return $con;
} catch (PropelException $pex) {
KalturaLog::alert($pex->getMessage());
throw new PropelException("Database error");
}
}
示例2: contributeMetadata
/**
* @param Metadata $metadata
* @param SimpleXMLElement $mrss
* @param kMrssParameters $mrssParams
* @return SimpleXMLElement
*/
public function contributeMetadata(Metadata $metadata, SimpleXMLElement $mrss, kMrssParameters $mrssParams = null)
{
$key = $metadata->getSyncKey(Metadata::FILE_SYNC_METADATA_DATA);
$xml = kFileSyncUtils::file_get_contents($key, true, false);
if (is_null($xml)) {
KalturaLog::alert("ready file sync was not found for key[{$key}]");
return;
}
$metadataXml = new SimpleXMLElement($xml);
$customData = $mrss->addChild('customData');
$customData->addAttribute('metadataId', $metadata->getId());
$customData->addAttribute('metadataVersion', $metadata->getVersion());
$customData->addAttribute('metadataProfileId', $metadata->getMetadataProfileId());
$customData->addAttribute('metadataProfileVersion', $metadata->getMetadataProfileVersion());
$this->contributeMetadataObject($customData, $metadataXml, $mrssParams, '');
}
示例3: fromDbArray
public static function fromDbArray($arr, KalturaDetachedResponseProfile $responseProfile = null)
{
$newArr = new KalturaConditionArray();
if ($arr == null) {
return $newArr;
}
foreach ($arr as $obj) {
$nObj = self::getInstanceByDbObject($obj);
if (!$nObj) {
KalturaLog::alert("Object [" . get_class($obj) . "] type [" . $obj->getType() . "] could not be translated to API object");
continue;
}
$nObj->fromObject($obj, $responseProfile);
$newArr[] = $nObj;
}
return $newArr;
}
示例4: execute
public function execute($input_parameters = null)
{
if (!kQueryCache::isCurrentQueryHandled()) {
kApiCache::disableConditionalCache();
}
$search = array();
$replace = array();
if (is_null($input_parameters)) {
$search = array_reverse(array_keys($this->values));
$replace = array_reverse($this->values);
} else {
$i = 1;
foreach ($input_parameters as $value) {
$search[] = ':p' . $i++;
if (is_null($value)) {
$replace[] = "NULL";
} else {
$replace[] = "'{$value}'";
}
}
$search = array_reverse($search);
$replace = array_reverse($replace);
}
$sql = str_replace($search, $replace, $this->queryString);
KalturaLog::debug($sql);
$sqlStart = microtime(true);
if (self::$dryRun && !preg_match('/^(\\/\\*.+\\*\\/ )?SELECT/i', $sql)) {
KalturaLog::debug("Sql dry run - " . (microtime(true) - $sqlStart) . " seconds");
} else {
try {
parent::execute($input_parameters);
} catch (PropelException $pex) {
KalturaLog::alert($pex->getMessage());
throw new PropelException("Database error");
}
$sqlTook = microtime(true) - $sqlStart;
KalturaLog::debug("Sql took - " . $sqlTook . " seconds");
KalturaMonitorClient::monitorDatabaseAccess($sql, $sqlTook);
}
}
示例5: execute
public function execute($input_parameters = null)
{
if (class_exists('KalturaResponseCacher')) {
KalturaResponseCacher::disableConditionalCache();
}
$search = array();
$replace = array();
if (is_null($input_parameters)) {
$search = array_reverse(array_keys($this->values));
$replace = array_reverse($this->values);
} else {
$i = 1;
foreach ($input_parameters as $value) {
$search[] = ':p' . $i++;
if (is_null($value)) {
$replace[] = "NULL";
} else {
$replace[] = "'{$value}'";
}
}
$search = array_reverse($search);
$replace = array_reverse($replace);
}
$sql = str_replace($search, $replace, $this->queryString);
KalturaLog::debug($sql);
$sqlStart = microtime(true);
if (self::$dryRun) {
KalturaLog::debug("Sql dry run - " . (microtime(true) - $sqlStart) . " seconds");
} else {
try {
parent::execute($input_parameters);
} catch (PropelException $pex) {
KalturaLog::alert($pex->getMessage());
throw new PropelException("Database error");
}
KalturaLog::debug("Sql took - " . (microtime(true) - $sqlStart) . " seconds");
}
}
示例6: postInsert
/* (non-PHPdoc)
* @see categoryEntry::postInsert()
*/
public function postInsert(PropelPDO $con = null)
{
// DO nothing - don't increase category entries count
}
}
$partnerId = null;
$startEntryIntId = null;
$limit = null;
$page = 200;
$dryRun = false;
if ($argc == 1 || strtolower($argv[1]) != 'realrun') {
$dryRun = true;
KalturaLog::alert('Using dry run mode');
}
if ($argc > 2) {
$partnerId = $argv[2];
}
if ($argc > 3) {
$startEntryIntId = $argv[3];
}
if ($argc > 4) {
$limit = $argv[4];
}
$criteria = new Criteria();
$criteria->addAscendingOrderByColumn(entryPeer::INT_ID);
if ($partnerId) {
$criteria->add(entryPeer::PARTNER_ID, $partnerId);
}
示例7: setFullName
public function setFullName($v)
{
// full_name column is deprecated
KalturaLog::alert('Field [full_name] on object [kuser] is deprecated');
list($firstName, $lastName) = kString::nameSplit($v);
$this->setFirstName($firstName);
$this->setLastName($lastName);
}
示例8: execute
//.........这里部分代码省略.........
$renderer->setCacheKey($execution_cache_key);
}
if (!$renderer->hasContentForCacheKey($this->response_type)) {
$this->benchmarkStart("applyPartnerFilters");
//init entitlement before set the default criteire by myPartnerUtils::applyPartnerFilters
kEntitlementUtils::initEntitlementEnforcement();
// apply filters for Criteria so there will be no chance of exposure of date from other partners !
// TODO - add the parameter for allowing kaltura network
myPartnerUtils::applyPartnerFilters($partner_id, $private_partner_data, $this->partnerGroup2(), $this->kalturaNetwork2());
$this->benchmarkEnd("applyPartnerFilters");
$this->benchmarkStart("puserKuser");
list($partner_id, $subp_id, $puser_id, $partner_prefix) = $this->preparePartnerPuserDetails($partner_id, $subp_id, $puser_id);
$puser_kuser = $this->getPuserKuser($partner_id, $subp_id, $puser_id);
$this->benchmarkEnd("puserKuser");
$this->benchmarkEnd("beforeImpl");
// ----------------------------- impl --------------------------
$start_impl = microtime(true);
$result = $this->executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser);
$end_impl = microtime(true);
kEventsManager::flushEvents();
} else {
/// the renderer claims to have the desired result ! just flow down the code ... ;)
}
// ----------------------------- impl --------------------------
} catch (APIException $api_ex) {
$message = $api_ex->getMessage();
if ($this->should_debug && $message) {
$this->addError(APIErrors::SERVERL_ERROR, "[{$message}]");
} elseif ($api_ex->api_code) {
call_user_func_array(array(&$this, 'addError'), $api_ex->extra_data);
// $this->addError ( $api_ex->api_code ,$api_ex->extra_data );
}
} catch (PropelException $pex) {
KalturaLog::alert($pex->getMessage());
$this->addError(APIErrors::INTERNAL_DATABASE_ERROR);
} catch (Exception $ex) {
$this->addError(APIErrors::INTERNAL_SERVERL_ERROR, $ex->getMessage());
KalturaLog::err($ex->getMessage());
}
$execute_impl_end_time = microtime(true);
// render according to the format_type
$res = array();
$this->addMsg("serverTime", time());
$res['result'] = $this->msg;
$res['error'] = $this->error;
if ($this->should_debug) {
// this specific debug line should be used
$this->addDebug("execute_impl_time", $end_impl - $start_impl);
$this->addDebug("execute_time", $execute_impl_end_time - $start_time);
// will be used as a place holder and will be replaced after the rendering.
if ($add_extra_debug_data) {
$this->addDebug("total_time", self::__TOTAL_TIME__);
}
if ($add_benchmarks && count($this->benchmarks) > 0) {
$this->addDebug("host", @$_ENV["HOSTNAME"]);
$this->addDebug("benchmarks", $this->getBenchmarks());
}
$res['debug'] = $this->debug;
}
// ignore all the errors and debug - the first msg is the only html used
if ($this->response_type == kalturaWebserviceRenderer::RESPONSE_TYPE_HTML) {
$res = "<html>";
foreach ($this->msg as $html_bit) {
$res .= $html_bit;
}
$res .= "</html>";
示例9: query
public function query()
{
if (class_exists('KalturaResponseCacher')) {
KalturaResponseCacher::disableConditionalCache();
}
$args = func_get_args();
$sql = $args[0];
KalturaLog::debug($sql);
$comment = $this->getCommentWrapped();
$sql = $comment . $sql;
$sqlStart = microtime(true);
try {
if (version_compare(PHP_VERSION, '5.3', '<')) {
$result = call_user_func_array(array($this, 'parent::query'), $args);
} else {
$result = call_user_func_array('parent::query', $args);
}
} catch (PropelException $pex) {
KalturaLog::alert($pex->getMessage());
throw new PropelException("Database error");
}
KalturaLog::debug("Sql took - " . (microtime(true) - $sqlStart) . " seconds");
return $result;
}
示例10: getExceptionObject
public function getExceptionObject($ex)
{
$this->adjustApiCacheForException($ex);
if ($ex instanceof KalturaAPIException) {
KalturaLog::err($ex);
$object = $ex;
} else {
if ($ex instanceof APIException) {
$args = $ex->extra_data;
$reflectionException = new ReflectionClass("KalturaAPIException");
$ex = $reflectionException->newInstanceArgs($args);
KalturaLog::err($ex);
$object = $ex;
} else {
if ($ex instanceof kCoreException) {
switch ($ex->getCode()) {
case kCoreException::INVALID_KS:
$object = new KalturaAPIException(KalturaErrors::INVALID_KS, $ex->getData(), ks::INVALID_STR, 'INVALID_STR');
break;
case kCoreException::MAX_NUMBER_OF_ACCESS_CONTROLS_REACHED:
$object = new KalturaAPIException(KalturaErrors::MAX_NUMBER_OF_ACCESS_CONTROLS_REACHED, $ex->getData());
break;
case kCoreException::MAX_CATEGORIES_PER_ENTRY:
$object = new KalturaAPIException(KalturaErrors::MAX_CATEGORIES_FOR_ENTRY_REACHED, entry::MAX_CATEGORIES_PER_ENTRY);
break;
case kCoreException::SEARCH_TOO_GENERAL:
throw new KalturaAPIException(KalturaErrors::SEARCH_TOO_GENERAL);
break;
case kCoreException::SOURCE_FILE_NOT_FOUND:
$object = new KalturaAPIException(KalturaErrors::SOURCE_FILE_NOT_FOUND);
break;
case APIErrors::INVALID_ACTIONS_LIMIT:
$object = new KalturaAPIException(APIErrors::INVALID_ACTIONS_LIMIT);
break;
case APIErrors::PRIVILEGE_IP_RESTRICTION:
$object = new KalturaAPIException(APIErrors::PRIVILEGE_IP_RESTRICTION);
break;
case APIErrors::INVALID_SET_ROLE:
$object = new KalturaAPIException(APIErrors::INVALID_SET_ROLE);
break;
case APIErrors::UNKNOWN_ROLE_ID:
$object = new KalturaAPIException(APIErrors::UNKNOWN_ROLE_ID);
break;
case APIErrors::SEARCH_ENGINE_QUERY_FAILED:
$object = new KalturaAPIException(APIErrors::SEARCH_ENGINE_QUERY_FAILED);
break;
default:
KalturaLog::crit($ex);
$object = new KalturaAPIException(KalturaErrors::INTERNAL_SERVERL_ERROR);
}
} else {
if ($ex instanceof PropelException) {
KalturaLog::alert($ex);
$object = new KalturaAPIException(KalturaErrors::INTERNAL_DATABASE_ERROR);
} else {
KalturaLog::crit($ex);
$object = new KalturaAPIException(KalturaErrors::INTERNAL_SERVERL_ERROR);
}
}
}
}
return $object;
}
示例11: getPermissions
private static function getPermissions($roleId)
{
$map = self::initEmptyMap();
// get cache dirty time
$roleCacheDirtyAt = 0;
if (self::$operatingPartner) {
$roleCacheDirtyAt = self::$operatingPartner->getRoleCacheDirtyAt();
}
// get role from cache
$roleCacheKey = self::getRoleIdKey($roleId, self::$operatingPartnerId);
$cacheRole = self::getFromCache($roleCacheKey, $roleCacheDirtyAt);
// compare updatedAt between partner dirty flag and cache
if ($cacheRole) {
return $cacheRole;
// initialization from cache finished
}
// cache is not updated - delete stored value and re-init from DB
$dbRole = null;
if (!is_null($roleId)) {
UserRolePeer::setUseCriteriaFilter(false);
$dbRole = UserRolePeer::retrieveByPK($roleId);
UserRolePeer::setUseCriteriaFilter(true);
if (!$dbRole) {
KalturaLog::alert('User role ID [' . $roleId . '] set for user ID [' . self::$ksUserId . '] of partner [' . self::$operatingPartnerId . '] was not found in the DB');
throw new kPermissionException('User role ID [' . $roleId . '] set for user ID [' . self::$ksUserId . '] of partner [' . self::$operatingPartnerId . '] was not found in the DB', kPermissionException::ROLE_NOT_FOUND);
}
}
$map = self::getPermissionsFromDb($dbRole);
// update cache
$cacheRole = array('updatedAt' => time(), 'mapHash' => md5(serialize($map)));
self::storeInCache($roleCacheKey, $cacheRole, $map);
return $map;
}
示例12: array
require_once ROOT_DIR . '/api_v3/bootstrap.php';
PermissionPeer::clearInstancePool();
PermissionItemPeer::clearInstancePool();
//-- Script start
// define all items
$permissionItems = array(array('object' => 'KalturaBaseEntry', 'parameter' => 'startDate', 'action' => ApiParameterPermissionItemAction::INSERT, 'permission' => PermissionName::CONTENT_MANAGE_SCHEDULE), array('object' => 'KalturaBaseEntry', 'parameter' => 'startDate', 'action' => ApiParameterPermissionItemAction::UPDATE, 'permission' => PermissionName::CONTENT_MANAGE_SCHEDULE), array('object' => 'KalturaBaseEntry', 'parameter' => 'endDate', 'action' => ApiParameterPermissionItemAction::INSERT, 'permission' => PermissionName::CONTENT_MANAGE_SCHEDULE), array('object' => 'KalturaBaseEntry', 'parameter' => 'endDate', 'action' => ApiParameterPermissionItemAction::UPDATE, 'permission' => PermissionName::CONTENT_MANAGE_SCHEDULE), array('object' => 'KalturaBaseEntry', 'parameter' => 'accessControlId', 'action' => ApiParameterPermissionItemAction::INSERT, 'permission' => PermissionName::CONTENT_MANAGE_ACCESS_CONTROL), array('object' => 'KalturaBaseEntry', 'parameter' => 'accessControlId', 'action' => ApiParameterPermissionItemAction::UPDATE, 'permission' => PermissionName::CONTENT_MANAGE_ACCESS_CONTROL), array('object' => 'KalturaBaseEntry', 'parameter' => 'categories', 'action' => ApiParameterPermissionItemAction::INSERT, 'permission' => PermissionName::CONTENT_MANAGE_ASSIGN_CATEGORIES . ',' . PermissionName::USER_SESSION_PERMISSION), array('object' => 'KalturaBaseEntry', 'parameter' => 'categories', 'action' => ApiParameterPermissionItemAction::UPDATE, 'permission' => PermissionName::CONTENT_MANAGE_ASSIGN_CATEGORIES . ',' . PermissionName::USER_SESSION_PERMISSION), array('object' => 'KalturaBaseEntry', 'parameter' => 'categoriesIds', 'action' => ApiParameterPermissionItemAction::INSERT, 'permission' => PermissionName::CONTENT_MANAGE_ASSIGN_CATEGORIES . ',' . PermissionName::USER_SESSION_PERMISSION), array('object' => 'KalturaBaseEntry', 'parameter' => 'categoriesIds', 'action' => ApiParameterPermissionItemAction::UPDATE, 'permission' => PermissionName::CONTENT_MANAGE_ASSIGN_CATEGORIES . ',' . PermissionName::USER_SESSION_PERMISSION), array('object' => 'KalturaBaseEntry', 'parameter' => 'name', 'action' => ApiParameterPermissionItemAction::UPDATE, 'permission' => PermissionName::CONTENT_MANAGE_METADATA . ',' . PermissionName::USER_SESSION_PERMISSION . ',' . PermissionName::CONTENT_MODERATE_METADATA), array('object' => 'KalturaBaseEntry', 'parameter' => 'tags', 'action' => ApiParameterPermissionItemAction::UPDATE, 'permission' => PermissionName::CONTENT_MANAGE_METADATA . ',' . PermissionName::USER_SESSION_PERMISSION . ',' . PermissionName::CONTENT_MODERATE_METADATA), array('object' => 'KalturaBaseEntry', 'parameter' => 'description', 'action' => ApiParameterPermissionItemAction::UPDATE, 'permission' => PermissionName::CONTENT_MANAGE_METADATA . ',' . PermissionName::USER_SESSION_PERMISSION . ',' . PermissionName::CONTENT_MODERATE_METADATA), array('object' => 'KalturaLiveStreamAdminEntry', 'parameter' => kApiParameterPermissionItem::ALL_VALUES_IDENTIFIER, 'action' => ApiParameterPermissionItemAction::READ, 'permission' => PermissionName::CONTENT_MANAGE_BASE), array('object' => 'KalturaLiveStreamAdminEntry', 'parameter' => kApiParameterPermissionItem::ALL_VALUES_IDENTIFIER, 'action' => ApiParameterPermissionItemAction::INSERT, 'permission' => PermissionName::CONTENT_MANAGE_BASE), array('object' => 'KalturaLiveStreamAdminEntry', 'parameter' => kApiParameterPermissionItem::ALL_VALUES_IDENTIFIER, 'action' => ApiParameterPermissionItemAction::UPDATE, 'permission' => PermissionName::CONTENT_MANAGE_BASE), array('object' => 'KalturaPartner', 'parameter' => 'secret', 'action' => ApiParameterPermissionItemAction::READ, 'permission' => PermissionName::INTEGRATION_BASE), array('object' => 'KalturaPartner', 'parameter' => 'adminSecret', 'action' => ApiParameterPermissionItemAction::READ, 'permission' => PermissionName::INTEGRATION_BASE));
// add all to required permissions
foreach ($permissionItems as $cur) {
$item = new kApiParameterPermissionItem();
$item->setObject($cur['object']);
$item->setParameter($cur['parameter']);
$item->setAction($cur['action']);
$item->setPartnerId(PartnerPeer::GLOBAL_PARTNER);
$item->save();
$permissions = $cur['permission'];
$permissions = explode(',', $permissions);
foreach ($permissions as $permissionName) {
if (!$permissionName) {
continue;
}
$permission = PermissionPeer::getByNameAndPartner(trim($permissionName), array(PartnerPeer::GLOBAL_PARTNER));
if (!$permission) {
$msg = '***** ERROR - Permission [' . $cur['permission'] . '] not found for item [' . $cur['object'] . '->' . $cur['parameter'] . ']';
KalturaLog::alert($msg);
echo $msg . PHP_EOL;
continue;
}
$permission->addPermissionItem($item->getId());
$permission->save();
}
}
示例13: getNewRole
function getNewRole($oldRoleName, $userRoles)
{
if (!$oldRoleName) {
$oldRoleName = 'guest';
}
if (!isset($userRoles[$oldRoleName])) {
KalturaLog::alert('New role name was not found for old role name [' . $oldRoleName . ']');
return null;
}
$c = new Criteria();
$c->addAnd(UserRolePeer::PARTNER_ID, ADMIN_CONSOLE_PARTNER_ID, Criteria::EQUAL);
$c->addAnd(UserRolePeer::ID, $userRoles[$oldRoleName]->getId(), Criteria::EQUAL);
$c->addAnd(UserRolePeer::TAGS, '%admin_console%', Criteria::LIKE);
UserRolePeer::clearInstancePool();
UserRolePeer::setUseCriteriaFilter(false);
$newRole = UserRolePeer::doSelectOne($c);
UserRolePeer::setUseCriteriaFilter(true);
if (!$newRole) {
KalturaLog::alert('Role with id [' . $userRoles[$oldRoleName]->getId() . '] was not found in DB!');
return null;
}
return $newRole;
}
示例14: fromObject
public function fromObject($source_object)
{
$reflector = KalturaTypeReflectorCacher::get(get_class($this));
foreach ($this->getMapBetweenObjects() as $this_prop => $object_prop) {
if (is_numeric($this_prop)) {
$this_prop = $object_prop;
}
if (array_key_exists($object_prop, $source_object->fields)) {
$value = $source_object->get($object_prop);
$property = $reflector->getProperty($this_prop);
if ($property->isDynamicEnum()) {
$propertyType = $property->getType();
$enumType = call_user_func(array($propertyType, 'getEnumClass'));
$value = kPluginableEnumsManager::coreToApi($enumType, $value);
} elseif ($property->getDynamicType()) {
$propertyType = $property->getDynamicType();
$enumType = call_user_func(array($propertyType, 'getEnumClass'));
$values = explode(',', $value);
$finalValues = array();
foreach ($values as $val) {
$finalValues[] = kPluginableEnumsManager::coreToApi($enumType, $val);
}
$value = implode(',', $finalValues);
}
$this->{$this_prop} = $value;
} else {
KalturaLog::alert("field [{$object_prop}] was not found on filter object class [" . get_class($source_object) . "]");
}
}
$newOrderBy = "";
$orderByMap = $this->getOrderByMap();
if ($orderByMap) {
$orderProps = explode(",", $this->orderBy);
foreach ($orderProps as $prop) {
$key = array_search($prop, $orderByMap);
if ($key !== false) {
$newOrderBy .= $key . ",";
}
}
}
if (strpos($newOrderBy, ",") === strlen($newOrderBy) - 1) {
$newOrderBy = substr($newOrderBy, 0, strlen($newOrderBy) - 1);
}
$this->orderBy = $newOrderBy;
$advancedSearch = $source_object->getAdvancedSearch();
if (is_object($advancedSearch) && $advancedSearch instanceof AdvancedSearchFilterItem) {
$apiClass = $advancedSearch->getKalturaClass();
if (!class_exists($apiClass)) {
KalturaLog::err("Class [{$apiClass}] not found");
} else {
$this->advancedSearch = new $apiClass();
$this->advancedSearch->fromObject($advancedSearch);
}
} else {
KalturaLog::debug("Advanced search not defined");
}
}
示例15: toInsertableObject
public function toInsertableObject($object_to_fill = null, $props_to_skip = array())
{
if (is_null($object_to_fill)) {
KalturaLog::alert("No object returned from toInsertableObject, object_to_fill [" . get_class($object_to_fill) . "], this [" . get_class($this) . "] line [" . __LINE__ . "]");
return null;
}
$dbObject = parent::toInsertableObject($object_to_fill, $props_to_skip);
if (!$dbObject) {
KalturaLog::alert("No object returned from toInsertableObject, object_to_fill [" . get_class($object_to_fill) . "], this [" . get_class($this) . "] line [" . __LINE__ . "]");
return null;
}
$pluginsData = $this->createPluginDataMap();
$dbObject->setPluginsData($pluginsData);
return $dbObject;
}