From 9de1e0ebe2c1f0d695f5f90d3c6ae247bdbeca13 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Mon, 29 Aug 2016 09:11:02 -0700 Subject: [PATCH] Fix shutdown() code duplication in LBFactory Merge duplicate shutdown() methods from LBFactory subclasses to the base class, as cronProt is also set there too. Change-Id: I4050b3469f61b1f4173d5841ff2497f3f30e1382 --- includes/db/loadbalancer/LBFactory.php | 5 ++++- includes/db/loadbalancer/LBFactoryMulti.php | 7 ------- includes/db/loadbalancer/LBFactorySimple.php | 7 ------- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/includes/db/loadbalancer/LBFactory.php b/includes/db/loadbalancer/LBFactory.php index f560cf17ab..84f7fcb3d2 100644 --- a/includes/db/loadbalancer/LBFactory.php +++ b/includes/db/loadbalancer/LBFactory.php @@ -196,9 +196,12 @@ abstract class LBFactory implements DestructibleService { /** * Prepare all tracked load balancers for shutdown * @param integer $flags Supports SHUTDOWN_* flags - * STUB */ public function shutdown( $flags = 0 ) { + if ( !( $flags & self::SHUTDOWN_NO_CHRONPROT ) ) { + $this->shutdownChronologyProtector( $this->chronProt ); + } + $this->commitMasterChanges( __METHOD__ ); // sanity } /** diff --git a/includes/db/loadbalancer/LBFactoryMulti.php b/includes/db/loadbalancer/LBFactoryMulti.php index 4b9cccc86a..f201081389 100644 --- a/includes/db/loadbalancer/LBFactoryMulti.php +++ b/includes/db/loadbalancer/LBFactoryMulti.php @@ -418,11 +418,4 @@ class LBFactoryMulti extends LBFactory { call_user_func_array( $callback, array_merge( [ $lb ], $params ) ); } } - - public function shutdown( $flags = 0 ) { - if ( !( $flags & self::SHUTDOWN_NO_CHRONPROT ) ) { - $this->shutdownChronologyProtector( $this->chronProt ); - } - $this->commitMasterChanges( __METHOD__ ); // sanity - } } diff --git a/includes/db/loadbalancer/LBFactorySimple.php b/includes/db/loadbalancer/LBFactorySimple.php index 3702c8b05d..c7c4752c6b 100644 --- a/includes/db/loadbalancer/LBFactorySimple.php +++ b/includes/db/loadbalancer/LBFactorySimple.php @@ -159,11 +159,4 @@ class LBFactorySimple extends LBFactory { call_user_func_array( $callback, array_merge( [ $lb ], $params ) ); } } - - public function shutdown( $flags = 0 ) { - if ( !( $flags & self::SHUTDOWN_NO_CHRONPROT ) ) { - $this->shutdownChronologyProtector( $this->chronProt ); - } - $this->commitMasterChanges( __METHOD__ ); // sanity - } } -- 2.20.1