本文整理匯總了PHP中Dir::delDir方法的典型用法代碼示例。如果您正苦於以下問題:PHP Dir::delDir方法的具體用法?PHP Dir::delDir怎麽用?PHP Dir::delDir使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Dir
的用法示例。
在下文中一共展示了Dir::delDir方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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();
}
}
示例2: 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'));
}
示例3: index
public function index()
{
$config_file = CONF_PATH . 'index/config.php';
$config = (include $config_file);
if ($dirname = $this->_get('dirname', 'trim')) {
$config['DEFAULT_THEME'] = $dirname;
file_put_contents($config_file, "<?php \nreturn " . var_export($config, true) . ";", LOCK_EX);
$obj_dir = new Dir();
is_dir(CACHE_PATH . 'index/') && $obj_dir->delDir(CACHE_PATH . 'index/');
@unlink(RUNTIME_FILE);
}
$tpl_dir = TMPL_PATH . 'index/';
$opdir = dir($tpl_dir);
$template_list = array();
while (false !== ($entry = $opdir->read())) {
if ($entry[0] == '.') {
continue;
}
if (!is_file($tpl_dir . $entry . '/info.php')) {
continue;
}
$info = (include_once $tpl_dir . $entry . '/info.php');
$info['preview'] = TMPL_PATH . 'index/' . $entry . '/preview.gif';
$info['dirname'] = $entry;
$template_list[$entry] = $info;
}
$this->assign('template_list', $template_list);
$this->assign('def_tpl', $config['DEFAULT_THEME']);
$this->display();
}
示例4: clear_cache
function clear_cache()
{
Dir::delDir(getcwd() . "/admin/Runtime/Cache/");
Dir::delDir(getcwd() . "/admin/Runtime/Data/");
Dir::delDir(getcwd() . "/admin/Runtime/Temp/");
@unlink(getcwd() . "/admin/Runtime/~app.php");
@unlink(getcwd() . "/admin/Runtime/~runtime.php");
Dir::delDir(getcwd() . "/app/Runtime/Cache/");
Dir::delDir(getcwd() . "/app/Runtime/Data/");
Dir::delDir(getcwd() . "/app/Runtime/Temp/");
Dir::delDir(getcwd() . "/app/Runtime/caches/");
Dir::delDir(getcwd() . "/app/Runtime/compiled/");
Dir::delDir(getcwd() . "/app/Runtime/" . HTML_DIR . '/');
@unlink(getcwd() . "/app/Runtime/~app.php");
@unlink(getcwd() . "/app/Runtime/~runtime.php");
@unlink(getcwd() . "/app/Runtime/js_lang.js");
Dir::delDir(getcwd() . "/install/Runtime/Cache/");
Dir::delDir(getcwd() . "/install/Runtime/Data/");
Dir::delDir(getcwd() . "/install/Runtime/Temp/");
@unlink(getcwd() . "/install/Runtime/~app.php");
@unlink(getcwd() . "/install/Runtime/~runtime.php");
Dir::delDir(getcwd() . "/mobile/Runtime/Cache/");
Dir::delDir(getcwd() . "/mobile/Runtime/Data/");
Dir::delDir(getcwd() . "/mobile/Runtime/Temp/");
@unlink(getcwd() . "/mobile/Runtime/~app.php");
@unlink(getcwd() . "/mobile/Runtime/~runtime.php");
Dir::delDir(getcwd() . "/update/Runtime/Cache/");
Dir::delDir(getcwd() . "/update/Runtime/Data/");
Dir::delDir(getcwd() . "/update/Runtime/Temp/");
@unlink(getcwd() . "/update/Runtime/~app.php");
@unlink(getcwd() . "/update/Runtime/~runtime.php");
}
示例5: clear
public function clear()
{
import("ORG.Io.Dir");
$dir = './Admin/Runtime/';
if (is_dir($dir)) {
Dir::delDir($dir);
}
$this->success('清除成功!');
}
示例6: deleteCache
function deleteCache()
{
import('ORG.Io.Dir');
$cacheDir = new Dir(APP_NAME . '/Runtime');
if ($cacheDir->delDir(APP_NAME . '/Runtime')) {
$this->success('清除緩存成功!');
} else {
$this->error('清除緩存失敗!請聯係管理員!');
}
}
示例7: Cache
function Cache()
{
import("ORG.Io.Dir");
if (file_exists('./Runtime')) {
Dir::delDir('./Runtime');
}
$return[] = array('text' => '返回首頁', 'link' => U('Index/index'));
$this->assign('return', $return);
$this->success('更新緩存成功!');
}
示例8: check
/**
* 檢測服務器環境
*/
public function check()
{
$this->assign('step_curr', 'check');
$flag = true;
//檢測文件夾權限
$check_file = array('/data', '/data/advert', '/data/author', '/data/items', '/data/logs', '/data/logs/taobao', '/data/news', '/admin/Runtime', '/index/Runtime', '/index/Conf/theme.php', '/config.inc.php');
$error = array();
foreach ($check_file as $file) {
$path_file = ROOT_PATH . $file;
if (!file_exists($path_file)) {
$error[] = $file . "不存在!";
$flag = false;
continue;
}
if (!is_writable($path_file)) {
$error[] = $file . "不可讀寫!";
$flag = false;
}
}
if (!function_exists("curl_getinfo")) {
$error[] = "係統不支持curl!";
$flag = false;
}
if (!function_exists("gd_info")) {
$error[] = "係統不支持GD!";
$flag = false;
}
import("ORG.Io.Dir");
$dir = new Dir();
$dir->delDir("admin/Runtime");
mkdir("admin/Runtime");
$dir->delDir("index/Runtime");
mkdir("index/Runtime");
if (!$flag) {
$this->assign('error', $error);
$this->display('check');
} else {
$this->redirect('index/setconf');
}
}
示例9: 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");
}
}
示例10: delCore
public function delCore()
{
import("ORG.Io.Dir");
$dir = new Dir();
@unlink(TEMP_PATH . '~runtime.php');
//刪除主編譯緩存文件
@unlink(TEMP_PATH . '~crons.php');
//刪除計劃任務緩存文件
@unlink(TEMP_PATH . 'cron.lock');
//刪除計劃任務執行鎖定文件
if (is_dir(DATA_PATH)) {
$dir->delDir(DATA_PATH);
}
if (is_dir(TEMP_PATH)) {
$dir->delDir(TEMP_PATH);
}
if (is_dir(CACHE_PATH)) {
$dir->delDir(CACHE_PATH);
}
if (is_dir(LOG_PATH)) {
$dir->delDir(LOG_PATH);
}
echo '[清除成功]';
}
示例11: delCore
public function delCore()
{
import("ORG.Io.Dir");
$dir = new Dir();
@unlink('./Temp/~runtime.php');
//刪除主編譯緩存文件
@unlink('./Temp/~crons.php');
//刪除計劃任務緩存文件
@unlink('./Temp/cron.lock');
//刪除計劃任務執行鎖定文件
if (is_dir('./Temp/Data')) {
$dir->delDir('./Temp/Data');
}
if (is_dir('./Temp/Temp')) {
$dir->delDir('./Temp/Temp');
}
if (is_dir('./Temp/Cache')) {
$dir->delDir('./Temp/Cache');
}
if (is_dir('./Temp/Logs')) {
$dir->delDir('./Temp/Logs');
}
echo '[清除成功]';
}
示例12: uninstall
public function uninstall($module)
{
if (!$module) {
$this->error("參數出錯!");
}
$info = M("Module")->where(array("module" => $module))->find();
if ($info) {
define("UNINSTALL", true);
import("Dir");
//卸載目錄
$path = APP_PATH . C("APP_GROUP_PATH") . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . 'Uninstall' . DIRECTORY_SEPARATOR;
$Dir = new Dir();
//SQL文件
if (file_exists($path . $module . '.sql')) {
$sql = file_get_contents($path . $module . '.sql');
$sql_split = $this->sql_split($sql, C("DB_PREFIX"));
$db = M('');
if (is_array($sql_split)) {
foreach ($sql_split as $s) {
$db->execute($s);
}
}
}
if (file_exists($path . 'Extention.inc.php')) {
@(include $path . 'Extention.inc.php');
}
//前台模板
if (file_exists($this->templatePath . $module . DIRECTORY_SEPARATOR)) {
$Dir->delDir($this->templatePath . $module . DIRECTORY_SEPARATOR);
}
D("Module")->where(array("module" => $module))->delete();
//刪除權限
M("Access")->where(array("g" => $module))->delete();
return true;
} else {
$this->error("該模塊不存在,無法卸載!");
}
}
示例13: check
/**
* 環境檢測
*/
public function check()
{
$flag = true;
//檢測文件夾權限
$check_file = array('./data', './data/mail_tpl', './data/msg_tpl', './data/static', './data/upload', './data/config/db.php', './data/config/url.php', './data/config/home/config.php');
$error = array();
foreach ($check_file as $file) {
$path_file = $file;
if (!file_exists($path_file)) {
$error[] = $file . L('not_exists');
$flag = false;
continue;
}
if (!is_writable($path_file)) {
//if (!$this->is_really_writable($path_file)) {
$error[] = $file . L('not_writable');
$flag = false;
}
}
if (!function_exists('curl_getinfo')) {
$error[] = L('no_curl');
$flag = false;
}
if (!function_exists('gd_info')) {
$error[] = L('no_gd');
$flag = false;
}
$dir_obj = new Dir();
is_dir('./data/runtime') && $dir_obj->delDir('./data/runtime');
if (!$flag) {
$this->assign('error', $error);
$this->assign('step_curr', 'check');
$this->display('check');
} else {
$this->redirect('setconf');
}
}
示例14: user_deleteavatar
/**
* 刪除用戶頭像
* @param type $uid 用戶名
* @return int 1:成功
* 0:失敗
*/
public function user_deleteavatar($uid)
{
if ($this->UCenter) {
return uc_user_deleteavatar($uid);
} else {
$dr = C("UPLOADFILEPATH") . "avatar/" . $uid . '/';
if (defined("CONFIG_FTPSTATUS") && CONFIG_FTPSTATUS) {
$Attachment = service("Attachment");
// 遠程存放地址
$remote = CONFIG_FTPUPPAT . str_replace(SITE_PATH . "/", "", $dr);
$Attachment->FTPrmdir($remote, true);
} else {
if (is_dir($dr) == false) {
return 0;
}
import("Dir");
$Dir = new Dir();
$Dir->delDir($dr);
}
M("Member")->where(array("userid" => $uid))->save(array("userpic" => ""));
return 1;
}
}
示例15: sp_clear_cache
/**
* 清空係統緩存,兼容sae
*/
function sp_clear_cache()
{
import("ORG.Util.Dir");
$dirs = array();
// runtime/
$rootdirs = sp_scan_dir(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 = sp_scan_dir($dir . "/*");
foreach ($tmprootdirs as $tdir) {
if ($tdir != "." && $tdir != "..") {
$tdir = $dir . '/' . $tdir;
if (is_dir($tdir)) {
array_push($dirs, $tdir);
} else {
@unlink($tdir);
}
}
}
} else {
@unlink($dir);
}
}
}
$dirtool = new \Dir("");
foreach ($dirs as $dir) {
$dirtool->delDir($dir);
}
if (sp_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);
}
}
}