]> git.mxchange.org Git - core.git/blobdiff - inc/classes/main/database/databases/class_LocalFileDatabase.php
Some fixes.
[core.git] / inc / classes / main / database / databases / class_LocalFileDatabase.php
index ed849a99369afd61d633cd215b1783bec5b26e05..881831054de5d5241ca2806420d09e2058b8cda6 100644 (file)
@@ -206,7 +206,7 @@ class LocalFileDatabase extends BaseDatabaseBackend implements DatabaseBackend {
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DATABASE: Writing ' . strlen($compressedData) . ' bytes ...');
 
                // Write this data BASE64 encoded to the file
-               $this->getFileIoInstance()->saveFile($fqfn, $compressedData, $this);
+               $this->getFileIoInstance()->saveStreamToFile($fqfn, $compressedData, $this);
 
                // Debug message
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DATABASE: Flushing ' . count($dataArray) . ' elements to database file completed.');
@@ -340,17 +340,22 @@ class LocalFileDatabase extends BaseDatabaseBackend implements DatabaseBackend {
         * @throws      SqlException                                    If an 'SQL error' occurs
         */
        public function querySelect ($tableName, LocalSearchCriteria $searchInstance) {
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DATABASE: tableName=' . $tableName . ' - CALLED!');
+
                // The result is null by any errors
                $resultData = NULL;
 
                // Create full path name
                $pathName = $this->getConfigInstance()->getConfigEntry('local_db_path') . $tableName . '/';
 
-               // A 'select' query is not that easy on local files, so first try to
-               // find the 'table' which is in fact a directory on the server
+               /*
+                * A 'select' query is not that easy on local files, so first try to
+                * find the 'table' which is in fact a directory on the server
+                */
                try {
                        // Get a directory pointer instance
-                       $directoryInstance = FrameworkDirectoryPointer::createFrameworkDirectoryPointer($pathName);
+                       $directoryInstance = ObjectFactory::createObjectByConfiguredName('directory_class', array($pathName));
 
                        // Initialize the result data, this need to be rewritten e.g. if a local file cannot be read
                        $resultData = array(
@@ -364,7 +369,10 @@ class LocalFileDatabase extends BaseDatabaseBackend implements DatabaseBackend {
                        $idx = 1;
 
                        // Read the directory with some exceptions
-                       while (($dataFile = $directoryInstance->readDirectoryExcept(array('.', '..', '.htaccess', '.svn', 'info.' . $this->getFileExtension()))) && (($limitFound < $searchInstance->getLimit()) || ($searchInstance->getLimit() == 0))) {
+                       while (($dataFile = $directoryInstance->readDirectoryExcept(array('.htaccess', 'info.' . $this->getFileExtension()))) && (($limitFound < $searchInstance->getLimit()) || ($searchInstance->getLimit() == 0))) {
+                               // Debug message
+                               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DATABASE: dataFile=' . $dataFile . ',this->getFileExtension()=' . $this->getFileExtension());
+
                                // Does the extension match?
                                if (substr($dataFile, -(strlen($this->getFileExtension()))) !== $this->getFileExtension()) {
                                        // Skip this file!
@@ -487,7 +495,7 @@ class LocalFileDatabase extends BaseDatabaseBackend implements DatabaseBackend {
                // Try all the requests
                try {
                        // Get a file pointer instance
-                       $directoryInstance = FrameworkDirectoryPointer::createFrameworkDirectoryPointer($pathName);
+                       $directoryInstance = ObjectFactory::createObjectByConfiguredName('directory_class', array($pathName));
 
                        // Initialize limit/skip
                        $limitFound = 0;
@@ -500,7 +508,7 @@ class LocalFileDatabase extends BaseDatabaseBackend implements DatabaseBackend {
                        $searchInstance = $dataSetInstance->getSearchInstance();
 
                        // Read the directory with some exceptions
-                       while (($dataFile = $directoryInstance->readDirectoryExcept(array('.', '..', '.htaccess', '.svn', 'info.' . $this->getFileExtension()))) && (($limitFound < $searchInstance->getLimit()) || ($searchInstance->getLimit() == 0))) {
+                       while (($dataFile = $directoryInstance->readDirectoryExcept(array('.htaccess', 'info.' . $this->getFileExtension()))) && (($limitFound < $searchInstance->getLimit()) || ($searchInstance->getLimit() == 0))) {
                                // Does the extension match?
                                if (substr($dataFile, -(strlen($this->getFileExtension()))) !== $this->getFileExtension()) {
                                        // Debug message