当前位置: 首页>>代码示例>>PHP>>正文


PHP removedir函数代码示例

本文整理汇总了PHP中removedir函数的典型用法代码示例。如果您正苦于以下问题:PHP removedir函数的具体用法?PHP removedir怎么用?PHP removedir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了removedir函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: removedir

function removedir($dirname, $keepdir = FALSE)
{
    $dirname = str_replace(array("\n", "\r", '..'), array('', '', ''), $dirname);
    if (!is_dir($dirname)) {
        return FALSE;
    }
    $handle = opendir($dirname);
    while (($file = readdir($handle)) !== FALSE) {
        if ($file != '.' && $file != '..') {
            $dir = $dirname . DIRECTORY_SEPARATOR . $file;
            is_dir($dir) ? removedir($dir) : unlink($dir);
        }
    }
    closedir($handle);
    return !$keepdir ? @rmdir($dirname) ? TRUE : FALSE : TRUE;
}
开发者ID:v998,项目名称:discuzx-en,代码行数:16,代码来源:cron_cleanup_daily.php

示例2: removedir

function removedir($dirname, $keepdir = FALSE)
{
    $dirname = wipespecial($dirname);
    if (!is_dir($dirname)) {
        return FALSE;
    }
    $handle = opendir($dirname);
    while (($file = readdir($handle)) !== FALSE) {
        if ($file != '.' && $file != '..') {
            $dir = $dirname . DIRECTORY_SEPARATOR . $file;
            is_dir($dir) ? removedir($dir) : unlink($dir);
        }
    }
    closedir($handle);
    return !$keepdir ? @rmdir($dirname) ? TRUE : FALSE : TRUE;
}
开发者ID:lilhorse,项目名称:cocoa,代码行数:16,代码来源:cleanup_daily.inc.php

示例3: removedir

 static function removedir($name)
 {
     if (is_dir($name)) {
         if ($dir = opendir($name)) {
             while (($file = readdir($dir)) !== false) {
                 $newpath = "{$name}/{$file}";
                 if (is_dir($newpath)) {
                     if (substr($file, -1, 1) != ".") {
                         removedir($newpath);
                     }
                 } else {
                     unlink($newpath);
                 }
             }
             closedir($dir);
         }
         if (substr($file, -1, 1) != ".") {
             rmdir($name);
         }
     }
 }
开发者ID:jne21,项目名称:hatatool,代码行数:21,代码来源:Utils.php

示例4: removeDir

 function removeDir($dir)
 {
     foreach (glob($dir . '/*') as $file) {
         if (is_dir($file)) {
             removedir($file);
         } else {
             unlink($file);
         }
     }
     if (is_dir($dir)) {
         rmdir($dir);
     }
 }
开发者ID:alvarobfdev,项目名称:applog,代码行数:13,代码来源:ModuleController.php

示例5: cpmsg

        }
    } else {
        if ($do = 'mdelete') {
            $catid = $_G['gp_catid'];
            $pdnovelop = $_G['gp_pdnovelop'];
            if ($pdnovelop == 'move') {
                $toid = $_G['gp_toid'];
                if (empty($toid)) {
                    cpmsg('category_notoid', 'action=pdnovel&operation=category&do=delete&catid=' . $catid, 'error');
                }
                DB::query('UPDATE ' . DB::table('pdnovel_view') . (' SET catid = ' . $toid . " WHERE catid = {$catid};"));
                DB::query('DELETE FROM ' . DB::table('pdnovel_category') . (' WHERE catid = ' . $catid . ';'));
                pdnovelcache('pdnovelcategory', 'pdnovel');
                cpmsg('category_delete_succeed', 'action=pdnovel&operation=category', 'succeed');
            } else {
                if ($pdnovelop == 'delete') {
                    $query = DB::query('SELECT novelid FROM ' . DB::table('pdnovel_view') . (' WHERE catid = ' . $catid . ';'));
                    while ($pdnovel = DB::fetch($query)) {
                        $pdnovelid = $pdnovel['pdnovelid'];
                        DB::query('DELETE FROM ' . DB::table('pdnovel_chapter') . (' WHERE novelid=' . $novelid . ';'));
                        removedir('pdnovel/file/' . floor($pdnovelid / 1000) . '/' . $pdnovelid);
                        DB::query('DELETE FROM ' . DB::table('pdnovel_info') . (' WHERE pdnovelid=' . $pdnovelid . ';'));
                    }
                    DB::query('DELETE FROM ' . DB::table('category') . (' WHERE catid = ' . $catid . ';'));
                    pdnovelcache('pdnovelcategory', 'pdnovel');
                    cpmsg('category_delete_succeed', 'action=pdnovel&operation=category', 'succeed');
                }
            }
        }
    }
}
开发者ID:chibimiku,项目名称:pdnovel_for_discuz_x2,代码行数:31,代码来源:admincp_category.php

示例6: removedir

// print_r($_SERVER);
// проверяем на КЕШ
/*
 * если у нас есть закешированная страница - выводим ее
 * иначе генерим и создаем кеш страницу
 */
// используем КЕШ сайта
if (USE_KEH == 1) {
    // подключаем класс работы CONTENT
    require "classes/cache.class.php";
    // если время с создания папки cache/index > 24 часов, удаляем ее
    if (get_date_last_modify_file_in_second(HOST . '/cache/index') > 86400) {
        /*
         * удаляем кеш
         */
        removedir(HOST . "/cache/index");
    }
    use_keh();
}
// если печатаем страницу
if (isset($_GET['action']) and $_GET['action'] == "print") {
    require HOST . "/ctrl/print/print.php";
    exit;
}
if (DEBUG_SITE == 1) {
    error_reporting(E_ALL);
    ini_set('display_errors', 1);
}
if (DEBUG_SITE == 1) {
    // время
    $profiler->enterSection('center');
开发者ID:AngelWayfarer,项目名称:prizvanie,代码行数:31,代码来源:index.php

示例7: remove_dir

function remove_dir($dirname)
{
    if (is_dir($dirname)) {
        $dir_handle = opendir($dirname);
    }
    if (!$dir_handle) {
        return false;
    }
    while ($file = readdir($dir_handle)) {
        if ($file != "." && $file != "..") {
            if (!is_dir($dirname . "/" . $file)) {
                unlink($dirname . "/" . $file);
            } else {
                $a = $dirname . '/' . $file;
                removedir($a);
            }
        }
    }
    closedir($dir_handle);
    rmdir($dirname);
    return true;
}
开发者ID:royanonuevo,项目名称:My-Web-Kit,代码行数:22,代码来源:helper.php

示例8: exit

<?php

/*
	[Discuz!] (C)2001-2007 Comsenz Inc.
	This is NOT a freeware, use is subject to license terms

	$Id: cleanup_daily.inc.php 9806 2007-08-15 06:04:37Z cnteacher $
*/
if (!defined('IN_DISCUZ')) {
    exit('Access Denied');
}
$db->query("UPDATE {$tablepre}advertisements SET available='0' WHERE endtime>'0' AND endtime<='{$timestamp}'", 'UNBUFFERED');
if ($db->affected_rows()) {
    require_once DISCUZ_ROOT . './include/cache.func.php';
    updatecache(array('settings', 'advs_archiver', 'advs_register', 'advs_index', 'advs_forumdisplay', 'advs_viewthread'));
}
$db->query("TRUNCATE {$tablepre}searchindex");
$db->query("DELETE FROM {$tablepre}threadsmod WHERE dateline<'{$timestamp}'-31536000", 'UNBUFFERED');
$db->query("DELETE FROM {$tablepre}subscriptions WHERE lastpost<'{$timestamp}'-7776000", 'UNBUFFERED');
$db->query("DELETE FROM {$tablepre}forumrecommend WHERE expiration<'{$timestamp}'", 'UNBUFFERED');
if ($qihoo['status'] && $qihoo['relatedthreads']) {
    $db->query("DELETE FROM {$tablepre}relatedthreads WHERE expiration<'{$timestamp}'", 'UNBUFFERED');
}
$db->query("UPDATE {$tablepre}trades SET closed='1' WHERE expiration<>0 AND expiration<'{$timestamp}'", 'UNBUFFERED');
$db->query("DELETE FROM {$tablepre}tradelog WHERE status=0 AND lastupdate<'" . ($timestamp - 5 * 86400) . "'", 'UNBUFFERED');
if ($cachethreadon) {
    removedir($cachethreaddir, TRUE);
}
if ($regstatus > 1) {
    $db->query("UPDATE {$tablepre}invites SET status='4' WHERE expiration<'{$timestamp}' AND status IN ('1', '3')");
}
开发者ID:BGCX262,项目名称:zyyhong-svn-to-git,代码行数:31,代码来源:cleanup_daily.inc.php

示例9: md5_file

            }
            $md5 = md5_file(DISCUZ_ROOT . './' . $script);
            $discuzfiles = file(DISCUZ_ROOT . './data/discuzfiles.md5');
            $md5datanew = array();
            foreach ($discuzfiles as $line) {
                $md5file = trim(substr($line, 34));
                $md5str = trim(substr($line, 0, 32));
                $md5datanew[$md5file] = $md5str;
            }
            $md5datanew['./' . $script] = $md5;
            $fp = fopen(DISCUZ_ROOT . './data/discuzfiles.md5', 'wb');
            foreach ($md5datanew as $key => $val) {
                fwrite($fp, $val . ' *' . $key . "\r\n");
            }
            fclose($fp);
            if ($run) {
                include_once $script;
                dftp_delete($ftpid, $script);
            }
            dftp_close($ftpid);
        }
        exit(true);
    }
} elseif ($operation == 'openbbs') {
    if (!($bbc = intval($bbc))) {
        removedir($packagepath);
    }
    DB::query("UPDATE " . DB::table('common_setting') . " SET svalue='{$bbc}' WHERE skey='bbclosed'");
    updatecache('setting');
    exit(true);
}
开发者ID:Kingson4Wu,项目名称:php_demo,代码行数:31,代码来源:admincp_upgrade.php

示例10: renptyoveDir

function renptyoveDir($dirName)
{
    if (!is_dir($dirName)) {
        @unlink($dirName);
        return false;
    }
    $handle = @opendir($dirName);
    while (($file = @readdir($handle)) !== false) {
        if (!($file != ".") && !($file != "..")) {
            $dir = $dirName . "/" . $file;
            is_dir($dir) ? removedir($dir) : unlink($dir);
        }
    }
    closedir($handle);
    return rmdir($dirName);
}
开发者ID:chibimiku,项目名称:pdnovel_for_discuz_x2,代码行数:16,代码来源:function_pdnovelcp.php

示例11: delete_all_cache

function delete_all_cache()
{
    require_once HOST . "/classes/cache.class.php";
    // удаляем весь каталог
    removedir(HOST . "/cache");
    // создаем новій каталог, устанавливаем права
    $flag = @mkdir(HOST . "/cache", "0700");
    @chmod(HOST . "/cache", 0777);
}
开发者ID:AngelWayfarer,项目名称:prizvanie,代码行数:9,代码来源:cache.class.php

示例12: removeDir

/**
 * Delete a directory and its whole content
 *
 * @author - Hugues Peeters
 * @param  - $dirPath (String) - the path of the directory to delete
 * @return - no return !
 */
function removeDir($dirPath)
{
    /* Try to remove the directory. If it can not manage to remove it,
     * it's probable the directory contains some files or other directories,
     * and that we must first delete them to remove the original directory.
     */
    if (!@rmdir($dirPath)) {
        chdir($dirPath);
        $handle = opendir($dirPath);
        while ($element = readdir($handle)) {
            if ($element == '.' || $element == '..') {
                continue;
                // skip current and parent directories
            } elseif (is_file($element)) {
                unlink($element);
            } elseif (is_dir($element)) {
                $dirToRemove[] = $dirPath . '/' . $element;
            }
        }
        closedir($handle);
        if (sizeof($dirToRemove) > 0) {
            foreach ($dirToRemove as $j) {
                removedir($j);
            }
            // recursivity
        }
        rmdir($dirPath);
    }
}
开发者ID:BackupTheBerlios,项目名称:migueloo,代码行数:36,代码来源:fileManageLib.inc.php


注:本文中的removedir函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。