[icinga-checkins] icinga.org: icinga-web/master: * Removed GlobIterator

git at icinga.org git at icinga.org
Wed Jan 19 11:19:11 CET 2011


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

Author: Marius Hein <marius.hein at netways.de>
Date:   Wed Jan 19 10:48:13 2011 +0100

* Removed GlobIterator
* Works again with PHP5.2.6

---

 app/modules/AppKit/models/IconFilesModel.class.php |   13 +++++++------
 .../AppKit/models/Tasks/ClearCacheModel.class.php  |    8 ++++----
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/app/modules/AppKit/models/IconFilesModel.class.php b/app/modules/AppKit/models/IconFilesModel.class.php
index a5eca81..0306dbe 100755
--- a/app/modules/AppKit/models/IconFilesModel.class.php
+++ b/app/modules/AppKit/models/IconFilesModel.class.php
@@ -42,20 +42,21 @@ class AppKit_IconFilesModel extends AppKitBaseModel implements Countable {
 			. '*'
 			. $s;
 		
-		$iterator = new GlobIterator($q, FilesystemIterator::KEY_AS_FILENAME);
+		$files = glob($q, GLOB_NOSORT);
 		
-		foreach ($iterator as $fileInfo) {
-			$name = $fileInfo->getBasename($s);
+		foreach ($files as $file) {
+			$name = basename($file, $s);
+			
 			$this->files[] = array (
-				'web_path' => $this->web_path. DIRECTORY_SEPARATOR. rawurlencode($fileInfo->getBasename()),
+				'web_path' => $this->web_path. DIRECTORY_SEPARATOR. rawurlencode(basename($file)),
 				'name' => $name,
 				'short' => $this->part . '.'. $name 
 			);
 		}
 		
-		$this->count = $iterator->count();
+		$this->count = count($files);
 		
-		return true;;
+		return true;
 	}
 	
 	public function Count() {
diff --git a/app/modules/AppKit/models/Tasks/ClearCacheModel.class.php b/app/modules/AppKit/models/Tasks/ClearCacheModel.class.php
index 9ab228a..2596f9e 100644
--- a/app/modules/AppKit/models/Tasks/ClearCacheModel.class.php
+++ b/app/modules/AppKit/models/Tasks/ClearCacheModel.class.php
@@ -11,11 +11,11 @@ class AppKit_Tasks_ClearCacheModel extends AppKitBaseModel {
 			$this->getContext()->getLoggerManager()->log(sprintf('ClearCache: Deleted %d cache (content) objects', $config_count), AgaviLogger::INFO);
 		}
 		
-		$iterator = new GlobIterator($cache_dir. '/config/*.php', FilesystemIterator::KEY_AS_FILENAME);
-		$config_count = count($iterator);
+		$config_files = glob($cache_dir. '/config/*.php', GLOB_NOSORT);
+		$config_count = count($config_files);
 		if ($config_count > 0) {
-			foreach ($iterator as $fi) {
-				unlink($fi->getRealPath());
+			foreach ($config_files as $config_file) {
+				unlink($config_file);
 			}
 			$this->getContext()->getLoggerManager()->log(sprintf('ClearCache: Deleted %d cache (config) files', $config_count), AgaviLogger::INFO);
 		}





More information about the icinga-checkins mailing list