The Ghost of Snapped Shot

Or, welcome to my low-maintenance heck.

<<
 >
>>
The Upgrade Blues

If you're thinking of upgrading to Drupal 7 (hint: it's painful) and are looking to streamline your upgrade process, the following might be helpful. If not, I highly recommend glossing over this post.

Still with me? Great!

So the upgrade process in Drupal 7 is somewhat more complex than the old ways we're accustomed to. Basically, the very first thing you need to do in order to even get to the point that you can run the upgrade script, is to log in on your existing Drupal 6 site and disable every non-core module.

Well, if you're like me, and you tend to not want to make changes like that on a live production site (even one that's in maintenance mode)—Or you're interested in testing the upgrade procedure repeatedly using a database backup, here is a handy dandy database script that you can run that will disable every non-standard module that exists in your Drupal configuration, without requiring you to login and edit a thing. (Note that you might need to edit the name of the system table listed at the end to suit your local configuration.)

I hope that this improves your upgrade, and please do be sure to share your Drupal 7 upgrade experience with me. If it's been as horrible for you as it has been for me, my condolences!

MySQL: (I haven't tested this one, let me know if it doesn't work for you)

create temporary table tmp_drupal_core_modules
( name varchar(128) not null, primary key (name) ); 


insert into tmp_drupal_core_modules (name)
values
 ('/aggregator/aggregator.module'),
 ('/block/block.module'),
 ('/blog/blog.module'),
 ('/book/book.module'),
 ('/color/color.module'),
 ('/comment/comment.module'),
 ('/contact/contact.module'),
 ('/contextual/contextual.module'),
 ('/dashboard/dashboard.module'),
 ('/dblog/dblog.module'),
 ('/field/modules/field_sql_storage/field_sql_storage.module'),
 ('/field/modules/list/list.module'),
 ('/field/modules/number/number.module'),
 ('/field/modules/options/options.module'),
 ('/field/modules/text/text.module'),
 ('/field/field.module'),
 ('/field_ui/field_ui.module'),
 ('/file/file.module'),
 ('/filter/filter.module'),
 ('/forum/forum.module'),
 ('/help/help.module'),
 ('/image/image.module'),
 ('/locale/locale.module'),
 ('/menu/menu.module'),
 ('/node/node.module'),
 ('/openid/openid.module'),
 ('/overlay/overlay.module'),
 ('/path/path.module'),
 ('/php/php.module'),
 ('/poll/poll.module'),
 ('/profile/profile.module'),
 ('/rdf/rdf.module'),
 ('/search/search.module'),
 ('/shortcut/shortcut.module'),
 ('/simpletest/simpletest.module'),
 ('/statistics/statistics.module'),
 ('/syslog/syslog.module'),
 ('/system/system.module'),
 ('/taxonomy/taxonomy.module'),
 ('/toolbar/toolbar.module'),
 ('/tracker/tracker.module'),
 ('/translation/translation.module'),
 ('/trigger/trigger.module'),
 ('/update/update.module'),
 ('/user/user.module'); 


delete from drupal_turbo_system
where filename not in (select name from tmp_drupal_core_modules);

PostgreSQL: (Tested and works!)

create temporary table tmp_drupal_core_modules
( name varchar(128) not null, primary key (name) );


copy tmp_drupal_core_modules from stdin;
modules/aggregator/aggregator.module
modules/block/block.module
modules/blog/blog.module
modules/book/book.module
modules/color/color.module
modules/comment/comment.module
modules/contact/contact.module
modules/contextual/contextual.module
modules/dashboard/dashboard.module
modules/dblog/dblog.module
modules/field/modules/field_sql_storage/field_sql_storage.module
modules/field/modules/list/list.module
modules/field/modules/number/number.module
modules/field/modules/options/options.module
modules/field/modules/text/text.module
modules/field/field.module
modules/field_ui/field_ui.module
modules/file/file.module
modules/filter/filter.module
modules/forum/forum.module
modules/help/help.module
modules/image/image.module
modules/locale/locale.module
modules/menu/menu.module
modules/node/node.module
modules/openid/openid.module
modules/overlay/overlay.module
modules/path/path.module
modules/php/php.module
modules/poll/poll.module
modules/profile/profile.module
modules/rdf/rdf.module
modules/search/search.module
modules/shortcut/shortcut.module
modules/simpletest/simpletest.module
modules/statistics/statistics.module
modules/syslog/syslog.module
modules/system/system.module
modules/taxonomy/taxonomy.module
modules/toolbar/toolbar.module
modules/tracker/tracker.module
modules/translation/translation.module
modules/trigger/trigger.module
modules/update/update.module
modules/user/user.module
.


delete from drupal_system
where filename not in (select name from tmp_drupal_core_modules);

Once this script has been run, it should be totally safe for you to run your Drupal upgrade script.

Incidentally: If you've done custom theme development on Drupal, I can guarantee that your theme won't load by default, either. Be sure to add the following line to the end of your sites/*/settings.php file the first time you try to login to your newly-upgraded site:

$conf[ 'theme_default' ] = 'bartik';

You can comment it out once you've finished upgrading your template to 7.

  DailyFodder


Comments:

#1 Brian C. Ledbetter 23-Feb-2011

Another gotcha I've run into is that update.php fails upgrading the "drupal_watchdog" table. One message I get is about creating an index that already exists (dropping the index resolves this error), but the other can only be resolved by running:

delete from drupal_watchdog;

... to clear out your dblog table.

#2 Brian C. Ledbetter 23-Feb-2011

I'm also hitting major issues upgrading Views—I've had to drop all of my views tables from the database and start over, which isn't good. Will have to keep testing this to see if I can find another way to fix this issue...

#3 Brian C. Ledbetter 25-Feb-2011

And apparently, if your template uses block.tpl.php, you'll have some changes to make. Notice that the "standard" block format in Drupal 7 is under modules/block/block.tpl.php, not under modules/system/.

Powered by Snarf · Contact Us