function Cache() { delFileUnderDir('./Runtime'); $return[] = array('text' => '返回首页', 'link' => U('Index/index')); $this->assign('return', $return); $this->success('更新缓存成功!'); }
function delFileUnderDir($dirName) { if ($handle = opendir("{$dirName}")) { while (false !== ($item = readdir($handle))) { if ($item != "." && $item != "..") { if (is_dir("{$dirName}/{$item}")) { delFileUnderDir("{$dirName}/{$item}"); } else { if (unlink("{$dirName}/{$item}")) { echo "成功删除文件: {$dirName}/{$item}<br />\n"; } } } } closedir($handle); } unset($handle); }
} break; case 'editgroup': $groupId = $_POST['egid']; $groupName = $_POST['egname']; $groupPolicy = $_POST['epolicy']; $sql = "UPDATE `sd_usergroup` SET `gname` = '{$groupName}',`policyid` = '{$groupPolicy}' WHERE `id` = '{$groupId}'"; if (mysqli_query($con, $sql)) { echo "ok|成功"; } else { echo "bad|" . "无法修改数据表"; } break; case 'cleantemp': delFileUnderDir("../views/content/templates_c"); delFileUnderDir("../content/templates_c"); echo "ok|ok"; break; case 'cleanfile': $cha = "SELECT * FROM `sd_file` WHERE `cishuo` = '1' "; $cha_result = mysqli_query($con, $cha); $jinri1 = mysqli_num_rows($cha_result); $shanchu = "delete from sd_file where cishuo = '1'"; if (mysqli_query($con, $shanchu)) { echo "ok|" . $jinri1; } else { echo "bad|无法删除数据"; } break; case 'cleansql': $ju = "OPTIMIZE TABLE `sd_file`, `sd_policy`, `sd_setting`, `sd_ss`, `sd_sskey`, `sd_user`, `sd_usergroup`, `sd_users`";
function delFileUnderDir($directory) { if (is_dir($directory) == false) { //exit("The Directory Is Not Exist!"); return false; } $handle = opendir($directory); while (($file = readdir($handle)) !== false) { if ($file != "." && $file != "..") { if (is_dir("{$directory}/{$file}")) { delFileUnderDir("{$directory}/{$file}"); } else { unlink("{$directory}/{$file}"); } } } closedir($handle); }
break; case 'data': $f = MAC_ROOT . '/cache/cache_data.lock'; if (file_exists($f)) { unlink($f); } updateCacheFile(); break; case 'mem': foreach ($colarr as $a) { delFileUnderDir($path . $a, 'inc'); } break; case 'file': foreach ($colarr as $a) { delFileUnderDir($path . $a, 'html'); } break; default: break; } } elseif ($method == 'update') { headAdmin2('在线更新'); $arr = explode('/', $_SERVER["SCRIPT_NAME"]); $adpath = $arr[count($arr) - 2]; echo "<div class='Update'><h1>在线升级进行中第一步【文件升级】,请稍后......</h1><textarea rows=\"25\" readonly>正在下载升级文件包...\n"; ob_flush(); flush(); sleep(2); $url = 'http://www.maccms.com/update/2014/'; $f = !empty($p['file']) ? $p['file'] : MAC_VERSION;
public function pathList() { load_class('history'); session_start(); //re start $session = isset($_SESSION['history']) ? $_SESSION['history'] : false; $user_path = $this->in['path']; delFileUnderDir(USER_TEMP); if (is_array($session)) { $hi = new history($session); if ($user_path == "") { $user_path = $hi->getFirst(); } else { $hi->add($user_path); $_SESSION['history'] = $hi->getHistory(); } } else { $hi = new history(array(), 20); if ($user_path == "") { $user_path = '/'; } $hi->add($user_path); $_SESSION['history'] = $hi->getHistory(); } //回收站不记录前进后退 if ($this->in['path'] != '*recycle*/' && $this->in['type'] !== 'desktop') { $_SESSION['this_path'] = $user_path; } $list = $this->path($this->path); $list['history_status'] = array('back' => $hi->isback(), 'next' => $hi->isnext()); show_json($list); }
function delFileUnderDir($dirName) { if ($handle = opendir("{$dirName}")) { while (false !== ($item = readdir($handle))) { if ($item != "." && $item != "..") { if (is_dir("{$dirName}/{$item}")) { delFileUnderDir("{$dirName}/{$item}"); } else { unlink("{$dirName}/{$item}"); // if (unlink("$dirName/$item")) // echo "成功删除文件: $dirName/$item\n"; } } } closedir($handle); } }
$cachePath = root . 'upload/cache'; if ($handle = opendir($cachePath)) { if (is_dir("{$cachePath}/app")) { delFileUnderDir("{$cachePath}/app"); } if (is_dir("{$cachePath}/vodlist")) { delFileUnderDir("{$cachePath}/vodlist"); } if (is_dir("{$cachePath}/artlist")) { delFileUnderDir("{$cachePath}/artlist"); } if (is_dir("{$cachePath}/search")) { delFileUnderDir("{$cachePath}/search"); } if (is_dir("{$cachePath}/client")) { delFileUnderDir("{$cachePath}/client"); } } closedir($handle); unset($handle); } elseif ($flag == 'index') { if (file_exists("../index.html")) { unlink("../index.html"); } if (file_exists("../index.htm")) { unlink("../index.htm"); } if (file_exists("../index.shtml")) { unlink("../index.shtml"); } }
function delFileUnderDir($dirName, $ext = '*') { if ($handle = opendir("{$dirName}")) { while (false !== ($item = readdir($handle))) { if ($item != "." && $item != "..") { if (is_dir("{$dirName}/{$item}")) { delFileUnderDir("{$dirName}/{$item}"); } else { if ($ext == '*') { unlink("{$dirName}/{$item}"); } else { if (strpos($item, '.' . $ext)) { unlink("{$dirName}/{$item}"); } } //echo "成功删除文件: $dirName/$item<br />\n"; } } } closedir($handle); } unset($handle); }
function delFileUnderDir($dirName) { if ($handle = opendir("{$dirName}")) { while (false !== ($item = readdir($handle))) { if ($item != "." && $item != "..") { if (is_dir("{$dirName}/{$item}")) { delFileUnderDir("{$dirName}/{$item}"); } else { if (unlink("{$dirName}/{$item}")) { return true; } else { return false; } } } } closedir($handle); } else { return false; } }