[icinga-checkins] icinga.org: icinga-web/jmosshammer/default: * Provded oracle fix for session garbage collector

git at icinga.org git at icinga.org
Mon Jul 4 12:54:50 CEST 2011


Module: icinga-web
Branch: jmosshammer/default
Commit: dd2791f409b1062f41092892d0b009f862cf7700
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=dd2791f409b1062f41092892d0b009f862cf7700

Author: Marius Hein <marius.hein at netways.de>
Date:   Sat Jun 25 13:20:52 2011 +0200

* Provded oracle fix for session garbage collector

---

 Makefile.in                                        |    3 +-
 .../AppKit/models/Tasks/ClearCacheModel.class.php  |   48 +++-----------------
 app/modules/Cronks/config/cronks.xml               |    5 ++
 etc/build.xml                                      |    6 +++
 etc/lib/agaviClearCache.php                        |   12 +++++
 5 files changed, 30 insertions(+), 44 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index e3d7490..0cafb2f 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -96,8 +96,7 @@ locclean:
 		$(LOC_MO)/*.json
 
 cacheclean:
-	rm -rf app/cache/config/*.php
-	rm -rf app/cache/content
+	$(PHING_CALL) agavi-clear-cache	
 
 distclean:
 	rm -rf \
diff --git a/app/modules/AppKit/models/Tasks/ClearCacheModel.class.php b/app/modules/AppKit/models/Tasks/ClearCacheModel.class.php
index 2596f9e..ec5a27a 100644
--- a/app/modules/AppKit/models/Tasks/ClearCacheModel.class.php
+++ b/app/modules/AppKit/models/Tasks/ClearCacheModel.class.php
@@ -2,48 +2,12 @@
 
 class AppKit_Tasks_ClearCacheModel extends AppKitBaseModel {
 
-	public function clearCache() {
-		$cache_dir = AgaviConfig::get('core.cache_dir');
-		
-		$content_dir = $cache_dir. '/content';
-		if (is_dir($content_dir)) {
-			$config_count = $this->removeFilesRecursive($content_dir);
-			$this->getContext()->getLoggerManager()->log(sprintf('ClearCache: Deleted %d cache (content) objects', $config_count), AgaviLogger::INFO);
-		}
-		
-		$config_files = glob($cache_dir. '/config/*.php', GLOB_NOSORT);
-		$config_count = count($config_files);
-		if ($config_count > 0) {
-			foreach ($config_files as $config_file) {
-				unlink($config_file);
-			}
-			$this->getContext()->getLoggerManager()->log(sprintf('ClearCache: Deleted %d cache (config) files', $config_count), AgaviLogger::INFO);
-		}
-	}
-	
-	private function removeFilesRecursive($path) {
-		$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST);
-		
-		$order = array ();
-		
-		foreach ($iterator as $fileObject) {
-			$order[] =$fileObject->getRealPath();
-		}
-		
-		$count = count($order);
-		
-		while(($file = array_pop($order))) {
-			if (is_dir($file)) {
-				rmdir($file);
-			}
-			elseif (is_file($file)) {
-				unlink($file);
-			}
-		}
-		
-		return $count;
-	}
-	
+    public function clearCache() {
+        AgaviToolkit::clearCache();
+        $this->log('Cache cleared through webinterface', AgaviLogger::INFO);
+        return true;
+    }
+    
 }
 
 ?>
\ No newline at end of file
diff --git a/app/modules/Cronks/config/cronks.xml b/app/modules/Cronks/config/cronks.xml
index 1a85ed4..a680060 100755
--- a/app/modules/Cronks/config/cronks.xml
+++ b/app/modules/Cronks/config/cronks.xml
@@ -528,5 +528,10 @@
 			<!-- Demo cronk - [STOP] -->
 	
 	</setting>
+
+	<!-- Include the site config file *NEVER REMOVE THIS LINE* -->
+	<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="cronks.site.xml" xpointer="xmlns(ae=http://agavi.org/agavi/config/global/envelope/1.0) xmlns(cronk=http://icinga.org/cronks/config/parts/cronks/1.0) xpointer(//ae:configurations/ae:configuration)">
+		<xi:fallback></xi:fallback>
+	</xi:include>
 	
 </settings>
diff --git a/etc/build.xml b/etc/build.xml
index ce9e779..0ab55ac 100755
--- a/etc/build.xml
+++ b/etc/build.xml
@@ -45,6 +45,12 @@
 		</if>
 		
 	</target>
+	
+	<target name="agavi-clear-cache">
+		<taskdef name="agaviClearCache" classname="etc.lib..agaviClearCache"/>
+		<agaviClearCache />
+    </target>
+
 
 	<target name="db-prepare" depends="prepare">
 		<taskdef name="agaviDBExtractor" classname="etc.lib.agaviDBExtractorTask"/>	
diff --git a/etc/lib/agaviClearCache.php b/etc/lib/agaviClearCache.php
new file mode 100644
index 0000000..d5ca2d9
--- /dev/null
+++ b/etc/lib/agaviClearCache.php
@@ -0,0 +1,12 @@
+<?php
+
+require_once(dirname(__FILE__)."/agaviConsoleTask.php");
+
+class agaviClearCache extends agaviConsoleTask {
+    
+    public function main() {
+        parent::main();
+        AgaviToolkit::clearCache();
+    }
+    
+}
\ No newline at end of file





More information about the icinga-checkins mailing list