From: Brian Wolff Date: Fri, 4 Jan 2013 12:02:10 +0000 (-0400) Subject: Remove references to non-existent 'execute' right in Title.php X-Git-Tag: 1.31.0-rc.0~20958 X-Git-Url: http://git.cyclocoop.org/%24dirpuce/puce%24spip_lang_rtl.gif?a=commitdiff_plain;h=3896b55a371b64fd546a05df0dc05eef856feb15;p=lhc%2Fweb%2Fwiklou.git Remove references to non-existent 'execute' right in Title.php The permission checks in Title will automatically fail any check against a special page, except for read, execute and createaccount. However, execute is not a right. It is not mentioned in any other MW file (or extension for that matter). It is neither in the list of core user rights in User.php, nor does it have a system msg If someone wants to check if they can run a special page, they should be doing a 'read' check. Note: The check in question was added in bc23aede55e back in 2008 I'm unsure if it is better to just leave it alone, or remove it. However, its presence could cause some confusion, hence this commit. Additionally I was unsure if this justified a release notes entry. Change-Id: I9cf2b0424b9cb189ac122b8274ec681302f560f7 --- diff --git a/includes/Title.php b/includes/Title.php index aa53563a95..442bc22922 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -1838,10 +1838,9 @@ class Title { * @return Array list of errors */ private function checkSpecialsAndNSPermissions( $action, $user, $errors, $doExpensiveQueries, $short ) { - # Only 'createaccount' and 'execute' can be performed on - # special pages, which don't actually exist in the DB. - $specialOKActions = array( 'createaccount', 'execute' ); - if ( NS_SPECIAL == $this->mNamespace && !in_array( $action, $specialOKActions ) ) { + # Only 'createaccount' can be performed on special pages, + # which don't actually exist in the DB. + if ( NS_SPECIAL == $this->mNamespace && $action !== 'createaccount' ) { $errors[] = array( 'ns-specialprotected' ); } diff --git a/tests/phpunit/includes/TitlePermissionTest.php b/tests/phpunit/includes/TitlePermissionTest.php index 3a30b12524..05f140805b 100644 --- a/tests/phpunit/includes/TitlePermissionTest.php +++ b/tests/phpunit/includes/TitlePermissionTest.php @@ -356,8 +356,6 @@ class TitlePermissionTest extends MediaWikiLangTestCase { $this->assertEquals( array( array( 'badaccess-group0' ), array( 'ns-specialprotected' ) ), $this->title->getUserPermissionsErrors( 'bogus', $this->user ) ); - $this->assertEquals( array( array( 'badaccess-group0' ) ), - $this->title->getUserPermissionsErrors( 'execute', $this->user ) ); $this->setTitle( NS_MAIN ); $this->setUserPerm( 'bogus' );