/** * Команда для очистки папки assets. * * Examples: * * yiic yupe flushAssets * * @return bool */ public function actionFlushAssets() { $dirs = glob(Yii::getPathOfAlias('webroot.assets') . DIRECTORY_SEPARATOR . '*', GLOB_ONLYDIR); foreach ($dirs as $value) { if (!\yupe\helpers\YFile::rmDir($value)) { $this->log('Failed to remove directory "' . $value . '"', CLogger::LEVEL_ERROR); } } return true; }
protected function cleanUp($module, $version, $rmUploaded = false) { Yii::log(sprintf('Start cleanup module "%s" version "%s"...', $module, $version), \CLogger::LEVEL_INFO, static::LOG_CATEGORY); $destination = Yii::getPathOfAlias('application.modules') . DIRECTORY_SEPARATOR . $module . '-' . $this->escapeVersion($version); if (is_dir($destination)) { Yii::log(sprintf('Deleting %s dir...', $destination), \CLogger::LEVEL_INFO, static::LOG_CATEGORY); YFile::rmDir($destination); } $modulePath = Yii::getPathOfAlias("application.modules.{$module}"); $backupPath = $modulePath . '_'; if (is_dir($backupPath)) { Yii::log(sprintf('Deleting backup path %s...', $backupPath), \CLogger::LEVEL_INFO, static::LOG_CATEGORY); YFile::rmDir($backupPath); } if ($rmUploaded) { YFile::rmIfExists($this->getUploadPathForModule($module, $this->escapeVersion($version))); YFile::rmIfExists($this->getUploadPathForModule($module, $this->escapeVersion($version), true)); } Yii::log(sprintf('Stop cleanup module "%s" version "%s"...', $module, $version), \CLogger::LEVEL_INFO, static::LOG_CATEGORY); }