/** * @brief 取得app相关配置文档 * * @param $confItem 配置所在路径 * @return success-array或者string failed-false * @retval array/boolean * @author chenyijie * @date 2012/09/27 17:20:22 **/ protected function _getConf($confRoute) { $conf = Bd_Conf::getAppConf($confRoute, Bd_AppEnv::getCurrApp()); if ($conf === false) { $arrErr = array('caller' => 'CacheProxy', 'class' => get_class($this->objClass)); Bd_Log::warning("Get config from config file: " . $confRoute . " failed.", self::GET_CONF_FAILED, $arrErr); self::$errCode = self::GET_CONF_FAILED; } return $conf; }
public static function getLogPrefix() { if (defined('IS_ODP') && IS_ODP == true) { return Bd_AppEnv::getCurrApp(); } else { if (defined('MODULE')) { return MODULE; } else { return 'unknow'; } } }
/** * @brief 打印监控信息至log文件 * * @return public function * @retval * @see * @note * @author luhaixia * @date 2012/05/02 17:59:04 oonst MAXLOGNUM = 100; **/ public static function dumpProfInfo() { if (!self::$writeLog) { self::$profInfo = array(); return true; } $arrLogInfo = array(); foreach (self::$profInfo as $info) { $module = $info['module']; if (isset($arrLogInfo[$module])) { $logStr = $arrLogInfo[$module]; } else { $logStr = ''; } $logStr .= self::_getLogString($info); $arrLogInfo[$module] = $logStr; } foreach ($arrLogInfo as $module => $logStr) { $fileName = Bd_AppEnv::getEnv('log', $module) . '/' . $module . '.profiler'; self::_writeLog($fileName, $logStr); } self::$profInfo = array(); return true; }
public static function setCurrApp($app = null) { $strPrevApp = self::$strCurrApp; self::$strCurrApp = empty($app) ? MAIN_APP : $app; return $strPrevApp; }
/** * @brief 全局初始化接口 * * @return success-true failed-false * @retval boolean * @see getCasInit() * @note 这个函数修改了session的存储文件路径为/odp/data/phpcas,并关闭了phpCAS第三方库本身的日志 * @note 在一个CGI中phpCAS client对象只能被初始化一次,因此设置$isCasClientInit属性用来控制 * @author chenyijie * @date 2012/09/28 22:28:43 **/ private static function init() { if (self::$isCasClientInit) { return true; } if (!self::getCasInit()) { Bd_Log::warning('UUAP CAS protocol init failed'); return false; } $link = self::$arrConf['Server'][0]['Hostname']; $port = self::$arrConf['DefaultPort']; if (defined("IS_ODP")) { $path = Bd_AppEnv::getEnv('data'); $path = dirname(dirname($path)) . '/phpcas/'; session_save_path($path); } phpCAS::setDebug(''); phpCAS::client(CAS_VERSION_2_0, $link, intval($port), ''); phpCAS::setNoCasServerValidation(); phpCAS::handleLogoutRequests(false); self::$isCasClientInit = true; return true; }
protected function _ralExecute($arrInput) { //ral_set_logid(LOG_ID); ral_set_log(4, Bd_AppEnv::getCurrApp()); ral_set_pathinfo($arrInput['pathinfo']); ral_set_querystring($arrInput['querystring']); ral_set_useragent('ral spider'); /* //ral_set_header("Cookie:".$strCookie);这个接口不会reset出出现head过大而报错问题,有需要再升级 $arrCookie = array(); if (is_array($_COOKIE) && count($_COOKIE) > 0) { foreach($_COOKIE as $key => $value) { if ($key != "LITE_DEBUG") { $arrCookie[] = "$key=".$value; } } } $strCookie = implode(";", $arrCookie); ral_set_header("Cookie:".$strCookie); */ if (count($arrInput['post']) <= 0) { $arrInput['post']['time'] = time(); } $content = ral($this->service, __FUNCTION__, http_build_query($arrInput['post']), rand()); if ($content == false) { Bd_Log::warning("ral execute [" . $this->service . "] failed param[" . var_export($arrInput, true) . "]"); } return $content; }
public static function getAppConf($strItem, $strValuePath) { $strItemPath = '/app/' . Bd_AppEnv::getCurrApp() . '/' . $strItem; $arrRes = self::getConf($strItemPath, $strValuePath); return $arrRes; }
private static function initAp() { // 读取App的ap框架配置 require_once LIB_PATH . '/bd/Conf.php'; $ap_conf = Bd_Conf::getAppConf('ap'); // 设置代码目录,其他使用默认或配置值 $ap_conf['directory'] = Bd_AppEnv::getEnv('code'); // 生成ap实例 $app = new Ap_Application(array('ap' => $ap_conf)); return true; }
public static function getAppConf($item = null, $app = null) { //和ODP环境解耦 if (!defined('IS_ODP')) { return self::getConf($item); } $conf_path = Bd_AppEnv::getEnv('conf', $app); if (!empty($item)) { $conf_path .= "/{$item}"; } return self::getConf($conf_path); }