From: Kunal Mehta Date: Thu, 2 Jul 2015 07:40:40 +0000 (-0700) Subject: Revision: Interpret a NULL rev_content_model as the default model X-Git-Tag: 1.31.0-rc.0~10897^2 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=a5bc9f49cd01e49cb78924686c7f35b03f45d8ea;p=lhc%2Fweb%2Fwiklou.git Revision: Interpret a NULL rev_content_model as the default model If a revision using the default content model is saved, the rev_content_model field will be set to NULL in order to save space. However, Revision::getContentModel() was using Title::getContentModel() when it found a NULL, which will return the current content model rather than the default. So change that to use the default content model, as returned by ContentHandler::getDefaultModelFor() rather than the current one. Change-Id: I7011812b6b131170b3c593917ad263bcba83898d --- diff --git a/includes/Revision.php b/includes/Revision.php index 5939715b5a..71bdf58cea 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -1087,7 +1087,7 @@ class Revision implements IDBAccessObject { /** * Returns the content model for this revision. * - * If no content model was stored in the database, $this->getTitle()->getContentModel() is + * If no content model was stored in the database, the default content model for the title is * used to determine the content model to use. If no title is know, CONTENT_MODEL_WIKITEXT * is used as a last resort. * @@ -1097,7 +1097,11 @@ class Revision implements IDBAccessObject { public function getContentModel() { if ( !$this->mContentModel ) { $title = $this->getTitle(); - $this->mContentModel = ( $title ? $title->getContentModel() : CONTENT_MODEL_WIKITEXT ); + if ( $title ) { + $this->mContentModel = ContentHandler::getDefaultModelFor( $title ); + } else { + $this->mContentModel = CONTENT_MODEL_WIKITEXT; + } assert( !empty( $this->mContentModel ) ); }