Upgrading from old versions to 6.x-2.3: update.php never finishes

bengtan - July 30, 2009 - 05:25
Project:Date
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:reviewed & tested by the community
Description

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

bengtan - July 30, 2009 - 05:25
Priority:normal» critical

#2

bengtan - July 30, 2009 - 06:17

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

DanielTheViking - July 30, 2009 - 07:35
Status:active» duplicate

Patch here:
http://drupal.org/node/535008

#4

bengtan - July 30, 2009 - 07:55
Status:duplicate» active

Sorry, this is different from http://drupal.org/node/535008. Please read the original post again. Thanks.

#5

David_Rothstein - July 30, 2009 - 17:02
Status:active» needs review

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.

AttachmentSize
date_update_6005.patch 1.28 KB

#6

Justin W Freeman - July 31, 2009 - 03:55
Version:6.x-2.3» 6.x-2.x-dev

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.

AttachmentSize
date_update_6005_2.patch 1002 bytes

#7

pastk - July 31, 2009 - 16:38

subscribing

#8

woodybrando - August 4, 2009 - 22:35

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

Justin W Freeman - August 4, 2009 - 23:02

Check out this how to - http://drupal.org/patch/apply

This patch will apply with
patch -p0 < date_update_6005_2.patch

#10

woodybrando - August 4, 2009 - 23:27

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

Justin W Freeman - August 4, 2009 - 23:34

Generally you put the file in the folder of the module you are patching and then run the command from that same folder.

#12

caillou - August 9, 2009 - 11:34

The patch works for me too.
Thanks very much !

#13

seutje - August 12, 2009 - 14:30

marked #522608: date.install update 6005 problem as duplicate, even though it's older, this one is more comprehensive and offers a patch

#14

kmonty - August 12, 2009 - 22:46
Status:needs review» reviewed & tested by the community

Patch #6 works great

#15

KarenS - August 21, 2009 - 20:32
Status:reviewed & tested by the community» fixed

Yep, the table got renamed from date_format to date_formats and this test didn't get updated to match that.

#16

glass.dimly - September 4, 2009 - 18:57

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

glass.dimly - September 11, 2009 - 15:06

Can somebody roll this into the current branch of the date module? It's not in the 2.x branch.

#18

kmonty - September 13, 2009 - 21:30
Status:fixed» patch (to be ported)

#19

anarcat - October 9, 2009 - 02:40
Status:patch (to be ported)» reviewed & tested by the community

The ported (to 2.4) patch is attached, please commit.

AttachmentSize
535270_date_upgrade.patch 1.01 KB

#20

anarcat - October 9, 2009 - 02:42

Last patch unintentionally fixed line endings, fixed.

AttachmentSize
535270_date_upgrade.patch 912 bytes

#21

Justin W Freeman - November 4, 2009 - 07:58

Patch in #20 works for me for 6.x-2.4

 
 

Drupal is a registered trademark of Dries Buytaert.