Page MenuHomePhabricator

Issue running update.php on fresh install when both AbuseFilter and Echo are being installed
Closed, ResolvedPublic

Description

Basically AbuseFilter tries to create an account, which calls the onUserSaveSettings hook, which tries to update the wiki.echo_notification table, except it hasn't been created yet.

A database query error has occurred.
Query: SELECT notification_event FROM echo_notification LEFT JOIN echo_event ON ((notification_event=event_id)) WHERE notification_user = '2' AND notification_bundle_base = '1' AND notification_read_timestamp IS NULL AND event_type IN ('welcome','edit-user-talk','reverted','mention','user-rights','edit-thank','flaggedrevs-reviewed') LIMIT 100
Function: MWDbEchoBackend::getNotificationCount
Error: 1146 Table 'wiki.echo_notification' doesn't exist (localhost)

Backtrace:
#0 /vagrant/mediawiki/includes/db/Database.php(1072): DatabaseBase->reportQueryError('Table 'wiki.ech...', 1146, 'SELECT notific...', 'MWDbEchoBackend...', false)
#1 /vagrant/mediawiki/includes/db/Database.php(1529): DatabaseBase->query('SELECT notific...', 'MWDbEchoBackend...')
#2 /vagrant/mediawiki/extensions/Echo/includes/DbEchoBackend.php(291): DatabaseBase->select(Array, Array, Array, 'MWDbEchoBackend...', Array, Array)
#3 /vagrant/mediawiki/extensions/Echo/includes/NotifUser.php(136): MWDbEchoBackend->getNotificationCount(Object(User), -1)
#4 /vagrant/mediawiki/extensions/Echo/includes/NotifUser.php(180): MWEchoNotifUser->getNotificationCount(false, -1)
#5 /vagrant/mediawiki/extensions/Echo/Hooks.php(819): MWEchoNotifUser->resetNotificationCount()
#6 [internal function]: EchoHooks::onUserSaveSettings(Object(User))
#7 /vagrant/mediawiki/includes/Hooks.php(199): call_user_func_array('EchoHooks::onUs...', Array)
#8 /vagrant/mediawiki/includes/GlobalFunctions.php(4033): Hooks::run('UserSaveSetting...', Array)
#9 /vagrant/mediawiki/includes/User.php(3324): wfRunHooks('UserSaveSetting...', Array)
#10 /vagrant/mediawiki/extensions/AbuseFilter/AbuseFilter.hooks.php(526): User->saveSettings()
#11 [internal function]: AbuseFilterHooks::createAbuseFilterUser(Object(MysqlUpdater))
#12 /vagrant/mediawiki/includes/installer/DatabaseUpdater.php(440): call_user_func_array(Array, Array)
#13 /vagrant/mediawiki/includes/installer/DatabaseUpdater.php(404): DatabaseUpdater->runUpdates(Array, true)
#14 /vagrant/mediawiki/maintenance/update.php(148): DatabaseUpdater->doUpdates(Array)
#15 /vagrant/mediawiki/maintenance/doMaintenance.php(113): UpdateMediaWiki->execute()
#16 /vagrant/mediawiki/maintenance/update.php(191): require_once('/vagrant/mediaw...')
#17 {main}


Version: unspecified
Severity: normal

Details

Reference
bz57335

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 2:29 AM
bzimport added a project: Notifications.
bzimport set Reference to bz57335.
bzimport added a subscriber: Unknown Object (MLST).

Change 96676 had a related patch set uploaded by Legoktm:
Define 'MW_UPDATER' when running update.php

https://gerrit.wikimedia.org/r/96676

Change 96677 had a related patch set uploaded by Legoktm:
Only run onUserSaveSettings hook if not in update.php

https://gerrit.wikimedia.org/r/96677

Change 96676 merged by jenkins-bot:
Define 'MW_UPDATER' when running update.php

https://gerrit.wikimedia.org/r/96676

Change 96677 merged by jenkins-bot:
Only run onUserSaveSettings hook if not in update.php

https://gerrit.wikimedia.org/r/96677

Can we define this sooner? I just ran into a problem (bug #60492) and putting the define in the constructor made my patch actually work. The solution here doesn't work since DPL uses Title::exists() in its $wgExtensionFunctions hook and extensions are loaded before update.php's execute() is called.