本文整理汇总了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);
}
}
}