Merge "When file sha1 populator fixes wrong values, make it fix the other metadata."
[lhc/web/wiklou.git] / includes / SpecialPage.php
index 5ecd013..7a6c0be 100644 (file)
@@ -1,25 +1,24 @@
 <?php
 /**
- * SpecialPage: handling special pages and lists thereof.
+ * Parent class for all special pages.
  *
- * To add a special page in an extension, add to $wgSpecialPages either
- * an object instance or an array containing the name and constructor
- * parameters. The latter is preferred for performance reasons.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
  *
- * The object instantiated must be either an instance of SpecialPage or a
- * sub-class thereof. It must have an execute() method, which sends the HTML
- * for the special page to $wgOut. The parent class has an execute() method
- * which distributes the call to the historical global functions. Additionally,
- * execute() also checks if the user has the necessary access privileges
- * and bails out if not.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
  *
- * To add a core special page, use the similar static list in
- * SpecialPage::$mList. To remove a core static special page at runtime, use
- * a SpecialPage_initList hook.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
  *
  * @file
  * @ingroup SpecialPage
- * @defgroup SpecialPage SpecialPage
  */
 
 /**
@@ -124,19 +123,18 @@ class SpecialPage {
         *
         * @param $page Mixed: SpecialPage or string
         * @param $group String
-        * @return null
         * @deprecated since 1.18 call SpecialPageFactory method directly
         */
        static function setGroup( $page, $group ) {
                wfDeprecated( __METHOD__, '1.18' );
-               return SpecialPageFactory::setGroup( $page, $group );
+               SpecialPageFactory::setGroup( $page, $group );
        }
 
        /**
         * Get the group that the special page belongs in on Special:SpecialPage
         *
         * @param $page SpecialPage
-        * @return null
+        * @return string
         * @deprecated since 1.18 call SpecialPageFactory method directly
         */
        static function getGroup( &$page ) {
@@ -768,7 +766,15 @@ class SpecialPage {
                // Works fine as the first parameter, which appears elsewhere in the
                // code base. Sighhhh.
                $args = func_get_args();
-               return call_user_func_array( array( $this->getContext(), 'msg' ), $args );
+               $message = call_user_func_array( array( $this->getContext(), 'msg' ), $args );
+               // RequestContext passes context to wfMessage, and the language is set from
+               // the context, but setting the language for Message class removes the
+               // interface message status, which breaks for example usernameless gender
+               // invokations. Restore the flag when not including special page in content.
+               if ( $this->including() ) {
+                       $message->setInterfaceMessageFlag( false );
+               }
+               return $message;
        }
 
        /**
@@ -1082,7 +1088,7 @@ class SpecialCreateAccount extends SpecialRedirectToSpecial {
 class SpecialMypage extends RedirectSpecialPage {
        function __construct() {
                parent::__construct( 'Mypage' );
-               $this->mAllowedRedirectParams = array( 'action' , 'preload' , 'editintro',
+               $this->mAllowedRedirectParams = array( 'action', 'preload', 'preloadtitle', 'editintro',
                        'section', 'oldid', 'diff', 'dir',
                        // Options for action=raw; missing ctype can break JS or CSS in some browsers
                        'ctype', 'maxage', 'smaxage' );
@@ -1104,7 +1110,7 @@ class SpecialMypage extends RedirectSpecialPage {
 class SpecialMytalk extends RedirectSpecialPage {
        function __construct() {
                parent::__construct( 'Mytalk' );
-               $this->mAllowedRedirectParams = array( 'action' , 'preload' , 'editintro',
+               $this->mAllowedRedirectParams = array( 'action', 'preload', 'preloadtitle', 'editintro',
                        'section', 'oldid', 'diff', 'dir' );
        }