From: Roland Haeder Date: Tue, 22 Jul 2014 21:57:16 +0000 (+0200) Subject: Fixed some stuff + added debug lines. X-Git-Url: https://git.mxchange.org/?p=core.git;a=commitdiff_plain;h=729fb79b1ce10dfb5ea22fd2073b031582594691 Fixed some stuff + added debug lines. Signed-off-by: Roland Häder --- diff --git a/inc/classes/main/file_directories/directory/class_FrameworkDirectoryPointer.php b/inc/classes/main/file_directories/directory/class_FrameworkDirectoryPointer.php index a267c63f..fc603ec3 100644 --- a/inc/classes/main/file_directories/directory/class_FrameworkDirectoryPointer.php +++ b/inc/classes/main/file_directories/directory/class_FrameworkDirectoryPointer.php @@ -105,11 +105,15 @@ class FrameworkDirectoryPointer extends BaseFrameworkSystem { // Get an iterator for the directory $directoryInstance = new DirectoryIterator($pathName); + // ... and rewind back + $directoryInstance->rewind(); + // Set directory pointer and path name $pointerInstance->setDirectoryInstance($directoryInstance); $pointerInstance->setPathName($pathName); // Return the instance + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DIRECTORY[' . __METHOD__ . ':' . __LINE__ . ']: Opened pathName=' . $pathName . ' - EXIT!'); return $pointerInstance; } @@ -119,22 +123,19 @@ class FrameworkDirectoryPointer extends BaseFrameworkSystem { * @return $currentEntry Current entry from encapsulated iterator */ public function readRawDirectory () { + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DIRECTORY[' . __METHOD__ . ':' . __LINE__ . '] - CALLED!'); + // Can the next entry be read? assert($this->getDirectoryInstance()->valid()); // Default is FALSE $currentEntry = FALSE; - // Is it a dot directory? - if (!$this->getDirectoryInstance()->isDot()) { - // Read data from the directory pointer and return it - $currentEntry = $this->getDirectoryInstance()->current(); - } // END - if - - // Advance to next entry - $this->getDirectoryInstance()->next(); + // Read data from the directory pointer and return it + $currentEntry = $this->getDirectoryInstance()->current(); // Return found entry + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DIRECTORY[' . __METHOD__ . ':' . __LINE__ . ']: currentEntry[]=' . gettype($currentEntry) . ' - EXIT!'); return $currentEntry; } @@ -150,7 +151,10 @@ class FrameworkDirectoryPointer extends BaseFrameworkSystem { // No exception given, so read all files and directories, but not recursive self::createDebugInstance(__CLASS__)->debugOutput('DIRECTORY[' . __METHOD__ . ':' . __LINE__ . ']: No exceptions given, please use readRawDirectory() instead!'); return $this->readRawDirectory(); - } // END - if + } elseif (!$this->getDirectoryInstance()->valid()) { + // No more left to read + return NULL; + } // Init raw line $rawLine = NULL; @@ -167,12 +171,18 @@ class FrameworkDirectoryPointer extends BaseFrameworkSystem { // Is it not excluded? if (in_array($rawLine, $except)) { + // To next entry + $this->getDirectoryInstance()->next(); + // Exclude this part $rawLine = $this->readDirectoryExcept($except); //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DIRECTORY[' . __METHOD__ . ':' . __LINE__ . ']: rawline[' . gettype($rawLine) . ']=' . $rawLine . ' - Recursive call!'); } // END - if } // END - if + // To next entry + $this->getDirectoryInstance()->next(); + // Return read line //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DIRECTORY[' . __METHOD__ . ':' . __LINE__ . ']: rawLine[' . gettype($rawLine) . ']=' . $rawLine); return $rawLine; diff --git a/inc/classes/middleware/compressor/class_CompressorChannel.php b/inc/classes/middleware/compressor/class_CompressorChannel.php index c2ee4949..ba7bbfa5 100644 --- a/inc/classes/middleware/compressor/class_CompressorChannel.php +++ b/inc/classes/middleware/compressor/class_CompressorChannel.php @@ -61,6 +61,9 @@ class CompressorChannel extends BaseMiddleware implements Registerable { // 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); + // 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