From 12ac655f8d71c7e369b4c6591c2cddb8445e56a5 Mon Sep 17 00:00:00 2001 From: daniel Date: Mon, 23 Apr 2012 10:08:59 +0200 Subject: [PATCH] fix handling of per-revision content model if different from title's default content model --- includes/Revision.php | 13 ++++--------- includes/WikiPage.php | 4 ++-- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/includes/Revision.php b/includes/Revision.php index 984ad1c108..82a4a943af 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -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; diff --git a/includes/WikiPage.php b/includes/WikiPage.php index 8f5d9a5250..61056375bc 100644 --- a/includes/WikiPage.php +++ b/includes/WikiPage.php @@ -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(); -- 2.20.1