Also for UPDATE
[core.git] / inc / classes / main / database / databases / class_LocalFileDatabase.php
index 9c9c00bde531870addff78e18f3611f25ea5919f..b6db990441dabd37cd30dadffd8336042725f7cc 100644 (file)
@@ -161,6 +161,9 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
         * @return      $dataArray
         */
        private function getDataArrayFromFile ($fqfn) {
+               // Debug message
+               //* NOISY-DEBUG: */ $this->debugOutput('DATABASE: Reading elements from database file ' . $fqfn . ' ...');
+
                // Get a file pointer
                $fileInstance = FrameworkFileInputPointer::createFrameworkFileInputPointer($fqfn);
 
@@ -177,6 +180,9 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
                // Unserialize it
                $dataArray = unserialize($serializedData);
 
+               // Debug message
+               //* NOISY-DEBUG: */ $this->debugOutput('DATABASE: Read ' . count($dataArray) . ' elements from database file ' . $fqfn . '.');
+
                // Finally return it
                return $dataArray;
        }
@@ -190,7 +196,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
         */
        private function writeDataArrayToFqfn ($fqfn, array $dataArray) {
                // Debug message
-               /* NOISY-DEBUG: */ $this->debugOutput('DATABASE: Flushing ' . count($dataArray) . ' elements to database file ' . $fqfn . ' ...');
+               //* NOISY-DEBUG: */ $this->debugOutput('DATABASE: Flushing ' . count($dataArray) . ' elements to database file ' . $fqfn . ' ...');
 
                // Get a file pointer instance
                $fileInstance = FrameworkFileOutputPointer::createFrameworkFileOutputPointer($fqfn, 'w');
@@ -205,7 +211,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
                $fileInstance->closeFile();
 
                // Debug message
-               /* NOISY-DEBUG: */ $this->debugOutput('DATABASE: Flushing ' . count($dataArray) . ' elements to database file completed.');
+               //* NOISY-DEBUG: */ $this->debugOutput('DATABASE: Flushing ' . count($dataArray) . ' elements to database file completed.');
        }
 
        /**
@@ -352,9 +358,9 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
                                                // Get criteria element
                                                $criteria = $criteriaInstance->getCriteriaElemnent($key);
 
-                                               // Is the criteria met?
-                                               //* NOISY-DEBUG: */ $this->debugOutput('DATABASE: criteria[' . gettype($criteria) . ']=' . $criteria . ',()=' . strlen($criteria) . ',value=' . $value . ',()=' . strlen($value));
-                                               if ((!is_null($criteria)) && ($criteria == $value))  {
+                                               // Is the criteria met or none set?
+                                               //* NOISY-DEBUG: */ $this->debugOutput('DATABASE: criteria[' . gettype($criteria) . ']=' . $criteria . ';()=' . strlen($criteria) . ',criteriaInstance()=' . $criteriaInstance->count() . ',value(' . strlen($value) . ')=' . $value);
+                                               if (((!is_null($criteria)) && ($criteria == $value)) || ($criteriaInstance->count() == 0))  {
                                                        // Shall we skip this entry?
                                                        if ($criteriaInstance->getSkip() > 0) {
                                                                // We shall skip some entries
@@ -467,6 +473,8 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
                        while (($dataFile = $directoryInstance->readDirectoryExcept(array('.', '..', '.htaccess', '.svn', 'info.' . $this->getFileExtension()))) && ($limitFound < $searchInstance->getLimit())) {
                                // Does the extension match?
                                if (substr($dataFile, -(strlen($this->getFileExtension()))) !== $this->getFileExtension()) {
+                                       // Debug message
+                                       /* NOISY-DEBUG: */ $this->debugOutput('DATABASE: dataFile=' . $dataFile . ',getFileExtension()=' . $this->getFileExtension());
                                        // Skip this file!
                                        continue;
                                } // END - if
@@ -482,7 +490,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
                                                $criteria = $searchInstance->getCriteriaElemnent($key);
 
                                                // Is the criteria met?
-                                               if ((!is_null($criteria)) && ($criteria == $value))  {
+                                               if (((!is_null($criteria)) && ($criteria == $value)) || ($searchInstance->count() == 0))  {
                                                        // Shall we skip this entry?
                                                        if ($searchInstance->getSkip() > 0) {
                                                                // We shall skip some entries