本文整理汇总了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();
}
示例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;
}
示例3: tearDown
public function tearDown()
{
$filePath = $this->getTestFilePath();
if (file_exists($filePath)) {
FileHelper::removeDirectory($filePath);
}
}
示例4: tearDown
public function tearDown()
{
FileHelper::removeDirectory($this->sourcePath);
if (file_exists($this->configFileName)) {
unlink($this->configFileName);
}
}
示例5: tearDown
protected function tearDown()
{
parent::tearDown();
$keyDir = Yii::getAlias('@canisunit/tokenStorage/runtime/keys');
if (is_dir($keyDir)) {
FileHelper::removeDirectory($keyDir);
}
}
示例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();
}
示例7: tearDown
protected function tearDown()
{
parent::tearDown();
$storageDir = Yii::getAlias($this->storagePathAlias);
if (is_dir($storageDir)) {
FileHelper::removeDirectory($storageDir);
}
}
示例8: deleteDomain
public static function deleteDomain($domain)
{
$dir = static::getDir() . DIRECTORY_SEPARATOR . $domain;
if (is_dir($dir)) {
FileHelper::removeDirectory($dir);
}
return false;
}
示例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));
}
}
示例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();
}
示例11: beforeDelete
/**
* @inheritdoc
*/
public function beforeDelete()
{
if (parent::beforeDelete()) {
FileHelper::removeDirectory(Yii::$app->file->dir . '/' . $this->id . '/');
return true;
}
return false;
}
示例12: tearDown
protected function tearDown()
{
$filePath = $this->getTestFilePath();
if (file_exists($filePath)) {
FileHelper::removeDirectory($filePath);
}
$this->dropFileCollection(CustomerFile::collectionName());
parent::tearDown();
}
示例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);
}
示例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);
}
}
示例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();
}