https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113479
Revision: 113479
Author: daniel
Date: 2012-03-09 16:16:40 +0000 (Fri, 09 Mar 2012)
Log Message:
-----------
fixed bad calls
Modified Paths:
--------------
branches/Wikidata/phase3/includes/ContentHandler.php
branches/Wikidata/phase3/includes/EditPage.php
branches/Wikidata/phase3/includes/Revision.php
Modified: branches/Wikidata/phase3/includes/ContentHandler.php
===================================================================
--- branches/Wikidata/phase3/includes/ContentHandler.php 2012-03-09
16:11:05 UTC (rev 113478)
+++ branches/Wikidata/phase3/includes/ContentHandler.php 2012-03-09
16:16:40 UTC (rev 113479)
@@ -193,7 +193,7 @@
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 @@
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 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 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 ) {
Modified: branches/Wikidata/phase3/includes/EditPage.php
===================================================================
--- branches/Wikidata/phase3/includes/EditPage.php 2012-03-09 16:11:05 UTC
(rev 113478)
+++ branches/Wikidata/phase3/includes/EditPage.php 2012-03-09 16:16:40 UTC
(rev 113479)
@@ -1310,7 +1310,7 @@
$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" );
Modified: branches/Wikidata/phase3/includes/Revision.php
===================================================================
--- branches/Wikidata/phase3/includes/Revision.php 2012-03-09 16:11:05 UTC
(rev 113478)
+++ branches/Wikidata/phase3/includes/Revision.php 2012-03-09 16:16:40 UTC
(rev 113479)
@@ -835,13 +835,14 @@
$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,9 +868,13 @@
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.
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs