Ensure users are able to edit the page after changing the content model
[lhc/web/wiklou.git] / includes / db / loadbalancer / LBFactoryMulti.php
index 0f3ca93..e56631d 100644 (file)
@@ -293,7 +293,7 @@ class LBFactoryMulti extends LBFactory {
         * @param bool|string $wiki Wiki ID, or false for the current wiki
         * @return LoadBalancer
         */
-       public function &getExternalLB( $cluster, $wiki = false ) {
+       public function getExternalLB( $cluster, $wiki = false ) {
                if ( !isset( $this->extLBs[$cluster] ) ) {
                        $this->extLBs[$cluster] = $this->newExternalLB( $cluster, $wiki );
                        $this->extLBs[$cluster]->parentInfo( [ 'id' => "ext-$cluster" ] );
@@ -313,7 +313,7 @@ class LBFactoryMulti extends LBFactory {
         * @return LoadBalancer
         */
        private function newLoadBalancer( $template, $loads, $groupLoads, $readOnlyReason ) {
-               return new LoadBalancer( [
+               $lb = new LoadBalancer( [
                        'servers' => $this->makeServerArray( $template, $loads, $groupLoads ),
                        'loadMonitor' => $this->loadMonitorClass,
                        'readOnlyReason' => $readOnlyReason,
@@ -321,6 +321,10 @@ class LBFactoryMulti extends LBFactory {
                        'srvCache' => $this->srvCache,
                        'wanCache' => $this->wanCache
                ] );
+
+               $this->initLoadBalancer( $lb );
+
+               return $lb;
        }
 
        /**
@@ -349,7 +353,7 @@ class LBFactoryMulti extends LBFactory {
                                }
                                $master = false;
                        } else {
-                               $serverInfo['slave'] = true;
+                               $serverInfo['replica'] = true;
                        }
                        if ( isset( $this->templateOverridesByServer[$serverName] ) ) {
                                $serverInfo = $this->templateOverridesByServer[$serverName] + $serverInfo;
@@ -364,6 +368,8 @@ class LBFactoryMulti extends LBFactory {
                        }
                        $serverInfo['hostName'] = $serverName;
                        $serverInfo['load'] = $load;
+                       $serverInfo += [ 'flags' => DBO_DEFAULT ];
+
                        $servers[] = $serverInfo;
                }
 
@@ -416,11 +422,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
-       }
 }