Page MenuHomePhabricator

CannotCreateActorException when undeleting a page with IP contributors, with temporary accounts enabled
Closed, ResolvedPublic2 Estimated Story Points

Description

Steps to reproduce

  1. With $wgAutoCreateTempUser['enabled'] = false, make a logged out edit to a page
  2. Log in as an admin and delete the page
  3. Set $wgAutoCreateTempUser['enabled'] = true
  4. Try to undelete the page

Expected: the page is successfully undeleted
Actual: CannotCreateActorException: Cannot create an actor for an IP user when temporary accounts are enabled

Backtrace:

from /var/www/html/mediawiki/core/includes/user/ActorStore.php(638)
#0 /var/www/html/mediawiki/core/includes/user/ActorStore.php(415): MediaWiki\User\ActorStore->validateActorForInsertion()
#1 /var/www/html/mediawiki/core/includes/Revision/RevisionStore.php(875): MediaWiki\User\ActorStore->acquireActorId()
#2 /var/www/html/mediawiki/core/includes/Revision/RevisionStore.php(760): MediaWiki\Revision\RevisionStore->getBaseRevisionRow()
#3 /var/www/html/mediawiki/core/includes/Revision/RevisionStore.php(626): MediaWiki\Revision\RevisionStore->insertRevisionRowOn()
#4 /var/www/html/mediawiki/core/includes/Revision/RevisionStore.php(477): MediaWiki\Revision\RevisionStore->insertRevisionInternal()
#5 /var/www/html/mediawiki/core/includes/libs/rdbms/database/Database.php(2300): MediaWiki\Revision\RevisionStore->MediaWiki\Revision\{closure}()
#6 /var/www/html/mediawiki/core/includes/libs/rdbms/database/DBConnRef.php(119): Wikimedia\Rdbms\Database->doAtomicSection()
#7 /var/www/html/mediawiki/core/includes/libs/rdbms/database/DBConnRef.php(672): Wikimedia\Rdbms\DBConnRef->__call()
#8 /var/www/html/mediawiki/core/includes/Revision/RevisionStore.php(485): Wikimedia\Rdbms\DBConnRef->doAtomicSection()
#9 /var/www/html/mediawiki/core/includes/page/UndeletePage.php(620): MediaWiki\Revision\RevisionStore->insertRevisionOn()
#10 /var/www/html/mediawiki/core/includes/page/UndeletePage.php(326): MediaWiki\Page\UndeletePage->undeleteRevisions()
#11 /var/www/html/mediawiki/core/includes/page/UndeletePage.php(259): MediaWiki\Page\UndeletePage->undeleteUnsafe()
#12 /var/www/html/mediawiki/core/includes/specials/SpecialUndelete.php(1628): MediaWiki\Page\UndeletePage->undeleteIfAllowed()
#13 /var/www/html/mediawiki/core/includes/specials/SpecialUndelete.php(391): MediaWiki\Specials\SpecialUndelete->undelete()
#14 /var/www/html/mediawiki/core/includes/specialpage/SpecialPage.php(694): MediaWiki\Specials\SpecialUndelete->execute()
#15 /var/www/html/mediawiki/core/includes/specialpage/SpecialPageFactory.php(1669): MediaWiki\SpecialPage\SpecialPage->run()
#16 /var/www/html/mediawiki/core/includes/actions/ActionEntryPoint.php(504): MediaWiki\SpecialPage\SpecialPageFactory->executePath()
#17 /var/www/html/mediawiki/core/includes/actions/ActionEntryPoint.php(145): MediaWiki\Actions\ActionEntryPoint->performRequest()
#18 /var/www/html/mediawiki/core/includes/MediaWikiEntryPoint.php(199): MediaWiki\Actions\ActionEntryPoint->execute()
#19 /var/www/html/mediawiki/core/index.php(58): MediaWiki\MediaWikiEntryPoint->run()
#20 {main}

Event Timeline

This could use the same solution as importing, where the actor store is allowed to create IP actors (T354207).

Like import, undelete won't try to create a new IP actor that has never done anything before, so bypassing this error should be safe.

Change #1034985 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/core@master] Allow undeletion of IP revisions when temp accounts are enabled

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

Change #1034985 merged by jenkins-bot:

[mediawiki/core@master] Allow undeletion of IP revisions when temp accounts are enabled

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

dom_walden subscribed.

I tested undeleting pages with IP edits on my local wiki, enwiki beta and dewiki beta.

In case of regression, I also tested importing pages with IP edits on dewiki beta.

Test environments: