Exemplo n.º 1
0
 public function get_conf($key)
 {
     if (!isset($this->__app_conf[$key])) {
         $val = syscache::instance('setting')->get('setting/' . $this->app->app_id . '-' . $key);
         $app_setting = $this->source();
         if ($val === null) {
             if (!is_null($app_setting) && isset($app_setting[$key]['default'])) {
                 $val = $app_setting[$key]['default'];
                 //$this->set_conf($key, $val);
             } else {
                 return null;
             }
         }
         $this->__app_conf[$key] = $val;
     }
     return $this->__app_conf[$key];
 }
Exemplo n.º 2
0
 function clear_by_app($app_id)
 {
     if (!$app_id) {
         return false;
     }
     $to_remove = array();
     $service_list = app::get('base')->model('app_content')->getlist('content_name,content_path,app_id', array('app_id' => $app_id, 'content_type' => 'service'));
     foreach ($service_list as $service) {
         $to_remove[$service['content_name']][] = $service['content_path'];
     }
     foreach ($to_remove as $service_name => $rows) {
         if (base_kvstore::instance('service')->fetch($service_name, $service_define)) {
             foreach ($rows as $row) {
                 unset($service_define['list'][$row]);
             }
             base_kvstore::instance('service')->store($service_name, $service_define);
         }
     }
     app::get('base')->model('app_content')->delete(array('app_id' => $app_id, 'content_type' => 'service'));
     app::get('base')->model('app_content')->delete(array('app_id' => $app_id, 'content_type' => 'service_category'));
     //更新service资源最后变更时间
     syscache::instance('service')->set_last_modify();
 }
Exemplo n.º 3
0
 public function clean_syscache($k)
 {
     $this->begin('index.php?app=desktop&ctl=cachestage');
     switch ($k) {
         case 'setting_cache':
             $this->end(syscache::instance('setting')->set_last_modify());
             break;
         case 'service_cache':
             $this->end(syscache::instance('service')->set_last_modify());
             break;
     }
 }
Exemplo n.º 4
0
 public function set_modified($key)
 {
     $vary_name = strtoupper(md5($this->app_id . $key));
     cachemgr::set_modified('CONF', $vary_name, syscache::instance('setting')->set_last_modify());
 }
Exemplo n.º 5
0
 static function servicelist($srv_name, $filter = null)
 {
     if (self::is_online()) {
         $service_define = syscache::instance('service')->get($srv_name);
         if (!is_null($service_define)) {
             return new service($service_define, $filter);
         } else {
             return new ArrayIterator(array());
         }
     }
     return new ArrayIterator(array());
 }
Exemplo n.º 6
0
 public function testGet()
 {
     echo 999;
     var_dump(syscache::instance('setting')->get('setting/site-sitemaps'));
 }
Exemplo n.º 7
0
 static function servicelist($srv_name, $filter = null)
 {
     if (self::is_online()) {
         $service_define = syscache::instance('service')->get($srv_name);
         if (!is_null($service_define)) {
             return new service($service_define, $filter);
         } else {
             return new ArrayIterator(array());
         }
         /*
         if(!isset(self::$__service[$srv_name])){
         				if(base_kvstore::instance('service')->fetch($srv_name,$service_define)){
         					self::$__service[$srv_name] = new service($service_define,$filter);
         					return self::$__service[$srv_name];
         				}
         			}else{
         				return self::$__service[$srv_name];
         			}
         */
     }
     return new ArrayIterator(array());
 }
Exemplo n.º 8
0
Arquivo: app.php Projeto: noikiy/snk
 public function set_modified($key)
 {
     $vary_name = strtoupper(md5($this->app_id . $key));
     $now = time();
     $db = vmc::database();
     $exec_count = $db->exec('REPLACE INTO vmc_base_cache_expires (`type`, `name`, `app`, `expire`) VALUES ("CONF", "' . $vary_name . '", "' . $this->app_id . '", ' . $now . ')', true);
     if ($exec_count) {
         cachemgr::set_modified('CONF', $vary_name, $now);
         syscache::instance('setting')->set_last_modify();
     }
 }
Exemplo n.º 9
0
 public function testGetOne()
 {
     var_dump(syscache::instance('setting')->get('setting/site-current_theme'));
 }
Exemplo n.º 10
0
 public function setConf($key, $value)
 {
     if ($this->setting()->set_conf($key, $value)) {
         syscache::instance('setting')->set_last_modify();
         return true;
     } else {
         return false;
     }
 }