r113479 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113478‎ | r113479 | r113480 >
Date:16:16, 9 March 2012
Author:daniel
Status:deferred
Tags:
Comment:
fixed bad calls
Modified paths:
  • /branches/Wikidata/phase3/includes/ContentHandler.php (modified) (history)
  • /branches/Wikidata/phase3/includes/EditPage.php (modified) (history)
  • /branches/Wikidata/phase3/includes/Revision.php (modified) (history)

Diff [purge]

Index: branches/Wikidata/phase3/includes/ContentHandler.php
@@ -193,7 +193,7 @@
194194 abstract class TextContentHandler extends ContentHandler {
195195
196196 public function __construct( $modelName, $formats ) {
197 - super::__construct( $modelName, $formats );
 197+ parent::__construct( $modelName, $formats );
198198 }
199199
200200 public function serialize( Content $content, Title $title, $format = null ) {
@@ -204,7 +204,7 @@
205205 class WikitextContentHandler extends TextContentHandler {
206206
207207 public function __construct( $modelName = CONTENT_MODEL_WIKITEXT ) {
208 - super::__construct( $modelName, array( 'application/x-wikitext' ) ); #FIXME: mime
 208+ parent::__construct( $modelName, array( 'application/x-wikitext' ) ); #FIXME: mime
209209 }
210210
211211 public function unserialize( $text, Title $title, $format = null ) {
@@ -216,7 +216,7 @@
217217 class JavaScriptContentHandler extends TextContentHandler {
218218
219219 public function __construct( $modelName = CONTENT_MODEL_WIKITEXT ) {
220 - super::__construct( $modelName, array( 'text/javascript' ) );
 220+ parent::__construct( $modelName, array( 'text/javascript' ) );
221221 }
222222
223223 public function unserialize( $text, Title $title, $format = null ) {
@@ -228,7 +228,7 @@
229229 class CssContentHandler extends TextContentHandler {
230230
231231 public function __construct( $modelName = CONTENT_MODEL_WIKITEXT ) {
232 - super::__construct( $modelName, array( 'text/css' ) );
 232+ parent::__construct( $modelName, array( 'text/css' ) );
233233 }
234234
235235 public function unserialize( $text, Title $title, $format = null ) {
Index: branches/Wikidata/phase3/includes/EditPage.php
@@ -1310,7 +1310,7 @@
13111311 $text = $this->textbox1; // do not try to merge here!
13121312 } elseif ( $this->isConflict ) {
13131313 # Attempt merge
1314 - if ( $this->mergeChangesInto( $text ) ) {
 1314+ if ( $this->mergeChangesInto( $text ) ) { #FIXME: use ContentHandler
13151315 // Successful merge! Maybe we should tell the user the good news?
13161316 $this->isConflict = false;
13171317 wfDebug( __METHOD__ . ": Suppressing edit conflict, successful merge.\n" );
Index: branches/Wikidata/phase3/includes/Revision.php
@@ -835,13 +835,14 @@
836836
837837 $handler = $this->getContentHandler();
838838 $format = $this->getContentFormat();
 839+ $title = $this->getTitle();
839840
840841 if( is_null( $this->mText ) ) {
841842 // Load text on demand:
842843 $this->mText = $this->loadText();
843844 }
844845
845 - $this->mContent = $handler->unserialize( $this->mText, $format );
 846+ $this->mContent = $handler->unserialize( $this->mText, $title, $format );
846847 }
847848
848849 return $this->mContent;
@@ -867,9 +868,13 @@
868869
869870 public function getContentHandler() {
870871 if ( !$this->mContentHandler ) {
871 - $m = $this->getModelName();
872 - $this->mContentHandler = ContentHandler::getForModelName( $m );
 872+ $title = $this->getTitle();
873873
 874+ if ( $title ) $model = $title->getContentModelName();
 875+ else $model = CONTENT_MODEL_WIKITEXT;
 876+
 877+ $this->mContentHandler = ContentHandler::getForModelName( $model );
 878+
874879 #XXX: do we need to verify that mContentHandler supports mContentFormat?
875880 # otherwise, a fixed content format may cause problems on insert.
876881 }

Status & tagging log