Switch various LoadBalancer::getConnection() callers to getConnectionRef()
[lhc/web/wiklou.git] / includes / page / WikiPage.php
index 332b1ee..6f94ccf 100644 (file)
@@ -1588,7 +1588,7 @@ class WikiPage implements Page, IDBAccessObject {
                $baseRevId = null;
                if ( $edittime && $sectionId !== 'new' ) {
                        $lb = $this->getDBLoadBalancer();
-                       $dbr = $lb->getConnection( DB_REPLICA );
+                       $dbr = $lb->getConnectionRef( DB_REPLICA );
                        $rev = Revision::loadFromTimestamp( $dbr, $this->mTitle, $edittime );
                        // Try the master if this thread may have just added it.
                        // This could be abstracted into a Revision method, but we don't want
@@ -1597,7 +1597,7 @@ class WikiPage implements Page, IDBAccessObject {
                                && $lb->getServerCount() > 1
                                && $lb->hasOrMadeRecentMasterChanges()
                        ) {
-                               $dbw = $lb->getConnection( DB_MASTER );
+                               $dbw = $lb->getConnectionRef( DB_MASTER );
                                $rev = Revision::loadFromTimestamp( $dbw, $this->mTitle, $edittime );
                        }
                        if ( $rev ) {
@@ -1697,6 +1697,7 @@ class WikiPage implements Page, IDBAccessObject {
                        MediaWikiServices::getInstance()->getDBLoadBalancerFactory()
                );
 
+               $derivedDataUpdater->setLogger( LoggerFactory::getInstance( 'SaveParse' ) );
                $derivedDataUpdater->setRcWatchCategoryMembership( $wgRCWatchCategoryMembership );
                $derivedDataUpdater->setArticleCountMethod( $wgArticleCountMethod );
 
@@ -1904,7 +1905,11 @@ class WikiPage implements Page, IDBAccessObject {
                // TODO: this logic should not be in the storage layer, it's here for compatibility
                // with 1.31 behavior. Applying the 'autopatrol' right should be done in the same
                // place the 'bot' right is handled, which is currently in EditPage::attemptSave.
-               if ( $needsPatrol && $this->getTitle()->userCan( 'autopatrol', $user ) ) {
+               $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
+
+               if ( $needsPatrol && $permissionManager->userCan(
+                       'autopatrol', $user, $this->getTitle()
+               ) ) {
                        $updater->setRcPatrolStatus( RecentChange::PRC_AUTOPATROLLED );
                }
 
@@ -2106,6 +2111,11 @@ class WikiPage implements Page, IDBAccessObject {
         *   - defer: one of the DeferredUpdates constants, or false to run immediately (default: false).
         *     Note that even when this is set to false, some updates might still get deferred (as
         *     some update might directly add child updates to DeferredUpdates).
+        *   - known-revision-output: a combined canonical ParserOutput for the revision, perhaps
+        *     from some cache. The caller is responsible for ensuring that the ParserOutput indeed
+        *     matched the $rev and $options. This mechanism is intended as a temporary stop-gap,
+        *     for the time until caches have been changed to store RenderedRevision states instead
+        *     of ParserOutput objects. (default: null) (since 1.33)
         * @since 1.32
         */
        public function doSecondaryDataUpdates( array $options = [] ) {
@@ -3073,7 +3083,7 @@ class WikiPage implements Page, IDBAccessObject {
         * (with ChangeTags::canAddTagsAccompanyingChange)
         *
         * @return array Array of errors, each error formatted as
-        *   array(messagekey, param1, param2, ...).
+        *   [ messagekey, param1, param2, ... ].
         * On success, the array is empty.  This array can also be passed to
         * OutputPage::showPermissionsErrorPage().
         */
@@ -3267,7 +3277,11 @@ class WikiPage implements Page, IDBAccessObject {
                // TODO: this logic should not be in the storage layer, it's here for compatibility
                // with 1.31 behavior. Applying the 'autopatrol' right should be done in the same
                // place the 'bot' right is handled, which is currently in EditPage::attemptSave.
-               if ( $wgUseRCPatrol && $this->getTitle()->userCan( 'autopatrol', $guser ) ) {
+               $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
+
+               if ( $wgUseRCPatrol && $permissionManager->userCan(
+                       'autopatrol', $guser, $this->getTitle()
+               ) ) {
                        $updater->setRcPatrolStatus( RecentChange::PRC_AUTOPATROLLED );
                }