Remove unused variable $user from SkinTemplate::outputPage()
[lhc/web/wiklou.git] / includes / WikiPage.php
index 9507e5f..0d987aa 100644 (file)
@@ -1660,7 +1660,8 @@ class WikiPage implements Page, IDBAccessObject {
         * @since 1.21
         */
        public function doEditContent( Content $content, $summary, $flags = 0, $baseRevId = false,
-                                                                  User $user = null, $serialisation_format = null ) {
+               User $user = null, $serialisation_format = null
+       ) {
                global $wgUser, $wgUseAutomaticEditSummaries, $wgUseRCPatrol, $wgUseNPPatrol;
 
                // Low-level sanity check
@@ -2016,6 +2017,11 @@ class WikiPage implements Page, IDBAccessObject {
                $user = is_null( $user ) ? $wgUser : $user;
                //XXX: check $user->getId() here???
 
+               // Use a sane default for $serialization_format, see bug 57026
+               if ( $serialization_format === null ) {
+                       $serialization_format = $content->getContentHandler()->getDefaultFormat();
+               }
+
                if ( $this->mPreparedEdit
                        && $this->mPreparedEdit->newContent
                        && $this->mPreparedEdit->newContent->equals( $content )
@@ -2253,8 +2259,8 @@ class WikiPage implements Page, IDBAccessObject {
                        return Status::newFatal( 'readonlytext', wfReadOnlyReason() );
                }
 
+               $this->loadPageData( 'fromdbmaster' );
                $restrictionTypes = $this->mTitle->getRestrictionTypes();
-
                $id = $this->getId();
 
                if ( !$cascade ) {