Remove title protection correctly for undeletions and imports
authorGeoffreyT2000 <geoffreytrang@gmail.com>
Thu, 9 May 2019 00:56:15 +0000 (17:56 -0700)
committerGeoffreyT2000 <geoffreytrang@gmail.com>
Fri, 16 Aug 2019 14:13:48 +0000 (14:13 +0000)
Undeletions and imports can both produce "new" pages with more than
1 revision. The fact that $options['created'] for the associated
DerivedPageDataUpdater instance is unexpectedly changed to false is due
to the fact that the latest revision often has a nonzero rev_parent_id.
This causes WikiPage::onArticleCreate not to be applied correctly, and
so title protection is not correctly removed. The part about "created"
being forced is therefore being fixed.

Bug: T200088
Change-Id: I8c899893486976285eb6fac87d641e93a616676d

includes/Storage/DerivedPageDataUpdater.php

index 68814ef..f49ea60 100644 (file)
@@ -1208,7 +1208,8 @@ class DerivedPageDataUpdater implements IDBAccessObject, LoggerAwareInterface {
                }
 
                // "created" is forced here
-               $this->options['created'] = ( $this->pageState['oldId'] === 0 );
+               $this->options['created'] = ( $this->options['created'] ||
+                                               ( $this->pageState['oldId'] === 0 ) );
 
                $this->revision = $revision;