fix handling of per-revision content model if different from title's default content...
authordaniel <daniel.kinzler@wikimedia.de>
Mon, 23 Apr 2012 08:08:59 +0000 (10:08 +0200)
committerdaniel <daniel.kinzler@wikimedia.de>
Mon, 23 Apr 2012 08:08:59 +0000 (10:08 +0200)
includes/Revision.php
includes/WikiPage.php

index 984ad1c..82a4a94 100644 (file)
@@ -515,8 +515,8 @@ class Revision {
                }
                $this->mUnpatrolled = null;
 
-        #FIXME: add patch for ar_content_format, ar_content_model, rev_content_format, rev_content_model to installer
-        #FIXME: add support for ar_content_format, ar_content_model, rev_content_format, rev_content_model to API
+        // @TODO: add support for ar_content_format, ar_content_model, rev_content_format, rev_content_model to API
+        // @TODO: get rid of $mText
        }
 
        /**
@@ -867,15 +867,10 @@ class Revision {
 
     public function getContentHandler() {
         if ( !$this->mContentHandler ) {
-            $title = $this->getTitle();
-
-            if ( $title ) $model = $title->getContentModelName();
-            else $model = CONTENT_MODEL_WIKITEXT;
-
+            $model = $this->getContentModelName();
             $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.
+            assert( $this->mContentHandler->isSupportedFormat( $this->getContentFormat() ) );
         }
 
         return $this->mContentHandler;
index 8f5d9a5..6105637 100644 (file)
@@ -353,8 +353,8 @@ class WikiPage extends Page {
     public function getContentModelName() {
         if ( $this->exists() ) {
             # look at the revision's actual content model
-            $content = $this->getContent();
-            return $content->getModelName();
+            $rev = $this->getRevision();
+            return $rev->getContentModelName();
         } else {
             # use the default model for this page
             return $this->mTitle->getContentModelName();