fixed bad calls
authorDaniel Kinzler <daniel.kinzler@wikimedia.de>
Fri, 9 Mar 2012 16:16:40 +0000 (16:16 +0000)
committerDaniel Kinzler <daniel.kinzler@wikimedia.de>
Wed, 4 Apr 2012 17:55:04 +0000 (19:55 +0200)
includes/ContentHandler.php
includes/EditPage.php
includes/Revision.php

index eef232e..7bfe03e 100644 (file)
@@ -193,7 +193,7 @@ abstract class ContentHandler {
 abstract class TextContentHandler extends ContentHandler {
 
     public function __construct( $modelName, $formats ) {
-        super::__construct( $modelName, $formats );
+        parent::__construct( $modelName, $formats );
     }
 
     public function serialize( Content $content, Title $title, $format = null ) {
@@ -204,7 +204,7 @@ abstract class TextContentHandler extends ContentHandler {
 class WikitextContentHandler extends TextContentHandler {
 
     public function __construct( $modelName = CONTENT_MODEL_WIKITEXT ) {
-        super::__construct( $modelName, array( 'application/x-wikitext' ) ); #FIXME: mime
+        parent::__construct( $modelName, array( 'application/x-wikitext' ) ); #FIXME: mime
     }
 
     public function unserialize( $text, Title $title, $format = null ) {
@@ -216,7 +216,7 @@ class WikitextContentHandler extends TextContentHandler {
 class JavaScriptContentHandler extends TextContentHandler {
 
     public function __construct( $modelName = CONTENT_MODEL_WIKITEXT ) {
-        super::__construct( $modelName, array( 'text/javascript' ) );
+        parent::__construct( $modelName, array( 'text/javascript' ) );
     }
 
     public function unserialize( $text, Title $title, $format = null ) {
@@ -228,7 +228,7 @@ class JavaScriptContentHandler extends TextContentHandler {
 class CssContentHandler extends TextContentHandler {
 
     public function __construct( $modelName = CONTENT_MODEL_WIKITEXT ) {
-        super::__construct( $modelName, array( 'text/css' ) );
+        parent::__construct( $modelName, array( 'text/css' ) );
     }
 
     public function unserialize( $text, Title $title, $format = null ) {
index 3425bb5..e09b595 100644 (file)
@@ -1310,7 +1310,7 @@ class EditPage {
                                $text = $this->textbox1; // do not try to merge here!
                        } elseif ( $this->isConflict ) {
                                # Attempt merge
-                               if ( $this->mergeChangesInto( $text ) ) {
+                               if ( $this->mergeChangesInto( $text ) ) { #FIXME: use ContentHandler
                                        // Successful merge! Maybe we should tell the user the good news?
                                        $this->isConflict = false;
                                        wfDebug( __METHOD__ . ": Suppressing edit conflict, successful merge.\n" );
index cdb0738..da1f881 100644 (file)
@@ -835,13 +835,14 @@ class Revision {
 
             $handler = $this->getContentHandler();
             $format = $this->getContentFormat();
+            $title = $this->getTitle();
 
             if( is_null( $this->mText ) ) {
                 // Load text on demand:
                 $this->mText = $this->loadText();
             }
 
-            $this->mContent = $handler->unserialize( $this->mText, $format );
+            $this->mContent = $handler->unserialize( $this->mText, $title, $format );
         }
 
         return $this->mContent;
@@ -867,8 +868,12 @@ class Revision {
 
     public function getContentHandler() {
         if ( !$this->mContentHandler ) {
-            $m = $this->getModelName();
-            $this->mContentHandler = ContentHandler::getForModelName( $m );
+            $title = $this->getTitle();
+
+            if ( $title ) $model = $title->getContentModelName();
+            else $model = CONTENT_MODEL_WIKITEXT;
+
+            $this->mContentHandler = ContentHandler::getForModelName( $model );
 
             #XXX: do we need to verify that mContentHandler supports mContentFormat?
             #     otherwise, a fixed content format may cause problems on insert.