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


PHP Dir::isEmpty方法代码示例

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


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

示例1: 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

示例2: 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

示例3: ImgList

 /**
  * 获取目录信息
  * @param $path
  */
 function ImgList($path)
 {
     $dir = new Dir($path);
     if ($dir->isEmpty($path)) {
         return false;
     }
     $dirlist = $dir->toArray();
     return $dirlist;
 }
开发者ID:singhvicky,项目名称:pintrest,代码行数:13,代码来源:DatacheckModel.class.php

示例4: 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

示例5: testDeleteRecursive

 function testDeleteRecursive()
 {
     $d = new Dir("/" . FRAMEWORK_CORE_PATH . "tests/io/delete_test_dir/");
     $this->assertTrue($d->exists(), "La cartella dal eliminare non esiste!!");
     $this->assertTrue($d->isEmpty(), "La cartella da popolare non e' vuota!!");
     $the_dir = $d->newSubdir("the_dir");
     $blabla = $the_dir->newFile("blabla.ini");
     $blabla->setContent("[section]\n\nchiave=valore\n\n");
     $hidden_test = $the_dir->newSubdir("hidden_test");
     $htaccess = $hidden_test->newFile(".htaccess");
     $htaccess->setContent("RewriteEngine on\n\n");
     $prova = $hidden_test->newFile("prova.txt");
     $prova->setContent("Questo e' un file con un testo di prova");
     $the_dir->delete(true);
     $this->assertFalse($the_dir->exists(), "La directory non e' stata eliminata!!");
     $this->assertTrue($d->isEmpty(), "Il contenuto della cartella non e' stato rimosso completamente!!");
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:17,代码来源:plain_dir_test.php

示例6: getProtectedStorage

 /**
  * 
  * Returns the verified storage folder. If it does not exists, it is created.
  * 
  * @return \Mbcraft\Piol\Dir the directory, as a \Mbcraft\Piol\Dir instance, pointing to the verified storage.
  * @throws \Mbcraft\Piol\IOException if the storage root does not exists or is not valid.
  * 
  * @api
  */
 public static function getProtectedStorage()
 {
     $protected_storage_dir = new Dir(self::$storage_root);
     if (!$protected_storage_dir->exists()) {
         throw new IOException("The storage folder does not exist : " . self::$storage_root);
     }
     if (!$protected_storage_dir->isWritable()) {
         throw new IOException("The storage folder is not readable and writable : " . self::$storage_root);
     }
     $results = $protected_storage_dir->listElements();
     if (count($results[0]) == 0 && count($results[1]) <= 1) {
         if ($protected_storage_dir->isEmpty()) {
             $protected_storage_dir->newRandomSubdir();
         }
         return $protected_storage_dir->getUniqueSubdir();
     } else {
         throw new IOException("The storage root folder is invalid : it must contain at most just one folder.");
     }
 }
开发者ID:mbcraft,项目名称:piol,代码行数:28,代码来源:StorageFactory.php

示例7: rmdir

 public function rmdir($dir, $force = false)
 {
     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,代码行数:11,代码来源:ModulePlug.class.php

示例8: File

 static function delete_image_thumbnails($path)
 {
     if ($path instanceof File) {
         $image_file = $path;
     } else {
         $image_file = new File($path);
     }
     $image_dir = $image_file->getDirectory();
     $full_cache_dir = new Dir(self::THUMBNAILS_DIR . $image_dir->getPath());
     $folders = $full_cache_dir->listFolders();
     foreach ($folders as $f) {
         $image_thumb = $f->newFile($image_file->getFilename());
         if ($image_thumb->exists()) {
             $image_thumb->delete();
         }
         if ($f->isEmpty()) {
             $f->delete();
         }
     }
     if ($full_cache_dir->isEmpty()) {
         $full_cache_dir->delete();
     }
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:23,代码来源:ImagePicker.class.php

示例9: get_verified_storage

 private static function get_verified_storage()
 {
     $protected_storage_dir = new Dir(self::$storage_root);
     if (!$protected_storage_dir->exists()) {
         throw new IOException("La cartella dello storage non esiste : " . self::$storage_root);
     }
     if (count($protected_storage_dir->listFiles()) > 1) {
         throw new IOException("Lo storage non è valido.");
     }
     if ($protected_storage_dir->isEmpty()) {
         $protected_storage_dir->newRandomSubdir();
     }
     return $protected_storage_dir->getSingleSubdir();
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:14,代码来源:Storage.class.php


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