public function actionRegenerate() { if (!Yii::app()->getRequest()->getIsPostRequest() || !Yii::app()->getRequest()->getPost('do')) { throw new CHttpException(404); } if (\yupe\helpers\YFile::rmIfExists($this->getModule()->getSiteMapPath())) { Yii::app()->getUser()->setFlash(YFlashMessages::SUCCESS_MESSAGE, Yii::t('SitemapModule.sitemap', 'Sitemap is deleted!')); Yii::app()->ajax->success(); } Yii::app()->getUser()->setFlash(YFlashMessages::ERROR_MESSAGE, Yii::t('SitemapModule.sitemap', 'Sitemap is not deleted!')); Yii::app()->ajax->failure(); }
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); }