r90804 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90803‎ | r90804 | r90805 >
Date:00:14, 26 June 2011
Author:nad
Status:deferred
Tags:
Comment:
better comments for DBhook classes
Modified paths:
  • /trunk/extensions/SimpleSecurity/SimpleSecurity_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SimpleSecurity/SimpleSecurity_body.php
@@ -411,8 +411,37 @@
412412 }
413413
414414 /**
415 - * Create a new class based on LoadBalancer which opens connections to our new hooked database class
 415+ * The new LBFactory_SimpleSecurity class identical to LBFactory_Simple except that it returns a LoadBalancer_SimpleSecurity onject
416416 */
 417+class LBFactory_SimpleSecurity extends LBFactory_Simple {
 418+
 419+ function newMainLB( $wiki = false ) {
 420+ global $wgDBservers, $wgMasterWaitTimeout;
 421+ if ( $wgDBservers ) {
 422+ $servers = $wgDBservers;
 423+ } else {
 424+ global $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, $wgDBtype, $wgDebugDumpSql;
 425+ $servers = array(array(
 426+ 'host' => $wgDBserver,
 427+ 'user' => $wgDBuser,
 428+ 'password' => $wgDBpassword,
 429+ 'dbname' => $wgDBname,
 430+ 'type' => $wgDBtype,
 431+ 'load' => 1,
 432+ 'flags' => ($wgDebugDumpSql ? DBO_DEBUG : 0) | DBO_DEFAULT
 433+ ));
 434+ }
 435+ return new LoadBalancer_SimpleSecurity( array(
 436+ 'servers' => $servers,
 437+ 'masterWaitTimeout' => $wgMasterWaitTimeout
 438+ ));
 439+ }
 440+
 441+}
 442+
 443+/**
 444+ * LoadBalancer_SimpleSecurity always returns Database_SimpleSecurity regardles of $wgDBtype
 445+ */
417446 class LoadBalancer_SimpleSecurity extends LoadBalancer {
418447
419448 function reallyOpenConnection( $server, $dbNameOverride = false ) {
@@ -449,32 +478,3 @@
450479 }
451480
452481 }
453 -
454 -/**
455 - * Create a new LBFactory class based on LBFactory_Simple which uses our new LoadBalancer class
456 - */
457 -class LBFactory_SimpleSecurity extends LBFactory_Simple {
458 -
459 - function newMainLB( $wiki = false ) {
460 - global $wgDBservers, $wgMasterWaitTimeout;
461 - if ( $wgDBservers ) {
462 - $servers = $wgDBservers;
463 - } else {
464 - global $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, $wgDBtype, $wgDebugDumpSql;
465 - $servers = array(array(
466 - 'host' => $wgDBserver,
467 - 'user' => $wgDBuser,
468 - 'password' => $wgDBpassword,
469 - 'dbname' => $wgDBname,
470 - 'type' => $wgDBtype,
471 - 'load' => 1,
472 - 'flags' => ($wgDebugDumpSql ? DBO_DEBUG : 0) | DBO_DEFAULT
473 - ));
474 - }
475 - return new LoadBalancer_SimpleSecurity( array(
476 - 'servers' => $servers,
477 - 'masterWaitTimeout' => $wgMasterWaitTimeout
478 - ));
479 - }
480 -
481 -}

Status & tagging log