ApiEditPage: Fetch content model from article, not title
authorBrad Jorsch <bjorsch@wikimedia.org>
Thu, 23 Apr 2015 14:21:11 +0000 (10:21 -0400)
committerBrad Jorsch <bjorsch@wikimedia.org>
Thu, 23 Apr 2015 14:23:41 +0000 (10:23 -0400)
The Title object's cached content model isn't updated after the edit.
The Article object fetches the model from the revision that was just
created, so let's just use that instead.

Bug: T96937
Change-Id: I4c5ab3ec6829d403a29a8a8f55e7458730369034

includes/api/ApiEditPage.php

index 0dee147..6ab8483 100644 (file)
@@ -497,7 +497,7 @@ class ApiEditPage extends ApiBase {
                                $r['result'] = 'Success';
                                $r['pageid'] = intval( $titleObj->getArticleID() );
                                $r['title'] = $titleObj->getPrefixedText();
-                               $r['contentmodel'] = $titleObj->getContentModel();
+                               $r['contentmodel'] = $articleObject->getContentModel();
                                $newRevId = $articleObject->getLatest();
                                if ( $newRevId == $oldRevId ) {
                                        $r['nochange'] = true;