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


PHP ModuleManager::flushCache方法代码示例

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


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

示例1: actionFlush

 /**
  * Flushes all application cache data
  */
 public function actionFlush()
 {
     Yii::app()->cache->flush();
     ModuleManager::flushCache();
     if (Yii::app()->cache instanceof CApcCache) {
         print "Warning: Could not flush APC Cache! - Restart Webserver!\n";
     }
     print "All application caches flushed!\n";
 }
开发者ID:alefernie,项目名称:intranet,代码行数:12,代码来源:HCacheCommand.php

示例2: install

 /**
  * Installs latest compatible module version
  *
  * @param type $moduleId
  */
 public function install($moduleId)
 {
     $modulePath = Yii::app()->getModulePath();
     if (!is_writable($modulePath)) {
         throw new CHttpException(500, Yii::t('AdminModule.libs_OnlineModuleManager', 'Module directory %modulePath% is not writeable!', array('%modulePath%' => $modulePath)));
     }
     $moduleInfo = $this->getModuleInfo($moduleId);
     if (!isset($moduleInfo['latestCompatibleVersion'])) {
         throw new CException(Yii::t('AdminModule.libs_OnlineModuleManager', "No compatible module version found!"));
     }
     if (is_dir($modulePath . DIRECTORY_SEPARATOR . $moduleId)) {
         throw new CHttpException(500, Yii::t('AdminModule.libs_OnlineModuleManager', 'Module directory for module %moduleId% already exists!', array('%moduleId%' => $moduleId)));
     }
     // Check Module Folder exists
     $moduleDownloadFolder = Yii::app()->getRuntimePath() . DIRECTORY_SEPARATOR . 'module_downloads';
     if (!is_dir($moduleDownloadFolder)) {
         if (!@mkdir($moduleDownloadFolder)) {
             throw new CException("Could not create module download folder!");
         }
     }
     $version = $moduleInfo['latestCompatibleVersion'];
     // Download
     $downloadUrl = $version['downloadUrl'];
     $downloadTargetFileName = $moduleDownloadFolder . DIRECTORY_SEPARATOR . basename($downloadUrl);
     try {
         $http = new Zend_Http_Client($downloadUrl, array('adapter' => 'Zend_Http_Client_Adapter_Curl', 'curloptions' => $this->getCurlOptions(), 'timeout' => 30));
         $response = $http->request();
         file_put_contents($downloadTargetFileName, $response->getBody());
     } catch (Exception $ex) {
         throw new CHttpException('500', Yii::t('AdminModule.libs_OnlineModuleManager', 'Module download failed! (%error%)', array('%error%' => $ex->getMessage())));
     }
     // Extract Package
     if (file_exists($downloadTargetFileName)) {
         // Unzip
         $zip = new ZipArchive();
         $res = $zip->open($downloadTargetFileName);
         if ($res === TRUE) {
             $zip->extractTo($modulePath);
             $zip->close();
         } else {
             throw new CHttpException('500', Yii::t('AdminModule.libs_OnlineModuleManager', 'Could not extract module!'));
         }
     } else {
         throw new CHttpException('500', Yii::t('AdminModule.libs_OnlineModuleManager', 'Download of module failed!'));
     }
     ModuleManager::flushCache();
     // Call Modules autostart
     $autostartFilename = $modulePath . DIRECTORY_SEPARATOR . $moduleId . DIRECTORY_SEPARATOR . 'autostart.php';
     if (file_exists($autostartFilename)) {
         require_once $autostartFilename;
         $module = Yii::app()->moduleManager->getModule($moduleId);
         $module->install();
     }
 }
开发者ID:skapl,项目名称:design,代码行数:59,代码来源:OnlineModuleManager.php

示例3: actionRun

 public function actionRun()
 {
     $this->forcePostRequest();
     $updatePackage = OnlineUpdateAPI::getAvailableUpdate();
     if ($updatePackage === null) {
         return $this->redirect($this->createUrl('index'));
     }
     $warnings = $updatePackage->install();
     $migration = "";
     Yii::import('application.commands.shell.HUpdateCommand');
     if (class_exists('HUpdateCommand') && method_exists('HUpdateCommand', 'AutoUpdate')) {
         $migration = HUpdateCommand::AutoUpdate();
     } else {
         // Old way
         Yii::import('application.commands.shell.ZMigrateCommand');
         $migration = ZMigrateCommand::AutoMigrate();
     }
     Yii::app()->cache->flush();
     ModuleManager::flushCache();
     $this->render('run', array('updatePackage' => $updatePackage, 'warnings' => $warnings, 'migration' => $migration));
 }
开发者ID:bmsrox,项目名称:humhub-modules-updater,代码行数:21,代码来源:UpdateController.php

示例4: uninstall

 /**
  * Uninstalls a module
  *
  * You may overwrite this method to add more cleanup stuff.
  *
  * This method shall:
  *      - Delete all module files
  *      - Delete all modules tables, database changes
  */
 public function uninstall()
 {
     if ($this->isCoreModule) {
         throw new CException("Could not uninstall core modules!");
         return;
     }
     if ($this->isEnabled()) {
         $this->disable();
     }
     // Use uninstall migration, when found
     $uninstallMigration = $this->getPath() . DIRECTORY_SEPARATOR . 'migrations' . DIRECTORY_SEPARATOR . 'uninstall.php';
     if (file_exists($uninstallMigration)) {
         Yii::import("application.commands.shell.*");
         ob_start();
         require_once $uninstallMigration;
         $migration = new uninstall();
         $migration->setDbConnection(Yii::app()->db);
         try {
             $migration->up();
         } catch (Exception $ex) {
         }
         ob_get_clean();
     }
     // Delete all executed migration by module
     $command = Yii::app()->db->createCommand('DELETE FROM migration WHERE module = :moduleId');
     $command->execute(array(':moduleId' => $this->getId()));
     Yii::app()->moduleManager->removeModuleFolder($this->getId());
     ModuleManager::flushCache();
 }
开发者ID:ahdail,项目名称:humhub,代码行数:38,代码来源:HWebModule.php

示例5: actionList

 public function actionList()
 {
     $installedModules = Yii::app()->moduleManager->getInstalledModules();
     ModuleManager::flushCache();
     $this->render('list', array('installedModules' => $installedModules));
 }
开发者ID:alefernie,项目名称:intranet,代码行数:6,代码来源:ModuleController.php

示例6: actionCaching

 /**
  * Caching Options
  */
 public function actionCaching()
 {
     Yii::import('admin.forms.*');
     $form = new CacheSettingsForm();
     $form->type = HSetting::Get('type', 'cache');
     $form->expireTime = HSetting::Get('expireTime', 'cache');
     // uncomment the following code to enable ajax-based validation
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'cache-settings-form') {
         echo CActiveForm::validate($form);
         Yii::app()->end();
     }
     if (isset($_POST['CacheSettingsForm'])) {
         Yii::app()->cache->flush();
         ModuleManager::flushCache();
         // Delete also published assets
         foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator(Yii::app()->getAssetManager()->getBasePath(), FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST) as $path) {
             // Do not remove .gitignore in assets folder
             if ($path->getPathname() == Yii::app()->getAssetManager()->getBasePath() . DIRECTORY_SEPARATOR . '.gitignore') {
                 continue;
             }
             if ($path->isDir()) {
                 rmdir($path->getPathname());
             } else {
                 unlink($path->getPathname());
             }
         }
         $_POST['CacheSettingsForm'] = Yii::app()->input->stripClean($_POST['CacheSettingsForm']);
         $form->attributes = $_POST['CacheSettingsForm'];
         if ($form->validate()) {
             HSetting::Set('type', $form->type, 'cache');
             HSetting::Set('expireTime', $form->expireTime, 'cache');
             // set flash message
             Yii::app()->user->setFlash('data-saved', Yii::t('AdminModule.controllers_SettingController', 'Saved and flushed cache'));
             $this->redirect(Yii::app()->createUrl('//admin/setting/caching'));
         }
     }
     $cacheTypes = array('CDummyCache' => Yii::t('AdminModule.controllers_SettingController', 'No caching (Testing only!)'), 'CFileCache' => Yii::t('AdminModule.controllers_SettingController', 'File'), 'CDbCache' => Yii::t('AdminModule.controllers_SettingController', 'Database'), 'CApcCache' => Yii::t('AdminModule.controllers_SettingController', 'APC'));
     $this->render('caching', array('model' => $form, 'cacheTypes' => $cacheTypes));
 }
开发者ID:luizreginaldo,项目名称:humhub,代码行数:42,代码来源:SettingController.php

示例7: actionIndex

 /**
  * Lists all installed modules.
  *
  * @param array $args
  */
 public function actionIndex($args)
 {
     print "Checking for new updates...";
     $updatePackage = OnlineUpdateAPI::getAvailableUpdate();
     print "OK\n\n";
     if ($updatePackage == null) {
         print "No new update available!\n\n";
         return;
     }
     print "Update to " . $updatePackage->versionTo . " found!\n";
     print "\n";
     echo Yii::t('UpdaterModule.base', 'Please note:') . "\n";
     echo "\t - " . Yii::t('UpdaterModule.base', 'Backup all your files & database before proceed') . "\n";
     echo "\t - " . Yii::t('UpdaterModule.base', 'Make sure all files are writable by application') . "\n";
     echo "\t - " . Yii::t('UpdaterModule.base', 'Please update installed marketplace modules before and after the update') . "\n";
     echo "\t - " . Yii::t('UpdaterModule.base', 'Make sure custom modules or themes are compatible with version %version%', array('%version%' => $updatePackage->versionTo)) . "\n";
     echo "\t - " . Yii::t('UpdaterModule.base', 'Do not use this updater in combination with Git!') . "\n";
     echo "\n";
     if (!$this->confirm("Proceed?", true)) {
         print "Aborted!\n";
         return;
     }
     print "\n";
     print "Downloading update package...";
     $updatePackage->download();
     print "OK!\n";
     print "Extracting update package...";
     $updatePackage->extract();
     print "OK!\n";
     print "Validating package...";
     $validationResults = $updatePackage->validate();
     print "OK!\n";
     print "\n";
     if (count($validationResults['notWritable']) != 0) {
         print "ERROR!\n";
         print "Following files are not writable: \n";
         foreach ($validationResults['notWritable'] as $file) {
             print "\t - " . $file . "\n";
         }
         print "\n";
         print "Please make this files writable and restart.\n\n";
         return;
     }
     if (count($validationResults['modified']) != 0) {
         echo Yii::t('UpdaterModule.base', 'The following files seems to be not original (%version%) and will be overwritten or deleted during update process.', array('%version%' => $updatePackage->versionFrom)) . "\n";
         foreach ($validationResults['modified'] as $file) {
             print "\t - " . $file . "\n";
         }
         if (!$this->confirm("These file(s) will be overwritten during update. OK?", true)) {
             print "Aborted!\n";
             return;
         }
         print "\n";
     }
     print "\n";
     print "RELEASE NOTES:\n\n";
     print $updatePackage->getReleaseNotes();
     print "\n\n";
     if (!$this->confirm("Proceed?", true)) {
         print "Aborted!\n";
         return;
     }
     print "\n";
     print "Installing...";
     $warnings = $updatePackage->install();
     print "OK!\n";
     if (count($warnings) != 0) {
         print "\n";
         print "WARNINGS:\n";
         foreach ($warnings as $warning) {
             print "\t - " . $warning . "\n";
         }
     }
     print "Migrating DB...";
     $migration = "";
     Yii::import('application.commands.shell.HUpdateCommand');
     if (class_exists('HUpdateCommand') && method_exists('HUpdateCommand', 'AutoUpdate')) {
         $migration = HUpdateCommand::AutoUpdate();
     } else {
         // Old way
         Yii::import('application.commands.shell.ZMigrateCommand');
         $migration = ZMigrateCommand::AutoMigrate();
     }
     print "OK!\n";
     if ($this->confirm("Show migration results?", false)) {
         print $migration . "\n";
     }
     Yii::app()->cache->flush();
     ModuleManager::flushCache();
     print "\n\n*** Updater successfully finished! ***\n\n";
     if ($this->confirm("Check for new/next available update?", true)) {
         print "\n\n------------------------------- \n\n\n";
         return $this->actionIndex($args);
     }
 }
开发者ID:bmsrox,项目名称:humhub-modules-updater,代码行数:100,代码来源:UpdaterCommand.php

示例8: actionUpdateAll

 public function actionUpdateAll($args)
 {
     $installedModules = Yii::app()->moduleManager->getInstalledModules(false, true);
     ModuleManager::flushCache();
     print "Updating modules: \n\n";
     foreach ($installedModules as $moduleId => $moduleClass) {
         $this->actionUpdate(array($moduleId), true);
     }
 }
开发者ID:alefernie,项目名称:intranet,代码行数:9,代码来源:ModuleTool.php

示例9: run

 public function run($args)
 {
     $exitCode = parent::run($args);
     Yii::app()->cache->flush();
     ModuleManager::flushCache();
 }
开发者ID:alefernie,项目名称:intranet,代码行数:6,代码来源:ZMigrateCommand.php


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