Fix shutdown() code duplication in LBFactory
authorAaron Schulz <aschulz@wikimedia.org>
Mon, 29 Aug 2016 16:11:02 +0000 (09:11 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Mon, 29 Aug 2016 16:11:05 +0000 (09:11 -0700)
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
includes/db/loadbalancer/LBFactoryMulti.php
includes/db/loadbalancer/LBFactorySimple.php

index f560cf1..84f7fcb 100644 (file)
@@ -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
        }
 
        /**
index 4b9cccc..f201081 100644 (file)
@@ -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
-       }
 }
index 3702c8b..c7c4752 100644 (file)
@@ -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
-       }
 }