public function update() { $conf_res = M("Conf")->where("is_effect = 1 and is_conf = 1")->findAll(); foreach ($conf_res as $k => $v) { conf($v['name'], $_REQUEST[$v['name']]); if ($v['name'] == 'URL_MODEL' && $v['value'] != $_REQUEST[$v['name']]) { clear_dir_file(get_real_path() . "public/runtime/app/data_caches/"); clear_dir_file(get_real_path() . "public/runtime/app/tpl_caches/"); clear_dir_file(get_real_path() . "public/runtime/app/tpl_compiled/"); clear_dir_file(get_real_path() . "public/runtime/app/data_caches/"); clear_dir_file(get_real_path() . "public/runtime/data/page_static_cache/"); clear_dir_file(get_real_path() . "public/runtime/data/dynamic_avatar_cache/"); } } //开始写入配置文件 $sys_configs = M("Conf")->findAll(); $config_str = "<?php\n"; $config_str .= "return array(\n"; foreach ($sys_configs as $k => $v) { $config_str .= "'" . $v['name'] . "'=>'" . addslashes($v['value']) . "',\n"; } $config_str .= ");\n ?>"; $filename = get_real_path() . "public/sys_config.php"; if (!($handle = fopen($filename, 'w'))) { $this->error(l("OPEN_FILE_ERROR") . $filename); } if (fwrite($handle, $config_str) === FALSE) { $this->error(l("WRITE_FILE_ERROR") . $filename); } fclose($handle); save_log(l("CONF_UPDATED"), 1); //clear_cache(); write_timezone(); $this->success(L("UPDATE_SUCCESS")); }
public function clear_image() { set_time_limit(0); es_session::close(); $path = APP_ROOT_PATH . "public/attachment/"; $this->clear_image_file($path); $path = APP_ROOT_PATH . "public/images/"; $this->clear_image_file($path); $qrcode_path = APP_ROOT_PATH . "public/images/qrcode/"; $this->clear_qrcode($qrcode_path); clear_dir_file(get_real_path() . "public/runtime/app/tpl_caches/"); clear_dir_file(get_real_path() . "public/runtime/app/tpl_compiled/"); header("Content-Type:text/html; charset=utf-8"); exit("<div style='line-height:50px; text-align:center; color:#f30;'>" . L('CLEAR_SUCCESS') . "</div><div style='text-align:center;'><input type='button' onclick='\$.weeboxs.close();' class='button' value='关闭' /></div>"); }
private function clear_image_file_fun() { $path = APP_ROOT_PATH . "public/attachment/"; $this->clear_image_file($path); $path = APP_ROOT_PATH . "public/images/"; $this->clear_image_file($path); $qrcode_path = APP_ROOT_PATH . "public/images/qrcode/"; $this->clear_qrcode($qrcode_path); clear_dir_file(get_real_path() . "public/runtime/app/tpl_caches/"); clear_dir_file(get_real_path() . "public/runtime/app/tpl_compiled/"); }
function clear_dir_file($path) { if ($dir = opendir($path)) { while ($file = readdir($dir)) { $check = is_dir($path . $file); if (!$check) { @unlink($path . $file); } else { if ($file != '.' && $file != '..') { clear_dir_file($path . $file . "/"); } } } closedir($dir); rmdir($path); return true; } }
/** +---------------------------------------------------------- * 清除缓存 +---------------------------------------------------------- * @access public +---------------------------------------------------------- * @param string $name 缓存变量名 +---------------------------------------------------------- * @return boolen +---------------------------------------------------------- */ public function clear() { $this->del_name_logs(); $path = $this->dir; clear_dir_file($path); }
public function clear_image() { set_time_limit(0); es_session::close(); $path = APP_ROOT_PATH . "public/attachment/"; $this->clear_image_file($path); $path = APP_ROOT_PATH . "public/images/"; $this->clear_image_file($path); $path = APP_ROOT_PATH . "public/comment/"; $this->clear_image_file($path); $qrcode_path = APP_ROOT_PATH . "public/images/qrcode/"; $this->clear_qrcode($qrcode_path); $GLOBALS['db']->query("update " . DB_PREFIX . "topic set is_cached = 0"); $GLOBALS['db']->query("update " . DB_PREFIX . "supplier_location set dp_group_point = '',tuan_youhui_cache = ''"); $GLOBALS['db']->query("update " . DB_PREFIX . "msg_box set data = ''"); $GLOBALS['cache']->clear(); clear_dir_file(APP_ROOT_PATH . "public/runtime/admin/"); clear_dir_file(APP_ROOT_PATH . "public/runtime/app/"); clear_dir_file(APP_ROOT_PATH . "public/runtime/data/"); clear_dir_file(APP_ROOT_PATH . "public/runtime/iwap/"); clear_dir_file(APP_ROOT_PATH . "public/runtime/wap/"); clear_dir_file(APP_ROOT_PATH . "public/runtime/statics/"); header("Content-Type:text/html; charset=utf-8"); exit("<div style='line-height:50px; text-align:center; color:#f30;'>" . L('CLEAR_SUCCESS') . "</div><div style='text-align:center;'><input type='button' onclick='\$.weeboxs.close();' class='button' value='关闭' /></div>"); }
public function update_commossion() { $conf_res = M("Conf")->where("is_effect = 1 and name in ('INVESTORS_COMMISSION_RATIO','BORROWER_COMMISSION_RATIO')")->findAll(); foreach ($conf_res as $k => $v) { conf($v['name'], floatval(strim($_REQUEST[$v['name']]))); if ($v['name'] == 'URL_MODEL' && $v['value'] != $_REQUEST[$v['name']]) { clear_auto_cache("byouhui_filter_nav_cache"); clear_auto_cache("cache_shop_acate_tree"); clear_auto_cache("cache_shop_cate_tree"); clear_auto_cache("cache_youhui_cate_tree"); clear_auto_cache("city_list_result"); clear_auto_cache("fyouhui_filter_nav_cache"); clear_auto_cache("get_help_cache"); clear_auto_cache("page_image"); clear_auto_cache("tuan_filter_nav_cache"); clear_auto_cache("youhui_page_recommend_youhui_list"); clear_auto_cache("ytuan_filter_nav_cache"); clear_auto_cache("store_filter_nav_cache"); clear_dir_file(get_real_path() . "public/runtime/app/data_caches/"); clear_dir_file(get_real_path() . "public/runtime/app/tpl_caches/"); clear_dir_file(get_real_path() . "public/runtime/app/tpl_compiled/"); clear_dir_file(get_real_path() . "public/runtime/app/data_caches/"); clear_dir_file(get_real_path() . "public/runtime/data/page_static_cache/"); clear_dir_file(get_real_path() . "public/runtime/data/dynamic_avatar_cache/"); } } //开始写入配置文件 $sys_configs = M("Conf")->findAll(); $config_str = "<?php\n"; $config_str .= "return array(\n"; foreach ($sys_configs as $k => $v) { $config_str .= "'" . $v['name'] . "'=>'" . addslashes($v['value']) . "',\n"; } $config_str .= ");\n ?>"; $filename = get_real_path() . "public/sys_config.php"; if (!($handle = fopen($filename, 'w'))) { $this->error(l("OPEN_FILE_ERROR") . $filename); } if (fwrite($handle, $config_str) === FALSE) { $this->error(l("WRITE_FILE_ERROR") . $filename); } fclose($handle); save_log(l("CONF_UPDATED"), 1); //clear_cache(); write_timezone(); $this->success(L("UPDATE_SUCCESS")); }