Fixed upgrade procedure (collation written to confg file).
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Fri, 8 Jan 2016 13:58:41 +0000 (14:58 +0100)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Sat, 9 Jan 2016 09:10:31 +0000 (10:10 +0100)
sql/alter2.4.php
sql/alter2.4rc1.php

index 0cc1fe46bdc1cff1f13579e735577afd93581c3d..0dfdbface1845fa5906fc6a73153289d2285e318 100644 (file)
@@ -19,7 +19,7 @@ class fa2_4 extends fa_patch {
        
        function fa2_4() {
                parent::fa_patch();
-               $this->description = _('Upgrade from version 2.3 to 2.4');
+               $this->description = _('Upgrade from version 2.3 to 2.4RC1');
        }
        
     /*
@@ -41,7 +41,7 @@ class fa2_4 extends fa_patch {
     */
        function prepare()
     {
-               $this->collation = get_mysql_collation(get_post('collation'));
+               $this->collation = get_post('collation');
                return true;
        }
 
@@ -75,6 +75,20 @@ class fa2_4 extends fa_patch {
 
                if ($result)
                        $result = $this->do_cleanup();
+               if ($result)
+               {
+                       $db_connections[$company]['collation'] = $this->collation;
+                       if (write_config_db())
+                               return $this->log_error(_("Cannot update config_db.php file."));
+               }
+
+               $sec_updates = array(
+                       'SA_SETUPCOMPANY' => array(
+                               'SA_ASSET', 'SA_ASSETCATEGORY', 'SA_ASSETCLASS',
+                               'SA_ASSETSTRANSVIEW','SA_ASSETTRANSFER', 'SA_ASSETDISPOSAL',
+                               'SA_DEPRECIATION', 'SA_ASSETSANALYTIC'),
+               );
+               $result = $this->update_security_roles($sec_updates);
 
                return $result;
        }
@@ -135,12 +149,15 @@ class fa2_4 extends fa_patch {
 
                $old_encoding = 'latin1'; // default client encoding
 
+               // uncomment in case of 1071 errors (requires SUPER privileges)
+               // db_query("SET @@global.innodb_large_prefix=1", "Cannot set large prefix");
+
                 // site default encoding is presumed as encoding for all databases!
                $lang = array_search_value($dflt_lang, $installed_languages, 'code');
                $new_encoding = get_mysql_encoding_name(strtoupper($lang['encoding']));
 
                $this->log_error(sprintf('Switching database to utf8 encoding from %s', $old_encoding), 'Info');
-               $collation = $this->collation;
+               $collation = get_mysql_collation($this->collation);
                $tsql = "SHOW TABLES LIKE '".($pref=='' ? '' : substr($pref, 0, -1).'\\_')."%'";
                $tresult = db_query($tsql, "Cannot select all tables with prefix '$pref'");
                while($tbl = db_fetch($tresult)) {
index 75ed0d05f26181c3e47ccb842ea955d46e2dbf14..02e17122d7c085be11ba3105ad7e17353a9e0cd2 100644 (file)
@@ -19,7 +19,7 @@ class fa2_4rc1 extends fa_patch {
 
        function fa2_4rc1() {
                parent::fa_patch();
-               $this->description = _('Upgrade from version 2.4beta to 2.4rc1');
+               $this->description = _('Upgrade from version 2.4beta to 2.4RC1');
        }
 
        //