Upgrading from old versions to 6.x-2.3: update.php never finishes
| Project: | Date |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | reviewed & tested by the community |
Just attempted an upgrade of a site from date 6.x-2.0rc6 to 6.x-2.3 and update.php never successfully finishes.
(Yes, I know 6.x-2.0rc6 is an old version, but this issue should also apply when upgrading from versions newer than 6.x-2.0rc6.)
Diagnosis:
Update.php lists available updates date:6005 and date_api:6002-6005. The updates date_api:6002-6005 runs first, creates a table {date_format}, and then renames it to {date_formats}. Update date:6005 then runs, and never finishes, because it is checking for the existence of a table {date_format} before proceeding, but {date_format} does not exist and *will not exist*. It has already been renamed to {date_formats}.
A workaround would be to get all users to upgrade to 6.x-2.2 first before attempting to upgrade to 6.x-2.3. This may be a satisfactory workaround, and perhaps you don't need to make any code fixes, but you should at least be aware of this issue.

#1
#2
One possibility is to change line 534 in date_update_6005() from:
from:
if (!db_table_exists('date_format') || !db_table_exists('date_format_types')) {to:
if ((!db_table_exists('date_format') && !db_table_exists('date_formats')) || !db_table_exists('date_format_types')) {#3
Patch here:
http://drupal.org/node/535008
#4
Sorry, this is different from http://drupal.org/node/535008. Please read the original post again. Thanks.
#5
I confirmed that this is a problem, although I'm pretty sure 6.x-2.0rc6 is the most recent release for which it would occur (since it looks like the 2.0 release of Date is when that update function was first added...)
Looking at the affected code, the suggestion in #2 above makes sense to me, so here it is as a patch.
#6
The patch works for me too.
Sorry to be picky but there are a couple of unnecessary lines in the #5 patch so I have made a slightly cleaner version. It is against 6.x-2.x-dev.
#7
subscribing
#8
Hi,
I'm having the same problem and was wondering if anyone could tell me how to apply the patch.
thx, jayson
lostvalley.org
#9
Check out this how to - http://drupal.org/patch/apply
This patch will apply with
patch -p0 < date_update_6005_2.patch
#10
thx Justin for the quick reply. Which directory should I be in when i run that command?
Oops, just answered my own question. I ran that command from /var/www/sites/all/modules/ and it returned this message:
patching file date/date/date.install
thx again for the help Justin!
jayson
lostvalley.org
#11
Generally you put the file in the folder of the module you are patching and then run the command from that same folder.
#12
The patch works for me too.
Thanks very much !
#13
marked #522608: date.install update 6005 problem as duplicate, even though it's older, this one is more comprehensive and offers a patch
#14
Patch #6 works great
#15
Yep, the table got renamed from date_format to date_formats and this test didn't get updated to match that.
#16
Did as #9 and #10 suggested, and the patch worked great. Wish I didn't have to patch at all, wish it was in Date core. Probably it is in the 2.x branch.
#17
Can somebody roll this into the current branch of the date module? It's not in the 2.x branch.
#18
#19
The ported (to 2.4) patch is attached, please commit.
#20
Last patch unintentionally fixed line endings, fixed.
#21
Patch in #20 works for me for 6.x-2.4