Add wfErrorLog() call before throwing an exception in readStyleFile
[lhc/web/wiklou.git] / includes / SpecialPage.php
index 629e06d..a72c1af 100644 (file)
@@ -105,19 +105,6 @@ class SpecialPage {
                return SpecialPageFactory::resolveAlias( $alias );
        }
 
-       /**
-        * Add a page to the list of valid special pages. This used to be the preferred
-        * method for adding special pages in extensions. It's now suggested that you add
-        * an associative record to $wgSpecialPages. This avoids autoloading SpecialPage.
-        *
-        * @param $page SpecialPage
-        * @deprecated since 1.7, warnings in 1.17, might be removed in 1.20
-        */
-       static function addPage( &$page ) {
-               wfDeprecated( __METHOD__, '1.7' );
-               SpecialPageFactory::getList()->{$page->mName} = $page;
-       }
-
        /**
         * Add a page to a certain display group for Special:SpecialPages
         *
@@ -267,6 +254,7 @@ class SpecialPage {
         *
         * @param $name String
         * @param $subpage String|Bool subpage string, or false to not use a subpage
+        * @throws MWException
         * @return Title object
         */
        public static function getTitleFor( $name, $subpage = false ) {
@@ -351,7 +339,7 @@ class SpecialPage {
                        $this->mFunction = $function;
                }
                if ( $file === 'default' ) {
-                       $this->mFile = dirname( __FILE__ ) . "/specials/Special$name.php";
+                       $this->mFile = __DIR__ . "/specials/Special$name.php";
                } else {
                        $this->mFile = $file;
                }
@@ -363,6 +351,7 @@ class SpecialPage {
         *
         * @param $fName String Name of called method
         * @param $a Array Arguments to the method
+        * @throws MWException
         * @deprecated since 1.17, call parent::__construct()
         */
        public function __call( $fName, $a ) {
@@ -532,9 +521,8 @@ class SpecialPage {
         *   pages?
         */
        public function isRestricted() {
-               global $wgGroupPermissions;
                // DWIM: If all anons can do something, then it is not restricted
-               return $this->mRestriction != '' && empty( $wgGroupPermissions['*'][$this->mRestriction] );
+               return $this->mRestriction != '' && User::groupHasPermission( '*', $this->mRestriction );
        }
 
        /**
@@ -605,7 +593,7 @@ class SpecialPage {
                 * @param $special SpecialPage
                 * @param $subPage string|null
                 */
-               wfRunHooks( 'SpecialPageBeforeExecute', array( &$this, $subPage ) );
+               wfRunHooks( 'SpecialPageBeforeExecute', array( $this, $subPage ) );
 
                $this->beforeExecute( $subPage );
                $this->execute( $subPage );
@@ -619,7 +607,7 @@ class SpecialPage {
                 * @param $special SpecialPage
                 * @param $subPage string|null
                 */
-               wfRunHooks( 'SpecialPageAfterExecute', array( &$this, $subPage ) );
+               wfRunHooks( 'SpecialPageAfterExecute', array( $this, $subPage ) );
        }
 
        /**
@@ -945,8 +933,8 @@ abstract class FormSpecialPage extends SpecialPage {
         * Called from execute() to check if the given user can perform this action.
         * Failures here must throw subclasses of ErrorPageError.
         * @param $user User
+        * @throws UserBlockedError
         * @return Bool true
-        * @throws ErrorPageError
         */
        protected function checkExecutePermissions( User $user ) {
                $this->checkPermissions();