public function clean() { if (sp_clear_cache()) { $this->success('缓存已清除'); } else { $this->error('缓存清楚失败!'); } }
public function index_post() { $_POST = array_map('trim', I('post.')); if (in_array('', $_POST)) { $this->error("不能留空!"); } $configs['SP_MAIL_ADDRESS'] = $_POST['address']; $configs['SP_MAIL_SENDER'] = $_POST['sender']; $configs['SP_MAIL_SMTP'] = $_POST['smtp']; $configs['SP_MAIL_LOGINNAME'] = $_POST['loginname']; $configs['SP_MAIL_PASSWORD'] = $_POST['password']; $rst = sp_set_dynamic_config($configs); sp_clear_cache(); if ($rst) { $this->success("保存成功!"); } else { $this->error("保存失败!"); } }
public function index() { sp_clear_cache(); $this->success('缓存更新成功', U('Index/index')); }
function sp_set_dynamic_config($data) { if (sp_is_sae()) { $kv = new SaeKV(); $ret = $kv->init(); $configs = $kv->get("THINKCMF_DYNAMIC_CONFIG"); $configs = empty($configs) ? array() : unserialize($configs); $configs = array_merge($configs, $data); $result = $kv->set('THINKCMF_DYNAMIC_CONFIG', serialize($configs)); } elseif (defined('IS_BAE') && IS_BAE) { $bae_mc = new BaeMemcache(); $configs = $bae_mc->get("THINKCMF_DYNAMIC_CONFIG"); $configs = empty($configs) ? array() : unserialize($configs); $configs = array_merge($configs, $data); $result = $bae_mc->set("THINKCMF_DYNAMIC_CONFIG", serialize($configs), MEMCACHE_COMPRESSED, 0); } else { $config_file = "./data/conf/config.php"; if (file_exists($config_file)) { $configs = (include $config_file); } else { $configs = array(); } $configs = array_merge($configs, $data); $result = file_put_contents($config_file, "<?php\treturn " . var_export($configs, true) . ";?>"); } sp_clear_cache(); return $result; }
function clearcache() { sp_clear_cache(); $this->display(); }