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


PHP remove_dir函数代码示例

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


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

示例1: remove_dir

function remove_dir($dirname)
{
    global $messageStack;
    $error = false;
    if ($dir = @dir($dirname)) {
        $dir->rewind();
        while ($file = $dir->read()) {
            //echo $dirname . '/' . $file . '<br />';
            if ($file != "." && $file != ".." && $file != ".htaccess" && $file != ".keep") {
                if (is_dir($dirname . '/' . $file)) {
                    // another directory, recurse
                    $error |= remove_dir($dirname . '/' . $file);
                    // if it was a directory, it should be empty now
                    if (!@rmdir($dirname . '/' . $file)) {
                        $error |= true;
                        $messageStack->add('Couldn\'t delete ' . $dirname . '/' . $file . '.', 'error');
                    }
                } else {
                    if (!@unlink($dirname . '/' . $file)) {
                        $error |= true;
                        $messageStack->add('Couldn\'t delete ' . $dirname . '/' . $file . '.', 'error');
                    }
                }
            }
        }
        $dir->close();
    } else {
        $error |= true;
    }
    return $error;
}
开发者ID:R-Future,项目名称:zencart,代码行数:31,代码来源:functions_bmz_io.php

示例2: deleteEntirely

 public function deleteEntirely($include_this)
 {
     if (!$this->exists()) {
         return true;
     }
     remove_dir($this->getPath(), false);
 }
开发者ID:allenlinatoc,项目名称:quickstart,代码行数:7,代码来源:Directory.php

示例3: filter_tex_updatedcallback

/**
 * Purge all caches when settings changed.
 */
function filter_tex_updatedcallback($name)
{
    global $CFG, $DB;
    reset_text_filters_cache();
    if (file_exists("{$CFG->dataroot}/filter/tex")) {
        remove_dir("{$CFG->dataroot}/filter/tex");
    }
    if (file_exists("{$CFG->dataroot}/filter/algebra")) {
        remove_dir("{$CFG->dataroot}/filter/algebra");
    }
    if (file_exists("{$CFG->tempdir}/latex")) {
        remove_dir("{$CFG->tempdir}/latex");
    }
    $DB->delete_records('cache_filters', array('filter' => 'tex'));
    $DB->delete_records('cache_filters', array('filter' => 'algebra'));
    if (!isset($CFG->filter_tex_pathlatex)) {
        // detailed settings not present yet
        return;
    }
    $pathlatex = trim($CFG->filter_tex_pathlatex, " '\"");
    $pathdvips = trim($CFG->filter_tex_pathdvips, " '\"");
    $pathconvert = trim($CFG->filter_tex_pathconvert, " '\"");
    if (!(is_file($pathlatex) && is_executable($pathlatex) && is_file($pathdvips) && is_executable($pathdvips) && is_file($pathconvert) && is_executable($pathconvert))) {
        // LaTeX, dvips or convert are not available, and mimetex can only produce GIFs so...
        set_config('filter_tex_convertformat', 'gif');
    }
}
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:30,代码来源:lib.php

示例4: finish

function finish($postid, $cloneid, $url, $fromform, $uploadfolder, $ajaxdata = '')
{
    // Clear out used playspace and/or uploadfolder
    if (isset($fromform->attachmentplayspace)) {
        // Unless we're keeping it, wipe the playspace
        forum::delete_attachment_playspace($fromform->attachmentplayspace, optional_param('keepplayspace', 0, PARAM_INT));
    }
    // Get rid of temporary upload folder
    if ($uploadfolder) {
        remove_dir($uploadfolder);
    }
    global $ajax;
    if ($ajax) {
        if ($ajaxdata) {
            // Print AJAX data if specified
            header('Content-Type: text/plain');
            print $ajaxdata;
            exit;
        } else {
            // Default otherwise is to print post
            forum_post::print_for_ajax_and_exit($postid, $cloneid, array(forum_post::OPTION_DISCUSSION_SUBJECT => true));
        }
    }
    redirect($url);
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:25,代码来源:editpost.php

示例5: game_OnExportHTML

function game_OnExportHTML($game, $context, $html)
{
    global $CFG;
    /*
            if( $game->gamekind == 'cross'){
                $destdir = "{$CFG->dataroot}/{$game->course}/export";
                if( !file_exists( $destdir)){
                    mkdir( $destdir);
                }
                game_OnExportHTML_cross( $game, $context, $html, $destdir);
                return;
            }
    */
    $destdir = game_export_createtempdir();
    switch ($game->gamekind) {
        case 'cross':
            game_OnExportHTML_cross($game, $context, $html, $destdir);
            break;
        case 'hangman':
            game_OnExportHTML_hangman($game, $context, $html, $destdir);
            break;
        case 'snakes':
            game_OnExportHTML_snakes($game, $html, $destdir);
            break;
        case 'millionaire':
            game_OnExportHTML_millionaire($game, $context, $html, $destdir);
            break;
    }
    remove_dir($destdir);
}
开发者ID:nadavkav,项目名称:Moodle2-Hebrew-plugins,代码行数:30,代码来源:exporthtml.php

示例6: __construct

 public function __construct()
 {
     $path = __STORAGE . '/DirectoryTest';
     if (is_dir($path)) {
         if (!remove_dir($path)) {
             echo "Ooh epic!";
             die;
         }
     }
     $this->instance = new Directory($path, true);
 }
开发者ID:allenlinatoc,项目名称:quickstart,代码行数:11,代码来源:DirectoryTest.php

示例7: create_incremental

function create_incremental($courseid, $oldbackup, $newbackup)
{
    global $CFG;
    $incremental_config = backup_get_config();
    //set directory paths
    if (!empty($incremental_config->backup_inc_destination)) {
        $backuppath = $incremental_config->backup_inc_destination . '/' . $courseid . '/';
    } else {
        $backuppath = $CFG->dataroot . '/' . $courseid . '/backupdata/';
    }
    $temppath = $CFG->dataroot . '/temp/incrementals/' . $courseid . '/';
    $newtempdir = str_ireplace('backup-', '', str_ireplace('.zip', '', $newbackup));
    //strip out .zip and backup from the string.
    $oldtempdir = str_ireplace('backup-', '', str_ireplace('.zip', '', $oldbackup));
    if (!check_dir_exists($temppath . $newtempdir, true, true)) {
        //now create folder for newtempdir
        error('failed to create temp dir for new backup' . $temppath . $newtempdir);
    }
    if (!check_dir_exists($temppath . $oldtempdir, true, true)) {
        //now create folder for newtempdir
        error('failed to create temp dir for old backup' . $temppath . $oldtempdir);
    }
    //create incremental directory if doesn't exist
    if (!check_dir_exists($backuppath . 'incrementals', true, true)) {
        error('failed to create incrementals directory');
    }
    //unzip each backup file into the temp dirs
    if (!unzip_file($backuppath . $oldbackup, $temppath . $oldtempdir, false)) {
        error('Couldn\'t unzip old backup');
    }
    if (!unzip_file($backuppath . $newbackup, $temppath . $newtempdir, false)) {
        error('Couldn\'t unzip new backup');
    }
    //now run the compare against both and create the diff.
    $mydiff = new xdelta();
    $mydiff->create_diff($temppath . $oldtempdir, $temppath . $newtempdir, $backuppath . 'incrementals/' . md5($oldbackup) . '-' . md5($newbackup) . '.zip');
    if (isset($mydiff->error)) {
        if ($mydiff->error == 'coursenotchanged') {
            //this course has not changed since the last backup so don't generate any more incrementals - and return false so that the $newbackup can be deleted.
            remove_dir($temppath . $oldtempdir);
            remove_dir($temppath . $newtempdir);
            return false;
        } else {
            print_object($mydiff);
            error("XDELTA diff failed!!- olddir:" . $temppath . $oldtempdir . "<br>Newdir:" . $temppath . $newtempdir . "<br>Backuppath:" . $backuppath . 'incrementals/' . md5($oldbackup) . '-' . md5($newbackup) . '.zip');
        }
    }
    //now delete the tmp directories.
    remove_dir($temppath . $oldtempdir);
    remove_dir($temppath . $newtempdir);
    return true;
}
开发者ID:r007,项目名称:PMoodle,代码行数:52,代码来源:incremental_backuplib.php

示例8: useredit_update_picture

function useredit_update_picture(&$usernew, &$userform)
{
    global $CFG;
    if (isset($usernew->deletepicture) and $usernew->deletepicture) {
        $location = $CFG->dataroot . '/users/' . $usernew->id;
        @remove_dir($location);
        set_field('user', 'picture', 0, 'id', $usernew->id);
    } else {
        if ($usernew->picture = save_profile_image($usernew->id, $userform->get_um(), 'users')) {
            set_field('user', 'picture', 1, 'id', $usernew->id);
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:13,代码来源:editlib.php

示例9: useredit_update_picture

function useredit_update_picture(&$usernew, &$userform)
{
    global $CFG;
    if (isset($usernew->deletepicture) and $usernew->deletepicture) {
        $location = make_user_directory($usernew->id, true);
        @remove_dir($location);
        set_field('user', 'picture', 0, 'id', $usernew->id);
    } else {
        if ($usernew->picture = save_profile_image($usernew->id, $userform->get_um(), 'user')) {
            set_field('user', 'picture', 1, 'id', $usernew->id);
        }
    }
}
开发者ID:r007,项目名称:PMoodle,代码行数:13,代码来源:editlib.php

示例10: useredit_update_picture

function useredit_update_picture(&$usernew, $userform)
{
    global $CFG, $DB;
    if (isset($usernew->deletepicture) and $usernew->deletepicture) {
        $location = make_user_directory($usernew->id, true);
        @remove_dir($location);
        $DB->set_field('user', 'picture', 0, array('id' => $usernew->id));
    } else {
        if ($userform->get_new_filename('imagefile')) {
            $usernew->picture = (int) save_profile_image($usernew->id, $userform, 'user', 'imagefile');
            $DB->set_field('user', 'picture', $usernew->picture, array('id' => $usernew->id));
        }
    }
}
开发者ID:ajv,项目名称:Offline-Caching,代码行数:14,代码来源:editlib.php

示例11: game_OnExportJavaME

/**
 * This page export the game to javame for mobile phones
 * 
 * @author  bdaloukas
 * @version $Id: exportjavame.php,v 1.17 2011/08/03 20:04:32 bdaloukas Exp $
 * @package game
 **/
function game_OnExportJavaME($game, $javame)
{
    global $CFG, $DB;
    $courseid = $game->course;
    $course = $DB->get_record('course', array('id' => $courseid));
    $destdir = game_export_createtempdir();
    if ($javame->type == 'hangmanp') {
        $destmobiledir = 'hangmanp';
    } else {
        $destmobiledir = 'hangman';
    }
    $src = $CFG->dirroot . '/mod/game/export/javame/' . $destmobiledir . '/simple';
    if ($javame->filename == '') {
        $javame->filename = 'moodle' . $destmobiledir;
    }
    $handle = opendir($src);
    while (false !== ($item = readdir($handle))) {
        if ($item != '.' && $item != '..') {
            if (!is_dir($src . '/' . $item)) {
                $itemdest = $item;
                if (substr($item, -5) == '.java') {
                    continue;
                    //don't copy the java source code files
                }
                if (substr($itemdest, -8) == '-1.class') {
                    $itemdest = substr($itemdest, 0, -8) . '$1.class';
                }
                copy($src . '/' . $item, $destdir . '/' . $itemdest);
            }
        }
    }
    mkdir($destdir . '/META-INF');
    game_exportjavame_exportdata($src, $destmobiledir, $destdir, $game, $javame->maxpicturewidth, $javame->maxpictureheight);
    game_create_manifest_mf($destdir . '/META-INF', $javame, $destmobiledir);
    $filejar = game_create_jar($destdir, $course, $javame);
    if ($filejar == '') {
        $filezip = game_create_zip($destdir, $course->id, $javame->filename . '.zip');
    } else {
        $filezip = '';
    }
    if ($destdir != '') {
        remove_dir($destdir);
    }
    if ($filezip != '') {
        echo "unzip the {$filezip} in a directory and when you are in this directory use the command <br><b>jar cvfm {$javame->filename}.jar META-INF/MANIFEST.MF<br></b> to produce the jar files<br><br>";
    }
    $file = $filejar != '' ? $filejar : $filezip;
    $fullfile = "{$CFG->dataroot}/{$courseid}/export/{$file}";
    game_send_stored_file($fullfile);
}
开发者ID:nadavkav,项目名称:Moodle2-Hebrew-plugins,代码行数:57,代码来源:exportjavame.php

示例12: remove_dir

function remove_dir($folder)
{
    $dir = dir($folder);
    while ($file = $dir->read()) {
        if ($file != '.' && $file != '..') {
            if (filetype($dir->path . $file) == 'file') {
                @unlink($dir->path . $file);
            }
            if (filetype($dir->path . $file) == 'dir') {
                remove_dir($dir->path . $file . '/');
            }
        }
    }
}
开发者ID:ngukho,项目名称:mvc-cms,代码行数:14,代码来源:functions.php

示例13: cache

 function cache()
 {
     global $_G;
     if ($_GET['onsubmit'] && check()) {
         if ($_GET[postdb][system_cache] == 1) {
             memory('clear');
             loadcache($_G[_config][cache_list], 'update');
         }
         api_post(array('m' => 'cache', 'a' => 'update', 'cache_list' => implode(',', $_G[_config][cache_list])));
         remove_dir('web/templates_c/');
         cpmsg('更新成功', 'success', 'm=tools&a=cache');
         return false;
     }
     $this->show('tools/cache');
 }
开发者ID:lqlstudio,项目名称:ttae_open,代码行数:15,代码来源:tools.action.php

示例14: filter_tex_updatedcallback

/**
 * Purge all caches when settings changed.
 */
function filter_tex_updatedcallback($name)
{
    global $CFG;
    if (file_exists("{$CFG->dataroot}/filter/tex")) {
        remove_dir("{$CFG->dataroot}/filter/tex");
    }
    if (file_exists("{$CFG->dataroot}/filter/algebra")) {
        remove_dir("{$CFG->dataroot}/filter/algebra");
    }
    if (file_exists("{$CFG->dataroot}/temp/latex")) {
        remove_dir("{$CFG->dataroot}/temp/latex");
    }
    delete_records('cache_filters', 'filter', 'tex');
    delete_records('cache_filters', 'filter', 'algebra');
}
开发者ID:veritech,项目名称:pare-project,代码行数:18,代码来源:lib.php

示例15: process

 /**
  * process
  */
 public static function process()
 {
     if (!theme_cache::current_user_can('manage_options')) {
         return false;
     }
     @ini_set('max_input_nesting_level', '10000');
     @ini_set('max_execution_time', 0);
     remove_dir(theme_features::get_stylesheet_directory() . theme_features::$basedir_js_min);
     theme_features::minify_force(theme_features::get_stylesheet_directory() . theme_features::$basedir_js_src);
     remove_dir(theme_features::get_stylesheet_directory() . theme_features::$basedir_css_min);
     theme_features::minify_force(theme_features::get_stylesheet_directory() . theme_features::$basedir_css_src);
     theme_features::minify_force(theme_features::get_stylesheet_directory() . theme_features::$basedir_addons);
     theme_file_timestamp::set_timestamp();
     wp_redirect(add_query_arg(__CLASS__, 1, theme_options::get_url()));
     die;
 }
开发者ID:ClayMoreBoy,项目名称:wp-theme-inn2015v2,代码行数:19,代码来源:min-rebuild.php


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