public function selectStyle() { $dir_name = Q("dirName"); if ($dir_name) { import('Config.Model.ConfigModel'); $Model = K("Config"); $Model->where("name='WEB_STYLE'")->save(array("value" => $dir_name)); //更新配置文件 $Model->updateCache(); //删除前台编译文件 is_dir("./temp/hdcms/Content/Compile") and Dir::del("./temp/hdcms/Content/Compile"); //删除编译文件 is_dir('temp/Hdcms/Index') and dir::del('temp/Hdcms/Index'); $this->success('操作成功'); } }
public function select_style() { $dir_name = Q("dir_name"); if ($dir_name) { import('Config.Model.ConfigModel'); $db = K("config"); K("config")->join()->where("name='WEB_STYLE'")->save(array("value" => $dir_name)); //更新配置文件 $db->update_config_file(); //删除前台编译文件 is_dir("./temp/hdcms/Content/Compile") and Dir::del("./temp/hdcms/Content/Compile"); //删除编译文件 is_dir('temp/Hdcms/Index') and dir::del('temp/Hdcms/Index'); $this->ajax(array('state' => 1, 'message' => '操作成功')); } }
/** * 删除编译模板,格式:应用/控制器/方法 * @param type $path */ function delCompileTpl($path) { $path_array = explode('/', trim($path, '/')); $path_nums = count($path_array); switch ($path_nums) { case 1: $temp = APP_GROUP . '_G/' . $path_array[0]; break; case 3: $temp = APP_GROUP . '_G/' . $path_array[0] . '_A/' . $path_array[1] . '_C/' . $path_array[2]; break; default: break; } $path = PATH_TEMP . '/Applications/' . $temp; dir::del($path); }
public function delAll() { return dir::del(PATH_APP); }
public function delBackUp() { foreach ($_POST['folder'] as $folder) { dir::del(PATH_ROOT . '/caches/db/' . $folder); } echo 1; exit; }
public function uninstall() { $plugin = Q('plugin', null); if (!$plugin) { $this->error('参数错误'); exit; } if (IS_POST) { $uninstallSql = "hd/Plugin/{$plugin}/Data/uninstall.sql"; if (is_file($uninstallSql)) { $sqls = explode(';', file_get_contents($uninstallSql)); if (!empty($sqls) && is_array($sqls)) { foreach ($sqls as $sql) { $sql = trim($sql); if (empty($sql)) { continue; } if (!M()->exe($sql)) { $this->error('执行SQL失败'); } } } else { $this->error('卸载SQL文件错误'); } } //删除Plugin表信息 $this->_db->del("app='{$plugin}'"); //删除插件菜单信息 M('node')->where(array('app_group' => 'Plugin', 'app' => $plugin))->del(); $NodeModel = K('Node'); $NodeModel->updateCache(); //删除文件 if (Q('del_dir')) { if (!dir::del('hd/Plugin/' . $plugin)) { $this->error('插件目录删除失败'); } } $this->success('插件卸载成功'); } else { //分配配置项 $field = array_change_key_case_d(require 'hd/Plugin/' . $plugin . '/Config/config.php'); $field['plugin'] = $plugin; $this->assign("field", $field); $this->display(); } }
/** * 删除表态文件 * @param void $name 目录名或者HTML文件 * @return boolean */ public function del($name) { if (is_array($name)) { foreach ($name as $v) { if (is_file($v)) { unlink($v); continue; } dir::del($v); } } else { if (is_file($name)) { unlink($name); } else { dir::del($name); } } return true; }
function update_cache() { if (dir::del(PATH_TEMP . '/Applications')) { $this->success("缓存目录已经全部删除成功"); } }