]> git.mxchange.org Git - shipsimu.git/blobdiff - inc/classes/main/database/classes/class_LocalFileDatabase.php
More class descriptions translated, generic user class added
[shipsimu.git] / inc / classes / main / database / classes / class_LocalFileDatabase.php
index 7ac2b7db11c7f53d981f5d7eb45bb52aa9a50749..dbe55ac36d4690125e36dfa9f74569cfaca4ccf9 100644 (file)
@@ -55,7 +55,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
                parent::__construct(__CLASS__);
 
                // Set description
-               $this->setObjectDescription("Dateidatenbankschicht");
+               $this->setObjectDescription("Class for local file databases");
 
                // Create unique ID
                $this->createUniqueID();
@@ -70,7 +70,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
         *
         * @param               $savePath                                       The local file path string
         * @param               $ioInstance                             The input/output handler. This
-        *                                                                      should be FileIOHandler
+        *                                                                      should be FileIoHandler
         * @return      $dbInstance                             An instance of LocalFileDatabase
         * @throws      SavePathIsEmptyException                If the given save path is an
         *                                                                      empty string
@@ -81,7 +81,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
         * @throws      SavePathWriteProtectedException If the save path is write-
         *                                                                              protected
         */
-       public final static function createLocalFileDatabase ($savePath, FileIOHandler $ioInstance) {
+       public final static function createLocalFileDatabase ($savePath, FileIoHandler $ioInstance) {
                // Get an instance
                $dbInstance = new LocalFileDatabase();
 
@@ -99,14 +99,9 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
                        throw new SavePathWriteProtectedException($savePath, self::EXCEPTION_WRITE_PROTECED_PATH);
                }
 
-               // Debug output
-               if (defined('DEBUG_DATABASE')) $dbInstance->getDebugInstance()->output(sprintf("[%s:] Es werden lokale Dateien zum Speichern von Objekten verwendet.<br />\n",
-                       $dbInstance->__toString()
-               ));
-
                // Set save path and IO instance
                $dbInstance->setSavePath($savePath);
-               $dbInstance->setFileIOInstance($ioInstance);
+               $dbInstance->setFileIoInstance($ioInstance);
 
                // Return database instance
                return $dbInstance;
@@ -122,12 +117,6 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
                // Secure string
                $savePath = (string) $savePath;
 
-               // Debug message
-               if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Lokaler Speicherpfad <strong>%s</strong> wird verwendet.<br />\n",
-                       $this->__toString(),
-                       $savePath
-               ));
-
                // Set save path
                $this->savePath = $savePath;
        }
@@ -164,30 +153,17 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
                        throw new MissingMethodException(array($object, '__toString'), self::EXCEPTION_MISSING_METHOD);
                }
 
-               // Debug message
-               if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Das Objekt <strong>%s</strong> soll in eine lokale Datei gespeichert werden.<br />\n",
-                       $this->__toString(),
-                       $object->__toString()
-               ));
-
                // Get a string containing the serialized object. We cannot exchange
                // $this and $object here because $object does not need to worry
                // about it's limitations... ;-)
                $serialized = $this->serializeObject($object);
 
-               // Debug message
-               if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Das Objekt <strong>%s</strong> ist nach der Serialisierung <strong>%s</strong> Byte gross.<br />\n",
-                       $this->__toString(),
-                       $object->__toString(),
-                       strlen($serialized)
-               ));
-
                // Get a path name plus file name and append the extension
                $fqfn = $this->getSavePath() . $object->getPathFileNameFromObject() . "." . $this->getFileExtension();
 
                // Save the file to disc we don't care here if the path is there,
                // this must be done in later methods.
-               $this->getFileIOInstance()->saveFile($fqfn, array($this->getCompressorChannel()->getCompressorExtension(), $serialized));
+               $this->getFileIoInstance()->saveFile($fqfn, array($this->getCompressorChannel()->getCompressorExtension(), $serialized));
        }
 
        /**
@@ -287,7 +263,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
                        $this->setLastFile($fqfn);
 
                        // Get instance for file handler
-                       $inputHandler = $this->getFileIOInstance();
+                       $inputHandler = $this->getFileIoInstance();
 
                        // Try to read from it. This makes it sure that the file is
                        // readable and a valid database file
@@ -380,7 +356,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
         */
        public final function getObjectFromCachedData ($uniqueID) {
                // Get instance for file handler
-               $inputHandler = $this->getFileIOInstance();
+               $inputHandler = $this->getFileIoInstance();
 
                // Get last file's name and contents
                $fqfn = $this->repairFQFN($this->getLastFile(), $uniqueID);