[icinga-checkins] icinga.org: icinga-web/master: * Modules can now be disabled (altough menu, etc. will be displayed)

git at icinga.org git at icinga.org
Sat Aug 20 12:53:39 CEST 2011


Module: icinga-web
Branch: master
Commit: 3187fb3cb7e0a65083c345ae30165ac0977800b0
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=3187fb3cb7e0a65083c345ae30165ac0977800b0

Author: Jannis Mosshammer <jannis.mosshammer at netways.de>
Date:   Thu Aug 18 13:29:18 2011 +0200

* Modules can now be disabled (altough menu,etc. will be displayed)

---

 .../lib/context/AppKitAgaviContext.class.php       |   14 +++++++++++---
 .../views/ModuleDisabledSuccessView.class.php      |    8 ++++++++
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/app/modules/AppKit/lib/context/AppKitAgaviContext.class.php b/app/modules/AppKit/lib/context/AppKitAgaviContext.class.php
index a9c55f7..f3e880e 100644
--- a/app/modules/AppKit/lib/context/AppKitAgaviContext.class.php
+++ b/app/modules/AppKit/lib/context/AppKitAgaviContext.class.php
@@ -44,6 +44,7 @@ class AppKitAgaviContext extends AgaviContext {
         $module_dir = AgaviToolKit::literalize("%core.module_dir%");
         $files = scandir($module_dir);
        
+        AppKitAgaviUtil::initializeModule('AppKit');
         foreach($files as $file) {
             if($file == '.' || $file == '..')
                 continue;
@@ -52,11 +53,16 @@ class AppKitAgaviContext extends AgaviContext {
             $list[] = $file;
         }
         
-       
+      
         foreach($list as $mod_name) {
-            AppKitAgaviUtil::initializeModule($mod_name);
+            try {
+               if($mod_name != 'AppKit')
+                    AppKitAgaviUtil::initializeModule($mod_name);
+            } catch(AgaviDisabledModuleException $e) {
+            
+            }
         }
-
+       
 
     }
 
@@ -70,6 +76,8 @@ class AppKitAgaviContext extends AgaviContext {
             }
         }
 
+        include AgaviConfigCache::checkConfig(AgaviToolkit::expandDirectives('%core.config_dir%/schedules.xml'));
+         
         // Global temp directory
         AgaviConfig::set('core.tmp_dir', AgaviConfig::get('core.data_dir'). '/tmp');
     }
diff --git a/app/modules/AppKit/views/ModuleDisabledSuccessView.class.php b/app/modules/AppKit/views/ModuleDisabledSuccessView.class.php
index a18addb..269f074 100644
--- a/app/modules/AppKit/views/ModuleDisabledSuccessView.class.php
+++ b/app/modules/AppKit/views/ModuleDisabledSuccessView.class.php
@@ -1,6 +1,14 @@
 <?php
 
 class AppKit_ModuleDisabledSuccessView extends AppKitBaseView {
+    public function executeJson(AgaviRequestDataHolder $rd) {
+      
+        $this->getResponse()->setHttpStatusCode('503');
+        return json_encode(array(
+            "success" => false,
+            "message" => "disabled module called"
+        ));
+    }
     public function executeHtml(AgaviRequestDataHolder $rd) {
         $this->setAttribute('_title', 'Module Disabled');
 





More information about the icinga-checkins mailing list