Index: trunk/phase3/maintenance/FiveUpgrade.inc |
— | — | @@ -20,8 +20,9 @@ |
21 | 21 | function FiveUpgrade() { |
22 | 22 | $this->conversionTables = $this->prepareWindows1252(); |
23 | 23 | |
24 | | - $this->dbw =& $this->newConnection(); |
25 | | - $this->dbr =& $this->streamConnection(); |
| 24 | + $this->loadBalancers = array(); |
| 25 | + $this->dbw = wfGetDB( DB_MASTER ); |
| 26 | + $this->dbr = $this->streamConnection(); |
26 | 27 | |
27 | 28 | $this->cleanupSwaps = array(); |
28 | 29 | $this->emailAuth = false; # don't preauthenticate emails |
— | — | @@ -67,13 +68,24 @@ |
68 | 69 | * @return Database |
69 | 70 | * @access private |
70 | 71 | */ |
71 | | - function &newConnection() { |
72 | | - global $wgDBadminuser, $wgDBadminpassword, $wgDBtype; |
73 | | - global $wgDBserver, $wgDBname; |
74 | | - $dbclass = 'Database' . ucfirst( $wgDBtype ) ; |
75 | | - $db = new $dbclass( $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname ); |
| 72 | + function newConnection() { |
| 73 | + $lb = wfGetLBFactory()->newMainLB(); |
| 74 | + $db = $lb->getConnection( DB_MASTER ); |
| 75 | + |
| 76 | + $this->loadBalancers[] = $lb; |
76 | 77 | return $db; |
77 | 78 | } |
| 79 | + |
| 80 | + /** |
| 81 | + * Close out the connections when we're done... |
| 82 | + * Is this needed? |
| 83 | + */ |
| 84 | + function close() { |
| 85 | + foreach( $this->loadBalancers as $lb ) { |
| 86 | + $lb->commitMasterChanges(); |
| 87 | + $lb->closeAll(); |
| 88 | + } |
| 89 | + } |
78 | 90 | |
79 | 91 | /** |
80 | 92 | * Open a second connection to the master server, with buffering off. |
— | — | @@ -82,7 +94,7 @@ |
83 | 95 | * @return Database |
84 | 96 | * @access private |
85 | 97 | */ |
86 | | - function &streamConnection() { |
| 98 | + function streamConnection() { |
87 | 99 | global $wgDBtype; |
88 | 100 | |
89 | 101 | $timeout = 3600 * 24; |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -420,6 +420,8 @@ |
421 | 421 | move a title to an interwiki target |
422 | 422 | * (bug 16638) 8-bit URL fallback encoding now set on additional languages using |
423 | 423 | Arabic script (Persian, Urdu, Sindhi, Punjabi) |
| 424 | +* (bug 16656) cleanupTitles and friends should now work in load-balanced |
| 425 | + DB environments when $wgDBserver isn't set. |
424 | 426 | |
425 | 427 | === API changes in 1.14 === |
426 | 428 | |