* @ingroup Database
*/
abstract class LBFactory {
+
+ /**
+ * @var LBFactory
+ */
static $instance;
/**
self::$instance = new LBFactory_Fake( $wgLBFactoryConf );
}
- /**
- * Resets the singleton for use if it's been disabled. Does nothing otherwise
- */
- public static function enableBackend() {
- if( self::$instance instanceof LBFactory_Fake )
- self::$instance = null;
- }
-
/**
* Get an LBFactory instance
*/
}
}
+ /**
+ * Set the instance to be the given object
+ */
+ static function setInstance( $instance ) {
+ self::destroyInstance();
+ self::$instance = $instance;
+ }
+
/**
* Construct a factory based on a configuration array (typically from $wgLBFactoryConf)
*/
*/
abstract function getMainLB( $wiki = false );
- /*
+ /**
* Create a new load balancer for external storage. The resulting object will be
* untracked, not chronology-protected, and the caller is responsible for
* cleaning it up.
*/
abstract function newExternalLB( $cluster, $wiki = false );
- /*
+ /**
* Get a cached (tracked) load balancer for external storage
*
* @param $cluster String: external storage cluster, or false for core
* A simple single-master LBFactory that gets its configuration from the b/c globals
*/
class LBFactory_Simple extends LBFactory {
+
+ /**
+ * @var LoadBalancer
+ */
var $mainLB;
var $extLBs = array();