X-Git-Url: https://git.mxchange.org/?p=core.git;a=blobdiff_plain;f=inc%2Fclasses%2Fmain%2Fdatabase%2Fdatabases%2Fclass_LocalFileDatabase.php;h=16e6bee0047b3c1e01de9a23b6b5ab3be1c444aa;hp=445b7f8d67481fd3e4e8e73647cace9df07f8721;hb=869f4d32219899f678c27272b5a4ea59fc48f362;hpb=54dce2f61472927289ae152afedf1aeaf076e8b1 diff --git a/inc/classes/main/database/databases/class_LocalFileDatabase.php b/inc/classes/main/database/databases/class_LocalFileDatabase.php index 445b7f8d..16e6bee0 100644 --- a/inc/classes/main/database/databases/class_LocalFileDatabase.php +++ b/inc/classes/main/database/databases/class_LocalFileDatabase.php @@ -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.'); @@ -350,7 +350,7 @@ class LocalFileDatabase extends BaseDatabaseBackend implements DatabaseBackend { // 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 +364,7 @@ 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))) { // Does the extension match? if (substr($dataFile, -(strlen($this->getFileExtension()))) !== $this->getFileExtension()) { // Skip this file! @@ -487,7 +487,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 +500,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 @@ -596,6 +596,22 @@ class LocalFileDatabase extends BaseDatabaseBackend implements DatabaseBackend { // Return the column return $primaryKey; } + + /** + * Removes non-public data from given array. + * + * @param $data An array with possible non-public data that needs to be removed. + * @return $data A cleaned up array with only public data. + * @todo Add more generic non-public data for removal + */ + public function removeNonPublicDataFromArray (array $data) { + // Remove '__idx' + unset($data[$this->indexKey]); + + // Return it + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DATABASE: data[' . gettype($data) . ']='.print_r($data, TRUE)); + return $data; + } } // [EOF]