From 40969d5f47b61f245db52e0152a9e71557ee536b Mon Sep 17 00:00:00 2001 From: Brian Wolff Date: Thu, 23 Jun 2011 04:57:14 +0000 Subject: [PATCH] Someone on irc had a very screwed up DB, and he reported that the updater gave a fatal error when trying to update (appearently did not have a recentchanges table, and one of the db functions returned false, which the updater did not expect). Add check for that since I figure an exception is much better than a fatal error. The relavent error this potentially stops is: Fatal error: Call to a member function isMultipleKey() on a non-object in /../includes/installer/MysqlUpdater.php on line 249" Not sure if the updater should do something better than an exception, but it seems like a much better situation than the fatal. In practise, I think it is rare that this situation would arise. --- RELEASE-NOTES-1.19 | 2 ++ includes/installer/MysqlUpdater.php | 3 +++ 2 files changed, 5 insertions(+) diff --git a/RELEASE-NOTES-1.19 b/RELEASE-NOTES-1.19 index 97b1d34535..e8d54df0df 100644 --- a/RELEASE-NOTES-1.19 +++ b/RELEASE-NOTES-1.19 @@ -113,6 +113,8 @@ production. * (bug 29492) Long-running steps in the installer (such as Upgrade and Install) can sometimes timeout * (bug 29507) Change 'image link' to 'file link' in Special:Whatlinkshere +* If the db is really screwed up, and doesn't have a recentchanges table, + make the updater throw an exception instead of a fatal. === API changes in 1.19 === * BREAKING CHANGE: action=watch now requires POST and token. diff --git a/includes/installer/MysqlUpdater.php b/includes/installer/MysqlUpdater.php index f4bc3ef521..b4e9ac5060 100644 --- a/includes/installer/MysqlUpdater.php +++ b/includes/installer/MysqlUpdater.php @@ -254,6 +254,9 @@ class MysqlUpdater extends DatabaseUpdater { */ protected function doIndexUpdate() { $meta = $this->db->fieldInfo( 'recentchanges', 'rc_timestamp' ); + if ( $meta === false ) { + throw new MWException( 'Missing rc_timestamp field of recentchanges table. Should not happen.' ); + } if ( $meta->isMultipleKey() ) { $this->output( "...indexes seem up to 20031107 standards\n" ); return; -- 2.20.1