Index: branches/Wikidata/phase3/includes/ContentHandler.php |
— | — | @@ -193,7 +193,7 @@ |
194 | 194 | abstract class TextContentHandler extends ContentHandler { |
195 | 195 | |
196 | 196 | public function __construct( $modelName, $formats ) { |
197 | | - super::__construct( $modelName, $formats ); |
| 197 | + parent::__construct( $modelName, $formats ); |
198 | 198 | } |
199 | 199 | |
200 | 200 | public function serialize( Content $content, Title $title, $format = null ) { |
— | — | @@ -204,7 +204,7 @@ |
205 | 205 | class WikitextContentHandler extends TextContentHandler { |
206 | 206 | |
207 | 207 | 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 |
209 | 209 | } |
210 | 210 | |
211 | 211 | public function unserialize( $text, Title $title, $format = null ) { |
— | — | @@ -216,7 +216,7 @@ |
217 | 217 | class JavaScriptContentHandler extends TextContentHandler { |
218 | 218 | |
219 | 219 | public function __construct( $modelName = CONTENT_MODEL_WIKITEXT ) { |
220 | | - super::__construct( $modelName, array( 'text/javascript' ) ); |
| 220 | + parent::__construct( $modelName, array( 'text/javascript' ) ); |
221 | 221 | } |
222 | 222 | |
223 | 223 | public function unserialize( $text, Title $title, $format = null ) { |
— | — | @@ -228,7 +228,7 @@ |
229 | 229 | class CssContentHandler extends TextContentHandler { |
230 | 230 | |
231 | 231 | public function __construct( $modelName = CONTENT_MODEL_WIKITEXT ) { |
232 | | - super::__construct( $modelName, array( 'text/css' ) ); |
| 232 | + parent::__construct( $modelName, array( 'text/css' ) ); |
233 | 233 | } |
234 | 234 | |
235 | 235 | public function unserialize( $text, Title $title, $format = null ) { |
Index: branches/Wikidata/phase3/includes/EditPage.php |
— | — | @@ -1310,7 +1310,7 @@ |
1311 | 1311 | $text = $this->textbox1; // do not try to merge here! |
1312 | 1312 | } elseif ( $this->isConflict ) { |
1313 | 1313 | # Attempt merge |
1314 | | - if ( $this->mergeChangesInto( $text ) ) { |
| 1314 | + if ( $this->mergeChangesInto( $text ) ) { #FIXME: use ContentHandler |
1315 | 1315 | // Successful merge! Maybe we should tell the user the good news? |
1316 | 1316 | $this->isConflict = false; |
1317 | 1317 | wfDebug( __METHOD__ . ": Suppressing edit conflict, successful merge.\n" ); |
Index: branches/Wikidata/phase3/includes/Revision.php |
— | — | @@ -835,13 +835,14 @@ |
836 | 836 | |
837 | 837 | $handler = $this->getContentHandler(); |
838 | 838 | $format = $this->getContentFormat(); |
| 839 | + $title = $this->getTitle(); |
839 | 840 | |
840 | 841 | if( is_null( $this->mText ) ) { |
841 | 842 | // Load text on demand: |
842 | 843 | $this->mText = $this->loadText(); |
843 | 844 | } |
844 | 845 | |
845 | | - $this->mContent = $handler->unserialize( $this->mText, $format ); |
| 846 | + $this->mContent = $handler->unserialize( $this->mText, $title, $format ); |
846 | 847 | } |
847 | 848 | |
848 | 849 | return $this->mContent; |
— | — | @@ -867,9 +868,13 @@ |
868 | 869 | |
869 | 870 | public function getContentHandler() { |
870 | 871 | if ( !$this->mContentHandler ) { |
871 | | - $m = $this->getModelName(); |
872 | | - $this->mContentHandler = ContentHandler::getForModelName( $m ); |
| 872 | + $title = $this->getTitle(); |
873 | 873 | |
| 874 | + if ( $title ) $model = $title->getContentModelName(); |
| 875 | + else $model = CONTENT_MODEL_WIKITEXT; |
| 876 | + |
| 877 | + $this->mContentHandler = ContentHandler::getForModelName( $model ); |
| 878 | + |
874 | 879 | #XXX: do we need to verify that mContentHandler supports mContentFormat? |
875 | 880 | # otherwise, a fixed content format may cause problems on insert. |
876 | 881 | } |