From 63f24865a26949885329d730fd1fd4355d699d87 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Thu, 14 May 2009 13:49:17 +0000 Subject: [PATCH] (bug 11451) Fix error in 1.2 -> 1.3 upgrade script, causing failure of upgrades from 1.2 or before. Rediscovered during automated testing. For backport to 1.15. --- maintenance/archives/patch-fix-il_from.sql | 11 +++++++++++ maintenance/updaters.inc | 14 ++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 maintenance/archives/patch-fix-il_from.sql diff --git a/maintenance/archives/patch-fix-il_from.sql b/maintenance/archives/patch-fix-il_from.sql new file mode 100644 index 0000000000..0a199e4d33 --- /dev/null +++ b/maintenance/archives/patch-fix-il_from.sql @@ -0,0 +1,11 @@ +-- Fix a bug from the 1.2 -> 1.3 upgrader by moving away the imagelinks table +-- and recreating it. +RENAME TABLE /*_*/imagelinks TO /*_*/imagelinks_old; +CREATE TABLE /*_*/imagelinks ( + il_from int unsigned NOT NULL default 0, + il_to varchar(255) binary NOT NULL default '' +) /*$wgDBTableOptions*/; + +CREATE UNIQUE INDEX /*i*/il_from ON /*_*/imagelinks (il_from,il_to); +CREATE UNIQUE INDEX /*i*/il_to ON /*_*/imagelinks (il_to,il_from); + diff --git a/maintenance/updaters.inc b/maintenance/updaters.inc index 69db8bf194..72e510f3cf 100644 --- a/maintenance/updaters.inc +++ b/maintenance/updaters.inc @@ -38,6 +38,7 @@ $wgUpdates = array( array( 'add_table', 'categorylinks', 'patch-categorylinks.sql' ), // do_linkscc_1_3_update obsolete array( 'do_old_links_update' ), + array( 'fix_ancient_imagelinks' ), array( 'add_field', 'recentchanges', 'rc_ip', 'patch-rc_ip.sql' ), // 1.4 @@ -784,6 +785,19 @@ function do_old_links_update() { } } +function fix_ancient_imagelinks() { + global $wgDatabase; + $info = $wgDatabase->fieldInfo( 'imagelinks', 'il_from' ); + if ( $info && $info->type() === 'string' ) { + wfOut( "Fixing ancient broken imagelinks table.\n" ); + wfOut( "NOTE: you will have to run maintenance/refreshLinks.php after this.\n" ); + dbsource( archive( 'patch-fix-il_from.sql' ) ); + wfOut( "ok\n" ); + } else { + wfOut( "...il_from OK\n" ); + } +} + function do_user_unique_update() { global $wgDatabase; $duper = new UserDupes( $wgDatabase ); -- 2.20.1