During the 6.x release cycle, we removed all 4.7-5.x updates to enforce the one major version upgrade at a time guideline more strictly, reduce memory usage on update.php, etc.

Here's a patch which does that, and also a bit of tidying in .install files - adding update phpdoc if it's missing, getting hooks in the same order etc.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

webernet’s picture

Status: Needs review » Needs work

There are a couple blocks of code in update.php for the 5.x-6.x update as well.

catch’s picture

Status: Needs work » Needs review
FileSize
89.16 KB

Well spotted, new patch.

webernet’s picture

Status: Needs review » Needs work

Looks like there's (at least) one more...

/**
 * Create the batch table.
 *
 * This is part of the Drupal 5.x to 6.x migration.
 */
function update_create_batch_table() {
catch’s picture

Status: Needs work » Needs review
FileSize
91.75 KB

Got that one. Did a grep, found some in blogapi.install - this should be everything now.

Hopefully this is all of them. Thanks for keeping your eyes peeled webernet.

lilou’s picture

FileSize
92.37 KB

Patch #4 re-rolled against CVS HEAD.

catch’s picture

Status: Needs review » Needs work

testing the testing bot

catch’s picture

Status: Needs work » Needs review

and again.

pwolanin’s picture

this is a good idea, but we should make 6.x->7.x updates work at all so we can confirm this patch.

Anonymous’s picture

Status: Needs review » Needs work

The last submitted patch failed testing.

Dave Reid’s picture

Assigned: catch » Dave Reid
Status: Needs work » Needs review
FileSize
106.34 KB

The previous patches were missing adding implementations of hook_update_last_removed and a few @defgroup 7.x blocks. I also wanted to make sure that update functions were always at the bottom of the .install file. That's why there are big changes in comment.install in this patch. No updates are actually changed however. I also found a few 700x updates that didn't start with 7000, so I fixed those as well.

Status: Needs review » Needs work

The last submitted patch failed testing.

Dave Reid’s picture

Status: Needs work » Needs review
FileSize
106.35 KB

Rerolled since the user table name was rolled back to users.

Status: Needs review » Needs work

The last submitted patch failed testing.

catch’s picture

Assigned: Dave Reid » catch
Status: Needs work » Needs review
FileSize
90.03 KB

Slight memory savings without APC enabled:

/admin (yes, we load every install file on /admin).

Before:
Memory used at: devel_boot()=2.59 MB, devel_shutdown()=22.67 MB, PHP peak usage=23 MB.

After:
Memory used at: devel_boot()=2.62 MB, devel_shutdown()=22.02 MB, PHP peak usage=22.25 MB.

Note there's absolutely no way these updates will run when the dbtng backwards compatibility layer is removed - so unless someone goes back retrospectively to both convert to dbtng and check for API functions which use one of the many renamed tables in D7 those updates are going to blow up for anyone trying a direct 5-7 upgrade.

Dries’s picture

Status: Needs review » Reviewed & tested by the community

Yep, we should remove those and force people to upgrade from Drupal 5 to Drupal 6 first. It is the recommended practice anyway. Marking RTBC so people can chime in if they still want to.

webchick’s picture

The "but won't someone think of the users?!?!?" part of me wants us to retain the upgrade path, since there are probably lots of sites out there that want to make the jump directly from 5.x to 7.x. But the technical arguments for removing this code are pretty compelling. So I've no problems with this patch being committed. I can do so tomorrow if you don't beat me to it. :)

catch’s picture

Users can still drop in a Drupal 6 code base, run update.php, then drop in a Drupal 7 install and run update.php in that - which will allow them to run their contrib module updates at the same time (which may or may not leave an upgrade path between Drupal versions - CCK from 5.x-7.x?).

chx’s picture

Right. NowPublic plans a D5->D7 upgrade but this does not mean I need to upgrade code in there

Dries’s picture

I'm not sure I understood what you said in #18, chx. Are you OK with committing this patch?

sun’s picture

An alternative would be to move all updates into $module.updates.inc - as a new standard. Solves the "$module.install is loaded on admin pages" and related issues.

FWIW, I also plan to upgrade most of our sites from D5->D7.

catch’s picture

@sun I think we should do that as well. But that won't solve update.php memory issues or the poor sod who has to go back and try to make Drupal 5-6 updates work for Drupal 7 (and in contrib too).

sun’s picture

FileSize
4.66 KB
102.11 KB

FWIW.

catch’s picture

Nice. Opened #497408: Move hook_update_N() to module.update since it makes a lot of sense to do that regardless.

Dries’s picture

Before something like #22 gets committed I want to study why we load all the install files. Can't look at the code yet.

catch’s picture

sun’s picture

IIRC, reason is hook_requirements(), which is supposed to live in $module.install. Some paths on/below admin/* check whether all requirements are met, and output a warning if not.

sun’s picture

ok, http://api.drupal.org/api/function/system_requirements/7 checks whether the database schema of all modules is up to date and thereby loads all hook_update_N() implementations via http://api.drupal.org/api/function/drupal_get_schema_versions/7. umph.

yched’s picture

FWIW, there's very little chance that CCK -> Fields D7 upgrade will work from anything else than D6.
+ When work on this progresses, it might very possibly uncover the need for a 'preparation' on the D6 side (before core upgrade), thus requiring getting current with CCK D6 latest release before upgrading core (just like a D5->D6 upgrade requires you get current with CCK D5 first)

catch’s picture

Looks like the unconditional load of every install file in system_status() is a pre-registry hangover. But since system_requirements() itself is going to load all updates (and is in system.install - by far the worst culprit anyway), then the only way to get the memory/code weight saving is to remove unneeded ones.

Dries’s picture

I was going to investigate this this morning, but you guys beat me to it when I was sleeping. Awesome. The Drupal community never sleeps. :-)

I'll go ahead and commit the patch in #14 and then we can continue to worry about loading of all the files in #497408: Move hook_update_N() to module.update?

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks!

tobiasb’s picture

Priority: Normal » Critical
Status: Fixed » Needs review
FileSize
486 bytes

Fatal error: Call to undefined function update_fix_d6_requirements() ...update.php on line 711

catch’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Quick fix

Ouch.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Oops. Committed to CVS HEAD. Thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Gábor Hojtsy’s picture

Status: Closed (fixed) » Needs work

Looks like this patch removed a few update functions which were not actually 5.x to 6.x updates. Around the first part of the patch is blogapi_update_6001(), which explicitly has in its comments that it is a 6.4 update. A locale location column update has a similar fate (realized via http://drupal.org/node/221020#comment-2038462). Granted these were not properly marked with the "updates-6.x-extra" group, which marks updates added after 6.0 was released. What's worse though is that updates explicitly marked with updates-6.x-extra were removed in system.install the same time.

We SHOULD keep the updates-6.x-extra updates in core, since that is the only way for 7.x to support upgrading from any 6.x version (which is our tradition and intention as far as I'm informed). If we remove updates which were added in the 6.x cycle, we'd require people to update to the latest 6.x first and only then update to 7.x. That is not how we operated so far.

My suggestion to revise this patch is to try and apply it to a Drupal 6.0 checkout. Whatever does not apply there was added after 6.x and should be rolled back and marked with the updates-6.x-extra tag. The locale location column update function was added with the wrong number even, so that should be resolved in its own issue, please leave the rollback of that out here.

Note that the patch Dries committed is in #14.

catch’s picture

Status: Needs work » Needs review
FileSize
2.21 KB

I'm not clear what the status is with that locale patch or what needs to avoid being rolled back here, so just included it - easy to delete that hunk from the patch to move it to another issue.

Blogapi is left out - that needs to be in the contrib blogapi module for D7 if anyone ever makes one.

System now has it's extras group back.

Gábor Hojtsy’s picture

Did you run through the other update functions on a check whether any others were inadvertently removed? I've just included the above as examples and suggested a procedure to verify the others.

catch’s picture

No I didn't.

Gábor Hojtsy’s picture

Status: Needs review » Needs work

Ok, let's ensure we did not restore only the random items I found manually but we systematically ensure that all update functions added after 6.0 are restored.

catch’s picture

Status: Needs work » Needs review

Well that means this patch needs review, to see if we lost any more than what's included, if we find any missing, then it needs work.

Gábor Hojtsy’s picture

@catch said in IRC, that he thinks that we should not support updates from any 6.x version to any 7.x version. Our whole development methodology is geared towards producing code supporting that though. Issues are expected to be filed against 7.x first and resolved there first before bumped back to 6.x. So by the time a possible DB update ends up in the D6 queue, it is already in D7. That is, all DB updates added after Drupal 6.0 should be in D7. Therefore Drupal 7 should support updating from any Drupal 6.x version. Changing development approaches at this point in the D7 development would not be a good idea IMHO.

Therefore we should ensure we have all extra updates restored.

catch’s picture

To clarify, I don't think this patch should've removed the 6.x-extra defgroup, and that wasn't in the initial patch on here - looks like it crept in during one of the re-rolls.

However, in principle, I think we should support updates of any release of 6.x after 7.x is released - since at that point both releases are supported. However, I don't think we particularly need to support updates from 6.0 to 7.0 since you really shouldn't be running 6.0 in February 2010 or whenever 7 comes out, and if you are, then the extra step of going to 6.0 to 6.latest-stable probably isn't the worst of your troubles. If we had such a policy, that'd mean we'd only add the -extra defgroup for schema changes to 6.x after the initial 7.0 release is out - which isn't going to happen often, since all backported updates would only appear once.

fwiw there's been a lot of moving around of update hunks in HEAD in cleanups so just checking what fails to apply is unlikely to give useful output, the more likely method to find missing updates is to check cvs history in 6.x .install files.

andypost’s picture

So what is the preferable way to make updates in install files before D7 released?

Mostly about #107824: Convert {watchdog}.referer and {accesslog}.url from VARCHAR to TEXT
and same #221020: locales_source.location is just varchar(255) and it is not truncated

if we already make a change in D6 schema in 6-extra section do we need a 700X update function?

Gábor Hojtsy’s picture

The way we did it with 5.x to 6.x is that we built in checks into the 6.x update functions to skip their business if the relevant 5.x update already happened. For identical updates, I think we've also left in "no-op update functions" (named empty functions) to signal that the given update number was removed due to a previous update covering the same thing.

Dave Reid’s picture

We need to re-add the 6.x-extra updates to our D7 system_install since we have broken update paths. Everything from system_update_6048() on up needs to be re-added, and system_update_last_removed() should be 6047.

Dave Reid’s picture

Status: Needs review » Needs work

Latest patch is missing update_6050 through 6053.

Dave Reid’s picture

Category: task » bug

Moving to a bug report so we don't miss this before release.

andypost’s picture

ctmattice1’s picture

While playing with update I ran across two items. First is the system tables default values in 6.14 do not match 7.x, in particular the weight field in 6.14 is set to tinyint(2) but in 7.x is int(11). This causes failure in update.inc function update_fix_d7_install_profile() Cannot upgrade from Drupal 6 to Drupal 7 - meta issue.

The other issue I ran into was the role_permissions tables and registry tables need to be created before updating. found role_permissions in system_update_7007. What I did was to change the system tables defaults and create the registry files in update.inc, had to also change the system_update_functions to check for the existence of the schema and skip table creation before running on both.

setting it up in update.inc still allows installs as expected and 6.x - > 7.x update with errors.

I don't pretend to know what else I missed. The errors I had dealt with d6 modules and filetimec errors on paths which resembled old d6 modules I hadn't disables when I tried the update. I particular it caught the cck module.

Can provide a diff if anyone is interested.

andypost’s picture

Status: Needs work » Needs review
FileSize
3.26 KB

This patch sync drupal-6 extra system updates section with drupal-7

catch’s picture

Assigned: catch » Unassigned

#51 is missing the locale update from #37.

andypost’s picture

catch’s picture

Status: Needs review » Reviewed & tested by the community

OK that's good enough for me.

Let's get this in.

But leave it open and at the same status so we can scour for more like the locale one which is still in flux.

catch’s picture

Title: Remove 5.x-6.x updates » Sync 6.x extra updates with HEAD

Re-titling.

andypost’s picture

Issue tags: -Quick fix +D7 upgrade path

taggin

andypost’s picture

Status: Reviewed & tested by the community » Needs review

This is a split for all modules with extra updates in d6
- modules/dblog/dblog.install
- modules/locale/locale.install
- modules/statistics/statistics.install
- modules/system/system.install - this one

Both #107824: Convert {watchdog}.referer and {accesslog}.url from VARCHAR to TEXT and #221020: locales_source.location is just varchar(255) and it is not truncated
I mark as postponed till this commited

andypost’s picture

FileSize
6.65 KB

patch

catch’s picture

Status: Needs review » Reviewed & tested by the community

This covers everything I'm aware of now - if, like me, you're wondering about the locale_update_7000() hunk when you read this, that's because we committed a 6.x update function to 7.x, which was never backported to D6, which then got removed by the original patch here or a similar one. Fun.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks!

catch’s picture

Status: Fixed » Active

Leaving this active until we're 100% sure we got everything.

moshe weitzman’s picture

can we remove the critical or close this?

nimi’s picture

I am having the mentioned watchdog problem of "data too long for column..." on my multilingual site.
Is the patch attached on comment #58 the one I need to apply to fix this?

One more thing, usually the patches I've seen apply changes to ".module files". This one, however, targets the ".install" files.
This means that I need to apply it normally and then run update.php?

Am I on the right track here?

Thanks,
Nimi.

nimi’s picture

anyone? help please...

gpk’s picture

@64: suggest you open a support request or forum topic - this issue is specifically about changes needed in 7.x. Without more info (Drupal version, exact error message) it's not possible in any case to answer your questions...

andypost’s picture

Suppose this issue should stay critical until D7 is released because D6 still have issues

system_update_7025() is broken as reported at #77 #358315: drupal_lookup_path() not respects alias' order
Let's wait for commit to D-6 branch... then sync new system_update_6054()

Another old issue #39 #221020: locales_source.location is just varchar(255) and it is not truncated waiting...

sun.core’s picture

Priority: Critical » Normal
Status: Active » Fixed

Since those are covered by other issues already, no need to keep this one open + critical.

Status: Fixed » Closed (fixed)
Issue tags: -D7 upgrade path

Automatically closed -- issue fixed for 2 weeks with no activity.