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


PHP FileHelper::removeDirectory方法代码示例

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


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

示例1: tearDown

 protected function tearDown()
 {
     if (is_dir($this->tmpPath)) {
         FileHelper::removeDirectory($this->tmpPath);
     }
     parent::tearDown();
 }
开发者ID:howq,项目名称:yii2,代码行数:7,代码来源:AssetConverterTest.php

示例2: cleanAssetDir

 public function cleanAssetDir()
 {
     $now = time();
     $asset_temp_dirs = glob($this->asset_dir . '/*', GLOB_ONLYDIR);
     // check if less than want to keep
     if (count($asset_temp_dirs) <= $this->keep) {
         return 0;
     }
     // get all dirs and sort by modified
     $modified = [];
     foreach ($asset_temp_dirs as $asset_temp_dir) {
         $modified[$asset_temp_dir] = filemtime($asset_temp_dir);
     }
     asort($modified);
     $nbr_dirs = count($modified);
     // keep last dirs
     for ($i = min($nbr_dirs, $this->keep); $i > 0; $i--) {
         array_pop($modified);
     }
     if ($this->dry_run) {
         $msg_try = 'would have ';
     } else {
         $msg_try = '';
     }
     // remove dirs
     foreach ($modified as $dir => $mod) {
         $this->echo_msg($msg_try . 'removed ' . $dir . ', last modified ' . Yii::$app->formatter->asDatetime($mod));
         if (!$this->dry_run) {
             FileHelper::removeDirectory($dir);
         }
     }
     return $this->dry_run ? 0 : $nbr_dirs;
 }
开发者ID:mbrowniebytes,项目名称:yii2-clean-assets,代码行数:33,代码来源:CleanAssetsController.php

示例3: tearDown

 public function tearDown()
 {
     $filePath = $this->getTestFilePath();
     if (file_exists($filePath)) {
         FileHelper::removeDirectory($filePath);
     }
 }
开发者ID:rajanishtimes,项目名称:basicyii,代码行数:7,代码来源:BaseMailerTest.php

示例4: tearDown

 public function tearDown()
 {
     FileHelper::removeDirectory($this->sourcePath);
     if (file_exists($this->configFileName)) {
         unlink($this->configFileName);
     }
 }
开发者ID:albertborsos,项目名称:yii2,代码行数:7,代码来源:BaseMessageControllerTest.php

示例5: tearDown

 protected function tearDown()
 {
     parent::tearDown();
     $keyDir = Yii::getAlias('@canisunit/tokenStorage/runtime/keys');
     if (is_dir($keyDir)) {
         FileHelper::removeDirectory($keyDir);
     }
 }
开发者ID:highestgoodlikewater,项目名称:yii2-token-storage,代码行数:8,代码来源:LocalKeyTest.php

示例6: tearDown

 protected function tearDown()
 {
     //        unlink(__DIR__ . '/runtime/compress.html');
     FileHelper::removeDirectory($this->getParam('components')['view']['minify_path']);
     FileHelper::removeDirectory($this->getParam('components')['assetManager']['basePath']);
     $this->destroyApplication();
     parent::tearDown();
 }
开发者ID:switchy,项目名称:yii2-minify-view,代码行数:8,代码来源:TestCase.php

示例7: tearDown

 protected function tearDown()
 {
     parent::tearDown();
     $storageDir = Yii::getAlias($this->storagePathAlias);
     if (is_dir($storageDir)) {
         FileHelper::removeDirectory($storageDir);
     }
 }
开发者ID:canis-io,项目名称:yii2-secure-token,代码行数:8,代码来源:BaseTokenTest.php

示例8: deleteDomain

 public static function deleteDomain($domain)
 {
     $dir = static::getDir() . DIRECTORY_SEPARATOR . $domain;
     if (is_dir($dir)) {
         FileHelper::removeDirectory($dir);
     }
     return false;
 }
开发者ID:vitalik74,项目名称:easyii,代码行数:8,代码来源:Multisite.php

示例9: setUp

 /**
  * @inheritdoc
  */
 protected function setUp()
 {
     parent::setUp();
     foreach (glob(Yii::$app->getAssetManager()->basePath . DIRECTORY_SEPARATOR . '*', GLOB_ONLYDIR) as $dir) {
         FileHelper::removeDirectory($dir);
         $this->assertFalse(is_dir($dir));
     }
 }
开发者ID:ivan-chkv,项目名称:yii2-bootstrap-bootswatch,代码行数:11,代码来源:CyborgAssetTest.php

示例10: setUp

 /**
  * @inheritdoc
  */
 protected function setUp()
 {
     FileHelper::removeDirectory(Yii::getAlias('@tests/uploads'));
     $this->mockApplication();
     Yii::$app->db->createCommand()->truncateTable('attach_file')->execute();
     Yii::$app->db->createCommand()->truncateTable('comment')->execute();
     Yii::$app->db->createCommand()->truncateTable('sqlite_sequence')->execute();
 }
开发者ID:nemmo,项目名称:yii2-attachments,代码行数:11,代码来源:TestCase.php

示例11: beforeDelete

 /**
  * @inheritdoc
  */
 public function beforeDelete()
 {
     if (parent::beforeDelete()) {
         FileHelper::removeDirectory(Yii::$app->file->dir . '/' . $this->id . '/');
         return true;
     }
     return false;
 }
开发者ID:sersid,项目名称:yii2-file-upload,代码行数:11,代码来源:Model.php

示例12: tearDown

 protected function tearDown()
 {
     $filePath = $this->getTestFilePath();
     if (file_exists($filePath)) {
         FileHelper::removeDirectory($filePath);
     }
     $this->dropFileCollection(CustomerFile::collectionName());
     parent::tearDown();
 }
开发者ID:glcode,项目名称:yii2-2.0.3-annotated,代码行数:9,代码来源:ActiveRecordTest.php

示例13: tearDown

 protected function tearDown()
 {
     File::deleteAll();
     News::deleteAll();
     FileHelper::removeDirectory(Yii::getAlias(Yii::$app->fileManager->uploadDirProtected));
     FileHelper::removeDirectory(Yii::getAlias(Yii::$app->fileManager->uploadDirUnprotected));
     FileHelper::removeDirectory(Yii::getAlias('@tests/data/files/tmp'));
     unset($_FILES);
 }
开发者ID:loveorigami,项目名称:filemanager-yii2,代码行数:9,代码来源:BaseTest.php

示例14: delete

 public function delete($path, array $options = null)
 {
     $options = array_merge(['recursively' => true], $options);
     if (is_dir($path) && $options['recursively']) {
         FileHelper::removeDirectory($path);
     } else {
         @unlink($path);
     }
 }
开发者ID:tsamsiyu,项目名称:yii2-over,代码行数:9,代码来源:IO.php

示例15: actionClearAssets

 public function actionClearAssets()
 {
     if (Yii::$app->assetManager->linkAssets == false) {
         foreach (glob(Yii::$app->assetManager->basePath . DIRECTORY_SEPARATOR . '*') as $asset) {
             \yii\helpers\FileHelper::removeDirectory($asset);
         }
     }
     $this->flash('success', Yii::t('hass', 'Assets cleared'));
     return $this->goReferrer();
 }
开发者ID:rocketyang,项目名称:hasscms-app,代码行数:10,代码来源:CacheController.php


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