viewgit/inc/functions.php:22 Function utf8_encode() is deprecated [8192]

tweaks to database code so server settings works after php5.4 changes, a=chris

Chris Pollett [2015-07-01 22:Jul:st]
tweaks to database code so server settings works after php5.4 changes, a=chris
Filename
configs/Config.php
controllers/components/SystemComponent.php
library/UpgradeFunctions.php
models/Model.php
models/ProfileModel.php
diff --git a/configs/Config.php b/configs/Config.php
index 067727faf..8167b3978 100755
--- a/configs/Config.php
+++ b/configs/Config.php
@@ -215,7 +215,7 @@ if (file_exists(WORK_DIRECTORY . PROFILE_FILE_NAME)) {
     }
     /** @ignore */
     define('PROFILE', false);
-    define('DBMS', 'sqlite3');
+    define('DBMS', 'Sqlite3');
     define('AUTHENTICATION_MODE', NORMAL_AUTHENTICATION);
     define('DEBUG_LEVEL', NO_DEBUG_INFO);
     define('USE_FILECACHE', false);
diff --git a/controllers/components/SystemComponent.php b/controllers/components/SystemComponent.php
index 447324197..832b7d8e4 100755
--- a/controllers/components/SystemComponent.php
+++ b/controllers/components/SystemComponent.php
@@ -570,6 +570,17 @@ class SystemComponent extends Component
         }
         $data = array_merge($data,
             $profile_model->getProfile(WORK_DIRECTORY));
+        if ($data['DBMS'] == lcfirst($data['DBMS'])) {
+            //using old name, migrate to new
+            $_REQUEST['DBMS'] = ucfirst($data['DBMS']);
+            $parent->updateProfileFields($data, $profile,
+                ['AD_LOCATION', 'SEND_MAIL_MEDIA_UPDATER',
+                'USE_FILECACHE', 'USE_MAIL_PHP', 'USE_MEMCACHE',
+                'USE_PROXY']);
+            $old_profile = $profile_model->getProfile(WORK_DIRECTORY);
+            $profile_model->updateProfile(WORK_DIRECTORY, $profile,
+                $old_profile);
+        }
         $data['MEMCACHE_SERVERS'] = str_replace(
             "|Z|","\n", $data['MEMCACHE_SERVERS']);
         $data['PROXY_SERVERS'] = str_replace(
diff --git a/library/UpgradeFunctions.php b/library/UpgradeFunctions.php
index 4e4460330..be616935e 100644
--- a/library/UpgradeFunctions.php
+++ b/library/UpgradeFunctions.php
@@ -157,7 +157,7 @@ function upgradeDatabaseWorkDirectory()
     $key = array_search($current_version, $versions);
     $versions = array_slice($versions, $current_version);
     foreach ($versions as $version) {
-        $upgradeDB = "upgradeDatabaseVersion$version";
+        $upgradeDB = NS_LIB . "upgradeDatabaseVersion$version";
         $upgradeDB($model->db);
     }
 }
diff --git a/models/Model.php b/models/Model.php
index 6befd42d4..f1b208b91 100755
--- a/models/Model.php
+++ b/models/Model.php
@@ -347,7 +347,7 @@ class Model implements CrawlConstants
      */
     public function loginDbms($dbms)
     {
-        return !in_array($dbms, ["sqlite", "sqlite3"]);
+        return !in_array($dbms, ["Sqlite3"]);
     }
     /**
      * Used to determine if an action involves just one yioop instance on
diff --git a/models/ProfileModel.php b/models/ProfileModel.php
index 9b71b548e..805c6dbee 100755
--- a/models/ProfileModel.php
+++ b/models/ProfileModel.php
@@ -455,7 +455,7 @@ EOT;
                     @mkdir(APP_DIR . "/css");
                     @chmod(APP_DIR . "/css", 0777);
                 }
-                $css_file = APP_DIR . "/css/Auxiliary.css";
+                $css_file = APP_DIR . "/css/auxiliary.css";
                 file_put_contents($css_file,
                     $new_profile_data['AUXILIARY_CSS']);
                 @chmod($css_file, 0777);
@@ -502,7 +502,6 @@ EOT;
     public function migrateDatabaseIfNecessary($dbinfo, $skip_list = [])
     {
         $test_dbm = $this->testDatabaseManager($dbinfo);
-
         if ($test_dbm === false || $test_dbm === true) {return $test_dbm; }

         $this->initializeSql($test_dbm, $dbinfo);
ViewGit