View Single Post
  #2  
Old 05-23-2012, 07:25 AM
 
ISG ISG is offline
 

Member
  
Join Date: Apr 2008
Posts: 16
 

Default Re: 4.5.0 Database upgrade packs released

Thanks!

I ran into a few small problems in the process of upgrading from 4.2.3 to 4.5.0. Just listing them here in case they happen to anyone else.

The first problem had to do with caching, I think. As soon as I ran upgrade_sql.php, it said, "ERROR in upg_get_all_languages_charsets function. $all_languages array is empty". I couldn't figure out how to get the charsets cache to work, so I just added these lines to simulate cached values:

Code:
@@ -1139,6 +1139,7 @@ } else { $translators = _upg_get_language_translators(); $all_languages = func_data_cache_get('charsets'); + $all_languages = array('US' => 'utf-8'); $_new_all_languages = array(); foreach ($all_languages as $k => $value) { $_new_all_languages[$translators[$k]] = $value; @@ -1961,6 +1962,7 @@ $all_languages = func_data_cache_get('languages', array('en')); } else { $all_languages = func_data_cache_get('charsets'); + $all_languages = array('US' => 'utf-8'); $_new_all_languages = array(); foreach ($all_languages as $k => $value) { $_new_all_languages[$translators[$k]] = $value; @@ -4335,6 +4337,7 @@ $all_languages = func_data_cache_get('languages', array('en')); } else { $all_languages = func_data_cache_get('charsets'); + $all_languages = array('US' => 'utf-8'); foreach ($all_languages as $k => $value) { $all_languages[$k] = array(); $all_languages[$k]['charset'] = $value;


The second problem occurred while the tables were being upgraded. This query:

Code:
ALTER TABLE $sql_tbl[address_book] ADD UNIQUE `no_dups_in_addressbook` (title,firstname,lastname,userid,address,city,county,state,country,zipcode)

failed with a MySQL error: "Specified key was too long; max key length is 1000 bytes". That's because my database's default charset was already UTF-8, so when the upgrade pack created the xcart_address_book table, it was UTF-8. Then, upgrade_sql.php tried to create an index with about 700 characters. That would work with an ISO 8859 table, but with UTF-8, MySQL assumes each character will take up 3 bytes for this purpose, so 700 charcters = 2100 bytes, which exceeds the 1000-byte maximum.

To get around this, I just used a shorter index:

Code:
ALTER TABLE $sql_tbl[address_book] ADD UNIQUE `no_dups_in_addressbook` (userid,address,zipcode)

When the conversion was done, I found that some characters (in user data and category names) were garbled when I browsed the store, because the store was set to display pages as ISO 8859-1, but the data was actually UTF-8. So I changed my language's charset to UTF-8.

Code:
UPDATE xcart_language_codes SET charset='UTF-8' WHERE lngid = 40;

I'm not sure if this is the right way to do what I want, but it seems to be the equivalent of changing the charset setting while editing a language in older versions of X-Cart. (I had set my language's charset to UTF-8 in the 4.2.3 version of the store.)
__________________
ISG
Florida, USA
X-Cart 4.5.0 [Linux]
Reply With Quote