Page MenuHomePhabricator

Patch for expiring user-groups did not apply correctly
Closed, ResolvedPublic

Description

I upgraded vagrant via git-update, + I ran update.php manually too. When I login with my account, I get this msg:

[06e3b1ef05be354f5e9bd318] /w/index.php?title=Special:UserLogin&returnto=Hauptseite DBQueryError from line 1063 of /vagrant/mediawiki/includes/libs/rdbms/database/Database.php: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading?
Query: SELECT ug_user,ug_group,ug_expiry FROM `user_groups` WHERE ug_user = '2'
Function: UserGroupMembership::getMembershipsForUser
Error: 1054 Unknown column 'ug_expiry' in 'field list' (127.0.0.1)

Backtrace:

#0 /vagrant/mediawiki/includes/libs/rdbms/database/Database.php(921): Database->reportQueryError(string, integer, string, string, boolean)
#1 /vagrant/mediawiki/includes/libs/rdbms/database/Database.php(1257): Database->query(string, string)
#2 /vagrant/mediawiki/includes/user/UserGroupMembership.php(326): Database->select(string, array, array, string)
#3 /vagrant/mediawiki/extensions/CentralAuth/includes/CentralAuthUser.php(2428): UserGroupMembership::getMembershipsForUser(string, DatabaseMysqli)
#4 /vagrant/mediawiki/extensions/CentralAuth/includes/CentralAuthUser.php(2270): CentralAuthUser->localUserData(string)
#5 /vagrant/mediawiki/extensions/CentralAuth/includes/CentralAuthUser.php(2243): CentralAuthUser->queryAttached()
#6 /vagrant/mediawiki/extensions/CentralAuth/includes/CentralAuthHooks.php(1388): CentralAuthUser->getLocalGroups()
#7 /vagrant/mediawiki/includes/Hooks.php(186): CentralAuthHooks::onPasswordPoliciesForUser(User, array)
#8 /vagrant/mediawiki/includes/password/UserPasswordPolicy.php(145): Hooks::run(string, array)
#9 /vagrant/mediawiki/includes/password/UserPasswordPolicy.php(74): UserPasswordPolicy->getPoliciesForUser(User)
#10 /vagrant/mediawiki/includes/user/User.php(1041): UserPasswordPolicy->checkUserPassword(User, string)
#11 /vagrant/mediawiki/includes/auth/AbstractPasswordPrimaryAuthenticationProvider.php(104): User->checkPasswordValidity(string)
#12 /vagrant/mediawiki/includes/auth/TemporaryPasswordPrimaryAuthenticationProvider.php(142): MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProvider->checkPasswordValidity(string, string)
#13 /vagrant/mediawiki/includes/auth/AuthManager.php(452): MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider->beginPrimaryAuthentication(array)
#14 /vagrant/mediawiki/includes/auth/AuthManager.php(382): MediaWiki\Auth\AuthManager->continueAuthentication(array)
#15 /vagrant/mediawiki/includes/specialpage/AuthManagerSpecialPage.php(353): MediaWiki\Auth\AuthManager->beginAuthentication(array, string)
#16 /vagrant/mediawiki/includes/specialpage/AuthManagerSpecialPage.php(482): AuthManagerSpecialPage->performAuthenticationStep(string, array)
#17 /vagrant/mediawiki/includes/htmlform/HTMLForm.php(663): AuthManagerSpecialPage->handleFormSubmit(array, VFormHTMLForm)
#18 /vagrant/mediawiki/includes/specialpage/AuthManagerSpecialPage.php(416): HTMLForm->trySubmit()
#19 /vagrant/mediawiki/includes/specialpage/LoginSignupSpecialPage.php(305): AuthManagerSpecialPage->trySubmit()
#20 /vagrant/mediawiki/includes/specialpage/SpecialPage.php(522): LoginSignupSpecialPage->execute(NULL)
#21 /vagrant/mediawiki/includes/specialpage/SpecialPageFactory.php(577): SpecialPage->run(NULL)
#22 /vagrant/mediawiki/includes/MediaWiki.php(286): SpecialPageFactory::executePath(Title, RequestContext)
#23 /vagrant/mediawiki/includes/MediaWiki.php(861): MediaWiki->performRequest()
#24 /vagrant/mediawiki/includes/MediaWiki.php(522): MediaWiki->main()
#25 /vagrant/mediawiki/index.php(43): MediaWiki->run()
#26 /var/www/w/index.php(5): include(string)
#27 {main}

However, the db is showing this:

(20:47) root@localhost:[wiki]> DESC user_groups;
+-----------+------------------+------+-----+---------+-------+
| Field     | Type             | Null | Key | Default | Extra |
+-----------+------------------+------+-----+---------+-------+
| ug_user   | int(10) unsigned | NO   | PRI | 0       |       |
| ug_group  | varbinary(255)   | NO   | PRI |         |       |
| ug_expiry | varbinary(14)    | YES  | MUL | NULL    |       |
+-----------+------------------+------+-----+---------+-------+
3 rows in set (0.00 sec)

How can I solve this issue?

Event Timeline

Zppix renamed this task from Patch about expiring user-groups did not apply cleanly to Patch for expiring user-groups did not apply correctly.Apr 7 2017, 9:13 PM

With another account I can login without any error.

Do you know which patch / git commit you're having in mind? https://phabricator.wikimedia.org/T157016 happened already a few weeks ago...

Restarted your vagrant vm just incase there's some weird caching in play?

And if you've got CentralAuth... Have you got multiple wikis on that vagrant? Is the db table updated on all of them?

If you do, I'm wondering if one of the accounts has accounts on all wikis, but the other doesn't? So it doesn't trigger the error

I restarted vagrant now, and ran foreachwiki update.php, that did not throw an error

As I wrote this task the wikis were updated to the mediawiki master. Looks like you are right with

If you do, I'm wondering if one of the accounts has accounts on all wikis, but the other doesn't? So it doesn't trigger the error

since my account exists on more wikis thatn the working one does, but I can't take a look since Special:CentralAuth throws that error too, if you try to lookup my account.

And it doesn't tell you what wiki the error is happening on?

CA doesn't have a great schema updater itself (no patches included), but the sql file should be running from master, against the wiki

	static public function onLoadExtensionSchemaUpdates( DatabaseUpdater $updater ) {
		global $wgWikimediaJenkinsCI;

		if ( !empty( $wgWikimediaJenkinsCI ) ) {
			$updater->addExtensionTable( 'globaluser', __DIR__ . '/../central-auth.sql' );
		}

		return true;
	}

How many wikis? Have you looked at all the db's to check the db columns?

And it doesn't tell you what wiki the error is happening on?

No, just the msg I posted.

How many wikis? Have you looked at all the db's to check the db columns?

(20:31) root@localhost:[wiki]> SHOW DATABASES;
+---------------------+
| Database            |
+---------------------+
| information_schema  |
| centralauth         |
| centralauthtestwiki |
| dewiki              |
| enwiki              |
| eswiki              |
| frwiki              |
| frwiktionarywiki    |
| hewiki              |
| kshwiki             |
| loginwiki           |
| mysql               |
| performance_schema  |
| rmwiki              |
| ruwiki              |
| stwiki              |
| testwiki            |
| votewiki            |
| wiki                |
| wikishared          |
| zhwiki              |
| zhwikivoyagewiki    |
+---------------------+
23 rows in set (0.00 sec)

There is a wiki for each db (except for some dbs obviously), so totally 17 wikis.

I checked the DB for each wiki and got everytime the same result, like this:

(20:36) root@localhost:[dewiki]> DESC loginwiki.user_groups;
+-----------+------------------+------+-----+---------+-------+
| Field     | Type             | Null | Key | Default | Extra |
+-----------+------------------+------+-----+---------+-------+
| ug_user   | int(10) unsigned | NO   | PRI | 0       |       |
| ug_group  | varbinary(255)   | NO   | PRI |         |       |
| ug_expiry | varbinary(14)    | YES  | MUL | NULL    |       |
+-----------+------------------+------+-----+---------+-------+
3 rows in set (0.00 sec)
Luke081515 claimed this task.

I fixed it myself now, it was more my fault then one of the software. Some time ago I disabled one wiki, and I looked like it still needed the access to the DB, however, this DB did not get updated when I ran foreachwiki update.php, so I updated the DB manually and it works now again.