Add used message keys to ContentHandler::getLocalizedName
[lhc/web/wiklou.git] / includes / content / ContentHandler.php
index 2de8408..89ef4e4 100644 (file)
@@ -354,6 +354,8 @@ abstract class ContentHandler {
         * @throws MWException if the model id isn't known.
         */
        public static function getLocalizedName( $name ) {
+               // Messages: content-model-wikitext, content-model-text,
+               // content-model-javascript, content-model-css
                $key = "content-model-$name";
 
                $msg = wfMessage( $key );
@@ -449,10 +451,11 @@ abstract class ContentHandler {
         * @since 1.21
         *
         * @param Title $destination the page to redirect to.
+        * @param string $text text to include in the redirect, if possible.
         *
         * @return Content
         */
-       public function makeRedirectContent( Title $destination ) {
+       public function makeRedirectContent( Title $destination, $text = '' ) {
                return null;
        }
 
@@ -906,6 +909,10 @@ abstract class ContentHandler {
                $undo_content = $undo->getContent();
                $undoafter_content = $undoafter->getContent();
 
+               if ( !$undo_content || !$undoafter_content ) {
+                       return false; // no content to undo
+               }
+
                $this->checkModelID( $cur_content->getModel() );
                $this->checkModelID( $undo_content->getModel() );
                $this->checkModelID( $undoafter_content->getModel() );
@@ -937,7 +944,7 @@ abstract class ContentHandler {
         * @return ParserOptions
         */
        public function makeParserOptions( $context ) {
-               global $wgContLang;
+               global $wgContLang, $wgEnableParserLimitReporting;
 
                if ( $context instanceof IContextSource ) {
                        $options = ParserOptions::newFromContext( $context );
@@ -949,7 +956,7 @@ abstract class ContentHandler {
                        throw new MWException( "Bad context for parser options: $context" );
                }
 
-               $options->enableLimitReport(); // show inclusion/loop reports
+               $options->enableLimitReport( $wgEnableParserLimitReporting ); // show inclusion/loop reports
                $options->setTidy( true ); // fix bad HTML
 
                return $options;