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


PHP Dir::delete方法代码示例

本文整理汇总了PHP中Dir::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Dir::delete方法的具体用法?PHP Dir::delete怎么用?PHP Dir::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dir的用法示例。


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

示例1: testMkdir

 function testMkdir()
 {
     $dir = new Dir("/" . FRAMEWORK_CORE_PATH . "tests/base/module_plug_root/prova/");
     $module_plug_test_root = new Dir("/" . FRAMEWORK_CORE_PATH . "tests/base/module_plug_root/");
     $target_dir = new Dir("/" . FRAMEWORK_CORE_PATH . "tests/base/module_plug_root/");
     $plug = new DirBridge($target_dir, new Dir("/" . FRAMEWORK_CORE_PATH . "tests/base/fakeroot/modules/ecommerce/cart/"));
     $this->assertFalse($dir->exists(), "La directory da creare esiste gia'!!");
     $plug->mkdir("prova");
     $this->assertTrue($dir->exists(), "La directory non è stata creata!!");
     $dir->delete();
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:11,代码来源:dir_bridge_test.php

示例2: execute

 function execute()
 {
     $dir = $this->dir;
     $force = $this->force;
     if (self::$dummy_mode) {
         echo "Rmdir : " . self::$root_dir->getPath() . $dir . "<br />";
         return;
     }
     $d = new Dir(self::$root_dir->getPath() . $dir);
     if (!$d->isEmpty() && $force || $d->isEmpty()) {
         $d->delete(true);
     }
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:13,代码来源:RmdirModuleAction.class.php

示例3: execute

 function execute()
 {
     $attributes = $this->attributes;
     $name = $attributes->name;
     $location = $attributes->location;
     $do_file_name = $name . "DO.class.php";
     $peer_file_name = $name . "Peer.class.php";
     $d = new Dir($location);
     $do_file = $d->newFile($do_file_name);
     $do_file->delete();
     $peer_file = $d->newFile($peer_file_name);
     $peer_file->delete();
     $d->delete();
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:14,代码来源:DropDoModuleAction.class.php

示例4: delete

 function delete()
 {
     $nome_categoria = Params::get("nome_categoria");
     $nome_modulo = Params::get("nome_modulo");
     if ($nome_categoria !== ModuleUtils::FRAMEWORK_CATEGORY_NAME && $nome_modulo !== ModuleUtils::FRAMEWORK_MODULE_NAME) {
         $path = AvailableModules::get_available_module_path($nome_categoria, $nome_modulo);
         $d = new Dir($path);
         $d->delete(true);
         Flash::ok("Modulo " . $nome_categoria . "/" . $nome_modulo . " eliminato con successo!!");
         return Redirect::success();
     } else {
         Flash::error("Impossibile eliminare il modulo " . $nome_categoria . "/" . $nome_modulo);
         return Redirect::failure();
     }
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:15,代码来源:ModulesController.class.php

示例5: GalleryCollectionPeer

 function delete_collection()
 {
     $peer = new GalleryCollectionPeer();
     $collection = $peer->find_by_id(Params::get("id_gallery_collection"));
     $all_galleries = call("gallery", "index", array("id_gallery_collection" => Params::get("id_gallery_collection")));
     foreach ($all_galleries as $gallery) {
         call("gallery", "delete_gallery", array("id_gallery" => $gallery->id_gallery));
     }
     $d = new Dir(GalleryCollectionController::GALLERY_COLLECTION_ROOT_DIR . $collection->folder);
     $d->delete();
     $peer->delete($collection);
     if (is_html()) {
         return Redirect::success();
     } else {
         return Result::ok();
     }
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:17,代码来源:GalleryCollectionController.class.php

示例6: Dir

 function delete_gallery()
 {
     $gallery_name = Params::get("gallery_name");
     $dir = new Dir($this->get_current_folder() . "/" . $gallery_name);
     $gallery_ini = $dir->newFile("_gallery.ini");
     if ($gallery_ini->exists()) {
         $dir->delete(true);
         if (is_html()) {
             return Redirect::success();
         } else {
             return Result::ok();
         }
     } else {
         if (is_html()) {
             return Redirect::failure();
         } else {
             return Result::error("Impossibile eliminare la gallery");
         }
     }
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:20,代码来源:GalleryController.class.php

示例7: GalleryPeer

 function delete_gallery()
 {
     $id_gallery = Params::get("id_gallery");
     $peer_gallery = new GalleryPeer();
     $gal = $peer_gallery->find_by_id($id_gallery);
     $peer_collection = new GalleryCollectionPeer();
     $collection = $peer_collection->find_by_id($gal->id_gallery_collection);
     $peer_gallery_image = new GalleryImagePeer();
     $peer_gallery_image->id_gallery__EQUAL($id_gallery);
     $all_images = $peer_gallery_image->find();
     foreach ($all_images as $img) {
         call("gallery_image", "delete_image", array("id_gallery_image" => $img->id_gallery_image));
     }
     $dir = new Dir(GalleryCollectionController::GALLERY_COLLECTION_ROOT_DIR . $collection->folder . "/" . $gal->folder);
     $dir->delete(true);
     $peer_gallery->delete($gal);
     if (is_html()) {
         return Redirect::success();
     } else {
         return Result::ok();
     }
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:22,代码来源:GalleryController.class.php

示例8: execute

 function execute()
 {
     $file_or_folder = $this->file_or_folder;
     $force = $this->force;
     if (self::$dummy_mode) {
         echo "Removing : " . $file_or_folder . "<br />";
         return;
     }
     $root_dir_path = self::$root_dir->getPath();
     //se è una cartella elimino solo i file che sono anche nel modulo
     if (FileSystemUtils::isDir($this->module_dir->getPath() . $file_or_folder)) {
         $source_dir = new Dir($this->module_dir->getPath() . $file_or_folder);
         $target_dir = new Dir($root_dir_path . $file_or_folder);
         if (!$target_dir->exists()) {
             return;
         }
         $toremove_files = $source_dir->listFiles();
         foreach ($toremove_files as $elem) {
             if ($elem->isDir()) {
                 $this->remove($file_or_folder . $elem->getName() . DS);
             } else {
                 $this->remove($file_or_folder . $elem->getFilename());
             }
         }
         if ($target_dir->isEmpty()) {
             $target_dir->delete(false);
         }
     } else {
         $source_file = new File($this->module_dir->getPath() . $file_or_folder);
         $target_file = new File($root_dir_path . $file_or_folder);
         if (!$force && !$source_file->exists()) {
             return;
         }
         //se non esiste nel modulo non lo rimuovo
         $target_file->delete();
     }
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:37,代码来源:RemoveModuleAction.class.php

示例9: main

 /**
  * Main function
  */
 public static function main()
 {
     // Array of forbidden types
     $forbidden_types = array('html', 'htm', 'js', 'jsb', 'mhtml', 'mht', 'php', 'phtml', 'php3', 'php4', 'php5', 'phps', 'shtml', 'jhtml', 'pl', 'py', 'cgi', 'sh', 'ksh', 'bsh', 'c', 'htaccess', 'htpasswd', 'exe', 'scr', 'dll', 'msi', 'vbs', 'bat', 'com', 'pif', 'cmd', 'vxd', 'cpl', 'empty');
     // Array of image types
     $image_types = array('jpg', 'png', 'bmp', 'gif', 'tif');
     // Get Site url
     $site_url = Option::get('siteurl');
     // Init vars
     if (Request::get('path')) {
         $path = Request::get('path');
     } else {
         $path = 'uploads/';
     }
     // Add slash if not exists
     if (substr($path, -1, 1) != '/') {
         $path .= '/';
         Request::redirect($site_url . '/admin/index.php?id=filesmanager&path=' . $path);
     }
     // Upload corectly!
     if ($path == 'uploads' || $path == 'uploads//') {
         $path = 'uploads/';
         Request::redirect($site_url . '/admin/index.php?id=filesmanager&path=' . $path);
     }
     // Only 'uploads' folder!
     if (strpos($path, 'uploads') === false) {
         $path = 'uploads/';
         Request::redirect($site_url . '/admin/index.php?id=filesmanager&path=' . $path);
     }
     // Set default path value if path is empty
     if ($path == '') {
         $path = 'uploads/';
         Request::redirect($site_url . '/admin/index.php?id=filesmanager&path=' . $path);
     }
     $files_path = ROOT . DS . 'public' . DS . $path;
     $current = explode('/', $path);
     // Delete file
     // -------------------------------------
     if (Request::get('id') == 'filesmanager' && Request::get('delete_file')) {
         if (Security::check(Request::get('token'))) {
             File::delete($files_path . Request::get('delete_file'));
             if (!is_file($files_path . Request::get('delete_file'))) {
                 Notification::set('success', __('File was deleted', 'filesmanager'));
             } else {
                 Notification::set('error', __('File was not deleted', 'filesmanager'));
             }
             Request::redirect($site_url . '/admin/index.php?id=filesmanager&path=' . $path);
         } else {
             die('Request was denied because it contained an invalid security token. Please refresh the page and try again.');
         }
     }
     // Delete dir
     // -------------------------------------
     if (Request::get('id') == 'filesmanager' && Request::get('delete_dir')) {
         if (Security::check(Request::get('token'))) {
             Dir::delete($files_path . Request::get('delete_dir'));
             if (!is_dir($files_path . Request::get('delete_dir'))) {
                 Notification::set('success', __('Directory was deleted', 'filesmanager'));
             } else {
                 Notification::set('error', __('Directory was not deleted', 'filesmanager'));
             }
             Request::redirect($site_url . '/admin/index.php?id=filesmanager&path=' . $path);
         } else {
             die('Request was denied because it contained an invalid security token. Please refresh the page and try again.');
         }
     }
     // Rename file/dir
     // -------------------------------------
     if (Request::post('rename_type')) {
         if (Security::check(Request::post('csrf'))) {
             $rename_type = Request::post('rename_type');
             $rename_from = Request::post('rename_from');
             $rename_to = Request::post('rename_to');
             if (empty($rename_to)) {
                 Notification::set('error', __('Can not be empty', 'filesmanager'));
                 Request::redirect($site_url . '/admin/index.php?id=filesmanager&path=' . $path);
             }
             $ext = $rename_type === 'file' ? '.' . File::ext($rename_from) : '';
             $rename_to = $files_path . Security::safeName($rename_to, null, false) . $ext;
             if (is_dir($rename_to)) {
                 Notification::set('error', __('Directory exists', 'filesmanager'));
                 Request::redirect($site_url . '/admin/index.php?id=filesmanager&path=' . $path);
             }
             if (is_file($rename_to)) {
                 Notification::set('error', __('File exists', 'filesmanager'));
                 Request::redirect($site_url . '/admin/index.php?id=filesmanager&path=' . $path);
             }
             $success = rename($files_path . $rename_from, $rename_to);
             if ($success) {
                 Notification::set('success', __('Renamed successfully', 'filesmanager'));
             } else {
                 Notification::set('error', __('Failure', 'filesmanager'));
             }
             Request::redirect($site_url . '/admin/index.php?id=filesmanager&path=' . $path);
         } else {
             die('Request was denied because it contained an invalid security token. Please refresh the page and try again.');
         }
//.........这里部分代码省略.........
开发者ID:rowena-altastratus,项目名称:altastratus,代码行数:101,代码来源:filesmanager.admin.php

示例10: function

});
/*    REMOVE FILE MEDIA
-----------------------------*/
/*
* @name   Media removefile
* @desc   Remove file on media ( :any use base64_encode remenber decode file)
*/
$p->route('/action/media/removefile/(:any)/(:any)', function ($token, $file) use($p) {
    if (Session::exists('user')) {
        if (Token::check($token)) {
            // get json file fow with and height
            $jsonFile = PUBLICFOLDER . '/media/mdb.json';
            $json = json_decode(File::getContent($jsonFile), true);
            // if remove thumb and dir unlik json file
            File::delete(ROOTBASE . $json[$file]['thumb']);
            Dir::delete(ROOTBASE . $json[$file]['images']);
            unset($json[$file]);
            if (File::setContent($jsonFile, json_encode($json))) {
                // set notification
                $p->setMsg($p::$lang['Success_remove']);
                Request::redirect($p->Url() . '/media');
            }
        } else {
            die('crsf Detect');
        }
    }
});
/*
* @name   Media removefile
* @desc   Remove file on media ( :any use base64_encode remenber decode file)
*/
开发者ID:xxwebplus,项目名称:morfy-admin-panel,代码行数:31,代码来源:removefile.php

示例11: defined

<?php

defined('PANEL_ACCESS') or die('No direct script access.');
/*    TOOLS / CACHE
---------------------------------*/
/*
* @name   Clear cache
* @desc   Clear cache on click
*/
$p->route('/action/clearCache/(:any)/', function ($token) use($p) {
    if (Session::exists('user')) {
        if (Token::check($token)) {
            if (Dir::exists(CACHE . '/doctrine/')) {
                Dir::delete(CACHE . '/doctrine/');
            }
            if (Dir::exists(CACHE . '/doctrine/')) {
                Dir::delete(CACHE . '/fenom/');
            }
            // set notification
            $p->setMsg($p::$lang['Success_cache']);
            // redirect
            Request::redirect($p->Url() . '/pages');
        } else {
            die('Crsf detect !');
        }
    } else {
        Request::redirect($p::$site['site_url'] . '/' . $p::$site['backend_folder']);
    }
});
开发者ID:nakome,项目名称:Fansoro-admin-panel,代码行数:29,代码来源:tools.php

示例12: Dir

<?php

/* This software is released under the BSD license. Full text at project root -> license.txt */
require_once "../init.php";
if (isset($_POST["nome_modulo"])) {
    $d = new Dir("/" . FRAMEWORK_MODULES_PATH . $_POST["nome_modulo"]);
    $module_deleted = $d->delete(true) && $d->exists();
}
?>
<html>
    <head>
        
    </head>
    <body>
        <?php 
if ($module_deleted) {
    echo "Modulo eliminato!!";
}
?>
        
        <form name="form__elimina_modulo" method="POST" action="/framework/utilities/delete_module.php">
            Nome del modulo : <input type="text" name="nome_modulo" value="" />
            <br />
            <input type="submit" name="Elimina modulo" value="Elimina modulo" />
        </form>
    </body>
</html>
开发者ID:mbcraft,项目名称:frozen,代码行数:27,代码来源:delete_module.php

示例13: die

     if (Request::get('del')) {
         if (Request::get('token')) {
             File::delete(STORAGE_PATH . '/pages' . Request::get('del') . '.md');
             Request::redirect(Url::getBase());
         } else {
             die('crsf detect !');
         }
     }
     // remove Cache
     if (Request::get('clearcache') == 'true') {
         if (Request::get('token')) {
             if (Dir::exists(CACHE_PATH . '/doctrine/')) {
                 Dir::delete(CACHE_PATH . '/doctrine/');
             }
             if (Dir::exists(CACHE_PATH . '/fenom/')) {
                 Dir::delete(CACHE_PATH . '/fenom/');
             }
             Request::redirect(Url::getBase());
         } else {
             die('crsf detect !');
         }
     }
     // logout
     if (Request::post('access_logout')) {
         Session::delete(Config::get('plugins.edit.name') . '_user');
         Request::redirect(Url::getCurrent());
     }
     // show template
     $template->display('admin.tpl', ['title' => $name, 'content' => $page, 'current' => $url, 'directory' => Dir::scan(STORAGE_PATH . '/pages')]);
 } else {
     // login
开发者ID:nakome,项目名称:Fansoro-edit-plugin,代码行数:31,代码来源:edit.php

示例14: delete

 /**
  * Delete directory
  *
  *  <code>
  *      Dir::delete('folder1');
  *  </code>
  *
  * @param string $dir Name of directory to delete
  */
 public static function delete($dir)
 {
     // Redefine vars
     $dir = (string) $dir;
     // Delete dir
     if (is_dir($dir)) {
         $ob = scandir($dir);
         foreach ($ob as $o) {
             if ($o != '.' && $o != '..') {
                 if (filetype($dir . '/' . $o) == 'dir') {
                     Dir::delete($dir . '/' . $o);
                 } else {
                     unlink($dir . '/' . $o);
                 }
             }
         }
     }
     reset($ob);
     rmdir($dir);
 }
开发者ID:Razzwan,项目名称:morfy,代码行数:29,代码来源:Dir.php

示例15: Dir

 function elimina_immagine()
 {
     $image_name = Params::get("image_name");
     $id_prodotto_servizio = Params::get("id_prodotto_servizio");
     $product_image_dir = new Dir(self::PRODUCT_IMAGE_DIR . "/" . $id_prodotto_servizio);
     $product_image_file = $product_image_dir->newFile($image_name);
     ImagePicker::delete_image_thumbnails($product_image_file);
     //elimino la riga associata all'immagine
     $peer = new ImmagineProdottoServizioPeer();
     $peer->id_prodotto_servizio__EQUALS($id_prodotto_servizio);
     $peer->nome_immagine__EQUALS($image_name);
     $elenco_immagini_prodotto_servizio = $peer->find();
     foreach ($elenco_immagini_prodotto_servizio as $img) {
         $peer->delete($img);
     }
     $product_image_file->delete();
     if ($product_image_dir->isEmpty()) {
         $product_image_dir->delete();
     }
     return Redirect::success();
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:21,代码来源:ProdottoServizioController.class.php


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