http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90804
Revision: 90804
Author: nad
Date: 2011-06-26 00:14:27 +0000 (Sun, 26 Jun 2011)
Log Message:
-----------
better comments for DBhook classes
Modified Paths:
--------------
trunk/extensions/SimpleSecurity/SimpleSecurity_body.php
Modified: trunk/extensions/SimpleSecurity/SimpleSecurity_body.php
===================================================================
--- trunk/extensions/SimpleSecurity/SimpleSecurity_body.php 2011-06-25
23:49:49 UTC (rev 90803)
+++ trunk/extensions/SimpleSecurity/SimpleSecurity_body.php 2011-06-26
00:14:27 UTC (rev 90804)
@@ -411,8 +411,37 @@
}
/**
- * Create a new class based on LoadBalancer which opens connections to our new
hooked database class
+ * The new LBFactory_SimpleSecurity class identical to LBFactory_Simple except
that it returns a LoadBalancer_SimpleSecurity onject
*/
+class LBFactory_SimpleSecurity extends LBFactory_Simple {
+
+ function newMainLB( $wiki = false ) {
+ global $wgDBservers, $wgMasterWaitTimeout;
+ if ( $wgDBservers ) {
+ $servers = $wgDBservers;
+ } else {
+ global $wgDBserver, $wgDBuser, $wgDBpassword,
$wgDBname, $wgDBtype, $wgDebugDumpSql;
+ $servers = array(array(
+ 'host' => $wgDBserver,
+ 'user' => $wgDBuser,
+ 'password' => $wgDBpassword,
+ 'dbname' => $wgDBname,
+ 'type' => $wgDBtype,
+ 'load' => 1,
+ 'flags' => ($wgDebugDumpSql ? DBO_DEBUG : 0) |
DBO_DEFAULT
+ ));
+ }
+ return new LoadBalancer_SimpleSecurity( array(
+ 'servers' => $servers,
+ 'masterWaitTimeout' => $wgMasterWaitTimeout
+ ));
+ }
+
+}
+
+/**
+ * LoadBalancer_SimpleSecurity always returns Database_SimpleSecurity
regardles of $wgDBtype
+ */
class LoadBalancer_SimpleSecurity extends LoadBalancer {
function reallyOpenConnection( $server, $dbNameOverride = false ) {
@@ -449,32 +478,3 @@
}
}
-
-/**
- * Create a new LBFactory class based on LBFactory_Simple which uses our new
LoadBalancer class
- */
-class LBFactory_SimpleSecurity extends LBFactory_Simple {
-
- function newMainLB( $wiki = false ) {
- global $wgDBservers, $wgMasterWaitTimeout;
- if ( $wgDBservers ) {
- $servers = $wgDBservers;
- } else {
- global $wgDBserver, $wgDBuser, $wgDBpassword,
$wgDBname, $wgDBtype, $wgDebugDumpSql;
- $servers = array(array(
- 'host' => $wgDBserver,
- 'user' => $wgDBuser,
- 'password' => $wgDBpassword,
- 'dbname' => $wgDBname,
- 'type' => $wgDBtype,
- 'load' => 1,
- 'flags' => ($wgDebugDumpSql ? DBO_DEBUG : 0) |
DBO_DEFAULT
- ));
- }
- return new LoadBalancer_SimpleSecurity( array(
- 'servers' => $servers,
- 'masterWaitTimeout' => $wgMasterWaitTimeout
- ));
- }
-
-}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs