]> git.mxchange.org Git - core.git/commitdiff
Fixed some stuff + added debug lines.
authorRoland Haeder <roland@mxchange.org>
Tue, 22 Jul 2014 21:57:16 +0000 (23:57 +0200)
committerRoland Haeder <roland@mxchange.org>
Tue, 22 Jul 2014 21:57:16 +0000 (23:57 +0200)
Signed-off-by: Roland Häder <roland@mxchange.org>
inc/classes/main/file_directories/directory/class_FrameworkDirectoryPointer.php
inc/classes/middleware/compressor/class_CompressorChannel.php

index a267c63f075eb6d0f6174aa88bb5808754e32ee2..fc603ec341c8321c664a37884a42eeb1c33a117e 100644 (file)
@@ -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;
index c2ee49496ca98e6261acbd4baf6fa38ee56c975f..ba7bbfa58d1f3dad3b56d8a294365e43f3cf4d7d 100644 (file)
@@ -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