Page MenuHomePhabricator

Populate script does not work correctly with MediaWiki 1.34
Closed, ResolvedPublic



If we check the contributors of a page using the Contributors special page, we see for some pages that it contains an item with (no username available) (no username available) in the list. I think this happens when you install the Contributors extension after making some edits when running MediaWiki 1.34.

We are running MediWiki starting from 1.28 I think. Then, every year we perform an upgrade to the latest version. We upgraded to v1.34 this year in February. One month later, in March, we installed the Contributors extension. All edits made before we upgraded to v1.34 are correctly populated in the contributors table. Changes made between February and March result in (no username available) (no username available). Changes made while the Contributors extension is installed are tracked correctly.

To reproduce our situation:
Install MediaWiki 1.32, create some pages and edit them. Do not install the Contributors extension yet. Then upgrade to v1.34 of MediaWiki and edit some more pages, or create new ones. Then install the Contributors extension and run the populate script. Optionally edit some more pages. Now check the contributions of those pages you editted. You should see that edits done with v1.34 of MediaWiki but without the Contributors result in an item with (no username available) (no username available) as username. Edits done after installing the Contributors extension are tracked correctly.
It is possible you do not need to install an old version at all and you can directly test with v1.34. I am not sure about this.

I have checked the code and I see that data is parsed from the revision table. When looking at that table, I see that all edits made after we upgraded to MediaWiki 1.34 does not have any user information anymore. It seems that the data this extension need is now stored in the table revision_actor_temp table.

Installation information:

Component version
OSDebian 10.3
Contributors extension2.0 (04de8a2)

Event Timeline

Found a bit more information about the revision_actor_temp table: It seems this is a temporary table and the revision table will get changed in the future?

Change 665064 had a related patch set uploaded (by Pwirth; owner: Pwirth):
[mediawiki/extensions/Contributors@master] Fix incompatibility due to revision table chanes sice 1.34

I think I ran into something similar. Using MediaWiki 1.35.4 (fa3248d) and Contributors master (d57ac06) as of 19.10.2021.

Here's the output when I try to run php_cli /maintenance/PopulateContributorsTable.php manually from the shell:

Started processing..
Getting Contributor's data..
Wikimedia\Rdbms\DBQueryError from line 1699 of /html/secret-wiki-test/mediawiki/includes/libs/rdbms/database/Database.php: Error 1054: Unknown column 'rev_user' in 'field list' (
Function: PopulateContributorsTable::execute
Query: SELECT  COUNT(*) AS cn_revision_count,rev_user,rev_user_text,rev_page,MIN(rev_timestamp) AS cn_first_edit,MAX(rev_timestamp) AS cn_last_edit  FROM `revision`    WHERE (rev_page BETWEEN 1 AND 100) AND ((rev_deleted & 4) = 0)  GROUP BY rev_page,rev_user,rev_user_text

#0 /html/secret-wiki-test/mediawiki/includes/libs/rdbms/database/Database.php(1683): Wikimedia\Rdbms\Database->getQueryException('Unknown column ...', 1054, 'SELECT  COUNT(*...', 'PopulateContrib...')
#1 /html/secret-wiki-test/mediawiki/includes/libs/rdbms/database/Database.php(1658): Wikimedia\Rdbms\Database->getQueryExceptionAndLog('Unknown column ...', 1054, 'SELECT  COUNT(*...', 'PopulateContrib...')
#2 /html/secret-wiki-test/mediawiki/includes/libs/rdbms/database/Database.php(1227): Wikimedia\Rdbms\Database->reportQueryError('Unknown column ...', 1054, 'SELECT  COUNT(*...', 'PopulateContrib...', false)
#3 /html/secret-wiki-test/mediawiki/includes/libs/rdbms/database/Database.php(1907): Wikimedia\Rdbms\Database->query('SELECT  COUNT(*...', 'PopulateContrib...', 32)
#4 /html/secret-wiki-test/mediawiki/includes/libs/rdbms/database/DBConnRef.php(68): Wikimedia\Rdbms\Database->select('revision', Array, Array, 'PopulateContrib...', Array)
#5 /html/secret-wiki-test/mediawiki/includes/libs/rdbms/database/DBConnRef.php(313): Wikimedia\Rdbms\DBConnRef->__call('select', Array)
#6 /html/secret-wiki-test/mediawiki/extensions/Contributors/maintenance/PopulateContributorsTable.php(51): Wikimedia\Rdbms\DBConnRef->select('revision', Array, Array, 'PopulateContrib...', Array)
#7 /html/secret-wiki-test/mediawiki/maintenance/doMaintenance.php(107): PopulateContributorsTable->execute()
#8 /html/secret-wiki-test/mediawiki/extensions/Contributors/maintenance/PopulateContributorsTable.php(89): require_once('/html/secret-wi...')
#9 {main}

I found and it says that the column rev_user was removed in MW 1.35.

I think PopulateContributorsTable.php needs to be updated (again?).

@Stefahn The Patch mentioned above was never merged into the master branch. So, when you tested Contributors master (d57ac06) as of 19.10.2021, it was not included.

You can test the patch running git fetch refs/changes/64/665064/6 && git checkout FETCH_HEAD

Feedback is much appreciated.

Change 665064 merged by jenkins-bot:

[mediawiki/extensions/Contributors@master] Fix incompatibility due to revision table changes since 1.34

Aklapper added a subscriber: Pwirth.

@Pwirth: Removing assignee as the email address of the assignee bounces.

Pppery assigned this task to Pwirth.
Pppery added a subscriber: Pppery.

Patch was merged years ago. Assuming this is resolved given T306900#9190301 confirmed the extension worked on 1.39.