public function __construct() { if (Arch_Yaml::isExist('arch', 'id')) { $this->opt = Arch_Yaml::get('arch', 'id'); } else { $this->opt = Core_Conf::getConf('arch:id'); } $this->db = Blue_DB::instance($this->opt['db']); }
private function __construct($ins) { $this->ins = new Memcached(); try { $ini = Arch_Yaml::get('mc', $ins, true); } catch (Core_Exception $e) { $ini = Core_Conf::getConf('memcache:' . $ins); } $this->ins->addServer($ini['host'], $ini['port']); $this->ins->setOption(Memcached::OPT_BINARY_PROTOCOL, true); //$this->ins->setSaslAuthData('53359429868211e4', 'd1ef_6f86'); }
private static function getConf() { if (Arch_Yaml::isExist('blue')) { $ini = Arch_Yaml::get('blue', 'passport'); } else { $ini = Core_Conf::getConf('blue:passport'); } if (empty($ini)) { throw new Blue_Exception_Fatal("配置blue.ini=>passport不存在"); } return $ini; }
public static function getInstance($ini) { if (Arch_Yaml::get('oss', $ini, true)) { $conf = Arch_Yaml::get('oss', $ini, true); } else { $conf = Core_Conf::getConf('oss:' . $ini); } if (empty($conf)) { throw new Blue_Exception_Fatal("Conf oss:{$ini} is empty"); } return new Arch_Oss($conf['ak'], $conf['sk'], $conf['host'], $conf['bucket'], $conf['ns'], $conf['cdn']); }
private function getSmartyIns($data) { $ins = new Smarty(); $ins->setTemplateDir(PDP_APP_VIEW); //views $ins->setCompileDir(PDP_APP_DATA . '/smarty'); //判断是否有smarty常量需要写入 $ini = Core_Conf::getConf('smarty'); if (is_array($ini) && isset($ini['const'])) { $data['CONST'] = $ini['const']; } if (!empty($data)) { if (isset($ini['config']) && $ini['config']['debug']) { $data['SMARTY_DEBUG'] = $data; } $ins->assign($data); } return $ins; }
/** * 获取基础配置 * * @return array */ private static function getConf() { return Core_Conf::getGlobalConf('arch:id'); }
public static function init($opt = array()) { self::$opt = array_merge(self::$opt, $opt); }
/** * * 初始化APP的数据 * * * * @param string $app 启用的app的名称,如:test * */ private static function initApp($app) { if (empty($app)) { exit('App must not be empty'); } define('PDP_APP', $app); define('PDP_APP_ROOT', DIR_APP . '/' . PDP_APP); define('PDP_APP_LIB', PDP_APP_ROOT . '/library'); define('PDP_APP_VIEW', PDP_APP_ROOT . '/views'); define('PDP_APP_DATA', PDP_ROOT . '/data/app/' . PDP_APP); //声明loader Yaf_Loader::getInstance(PDP_APP_LIB, PDP_ROOT_PHPLIB); Arch_Env::set(Arch_Env::NS, PDP_APP); $config = array("application" => array("directory" => PDP_APP_ROOT, 'library' => PDP_APP_LIB, 'baseUri' => '/' . $app)); self::$app = new Yaf_Application($config); //增加日志初始化 Core_Conf::init(array('path' => PDP_DIR_CONF . '/')); //增加日志的初始化 Core_Log::init(array('path' => PDP_DIR_LOG . '/' . PDP_APP . '/', 'file' => PDP_APP . '.log')); }