]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/stacker/file/class_BaseFileStack.php
WIP:
[core.git] / framework / main / classes / stacker / file / class_BaseFileStack.php
index 6b4a8bfb0f58982df285a06ca2251ea08c089a96..4d236a0900993768c6a29428976cfd432da00a13 100644 (file)
@@ -242,6 +242,17 @@ abstract class BaseFileStack extends BaseStacker {
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: Calling this->iteratorInstance->initCountersGapsArray() ...');
                $this->getIteratorInstance()->initCountersGapsArray();
 
+               /*
+                * Get stack index instance. This can be used for faster
+                * "defragmentation" and startup.
+                */
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: Creating index instance for fileInfoInstance[%s]=%s,type=%s ...', get_class($fileInfoInstance), $fileInfoInstance, $type));
+               $indexInstance = FileStackIndexFactory::createFileStackIndexInstance($fileInfoInstance, $type);
+
+               // And set it here
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: indexInstance=%s', $indexInstance->__toString()));
+               $this->setIndexInstance($indexInstance);
+
                // Is the file's header initialized?
                if (!$this->getIteratorInstance()->isFileHeaderInitialized()) {
                        // First pre-allocate a bit
@@ -257,17 +268,6 @@ abstract class BaseFileStack extends BaseStacker {
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: Calling this->readStackHeader() ...');
                $this->readStackHeader();
 
-               /*
-                * Get stack index instance. This can be used for faster
-                * "defragmentation" and startup.
-                */
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: Creating index instance for fileInfoInstance[%s]=%s,type=%s ...', get_class($fileInfoInstance), $fileInfoInstance, $type));
-               $indexInstance = FileStackIndexFactory::createFileStackIndexInstance($fileInfoInstance, $type);
-
-               // And set it here
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: indexInstance=%s', $indexInstance->__toString()));
-               $this->setIndexInstance($indexInstance);
-
                // Is the index loaded correctly and the stack file is just created?
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: Calling this->indexInstance->isIndexLoaded() ...');
                if (!$this->getIndexInstance()->isIndexLoaded()) {
@@ -729,9 +729,9 @@ abstract class BaseFileStack extends BaseStacker {
                // Return gap position, hash and length of raw data
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: stackName=%s,hash=%s,rawData()=%d - EXIT!', $stackName, $hash, strlen($rawData)));
                return [
-                       self::ARRAY_NAME_GAP_POSITION => $gapPosition,
-                       self::ARRAY_NAME_HASH         => $hash,
-                       self::ARRAY_NAME_DATA_LENGTH  => strlen($rawData),
+                       StackableFile::ARRAY_NAME_GAP_POSITION => $gapPosition,
+                       StackableFile::ARRAY_NAME_HASH         => $hash,
+                       StackableFile::ARRAY_NAME_DATA_LENGTH  => strlen($rawData),
                ];
        }