當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。