Page MenuHomePhabricator

reviewAllPages.php doesn't work triggers "First argument must be a Title or WikiPage"
Closed, ResolvedPublic

Description

Author: Piotr.Kryszk

Description:
I cann't review all pages using reviewAllPages.php script. The following messages occur:

yoga:/srv/mediawiki-1.21.1/extensions/FlaggedRevs/maintenance # php ./reviewAllPages.php --conf ../../../LocalSettings.php --username Admin

PHP Notice: Undefined index: * in /srv/mediawiki-1.21.1/extensions/ConfirmEdit/ConfirmEdit.php on line 206
Reviewer username: Admin
First argument must be a Title or WikiPage.
Backtrace:
#0 /srv/mediawiki-1.21.1/extensions/FlaggedRevs/backend/FlaggedRevs.class.php(1022): FlaggedRevs::stableVersionUpdates(Object(Article))
#1 /srv/mediawiki-1.21.1/extensions/FlaggedRevs/maintenance/reviewAllPages.php(94): FlaggedRevs::autoReviewEdit(Object(Article), Object(User), Object(Revision), Array, true)
#2 /srv/mediawiki-1.21.1/extensions/FlaggedRevs/maintenance/reviewAllPages.php(26): ReviewAllPages->autoreview_current(Object(User))
#3 /srv/mediawiki-1.21.1/maintenance/doMaintenance.php(110): ReviewAllPages->execute()
#4 /srv/mediawiki-1.21.1/extensions/FlaggedRevs/maintenance/reviewAllPages.php(118): require_once('/srv/...')
#5 {main}
Can anybody sugest me what I should correct?
Thanks in advance.


Version: REL1_21-branch
Severity: major
OS: Linux
Platform: PC

Details

Reference
bz59012

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:30 AM
bzimport added a project: FlaggedRevs.
bzimport set Reference to bz59012.
bzimport added a subscriber: Unknown Object (MLST).

Hi Piotr, is this really about 1.21.1? 1.21.3 is the latest in that series.

(In reply to comment #0)

PHP Notice: Undefined index: * in
/srv/mediawiki-1.21.1/extensions/ConfirmEdit/ConfirmEdit.php on line 206

http://git.wikimedia.org/blob/mediawiki%2Fextensions%2FConfirmEdit.git/HEAD/ConfirmEdit.php#L206 says
if ( !$wgGroupPermissions['*']['read'] && $wgCaptchaTriggers['badlogin'] )

so I assume this has to do with your group permissions setup. This does not sound like something is wrong in the code of MediaWiki (a so-called "bug"), but instead like a support request (how to change settings, questions how to do something, etc.). As bugzilla.wikimedia.org is only for specific bug reports and enhancement requests, please use https://www.mediawiki.org/wiki/Project:Support_desk for support requests. Thanks!

Piotr.Kryszk wrote:

Hi Andre,
thank You for response, but problem is not in "PHP Notice" about ConfirmEdit.php.

Look at message from reviewAllPages.php script:
"First argument must be a Title or Wikipage"
and following messages in Backtrace.

This is a case I can not manage.
Could You please help me with this issue?

Thank You in advance!

Piotr.Kryszk wrote:

PHP Notice was fixed.
ReviewAllPages.php still return message: "First argument must be a Title or WikiPage." and backtrace as in previous posts.
Could You please look at it?

Piotr: Please paste the output you get nowadays.
Does using an absolute instead of a relative path as parameter help?

Piotr.Kryszk wrote:

Hi Andre,

This is the result from relative paths:

yoga:/srv/www/htdocs/mediawiki-1.21.1-II-instancja/extensions/FlaggedRevs/maintenance # php reviewAllPages.php --conf ../../../LocalSettings.php --username admin
Auto-reviewing all current page versions...
Reviewer username: Admin
...doing page_id from 1 to 100
First argument must be a Title or WikiPage.
Backtrace:
#0 /srv/www/htdocs/mediawiki-1.21.1-II-instancja/extensions/FlaggedRevs/backend/FlaggedRevs.class.php(1022): FlaggedRevs::stableVersionUpdates(Object(Article))
#1 /srv/www/htdocs/mediawiki-1.21.1-II-instancja/extensions/FlaggedRevs/maintenance/reviewAllPages.php(76): FlaggedRevs::autoReviewEdit(Object(Article), Object(User), Object(Revision), Array, true)
#2 /srv/www/htdocs/mediawiki-1.21.1-II-instancja/extensions/FlaggedRevs/maintenance/reviewAllPages.php(26): ReviewAllPages->autoreview_current(Object(User))
#3 /srv/www/htdocs/mediawiki-1.21.1-II-instancja/maintenance/doMaintenance.php(110): ReviewAllPages->execute()
#4 /srv/www/htdocs/mediawiki-1.21.1-II-instancja/extensions/FlaggedRevs/maintenance/reviewAllPages.php(99): require_once('/srv/www/htdocs...')
#5 {main}

This is the result from absolute paths:

yoga:/srv/www/htdocs/mediawiki-1.21.1-II-instancja/extensions/FlaggedRevs/maintenance # php /srv/www/htdocs/mediawiki-1.21.1-II-instancja/extensions/FlaggedRevs/maintenance/reviewAllPages.php --conf /srv/www/htdocs/mediawiki-1.21.1-II-instancja/LocalSettings.php --username admin
Auto-reviewing all current page versions...
Reviewer username: Admin
...doing page_id from 1 to 100
First argument must be a Title or WikiPage.
Backtrace:
#0 /srv/www/htdocs/mediawiki-1.21.1-II-instancja/extensions/FlaggedRevs/backend/FlaggedRevs.class.php(1022): FlaggedRevs::stableVersionUpdates(Object(Article))
#1 /srv/www/htdocs/mediawiki-1.21.1-II-instancja/extensions/FlaggedRevs/maintenance/reviewAllPages.php(76): FlaggedRevs::autoReviewEdit(Object(Article), Object(User), Object(Revision), Array, true)
#2 /srv/www/htdocs/mediawiki-1.21.1-II-instancja/extensions/FlaggedRevs/maintenance/reviewAllPages.php(26): ReviewAllPages->autoreview_current(Object(User))
#3 /srv/www/htdocs/mediawiki-1.21.1-II-instancja/maintenance/doMaintenance.php(110): ReviewAllPages->execute()
#4 /srv/www/htdocs/mediawiki-1.21.1-II-instancja/extensions/FlaggedRevs/maintenance/reviewAllPages.php(99): require_once('/srv/www/htdocs...')
#5 {main}

and the third attempt results

yoga:/srv/www/htdocs/mediawiki-1.21.1-II-instancja # php /srv/www/htdocs/mediawiki-1.21.1-II-instancja/extensions/FlaggedRevs/maintenance/reviewAllPages.php --conf /srv/www/htdocs/mediawiki-1.21.1-II-instancja/LocalSettings.php --username admin
Auto-reviewing all current page versions...
Reviewer username: Admin
...doing page_id from 1 to 100
First argument must be a Title or WikiPage.
Backtrace:
#0 /srv/www/htdocs/mediawiki-1.21.1-II-instancja/extensions/FlaggedRevs/backend/FlaggedRevs.class.php(1022): FlaggedRevs::stableVersionUpdates(Object(Article))
#1 /srv/www/htdocs/mediawiki-1.21.1-II-instancja/extensions/FlaggedRevs/maintenance/reviewAllPages.php(76): FlaggedRevs::autoReviewEdit(Object(Article), Object(User), Object(Revision), Array, true)
#2 /srv/www/htdocs/mediawiki-1.21.1-II-instancja/extensions/FlaggedRevs/maintenance/reviewAllPages.php(26): ReviewAllPages->autoreview_current(Object(User))
#3 /srv/www/htdocs/mediawiki-1.21.1-II-instancja/maintenance/doMaintenance.php(110): ReviewAllPages->execute()
#4 /srv/www/htdocs/mediawiki-1.21.1-II-instancja/extensions/FlaggedRevs/maintenance/reviewAllPages.php(99): require_once('/srv/www/htdocs...')
#5 {main}

Regards
Peter

glen.84 wrote:

I have the same issue with MW 1.22.6 on PHP 5.5.12.

[60eb825b] [no req] Exception from line 615 of /var/www/clients/client1/web2/web/mediawiki/extensions/FlaggedRevs/backend/FlaggedRevs.class.php: First argument must be a Title or WikiPage.
Backtrace:
#0 /var/www/clients/client1/web2/web/mediawiki/extensions/FlaggedRevs/backend/FlaggedRevs.class.php(1028): FlaggedRevs::stableVersionUpdates(Article)
#1 /var/www/clients/client1/web2/web/mediawiki/extensions/FlaggedRevs/maintenance/reviewAllPages.php(76): FlaggedRevs::autoReviewEdit(Article, User, Revision, array, boolean)
#2 /var/www/clients/client1/web2/web/mediawiki/extensions/FlaggedRevs/maintenance/reviewAllPages.php(26): ReviewAllPages->autoreview_current(User)
#3 /var/www/clients/client1/web2/web/mediawiki/maintenance/doMaintenance.php(113): ReviewAllPages->execute()
#4 /var/www/clients/client1/web2/web/mediawiki/extensions/FlaggedRevs/maintenance/reviewAllPages.php(99): require_once(string)
#5 {main}

glen.84 wrote:

If I do this:

		if ( $page instanceof FlaggableWikiPage ) {
			$article = $page;
		} elseif ( $page instanceof WikiPage ) {
			$article = FlaggableWikiPage::getTitleInstance( $page->getTitle() );
		} elseif ( $page instanceof Title ) {
			$article = FlaggableWikiPage::getTitleInstance( $page );
		} else {
			var_dump(get_class($page)); // *** HERE ***
			throw new MWException( "First argument must be a Title or WikiPage." );
		}

It prints "Article" -- I have no idea what that means, but I'm sure you do. :-)

Because var article is an instance of class Artcile:
$article = new Article( $title );

glen.84 wrote:

(In reply to Florian from comment #11)

Because var article is an instance of class Artcile:
$article = new Article( $title );

Sorry, I wasn't clear. I know that, I just don't know why this class is not handled. Is it new? Is it old? Should this ever happen?

What's the difference between a FlaggableWikiPage / WikiPage / Article, etc.

Let me know if you need any more information.

I haven't installed FlaggedRevs, so can maybe someone change simple Article to WikiPage?
https://github.com/wikimedia/mediawiki-extensions-FlaggedRevs/blob/23a84dc37dc0d13027209d7f68ad9cbba4bdbe6a/maintenance/reviewAllPages.php#L74

In this line, if i looked right, the instance is only used there, so we can use WikiPage instead of Article.

glen.84 wrote:

Is it fairly safe to do so?

If i were you, i would test this on a testwiki ;) But normally it's safe :) If i have time, i will install flaggedrev and look :)

I have tested it now, seems to be the right change. I will commit it soon and then we see, what the project owners say to it, if i'm right, that we can simply change the class :)

Change 135563 had a related patch set uploaded by Florianschmidtwelzow:
Changed $article to be instance of WikiPage

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

glen.84 wrote:

Nice, I tested it as well locally, and it seemed to work (although I only had one page).

I will try it in production now, after I confirm that we have a backup.

glen.84 wrote:

It seems to have worked fine. +1

Thanks for your help!

Change 135563 merged by Aaron Schulz:
Changed $article to be instance of WikiPage

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