X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fclasses%2Fmiddleware%2Fcompressor%2Fclass_CompressorChannel.php;h=f1189c5fb0e0b094a26825361385495861f12e7c;hb=5203f9bd014ad46fbc7ee54e7223dcd46e14e3b4;hp=81b2ffff97c3b39b2bd9860aa980576b2fedfde6;hpb=607a11e2c22949ea0647568c17d62a605595e83b;p=core.git diff --git a/inc/classes/middleware/compressor/class_CompressorChannel.php b/inc/classes/middleware/compressor/class_CompressorChannel.php index 81b2ffff..f1189c5f 100644 --- a/inc/classes/middleware/compressor/class_CompressorChannel.php +++ b/inc/classes/middleware/compressor/class_CompressorChannel.php @@ -2,11 +2,11 @@ /** * Middleware class for selecting the right compressor channel * - * @author Roland Haeder + * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.shipsimu.org * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -49,9 +49,7 @@ class CompressorChannel extends BaseMiddleware implements Registerable { // Is the compressor handler set? if ( (is_null($compressorInstance->getCompressor())) - || (!is_object($compressorInstance->getCompressor())) - || (!method_exists($compressorInstance->getCompressor(), 'compressStream')) - || (!method_exists($compressorInstance->getCompressor(), 'decompressStream')) + || (!$compressorInstance->getCompressor() instanceof Compressor) ) { // Init base directory $baseDir = @@ -59,10 +57,13 @@ class CompressorChannel extends BaseMiddleware implements Registerable { $compressorInstance->getConfigInstance()->getConfigEntry('compressor_base_path'); // Get a directory pointer - $dirPointer = FrameworkDirectoryPointer::createFrameworkDirectoryPointer($baseDir); + $directoryInstance = ObjectFactory::createObjectByConfiguredName('directory_class', array($baseDir)); + + // Read all directories but no sub directories, .htaccess files and NullCompressor class + while ($directoryEntry = $directoryInstance->readDirectoryExcept(array('.htaccess', 'class_NullCompressor.php'))) { + // Debug message + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('COMPRESSOR[' . __METHOD__ . ':' . __LINE__ . ']: directoryEntry=' . $directoryEntry); - // Read all directories but no sub directories - 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 @@ -89,17 +90,17 @@ class CompressorChannel extends BaseMiddleware implements Registerable { } // END - while // Close the directory - $dirPointer->closeDirectory(); + $directoryInstance->closeDirectory(); } // END - if // Check again if there is a compressor if ( (is_null($compressorInstance->getCompressor())) || (!is_object($compressorInstance->getCompressor())) - || (!method_exists($compressorInstance->getCompressor(), 'compressStream')) - || (!method_exists($compressorInstance->getCompressor(), 'decompressStream')) + || (!$compressorInstance instanceof Compressor) ) { // Set the null compressor handler. This should not be configureable! + // @TODO Is there a configurable fall-back compressor needed, or is NullCompressor okay? $compressorInstance->setCompressor(ObjectFactory::createObjectByName('NullCompressor')); } // END - if