Upgrade problem from 5.x-2.5 to 6.x-1.2
| Project: | Internationalization |
| Version: | 6.x-1.2 |
| Component: | Miscellaneous |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Hi,
I'm preparing to upgrade my site from 5.x to 6.x and I've been testing the upgrade path in my development environment this weekend. It looks like that either my 5.x database is broken in terms of i18n or something is wrong with the 6.x-1.2 update scripts. Either way, I would really appreciate help with my problems.
Background information:
- Core versions: 5.20 and 6.14
Pre-update procedures I've taken:
- All contrib modules were up to date
- Only i18n module of i18n package was in use in my 5.x site
- Disabled all contrib modules prior to update
- Switched the theme to Garland
Upgrade procedures:
- Emptied the installation directory of 5.x
- Copied D6.14 files there, copied my previous sites/default/settings.php and files-directory
- I ran update.php
Problem #1
Got the following warning when running update.php to update Drupal core:
user warning: Duplicate entry '5825-0' for key 1 query: ALTER TABLE drupal_locales_target ADD PRIMARY KEY (language, lid, plural) in /path/to/drupal/includes/database.mysql-common.inc on line 374.Question 1: Is this warning somehow related to the following problems?
Question 2: If not, could somebody please point me where to find a resolution to this warning (or confirm that this can be safely ignored as I did in my tests)
Upgrade procedures continued as follows:
- I ran update.php again so that dblog module was updated as well (for some reason it didn't update on the first run)
- Enabled Core Content Translation module as instructed in i18n upgrade handbook page
- Copied i18n (version 6.x-1.2) module files to sites/all/modules/contrib_modules
- I need i18n menu in D6 so I enabled the following modules: i18n, i18n blocks, i18n menu, string translation
Problem #2
Right after enabling this four modules I got bunch of normal messages like this (on /admin/build/modules):
Created string item:135:title for text group menu: Contact InformationBelow these messages I got bunch of error messages like this:
user warning: Table 'dev.drupal_i18n_strings' doesn't exist query: SELECT s.*, i.type, i.objectid, i.property FROM drupal_locales_source s LEFT JOIN drupal_i18n_strings i ON s.lid = i.lid WHERE s.textgroup = 'menu' AND s.location = 'item:135:title' in /path/to/drupal/sites/all/modules/contrib_modules/i18n/i18nstrings/i18nstrings.module on line 403.Below these errors I can see these two errors that are different than the one listed above:
user warning: Table 'dev.drupal_i18n_blocks' doesn't exist query: SELECT * FROM drupal_i18n_blocks WHERE language = '' in /path/to/drupal/sites/all/modules/contrib_modules/i18n/i18nblocks/i18nblocks.module on line 367.
user warning: Table 'dev.drupal_i18n_blocks' doesn't exist query: SELECT DISTINCT b.* FROM drupal_blocks b LEFT JOIN drupal_blocks_roles r ON b.module = r.module AND b.delta = r.delta LEFT JOIN drupal_i18n_blocks i18n ON (b.module = i18n.module AND b.delta = i18n.delta) WHERE (i18n.language ='fi' OR i18n.language ='' OR i18n.language IS NULL) AND ( b.theme = 'garland' AND b.status = 1 AND (r.rid IN (2,3,4,5,7) OR r.rid IS NULL) )ORDER BY b.region, b.weight, b.module in /path/to/drupal/modules/block/block.module on line 407.Problem #3
I ignored the errors just to see what happens if I ran update.php. I got the following errors: (i18nblocks module, update #2)
user warning: Table 'dev.drupal_i18n_blocks_i18n' doesn't exist query: INSERT INTO drupal_i18n_blocks (module, delta, language) SELECT i.module, i.delta, i.language FROM drupal_i18n_blocks_i18n i WHERE i.module = 'block' in /path/to/drupal/sites/all/modules/contrib_modules/i18n/i18nblocks/i18nblocks.install on line 121.Essential background information
As I mentioned in the beginning of my post, the i18n module is the only module in the i18n package that is currently in use on my 5.x site. However, I have had some other i18n modules enabled but I have disabled them after finding a way to build the site without them. These modules have been enabled very long time ago and i18n has been updated probably many times (without update errors) on my 5.x site.
Unfortunately I can't give you details on what i18n modules I have had in use. I'm sure that can be found out with a little digging in the database so I could use some help with this (this is my question #3, where to look from?).
My gut feeling tells my that the root cause for the problems #2 and #3 is the fact that I have had some other i18n modules than the i18n-core module enabled in the past (I don't believe that the upgrade path from 5.x to 6.x would be completely broken - after all i18n is so widely used). It might even be that I have used some i18n experimental modules in the past - can't tell for sure.
I guess that one solution might be to manually uninstall the unneeded i18n data from my 5.x database prior to the upgrade (this is based on an assumption that the errors mentioned above are caused from those and not bugs in 6.x-1.2 update scripts).
I'll be glad to give additional information on my 5.x database structure to get these problems solved. At the moment these i18n problems are critical blockers for my site upgrade.
Best regards,
Markus Sipilä
Finland

#1
Update:
I did some digging in the database and I can now confirm that I have not enabled the experimental i18n modules so they are not causing these problems.
i18n strings: I don't have {i18n_locale_strings} that would have been created during install
i18n sync: the weight of this module is 0 (would be 100 if the module had been installed)
i18n content: this module does not make structural changes to db, only select queries
Based on this I can't see any "stupid user errors" that I would have made to cause these update errors - all other i18n modules (except the experimental ones) should upgrade without errors, right?
-Markus
#2
Upgrading experimental modules is not yet supported. This seems to be a duplicate of #395598: D52 -> D6 upgrade: missing columns in i18n_strings table.
#3
hass, thanks for your reply!
If I'm not mistaken only the first part of problem #2 is duplicate to issue #395598.
i18n strings
I'm a little confused about this issue (i18n strings) because I haven't enabled the experimental 5.x strings module as I explained in comment #1.
i18n blocks
i18n blocks is also causing troubles and I think that module is not marked as experimental. Any ideas to this?
How to proceed
I would really like to help troubleshoot these issues and contribute my findings but I need a little guidance on how to proceed. I'm familiar with PHP, MySQL (and Drupal module development to some extent) but I haven't been working with module update scripts before.
What I'm asking is that somebody would check my first post in this issue and give me an educated guess of whether this problems are related to each other or do they look like separate problems. Meanwhile I'll google how the update scripts work.
#4
#1. This is a core bug, see #223077: update 5.7 to 6.0 failed "ALTER TABLE {locales_target} ADD PRIMARY KEY (language, lid, plural)"
#2. How have you upgraded? I haven't tested the upgrade path with i18n, but I believe it's possible that this haven't been tested with all i18n modules disabled, but in such a case the upgrade hooks are still executed. I'm only guessing... you need to post the upgrade errors (marked red).
#5
The update process is described in detail in the first post of this issue as well as the DB error messages I got. The i18n modules were all disabled at first as instructed in the updgare handbook page of the i18n module, see http://drupal.org/node/313315.
If I understood your last comment correctly I should try to upgrade my installation with i18n modules enabled, right? Just to make sure:
- leave i18n modules enabled in D5 installation
- copy D6 core files to the right place
- copy D6 i18n files the right place
- try to run update.php
I'll try this and report how it went.
#6
Yes, many developers missed this D6 feature :-(((. It's best to upgrade core first via update.php and copy the modules afterwards inside and run update.php again. This way you really see if this is a core or module bug and it may prevent failures you may have seen if you keep the module enabled in D5, but make sure not to copy the modules into the install until core has been upgraded. Try it...
#7
I got rid of the first problem (locales_target) which was a Drupal core bug, http://drupal.org/node/223077#comment-2195328
I then made two different upgrade tests.
Test 1 - i18n modules were disabled in 5.20 before upgrading
This is like the upgrade test in my first post except that I'm using the patched core system.install to avoid the locales_target -error.
user warning: Table 'dev.drupal_i18n_blocks' doesn't exist query: SELECT * FROM drupal_i18n_blocks WHERE language = '' in /path/to/drupal/sites/all/modules/contrib_modules/i18n/i18nblocks/i18nblocks.module on line 367.user warning: Table 'dev.drupal_i18n_blocks' doesn't exist query: SELECT DISTINCT b.* FROM drupal_blocks b LEFT JOIN drupal_blocks_roles r ON b.module = r.module AND b.delta = r.delta LEFT JOIN drupal_i18n_blocks i18n ON (b.module = i18n.module AND b.delta = i18n.delta) WHERE (i18n.language ='fi' OR i18n.language ='' OR i18n.language IS NULL) AND ( b.theme = 'garland' AND b.status = 1 AND (r.rid IN (2,3,4,5,7) OR r.rid IS NULL) )ORDER BY b.region, b.weight, b.module in /path/to/drupal/modules/block/block.module on line 407.Test 2 - i18n module enabled in D5.20 before upgrading
In this test I left the i18n module and i18n block module enabled before I started the upgrade process.
An error occurred. http://www.example.com/update.php?id=1&op=do <br /> <b>Fatal error</b>: Call to undefined function tt() in <b>/path/to/drupal/sites/all/modules/contrib_modules/i18n/i18nblocks/i18nblocks.module</b> on line <b>234</b><br />Conclusion
drupal_i18n_blocksdoes not exist. These errors occur before update.php, when enabling the i18n blocks module#8
I managed to debug this a little bit further. As the conclusion in my previous comment suggests, the problem is indeed in the i18nblocks module. I can upgrade the Internationalization module and install the String translation module without errors as follows:
Debugging the i18nblocks module
After succesfully upgrading the i18n module and installing the String translation module I dug a little bit deeper with the i18nblocks module.
#9
#10
I ran drupal_install_schema('i18nblocks') manually. I did this by creating a new node, setting the input format to php and running the function from there by previewing the new node. The i18n_blocks table was created successfully without errors and now everything seems to work normally.
Conclusion
For some reason my D5 DB did not contain the i18n_blocks table and this caused the problem. This might be due to disabling (maybe even uninstalling?) the module at some point in my D5 based site development. As I mentioned earlier the only i18n module I needed in my D5 production site was the i18n module itself. However, everything in this case suggests that I had had the i18n blocks module installed at some point in the development of my D5 site.
Edit: fixed a typo, the right argument to drupal_install_schema is 'i18nblocks' (not 'i18n_blocks')