本文整理匯總了PHP中Dir::del方法的典型用法代碼示例。如果您正苦於以下問題:PHP Dir::del方法的具體用法?PHP Dir::del怎麽用?PHP Dir::del使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Dir
的用法示例。
在下文中一共展示了Dir::del方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: qclear
public function qclear()
{
$obj_dir = new Dir();
is_dir(DATA_PATH . '_fields/') && $obj_dir->del(DATA_PATH . '_fields/');
is_dir(CACHE_PATH) && $obj_dir->delDir(CACHE_PATH);
is_dir(DATA_PATH) && $obj_dir->del(DATA_PATH);
is_dir(TEMP_PATH) && $obj_dir->delDir(TEMP_PATH);
is_dir(LOG_PATH) && $obj_dir->delDir(LOG_PATH);
is_dir(PIN_DATA_PATH . '/static/') && $obj_dir->del(PIN_DATA_PATH . '/static/');
@unlink(RUNTIME_FILE);
$this->ajaxReturn(1, L('clear_success'));
}
示例2: clearCache
function clearCache()
{
import("ORG.Io.Dir");
$dir = new Dir();
if (is_dir(CACHE_PATH)) {
$dir->del(CACHE_PATH);
}
if (is_dir(TEMP_PATH)) {
$dir->del(TEMP_PATH);
}
if (is_dir(LOG_PATH)) {
$dir->del(LOG_PATH);
}
if (is_dir(DATA_PATH . '_fields/')) {
$dir->del(DATA_PATH . '_fields/');
}
if (is_dir("./index/Runtime/Cache/")) {
$dir->del("./index/Runtime/Cache/");
}
if (is_dir("./index/Runtime/Temp/")) {
$dir->del("./index/Runtime/Temp/");
}
if (is_dir("./index/Runtime/Logs/")) {
$dir->del("./index/Runtime/Logs/");
}
if (is_dir("./index/Runtime/Data/_fields/")) {
$dir->del("./index/Runtime/Data/_fields/");
}
$this->display('index');
}
示例3: public_cache
public function public_cache()
{
if (isset($_GET['type'])) {
import("Dir");
import('Cacheapi');
$Cache = new Cacheapi();
$Cachepath = RUNTIME_PATH;
$Dir = new Dir();
$type = $this->_get("type");
switch ($type) {
case "site":
try {
$Dir->del($Cachepath);
$Dir->del($Cachepath . "Data/");
$Dir->del($Cachepath . "Data/_fields/");
} catch (Exception $exc) {
}
try {
$cache = Cache::getInstance();
$cache->clear();
} catch (Exception $exc) {
}
$modules = array(array('name' => "菜單,模型,欄目緩存更新成功!", 'function' => 'site_cache', 'param' => ''), array('name' => "模型字段緩存更新成功!", 'function' => 'model_field_cache', 'param' => ''), array('name' => "模型content處理類緩存更新成功!", 'function' => 'model_content_cache', 'param' => ''), array('name' => "會員相關緩存更新成功!", 'function' => 'member_cache', 'param' => ''), array('name' => "應用更新成功!", 'function' => 'appstart_cache', 'param' => ''), array('name' => "敏感詞緩存生成成功!", 'function' => 'censorword_cache', 'param' => ''));
foreach ($modules as $k => $v) {
try {
if ($v['function']) {
$Cache->{$v}['function']();
}
} catch (Exception $exc) {
}
}
$this->success("站點數據緩存更新成功!", U('Index/public_cache'));
break;
case "template":
$Dir->delDir($Cachepath . "Cache/");
$this->success("模板緩存清理成功!", U('Index/public_cache'));
break;
case "logs":
$Dir->del($Cachepath . "Logs/");
$this->success("站點日誌清理成功!", U('Index/public_cache'));
break;
default:
$this->error("請選擇清楚緩存類型!");
break;
}
} else {
$this->display("Index:cache");
}
}
示例4: setup
function setup()
{
$post = $_POST;
$file = $post['path_root'] . '/' . trim($post['filename'], '.php') . '.php';
$appgroup = empty($post['appgroup']) ? '' : "\tdefine('APP_GROUP','{$post['appgroup']}');//應用組目錄 \n";
$appname = empty($post['appname']) ? '' : "\tdefine('APP_NAME','{$post['appname']}');//應用名 \n";
$compile = $post['compile'] ? "\tdefine('COMPILE',true);//是否生成核心編譯文件\n" : "define('COMPILE',false);//是否生成核心編譯文件 \n";
$path_hdphp = dirname(PATH_ROOT) . '/hdphp/hdphp.php';
$str = '<?php ' . "\n\t//www.hdphp.com 向軍\n" . $appgroup . $appname . $compile . "\tinclude '{$path_hdphp}'; //HD框架核心包 \n" . '?>';
$appgroup = empty($post['appgroup']) ? $post['appgroup'] : $post['appgroup'] . '/';
$url = $post['root'] . '/' . basename($file);
$appDir = PATH_ROOT . '/' . $appgroup . $post['appname'];
//刪除緩存
$cachefiles = glob($_POST['path_root'] . '/temp/*');
foreach ($cachefiles as $v) {
$fileName = basename($v);
if (in_array($fileName, array("log", "Session"))) {
continue;
}
Dir::del($v);
}
if (is_dir($appDir)) {
$this->error("應用{$post['appname']}已經創建,請刪除後再創建");
}
if (is_file($file)) {
$this->error("單入口文件已經存在");
}
if (file_put_contents($file, $str)) {
$this->success("單入口文件創建成功", $url);
} else {
$this->error('文件創建失敗,請檢查目錄權限');
}
}
示例5: cache
public function cache()
{
if (isset($_GET['type'])) {
$Dir = new \Dir();
$cache = D('Common/Cache');
$type = I('get.type');
switch ($type) {
case "template":
//刪除緩存目錄下的文件
$Dir->del(RUNTIME_PATH);
$Dir->delDir(RUNTIME_PATH . "Cache/");
$Dir->delDir(RUNTIME_PATH . "Temp/");
//更新開啟其他方式的緩存
\Think\Cache::getInstance()->clear();
$this->success("模板緩存清理成功!", U('Index/cache'));
break;
case "logs":
$Dir->delDir(RUNTIME_PATH . "Logs/");
$this->success("站點日誌清理成功!", U('Index/cache'));
break;
default:
$this->error("請選擇清楚緩存類型!");
break;
}
} else {
$this->display();
}
}
示例6: sp_clear_cache
/**
* 清空緩存
*/
function sp_clear_cache()
{
import("ORG.Util.Dir");
$dirs = array();
// runtime/
$rootdirs = scandir(RUNTIME_PATH);
//$noneed_clear=array(".","..","Data");
$noneed_clear = array(".", "..");
$rootdirs = array_diff($rootdirs, $noneed_clear);
foreach ($rootdirs as $dir) {
if ($dir != "." && $dir != "..") {
$dir = RUNTIME_PATH . $dir;
if (is_dir($dir)) {
array_push($dirs, $dir);
$tmprootdirs = scandir($dir);
foreach ($tmprootdirs as $tdir) {
if ($tdir != "." && $tdir != "..") {
$tdir = $dir . '/' . $tdir;
if (is_dir($tdir)) {
array_push($dirs, $tdir);
}
}
}
} else {
@unlink($dir);
}
}
}
$dirtool = new Dir("");
foreach ($dirs as $dir) {
$dirtool->del($dir);
}
if (defined('IS_SAE') && IS_SAE) {
$global_mc = @memcache_init();
if ($global_mc) {
$global_mc->flush();
}
$no_need_delete = array("THINKCMF_DYNAMIC_CONFIG");
$kv = new SaeKV();
// 初始化KVClient對象
$ret = $kv->init();
// 循環獲取所有key-values
$ret = $kv->pkrget('', 100);
while (true) {
foreach ($ret as $key => $value) {
if (!in_array($key, $no_need_delete)) {
$kv->delete($key);
}
}
end($ret);
$start_key = key($ret);
$i = count($ret);
if ($i < 100) {
break;
}
$ret = $kv->pkrget('', 100, $start_key);
}
}
}
示例7: updateCache
public function updateCache()
{
$ActionCache = F('updateCache');
if ($ActionCache) {
$action = array_shift($ActionCache);
F('updateCache', $ActionCache);
switch ($action) {
case "Config":
$Model = K("Config");
$Model->updateCache();
$this->success('網站配置更新完畢...', U("updateCache"), 0);
break;
case "Model":
$Model = K("Model");
$Model->updateCache();
$this->success('模型更新完畢...', U("updateCache"), 0);
break;
case "Field":
$Model = new ModelFieldModel(1);
$ModelCache = cache("model");
foreach ($ModelCache as $mid => $data) {
$Model->updateCache($mid);
}
$this->success('字段更新完畢...', U("updateCache"), 0);
break;
case "Category":
$Model = K("Category");
$Model->updateCache();
$this->success('欄目更新完畢...', U("updateCache"), 0);
break;
case "Node":
$Model = K("Node");
$Model->updateCache();
$this->success('權限節點更新完畢...', U("updateCache"), 0);
break;
case "Table":
cache('table', null);
$this->success('數據表更新完畢...', U("updateCache"), 0);
break;
case "Role":
$Model = K("Role");
$Model->updateCache();
$this->success('角色更新完畢...', U("updateCache"), 0);
break;
case "Flag":
$Model = new FlagModel(1);
$ModelCache = cache("model");
foreach ($ModelCache as $mid => $data) {
$Model->updateCache($mid);
}
$this->success('Flag更新完畢...', U("updateCache"), 0);
break;
}
} else {
Dir::del('temp');
$this->success('緩存更新成功...', U('index'), 0);
}
}
示例8: del
public function del()
{
$r = Dir::del('Backup/' . $_GET['dir']);
if ($r) {
$this->success('刪除成功');
} else {
$this->error('刪除失敗');
}
}
示例9: del
public function del()
{
$dir = Q('dir');
if (Dir::del('backup/' . $dir)) {
$this->success('刪除成功!', 'index');
} else {
$this->error('刪除失敗,請檢查目錄權限!', 'index');
}
}
示例10: updateCache
public function updateCache()
{
if ($action = Q('get.action')) {
switch ($action) {
case "Config":
$Model = K("Config");
$Model->updateCache();
$this->success('網站配置更新完畢...', U('updateCache', array('action' => 'Model')), 0);
break;
case "Model":
$Model = K("Model");
$Model->updateCache();
$this->success('模型更新完畢...', U('updateCache', array('action' => 'Field')), 0);
break;
case "Field":
$ModelCache = S("model");
foreach ($ModelCache as $mid => $data) {
$_REQUEST['mid'] = $mid;
$Model = new FieldModel();
$Model->updateCache($mid);
}
$this->success('字段更新完畢...', U('updateCache', array('action' => 'Category')), 0);
break;
case "Category":
$Model = K('Category');
$Model->updateCache();
$this->success('欄目更新完畢...', U('updateCache', array('action' => 'Node')), 0);
break;
case "Node":
$Model = K("Node");
$Model->updateCache();
$this->success('權限節點更新完畢...', U('updateCache', array('action' => 'Table')), 0);
break;
case "Table":
Dir::del('temp/Table');
$this->success('數據表更新完畢...', U('updateCache', array('action' => 'Role')), 0);
break;
case "Role":
$Model = K("Role");
$Model->updateCache();
$this->success('角色更新完畢...', U('updateCache', array('action' => 'Flag')), 0);
break;
case "Flag":
$ModelCache = S("model");
foreach ($ModelCache as $mid => $data) {
$_REQUEST['mid'] = $mid;
$Model = new FlagModel();
$Model->updateCache();
}
$this->display('success.php');
break;
}
} else {
$this->success('緩存更新成功...', U('index'), 0);
}
}
示例11: clearCache
function clearCache()
{
set_time_limit(0);
$i = intval($_REQUEST['id']);
if (!$i) {
$this->error('操作失敗');
} else {
import("ORG.Io.Dir");
$dir = new Dir();
switch ($i) {
case 1:
//更新全站緩存
is_dir(CACHE_PATH) && $dir->del(CACHE_PATH);
is_dir(DATA_PATH . '_fields/') && $dir->del(DATA_PATH . '_fields/');
is_dir(TEMP_PATH) && $dir->del(TEMP_PATH);
if (is_dir("./index/Runtime")) {
deleteCacheData("./index/Runtime");
}
if (is_dir("./admin/Runtime")) {
deleteCacheData("./admin/Runtime");
}
//Api緩存
is_dir('./Apicache/') && delCache('./Apicache/');
break;
case 2:
//後台模版緩存
is_dir(CACHE_PATH) && $dir->del(CACHE_PATH);
break;
case 3:
//前台模版緩存
is_dir("./index/Runtime/Cache/") && $dir->del("./index/Runtime/Cache/");
is_dir("./index/Html/") && $dir->del("./index/Html/");
break;
case 4:
//數據庫緩存
is_dir(DATA_PATH . '_fields/') && $dir->del(DATA_PATH . '_fields/');
is_dir("./index/Runtime/Data/_fields/") && $dir->del("./index/Runtime/Data/_fields/");
break;
case 5:
//Api緩存
is_dir('./Apicache/') && delCache('./Apicache/');
break;
default:
break;
}
$runtime = defined('MODE_NAME') ? '~' . strtolower(MODE_NAME) . '_runtime.php' : '~runtime.php';
$runtime_file_admin = RUNTIME_PATH . $runtime;
$runtime_file_front = ROOT_PATH . '/index/Runtime/' . $runtime;
is_file($runtime_file_admin) && @unlink($runtime_file_admin);
is_file($runtime_file_front) && @unlink($runtime_file_front);
$this->success('更新完成', U('Cache/index'));
}
}
示例12: delcache
function delcache()
{
$temp = Q('temp', null, 'trim');
if ($temp && is_dir($temp)) {
foreach (glob($temp . '/*') as $d) {
Dir::del($d);
}
}
$url = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
$this->success('緩存目錄已經全部刪除成功', $url);
}
示例13: deleteFailureDir
public function deleteFailureDir($dir)
{
foreach (Dir::tree($dir) as $d) {
if (!is_file($d['path'] . '/lock.php')) {
if (!\Dir::del($d['path'])) {
$this->error = $d['path'] . "刪除失敗";
return FALSE;
}
}
}
return TRUE;
}
示例14: create_all
public function create_all()
{
if (IS_POST) {
//刪除html目錄
Dir::del(C('HTML_PATH'));
F("RedirectInfo", array(array('url' => 'create_index', 'title' => '準備生成首頁'), array('url' => 'create_category', 'title' => '準備生成欄目頁...'), array('url' => 'create_content', 'title' => '準備生成內容頁...'), array('url' => 'create_all', 'title' => '全部生成完畢...')));
//生成首頁
$this->success('初始化完成...', 'create_index');
} else {
F("RedirectInfo", null);
$this->display();
}
}
示例15: index
public function index()
{
if (IS_POST) {
is_file(TEMP_PATH . '~Boot.php') && unlink(TEMP_PATH . '~Boot.php');
Dir::del('Temp/Compile');
Dir::del('Temp/Content');
Dir::del('Temp/Table');
//緩存更新動作
S('updateCacheAction', $_POST['Action']);
$this->success('準備更新...', U('updateCache', array('action' => 'Config')), 1);
} else {
$this->display();
}
}