Revert "Temporarily trim leading/trailing whitespace from parser test clauses"
[lhc/web/wiklou.git] / includes / page / WikiPage.php
index 6217ee7..cd0fa8b 100644 (file)
@@ -637,7 +637,7 @@ class WikiPage implements Page, IDBAccessObject {
         */
        public function getContentModel() {
                if ( $this->exists() ) {
-                       $cache = ObjectCache::getMainWANInstance();
+                       $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
 
                        return $cache->getWithSetCallback(
                                $cache->makeKey( 'page-content-model', $this->getLatest() ),
@@ -895,7 +895,8 @@ class WikiPage implements Page, IDBAccessObject {
         *   Revision::RAW              get the text regardless of permissions
         * @param User|null $user User object to check for, only if FOR_THIS_USER is passed
         *   to the $audience parameter
-        * @return string Comment stored for the last article revision
+        * @return string|null Comment stored for the last article revision, or null if the specified
+        *  audience does not have access to the comment.
         */
        public function getComment( $audience = Revision::FOR_PUBLIC, User $user = null ) {
                $this->loadLastEdit();
@@ -2625,7 +2626,9 @@ class WikiPage implements Page, IDBAccessObject {
                // Avoid PHP 7.1 warning of passing $this by reference
                $wikiPage = $this;
 
-               $deleter = is_null( $deleter ) ? $wgUser : $deleter;
+               if ( !$deleter ) {
+                       $deleter = $wgUser;
+               }
                if ( !Hooks::run( 'ArticleDelete',
                        [ &$wikiPage, &$deleter, &$reason, &$error, &$status, $suppress ]
                ) ) {
@@ -2815,8 +2818,7 @@ class WikiPage implements Page, IDBAccessObject {
         */
        protected function archiveRevisions( $dbw, $id, $suppress ) {
                global $wgContentHandlerUseDB, $wgMultiContentRevisionSchemaMigrationStage,
-                       $wgCommentTableSchemaMigrationStage, $wgActorTableSchemaMigrationStage,
-                       $wgDeleteRevisionsBatchSize;
+                       $wgActorTableSchemaMigrationStage, $wgDeleteRevisionsBatchSize;
 
                // Given the lock above, we can be confident in the title and page ID values
                $namespace = $this->getTitle()->getNamespace();
@@ -2942,9 +2944,7 @@ class WikiPage implements Page, IDBAccessObject {
                        $dbw->insert( 'archive', $rowsInsert, __METHOD__ );
 
                        $dbw->delete( 'revision', [ 'rev_id' => $revids ], __METHOD__ );
-                       if ( $wgCommentTableSchemaMigrationStage > MIGRATION_OLD ) {
-                               $dbw->delete( 'revision_comment_temp', [ 'revcomment_rev' => $revids ], __METHOD__ );
-                       }
+                       $dbw->delete( 'revision_comment_temp', [ 'revcomment_rev' => $revids ], __METHOD__ );
                        if ( $wgActorTableSchemaMigrationStage & SCHEMA_COMPAT_WRITE_NEW ) {
                                $dbw->delete( 'revision_actor_temp', [ 'revactor_rev' => $revids ], __METHOD__ );
                        }