Revert r104659 and its followup r104665: break the unit tests with a fatal error...
[lhc/web/wiklou.git] / includes / SpecialPage.php
index 64c4287..419c595 100644 (file)
@@ -27,7 +27,7 @@
  * page list.
  * @ingroup SpecialPage
  */
-class SpecialPage extends ContextSource {
+class SpecialPage {
 
        // The canonical name of this special page
        // Also used for the default <h1> heading, @see getDescription()
@@ -611,6 +611,92 @@ class SpecialPage extends ContextSource {
                return self::getTitleFor( $this->mName, $subpage );
        }
 
+       /**
+        * Sets the context this SpecialPage is executed in
+        *
+        * @param $context IContextSource
+        * @since 1.18
+        */
+       public function setContext( $context ) {
+               $this->mContext = $context;
+       }
+
+       /**
+        * Gets the context this SpecialPage is executed in
+        *
+        * @return IContextSource
+        * @since 1.18
+        */
+       public function getContext() {
+               if ( $this->mContext instanceof IContextSource ) {
+                       return $this->mContext;
+               } else {
+                       wfDebug( __METHOD__ . " called and \$mContext is null. Return RequestContext::getMain(); for sanity\n" );
+                       return RequestContext::getMain();
+               }
+       }
+
+       /**
+        * Get the WebRequest being used for this instance
+        *
+        * @return WebRequest
+        * @since 1.18
+        */
+       public function getRequest() {
+               return $this->getContext()->getRequest();
+       }
+
+       /**
+        * Get the OutputPage being used for this instance
+        *
+        * @return OutputPage
+        * @since 1.18
+        */
+       public function getOutput() {
+               return $this->getContext()->getOutput();
+       }
+
+       /**
+        * Shortcut to get the User executing this instance
+        *
+        * @return User
+        * @since 1.18
+        */
+       public function getUser() {
+               return $this->getContext()->getUser();
+       }
+
+       /**
+        * Shortcut to get the skin being used for this instance
+        *
+        * @return Skin
+        * @since 1.18
+        */
+       public function getSkin() {
+               return $this->getContext()->getSkin();
+       }
+
+       /**
+        * Shortcut to get user's language
+        *
+        * @deprecated 1.19 Use getLanguage instead
+        * @return Language
+        * @since 1.18
+        */
+       public function getLang() {
+               return $this->getLanguage();
+       }
+
+       /**
+        * Shortcut to get user's language
+        *
+        * @return Language
+        * @since 1.19
+        */
+       public function getLanguage() {
+               return $this->getContext()->getLanguage();
+       }
+
        /**
         * Return the full title, including $par
         *