Follow-up r89568: use local context instead of $wgOut
[lhc/web/wiklou.git] / includes / SpecialPage.php
index 9984ac0..872a493 100644 (file)
@@ -31,7 +31,7 @@ class SpecialPage {
 
        // The canonical name of this special page
        // Also used for the default <h1> heading, @see getDescription()
-       private $mName;
+       protected $mName;
 
        // The local name of this special page
        private $mLocalName;
@@ -57,7 +57,7 @@ class SpecialPage {
 
        /**
         * Current request context
-        * @var RequestContext
+        * @var IContextSource
         */
        protected $mContext;
 
@@ -226,28 +226,15 @@ class SpecialPage {
         * page, and true if it was successful.
         *
         * @param $title          Title object
-        * @param $context        RequestContext
+        * @param $context        IContextSource
         * @param $including      Bool output is being captured for use in {{special:whatever}}
         * @return Bool
         * @deprecated since 1.18 call SpecialPageFactory method directly
         */
-       public static function executePath( &$title, RequestContext &$context, $including = false ) {
+       public static function executePath( &$title, IContextSource &$context, $including = false ) {
                return SpecialPageFactory::executePath( $title, $context, $including );
        }
 
-       /**
-        * Just like executePath() except it returns the HTML instead of outputting it
-        * Returns false if there was no such special page, or a title object if it was
-        * a redirect.
-        *
-        * @param $title Title
-        * @return String: HTML fragment
-        * @deprecated since 1.18 call SpecialPageFactory method directly
-        */
-       static function capturePath( &$title ) {
-               return SpecialPageFactory::capturePath( $title );
-       }
-
        /**
         * Get the local name for a specified canonical name
         *
@@ -545,7 +532,7 @@ class SpecialPage {
                if ( $this->userCanExecute( $this->getUser() ) ) {
                        $func = $this->mFunction;
                        // only load file if the function does not exist
-                       if(!is_callable($func) and $this->mFile) {
+                       if( !is_callable($func) && $this->mFile ) {
                                require_once( $this->mFile );
                        }
                        $this->outputHeader();
@@ -605,7 +592,7 @@ class SpecialPage {
        /**
         * Sets the context this SpecialPage is executed in
         *
-        * @param $context RequestContext
+        * @param $context IContextSource
         * @since 1.18
         */
        public function setContext( $context ) {
@@ -615,11 +602,11 @@ class SpecialPage {
        /**
         * Gets the context this SpecialPage is executed in
         *
-        * @return RequestContext
+        * @return IContextSource
         * @since 1.18
         */
        public function getContext() {
-               if ( $this->mContext instanceof RequestContext ) {
+               if ( $this->mContext instanceof IContextSource ) {
                        return $this->mContext;
                } else {
                        wfDebug( __METHOD__ . " called and \$mContext is null. Return RequestContext::getMain(); for sanity\n" );
@@ -703,14 +690,14 @@ class SpecialPage {
         * @param $params array
         */
        protected function addFeedLinks( $params ) {
-               global $wgFeedClasses, $wgOut;
+               global $wgFeedClasses;
 
                $feedTemplate = wfScript( 'api' ) . '?';
 
                foreach( $wgFeedClasses as $format => $class ) {
                        $theseParams = $params + array( 'feedformat' => $format );
                        $url = $feedTemplate . wfArrayToCGI( $theseParams );
-                       $wgOut->addFeedLink( $format, $url );
+                       $this->getOutput()->addFeedLink( $format, $url );
                }
        }
 }
@@ -825,7 +812,8 @@ abstract class FormSpecialPage extends SpecialPage {
                }
 
                if ( $this->requiresUnblock() && $user->isBlocked() ) {
-                       throw new UserBlockedError( $user->getBlock() );
+                       $block = $user->mBlock;
+                       throw new UserBlockedError( $block );
                }
 
                return true;