]> git.mxchange.org Git - core.git/blobdiff - inc/classes/main/database/databases/class_LocalFileDatabase.php
Moved socket registry to hub project, extended socket container with more parameters
[core.git] / inc / classes / main / database / databases / class_LocalFileDatabase.php
index 2d4929c80273157a75fa9b143d66484711c2e270..0eb8f91bb2e8443744b45a858cae65d381ca9054 100644 (file)
@@ -6,7 +6,7 @@
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.ship-simu.org
  *
@@ -83,13 +83,9 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
         *
         * @return      void
         */
-       protected function __construct() {
+       protected function __construct () {
                // Call parent constructor
                parent::__construct(__CLASS__);
-
-               // Clean up a little
-               $this->removeNumberFormaters();
-               $this->removeSystemArray();
        }
 
        /**
@@ -103,17 +99,23 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
         */
        public final static function createLocalFileDatabase ($savePath, FileIoHandler $ioInstance) {
                // Get an instance
-               $dbInstance = new LocalFileDatabase();
+               $databaseInstance = new LocalFileDatabase();
 
                // Set save path and IO instance
-               $dbInstance->setSavePath($savePath);
-               $dbInstance->setFileIoInstance($ioInstance);
+               $databaseInstance->setSavePath($savePath);
+               $databaseInstance->setFileIoInstance($ioInstance);
+
+               // Set the compressor channel
+               $databaseInstance->setCompressorChannel(CompressorChannel::createCompressorChannel(
+                       $databaseInstance->getConfigInstance()->getConfigEntry('base_path').
+                       $databaseInstance->getConfigInstance()->getConfigEntry('compressor_base_path')
+               ));
 
                // "Connect" to the database
-               $dbInstance->connectToDatabase();
+               $databaseInstance->connectToDatabase();
 
                // Return database instance
-               return $dbInstance;
+               return $databaseInstance;
        }
 
        /**
@@ -123,11 +125,8 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
         * @return      void
         */
        public final function setSavePath ($savePath) {
-               // Secure string
-               $savePath = (string) $savePath;
-
                // Set save path
-               $this->savePath = $savePath;
+               $this->savePath = (string) $savePath;
        }
 
        /**
@@ -290,7 +289,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend
                // Get the file contents
                try {
                        $infoArray = $this->getDataArrayFromFile($fqfn);
-               } catch (FileNotFoundException $e) {
+               } catch (FileIoException $e) {
                        // Not found, so ignore it here
                }