From be3e5282ba536934ddeac3daff59c5b7e43b1cd2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 31 Aug 2011 20:43:41 +0000 Subject: [PATCH] Implemented a fall-back if the first compressor class doesn't work --- .../compressor/class_CompressorChannel.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/inc/classes/middleware/compressor/class_CompressorChannel.php b/inc/classes/middleware/compressor/class_CompressorChannel.php index 0aa8205b..8830de87 100644 --- a/inc/classes/middleware/compressor/class_CompressorChannel.php +++ b/inc/classes/middleware/compressor/class_CompressorChannel.php @@ -62,17 +62,24 @@ class CompressorChannel extends BaseMiddleware implements Registerable { $dirPointer = FrameworkDirectoryPointer::createFrameworkDirectoryPointer($baseDir); // Read all directories but no sub directories - while ($directoryEntry = $dirPointer->readDirectoryExcept(array('..', '.', '.htaccess', '.svn'))) { + while ($directoryEntry = $dirPointer->readDirectoryExcept(array('..', '.', '.htaccess', '.svn', 'class_NullCompressor.php'))) { // Is this a class file? if ((substr($directoryEntry, 0, 6) == 'class_') && (substr($directoryEntry, -4, 4) == '.php')) { - // Get the compressor's name. That's why you must name - // your files like your classes and also that's why you - // must keep on class in one file. + /* Get the compressor's name. That's why you must name + * your files like your classes and also that's why you + * must keep on class in one file. + */ $className = substr($directoryEntry, 6, -4); // Get an instance from our object factory $tempInstance = ObjectFactory::createObjectByName($className); + // Is it null? + if (is_null($tempInstance)) { + // Then skip to the next one + continue; + } // END - if + // Set the compressor $compressorInstance->setCompressor($tempInstance); -- 2.39.5