Page MenuHomePhabricator

Not able to access Special:Undelete for translation page
Closed, ResolvedPublic

Description

For some reason, I can't access Special:Undelete for one particular page (/w/index.php?title=Special:Undelete&target=Miraheze%2Fit), because it throws a 'permission denied' error, despite I am in the sysop group:

You do not have permission to view this page's deleted history, for the following reason:

The action you have requested is limited to users in one of the groups: Administrators, oversight.

The following code block in includes/specials/SpecialUndelete.php (introduced in https://gerrit.wikimedia.org/r/#/c/154868/) causes this:

/**
 * Checks whether a user is allowed the permission for the
 * specific title if one is set.
 *
 * @param string $permission
 * @param User $user
 * @return bool
 */
protected function isAllowed( $permission, User $user = null ) {
        $user = $user ?: $this->getUser();
        if ( $this->mTargetObj !== null ) {
                return $this->mTargetObj->userCan( $permission, $user );
        } else {
                return $user->isAllowed( $permission );
        }
}

If isAllowed *only* returns the value of $user->isAllowed( $permission ); the special page works fine for me, so I am sure that $this->mTargetObj->userCan( $permission, $user ); is somehow being the culprit here. $user seems to be an object containing my user account, so that's not the issue

What I know is that $this->mTargetObj->userCan() is actually Title::userCan(), and that just returns "!count( $this->getUserPermissionsErrorsInternal( $action, $user, $rigor, true ) );". Title::getUserPermissionsErrorsInternal() returns "$errors;", and when I do a var_dump( $errors ); just before it returns $errors, I get the following output:

array(0) {
}
array(1) {
  [0]=>
  array(3) {
    [0]=>
    string(15) "tpt-target-page"
    [1]=>
    string(9) ":Miraheze"
    [2]=>
    string(113) "https://meta.miraheze.org/w/index.php?title=Special:Translate&group=page-Miraheze&action=page&filter=&language=it"
  }
}
array(1) {
  [0]=>
  array(3) {
    [0]=>
    string(15) "tpt-target-page"
    [1]=>
    string(9) ":Miraheze"
    [2]=>
    string(113) "https://meta.miraheze.org/w/index.php?title=Special:Translate&group=page-Miraheze&action=page&filter=&language=it"
  }
}
array(1) {
  [0]=>
  array(3) {
    [0]=>
    string(15) "tpt-target-page"
    [1]=>
    string(9) ":Miraheze"
    [2]=>
    string(113) "https://meta.miraheze.org/w/index.php?title=Special:Translate&group=page-Miraheze&action=page&filter=&language=it"
  }
}
array(1) {
  [0]=>
  array(1) {
    [0]=>
    string(19) "ns-specialprotected"
  }
}
array(0) {
}
array(1) {
  [0]=>
  array(1) {
    [0]=>
    string(19) "ns-specialprotected"
  }
}

This does not happen on each deleted page, only this page (Miraheze/it) seems to cause this error. I run MediaWiki 1.26 with HHVM 3.9 LTS. Config is available at https://github.com/miraheze/mw-config.

Can you please look at this?

Event Timeline

Southparkfan raised the priority of this task from to Needs Triage.
Southparkfan updated the task description. (Show Details)
Southparkfan added subscribers: Southparkfan, Legoktm.

I have also noticed that any "translate" page gives the same issue, whether deleted/existent or not.

matmarex subscribed.

'tpt-target-page' error comes from the Translate extension, which (by a quick reading) disallows non-translators from doing almost anything to translated pages. The only whitelisted rights are 'read', 'delete' and 'review', and apparently Special:Undelete requires the 'deletedhistory' right.

Nikerabbit renamed this task from Not able to access Special:Undelete despite being in the sysop group to Not able to access Special:Undelete for translation page.EditedMar 23 2016, 7:33 AM
Nikerabbit triaged this task as Low priority.
Nikerabbit added a project: good first task.
Nikerabbit subscribed.

It is possible to add this right to the whitelist.

Change 293909 had a related patch set uploaded (by Glaisher):
Allow accessing Special:Undelete for translation pages

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

Change 293909 merged by jenkins-bot:
Allow accessing Special:Undelete for translation pages

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

Glaisher claimed this task.
Glaisher subscribed.

There's a caveat when deleted translation pages are restored. If a translation page was deleted with its translation unit pages, this won't undelete those units. As a consequence, if someone does an edit (without the units being restored), all the other translations will also be overridden. So if you want to do a full restoration, the units have to be restored prior to restoring the translation page. This is not optimal but this is better than the current behavior of not allowing to access Special:Undelete at all. Ideally, it should be easy to restore a page with all its units as well but that is not trivial.