Beispiel #1
0
 private static function file($level)
 {
     if ($level > 0x3) {
         return DIR_LOG . Arch_Env::get(Arch_Env::NS) . '.log.wf';
     } else {
         return DIR_LOG . Arch_Env::get(Arch_Env::NS) . '.log';
     }
 }
Beispiel #2
0
 /**
  * 判断配置文件是否存在
  *
  * @param string $file
  * @param boolean $isGlobal
  *
  * @return bool
  */
 public static function isExist($file, $name = null, $isGlobal = false)
 {
     $ns = Arch_Env::get(Arch_Env::NS);
     if (false === $isGlobal && $ns) {
         $file = $ns . '/' . $file;
     }
     $fv = null;
     if (isset(self::$cache[$file]) == false) {
         $f = self::$opt['path'] . $file . '.yaml';
         if (false == is_file($f)) {
             return false;
         }
         self::$cache[$file] = yaml_parse_file($f);
     }
     $fv = self::$cache[$file];
     if ($name === null) {
         return true;
     }
     return isset($fv[$name]);
 }
Beispiel #3
0
 /**
  * * 初始化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'));
 }