From 3896b55a371b64fd546a05df0dc05eef856feb15 Mon Sep 17 00:00:00 2001 From: Brian Wolff Date: Fri, 4 Jan 2013 08:02:10 -0400 Subject: [PATCH] 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 --- includes/Title.php | 7 +++---- tests/phpunit/includes/TitlePermissionTest.php | 2 -- 2 files changed, 3 insertions(+), 6 deletions(-) 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' ); -- 2.20.1