Esempio n. 1
0
 /**
  * 创建配置文件目录
  * @return bool
  */
 private static function is_create_confg_dir()
 {
     if ($env = Config::get('sys@environment')) {
         //merge in config array
         //            $oneEnv = array_merge_one($env);
         //            $osName = getMachineName();
         $configDir = Config::get('sys@config_dir');
         // 总目录
         is_create_dir($configDir);
         foreach ($env as $k => $v) {
             // 不是数字类型执行
             if (!is_numeric($k)) {
                 // 创建配置目录
                 if (!is_dir($configDir . $k)) {
                     if ($k) {
                         is_create_dir($configDir . $k);
                     }
                 }
             } else {
                 return true;
             }
             //end for
         }
         return true;
     }
 }
Esempio n. 2
0
 /**
  * @see Cache#_connect()
  */
 public function __construct()
 {
     if ($this->_memcache !== null) {
         return $this->_memcache;
     }
     if (!extension_loaded('memcache')) {
         throw new UpaddException('Load memcache extension failure!');
     }
     $this->config = Configuration::get('tag@memcache');
     $this->connect();
 }
Esempio n. 3
0
 public static function __callStatic($method, $parameters)
 {
     if ($method == 'redis') {
         if (Configuration::get('sys@is_use_redis')) {
             return new getRedis();
         }
     }
     if ($method == 'memcache') {
         if (Configuration::get('sys@is_use_memcache')) {
             return new getMemcache();
         }
     }
 }
Esempio n. 4
0
 /**
  * 判断系统目录是否存在
  */
 public function is_dir()
 {
     $this->system_dir = Configuration::get('sys@system_dir');
     is_create_dir($this->system_dir);
 }
Esempio n. 5
0
 /**
  * 链接
  */
 protected function connect()
 {
     $config = Configuration::get('tag@redis');
     $this->redis = new \Redis();
     $this->redis->connect($config['host'], $config['port']);
 }
Esempio n. 6
0
 /**
  * 调用配置数组参数
  * @param string $name
  * @param string $val
  * @return string
  */
 function conf($key)
 {
     return \Upadd\Bin\Config\Configuration::get($key);
 }