本文整理汇总了PHP中CLog::fatal方法的典型用法代码示例。如果您正苦于以下问题:PHP CLog::fatal方法的具体用法?PHP CLog::fatal怎么用?PHP CLog::fatal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLog
的用法示例。
在下文中一共展示了CLog::fatal方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: templateBack
/**
* 模板回退,重新加载相应的模板配置
* @param unknown_type $data
* @param unknown_type $strBakTemplateType 需要回退到的模板类型 默认baidu
* @param unknown_type $strBakTemplateName 需要回退到的模板名字 默认baidu
*/
public static function templateBack(&$data, $strBakTemplateType = 'baidu', $strBakTemplateName = 'baidu')
{
$data['uiControl']['templateType'] = $strBakTemplateType;
$data['uiControl']['templateName'] = $strBakTemplateName;
$data['uiControl']['oriTplName'] = $strBakTemplateName;
$GLOBALS['logArr']['templateType'] = $data['uiControl']['templateType'];
$GLOBALS['logArr']['templateName'] = $data['uiControl']['templateName'];
$objTemplateSelector = new TemplateSelector();
$bolRet = $objTemplateSelector->getUserInfo($data);
if ($bolRet == false) {
$status = $GLOBALS['STATUS_CODE']['TPL_SELECT_FAIL'];
CLog::fatal($GLOBALS['STATUS_MSG'][$status], $status, $GLOBALS['logArr']);
$result['status'] = $status;
return false;
}
$arrTplConfig = $objTemplateSelector->getTplConfig($data['uiControl']['tplConfigPath']);
if (!is_array($arrTplConfig) || empty($arrTplConfig) || count($arrTplConfig) <= 0) {
$status = $GLOBALS['STATUS_CODE']['TPL_SELECT_FAIL'];
CLog::fatal($GLOBALS['STATUS_MSG'][$status], $status, $GLOBALS['logArr']);
return $status;
}
// 处理首页模板
if ($data['uiControl']['templateSwitch'] == 2) {
$arrFrontPage = Bd_Conf::getConf('/baidu/');
if (!empty($arrFrontPage) && is_array($arrFrontPage)) {
foreach ($arrFrontPage as $key => $value) {
$arrTplConfig[$key] = $value;
}
}
}
// 解析模板配置项
$objTemplateSelector->parseTplConfig($data, $arrTplConfig);
unset($arrData['uiControl']['tplConfigPath']);
unset($arrData['uiControl']['tplConfigName']);
unset($arrData['uiControl']['tplConfigType']);
return true;
}
示例2: queryFromUs
//.........这里部分代码省略.........
$objQuery->platformName = $arrControlInfo['platform'];
$objQuery->is_bws_re = $arrQueryInfo['is_bws_re'];
$objQuery->useragent_full = $arrQueryInfo['useragent_full'];
$objQuery->confuse_Switch = $arrQueryInfo['confuse_Switch'];
$objQuery->protectNum = $arrQueryInfo['protectNum'];
$objQuery->ec_src = $arrQueryInfo['ec_src'];
$objQuery->php_default_platform = $GLOBALS['DEFAULT_PLATFORM'];
$objQuery->dspName = $arrQueryInfo['dspName'];
$objQuery->ipv6Address = $arrQueryInfo['ipv6Address'];
$objQuery->refer = $arrQueryInfo['refer'];
$objQuery->needProtect = $arrQueryInfo['needProtect'];
$objQuery->protectPPSwitch = $arrQueryInfo['protectPPSwitch'];
$objQuery->nojc = $arrQueryInfo['nojc'];
$objQuery->super_se_flag = $arrQueryInfo['superSeFlag'];
$objQuery->isContainPunc = $arrQueryInfo['isContainPunc'];
$objQuery->wordNoPunc = $arrQueryInfo['wordNoPunc'];
$objQuery->clusterMod = $arrQueryInfo['clusterMod'];
$objQuery->wordEnc = $arrQueryInfo['wordEnc'];
$objQuery->extraStr = $arrQueryInfo['extraStr'];
$objQuery->strategy_state = $arrQueryInfo['strategyState'];
$objQuery->prompt_flag = $arrQueryInfo['promptUsOpen'];
$objQuery->passport_user_id = $arrSessionInfo['passportUserId'];
$objQuery->need_interleaving = $arrQueryInfo['need_interleaving'];
$objQuery->comeFrom = $arrQueryInfo['comeFrom'];
if (!empty($arrQueryInfo['country'])) {
$objQuery->country_str = $arrQueryInfo['country'];
}
$objQuery->is_sample_template = isset($arrQueryInfo['is_sample_template']) ? intval($arrQueryInfo['is_sample_template']) : 0;
$objQuery->superseSwitch = isset($arrQueryInfo['superseSwitch']) ? intval($arrQueryInfo['superseSwitch']) : 1;
$objQuery->query_lang = $arrQueryInfo['query_lang'];
$objQuery->displayLang = $arrControlInfo['language'];
if (isset($arrQueryInfo['isParams'])) {
if ($arrQueryInfo['isParams']['mod'] === IS_PRE_DICT_REQ) {
if (!empty($arrQueryInfo['isParams']['hsug'])) {
$objQuery->hsug = $arrQueryInfo['isParams']['hsug'];
}
if (!empty($arrQueryInfo['isParams']['sug'])) {
$objQuery->sug = $arrQueryInfo['isParams']['sug'];
}
if (!empty($arrQueryInfo['isParams']['clist'])) {
$objQuery->clist = $arrQueryInfo['isParams']['clist'];
}
}
$objQuery->mod = $arrQueryInfo['isParams']['mod'];
$objQuery->cqid = empty($arrQueryInfo['isParams']['cqid']) ? '0' : $arrQueryInfo['isParams']['cqid'];
$objQuery->isid = empty($arrQueryInfo['isParams']['isid']) ? '0' : $arrQueryInfo['isParams']['isid'];
$objQuery->chk = empty($arrQueryInfo['isParams']['chk']) ? '0' : $arrQueryInfo['isParams']['chk'];
if (in_array($objQuery->mod, array(IS_PRE_REQ, IS_PRE_DICT_REQ)) && in_array($objQuery->word, array('baidu', '百度'))) {
$objQuery->f4s = 1;
} else {
$objQuery->f4s = $arrQueryInfo['isParams']['f4s'];
}
$objQuery->isbd = $arrQueryInfo['isParams']['isbd'];
$objQuery->csq = intval($arrQueryInfo['isParams']['csq']);
$objQuery->pstg = intval($arrQueryInfo['isParams']['pstg']);
$objQuery->isDebugSwitch = intval($arrQueryInfo['isDebugSwitch']);
}
// User Agent相关字段, by chenjinsheng@baidu.com, 2013-07-08
if (!empty($arrQueryInfo['userAgent'])) {
list($resx, $resy) = @explode('x', $arrQueryInfo['userAgent']['resolution']);
$arrUaInfo = array('ua_os' => $arrQueryInfo['userAgent']['os'], 'ua_browser' => $arrQueryInfo['userAgent']['browser'], 'ua_modal' => $arrQueryInfo['userAgent']['modal'], 'ua_measure' => $arrQueryInfo['userAgent']['measure'], 'ua_res_x' => $resx, 'ua_res_y' => $resy);
$arrExpFields = Bd_Conf::getConf('tpl_uaadaptation/UA_DICT_EXPLICIT');
$arrExpFields = array_keys($arrExpFields);
foreach ($arrExpFields as $filed) {
unset($arrQueryInfo['userAgent'][$filed]);
}
if (!empty($arrQueryInfo['userAgent'])) {
$objUaFields = Util::mcpack_normal($arrQueryInfo['userAgent']);
$strUaFields = mc_pack_array2pack($objUaFields);
$arrUaInfo['ua_ext'] = $strUaFields;
}
$objQuery->uaInfo = $arrUaInfo;
}
$arrQuery = $objQuery->toArray();
$arrQuery = Util::mcpack_normal($arrQuery);
foreach ($arrQuery as $key => $value) {
if (in_array($key, array('cookie', 'beforeUrl', 'UrlParaPack', 'JpAlaPre'))) {
$arrQuery['(raw)' . $key] = $value;
unset($arrQuery[$key]);
}
}
if (!isset($_ENV['HHVM'])) {
ral_set_logid(CLog::logId());
$ret = ral('us', 'us', $arrQuery, Volatile::rand());
if ($ret === false) {
$intErrno = ral_get_errno();
CLog::fatal('Fail to connect us, errNo:' . $intErrno, $GLOBALS['logArr']);
}
} else {
$ral = new RalClass();
$ral->ral_set_logid(CLog::logId());
$ret = $ral->ral('us', 'us', $arrQuery, Volatile::rand());
if ($ret === false) {
$intErrno = $ral->ral_get_errno();
$strErrmsg = $ral->ral_get_error($intErrno);
CLog::fatal('Fail to connect us, errNo:' . $intErrno . 'errMsg: ' . $strErrmsg, $GLOBALS['logArr']);
}
}
return $ret;
}
示例3: load_conf
/**
* load configure file
*/
function load_conf($dir)
{
/**
* load configure file
*/
//if (Util::getConf('/feature', 'FEATURE_LIST/CONFIG2BDCONF/TURN') !== 'ON') {
// $conf = config_load($dir, "vui-global.conf", "view-ui.range");
//} else {
$conf = Bd_Conf::getConf('/vui-global');
//}
if (false === $conf) {
/**
* default log config
*/
$GLOBALS['LOG'] = array('intLevel' => 0x4, 'strLogFile' => VUI_LOG_PATH . '/view-ui.log');
return false;
}
/**
* assign configure value
*/
foreach ($conf as $key => $value) {
$GLOBALS[$key] = $value;
}
/**
* strLogName
*/
if (empty($GLOBALS['LOG']['strLogName'])) {
$GLOBALS['LOG']['strLogName'] = "view-ui.log";
}
$GLOBALS['LOG']['strLogFile'] = VUI_LOG_PATH . "/" . $GLOBALS['LOG']['strLogName'];
/**
* ui encoding
*/
if (empty($GLOBALS['UI_ENCODING'])) {
$status = $GLOBALS['STATUS_CODE']['INIT_FAIL'];
CLog::fatal($GLOBALS['STATUS_MSG'][$status] . ", UI_ENCODING cannot be empty", $status);
return false;
}
/**
* request type
*/
if (empty($GLOBALS['REQUEST_TYPE']) || !is_array($GLOBALS['REQUEST_TYPE'])) {
$status = $GLOBALS['STATUS_CODE']['INIT_FAIL'];
CLog::fatal($GLOBALS['STATUS_MSG'][$status] . ", REQUEST_TYPE cannot be empty", $status);
return false;
}
/**
* badiu page's mini size
*/
if (empty($GLOBALS['MINI_BAIDU_PSIZE']) || intval($GLOBALS['MINI_BAIDU_PSIZE']) <= 0) {
$status = $GLOBALS['STATUS_CODE']['INIT_FAIL'];
$invalid_mini_psize = $GLOBALS['MINI_BAIDU_PSIZE'];
$default_mini_psize = 10;
$GLOBALS['MINI_BAIDU_PSIZE'] = $default_mini_psize;
CLog::warning($GLOBALS['STATUS_MSG'][$status] . ", MINI_BAIDU_PSIZE[{$invalid_mini_psize}] is not valid, and set to " . $GLOBALS['MINI_BAIDU_PSIZE'], $status);
}
/**
* aladdin template type
*/
if (empty($GLOBALS['ALADDIN_TEMPLATE_TYPE'])) {
$status = $GLOBALS['STATUS_CODE']['INIT_FAIL'];
CLog::fatal($GLOBALS['STATUS_MSG'][$status] . ", ALADDIN_TEMPLATE_TYPE cannot be empty", $status);
return false;
}
if (!defined("VUI_TEMPLATE_ALADDIN_TEMPLATE_TYPE")) {
define("VUI_TEMPLATE_ALADDIN_TEMPLATE_TYPE", $GLOBALS['ALADDIN_TEMPLATE_TYPE']);
} else {
$status = $GLOBALS['STATUS_CODE']['INIT_FAIL'];
CLog::warning($GLOBALS['STATUS_MSG'][$status] . ", ALADDIN_TEMPLATE_TYPE is already defined:" . ALADDIN_TEMPLATE_TYPE, $status, $GLOBALS['logArr']);
return false;
}
//load STRATEGY
if (!empty($GLOBALS['STRATEGY']['USE_STRATEGY'])) {
$strategys = explode(',', $GLOBALS['STRATEGY']['USE_STRATEGY']);
$use_strategys = array();
foreach ($strategys as $key => $value) {
$strategy = "STRATEGY" . $value;
if (!empty($GLOBALS[$strategy]['STRATEGY_NAME']) && !empty($GLOBALS[$strategy]['STRATEGY_FUNCTION'])) {
if (!strncmp($GLOBALS[$strategy]['STRATEGY_FUNCTION'], "strategy_function", strlen("strategy_function")) && function_exists($GLOBALS[$strategy]['STRATEGY_FUNCTION'])) {
//load STRATEGY1
if ($value == 1) {
if (!empty($GLOBALS[$strategy])) {
$template_interfere = array();
if (!empty($GLOBALS[$strategy]['TEMPLATE_INTERFERE']) && is_array($GLOBALS[$strategy]['TEMPLATE_INTERFERE'])) {
foreach ($GLOBALS[$strategy]['TEMPLATE_INTERFERE'] as $k => $v) {
$interfere_pair = explode("->", $v);
$template_interfere[$k]['left'] = $interfere_pair[0];
$template_interfere[$k]['right'] = $interfere_pair[1];
$template_interfere[$k]['default'] = $interfere_pair[2];
}
}
$GLOBALS[$strategy]['TEMPLATE_INTERFERE'] = $template_interfere;
$use_strategys[] = $value;
} else {
$status = $GLOBALS['STATUS_CODE']['INIT_FAIL'];
CLog::warning($GLOBALS['STATUS_MSG'][$status] . ", USE_STRATEGY {$value} cannot be empty", $status);
}
//.........这里部分代码省略.........