X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fclasses%2Fmain%2Fdatabase%2Fdatabases%2Fclass_LocalFileDatabase.php;h=dd1f5b745990c5d6d90f148a913626948ccead42;hb=4ad6f99674864c9771a7f4c06a61bdbba3684e59;hp=e7378df5ec34a6ea27042127e56d4060c25ef366;hpb=fdc6a02b5e6c2155cda61fcc345c7583b734ab85;p=core.git diff --git a/inc/classes/main/database/databases/class_LocalFileDatabase.php b/inc/classes/main/database/databases/class_LocalFileDatabase.php index e7378df5..dd1f5b74 100644 --- a/inc/classes/main/database/databases/class_LocalFileDatabase.php +++ b/inc/classes/main/database/databases/class_LocalFileDatabase.php @@ -27,7 +27,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class LocalFileDatabase extends BaseDatabaseBackend implements DatabaseBackendInterface { +class LocalFileDatabase extends BaseDatabaseBackend implements DatabaseBackend { /** * The file's extension */ @@ -350,7 +350,7 @@ class LocalFileDatabase extends BaseDatabaseBackend implements DatabaseBackendIn // 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 DatabaseBackendIn $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 DatabaseBackendIn // 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 DatabaseBackendIn $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 DatabaseBackendIn // 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]