From d2cd543276107c3e6d1d6e65bed9275127a62b5f Mon Sep 17 00:00:00 2001 From: Daniel Kinzler Date: Fri, 9 Mar 2012 16:16:40 +0000 Subject: [PATCH] fixed bad calls --- includes/ContentHandler.php | 8 ++++---- includes/EditPage.php | 2 +- includes/Revision.php | 11 ++++++++--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/includes/ContentHandler.php b/includes/ContentHandler.php index eef232eec6..7bfe03e080 100644 --- a/includes/ContentHandler.php +++ b/includes/ContentHandler.php @@ -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 ) { diff --git a/includes/EditPage.php b/includes/EditPage.php index 3425bb5902..e09b595571 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -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" ); diff --git a/includes/Revision.php b/includes/Revision.php index cdb0738970..da1f881613 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -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. -- 2.20.1