Page MenuHomePhabricator

FlaggedRevs: reviewAllPages.php CommentStore.php: $row does not contain fields needed for comment rev_comment
Open, Needs TriagePublic

Description

Happening in a new mediawiki installation where database was restored using maintenance script importDump.php. All pages are now unchecked. To avoid having to check 100's of pages. I wanted to use the following maintenance script.

php reviewAllPages.php --username Patrick

issue:

Auto-reviewing all current page versions...
Reviewer username: Patrick
...doing page_id from 2 to 101
InvalidArgumentException from line 302 of /var/www/w/includes/CommentStore.php: $row does not contain fields needed for comment rev_comment
#0 /var/www/w/includes/CommentStore.php(403): CommentStore->getCommentInternal(Object(Wikimedia\Rdbms\DBConnRef), 'rev_comment', Array, true)
#1 /var/www/w/includes/Revision/RevisionStore.php(1529): CommentStore->getCommentLegacy(Object(Wikimedia\Rdbms\DBConnRef), 'rev_comment', Object(stdClass), true)
#2 /var/www/w/includes/Revision/RevisionStore.php(1387): MediaWiki\Revision\RevisionStore->newRevisionFromRowAndSlots(Object(stdClass), NULL, 1, Object(Title), false)
#3 /var/www/w/extensions/FlaggedRevs/maintenance/reviewAllPages.php(79): MediaWiki\Revision\RevisionStore->newRevisionFromRow(Object(stdClass), 1)
#4 /var/www/w/extensions/FlaggedRevs/maintenance/reviewAllPages.php(31): ReviewAllPages->autoreview_current(Object(User))
#5 /var/www/w/maintenance/doMaintenance.php(107): ReviewAllPages->execute()
#6 /var/www/w/extensions/FlaggedRevs/maintenance/reviewAllPages.php(106): require_once('/var/www/w/main...')
#7 {main}

mediawiki version: 1.35.1

T252043 might be related.

Please advice.

Event Timeline

My quick guess is that the script should use RevisionStore::getQueryInfo, whereas it currently queries revision manually:

$res = $db->select( [ 'page', 'revision' ],
	'*',
	[ "page_id BETWEEN $blockStart AND $blockEnd",
		'page_namespace' => FlaggedRevs::getReviewNamespaces(),
		'rev_id = page_latest' ],
	__METHOD__
);

this doesn't account for comment & actor migrations and related new tables.

Since I'm pinged.
FlaggedRevs is unmaintained and my 4-year-long work to find a maintainer for it has been futile T185664: Code stewardship review: FlaggedRevs and its code quality is among the worst I've seen in my whole career (case in point). I'm sorry but I'm not gonna spend time on fixing anything on it unless it's causing major issues.

One thing I can suggest is to get rid of its overly complex parts. For example, you can simply delete the whole script and use the API instead.