]> git.mxchange.org Git - core.git/blobdiff - inc/classes/main/database/databases/class_LocalFileDatabase.php
Rewritten a lot double-quotes to single-requotes, removed deprecated exception, some...
[core.git] / inc / classes / main / database / databases / class_LocalFileDatabase.php
index 2e28443090bf01b5ebfff2ebe9a36cb1d3a7b900..d026afd4fbb4e332053f8369ea0d88671fba85e1 100644 (file)
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontendInterface {
-
        // Constants for MySQL backward-compatiblity (PLEASE FIX THEM!)
        const DB_CODE_TABLE_MISSING     = 0x100;
        const DB_CODE_TABLE_UNWRITEABLE = 0x101;
        const DB_CODE_DATA_FILE_CORRUPT = 0x102;
 
+       // Status results
+       const RESULT_OKAY = 'ok';
+
        /**
         * Save path for "file database"
         */
@@ -38,7 +40,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
        /**
         * The file's extension
         */
-       private $fileExtension = "serialized";
+       private $fileExtension = 'serialized';
 
        /**
         * The last read file's name
@@ -331,7 +333,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
                if (!isset($this->tableInfo['primary'])) {
                        // Then create the info file
                        $this->createTableInfoFile($dataSetInstance);
-               } elseif (($this->getConfigInstance()->readConfig('db_update_primary_forced') === "Y") && ($dataSetInstance->getPrimaryKey() != $this->tableInfo['primary'])) {
+               } elseif (($this->getConfigInstance()->readConfig('db_update_primary_forced') == 'Y') && ($dataSetInstance->getPrimaryKey() != $this->tableInfo['primary'])) {
                        // Set the array element
                        $this->tableInfo[$dataSetInstance->getTableName()]['primary'] = $dataSetInstance->getPrimaryKey();
 
@@ -353,12 +355,12 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
         * Starts a SELECT query on the database by given return type, table name
         * and search criteria
         *
-        * @param       $resultType             Result type ("array", "object" and "indexed" are valid)
+        * @param       $resultType             Result type ('array', 'object' and 'indexed' are valid)
         * @param       $tableName              Name of the database table
         * @param       $criteria               Local search criteria class
         * @return      $resultData             Result data of the query
         * @throws      UnsupportedCriteriaException    If the criteria is unsupported
-        * @throws      SqlException                                    If an "SQL error" occurs
+        * @throws      SqlException                                    If an 'SQL error' occurs
         */
        public function querySelect ($resultType, $tableName, LocalSearchCriteria $criteriaInstance) {
                // The result is null by any errors
@@ -367,15 +369,15 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
                // Create full path name
                $pathName = $this->getSavePath() . $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);
 
                        // Initialize the result data, this need to be rewritten e.g. if a local file cannot be read
                        $resultData = array(
-                               'status'        => "ok",
+                               'status'        => LocalfileDatabase::RESULT_OKAY,
                                'rows'          => array()
                        );
 
@@ -385,7 +387,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
                        $idx = 1;
 
                        // Read the directory with some exceptions
-                       while (($dataFile = $directoryInstance->readDirectoryExcept(array(".", "..", ".htaccess", ".svn", "info." . $this->getFileExtension()))) && ($limitFound < $criteriaInstance->getLimit())) {
+                       while (($dataFile = $directoryInstance->readDirectoryExcept(array('.', '..', '.htaccess', '.svn', "info." . $this->getFileExtension()))) && ($limitFound < $criteriaInstance->getLimit())) {
                                // Does the extension match?
                                if (substr($dataFile, -(strlen($this->getFileExtension()))) !== $this->getFileExtension()) {
                                        // Skip this file!
@@ -521,7 +523,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
                        $searchInstance = $dataSetInstance->getSearchInstance();
 
                        // Read the directory with some exceptions
-                       while (($dataFile = $directoryInstance->readDirectoryExcept(array(".", "..", ".htaccess", ".svn", "info." . $this->getFileExtension()))) && ($limitFound < $searchInstance->getLimit())) {
+                       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()) {
                                        // Skip this file!