7
7
* @author Nmlgc
8
8
*/
9
9
10
+ use MediaWiki \MediaWikiServices ;
11
+
10
12
class TPCPatchMap {
11
13
12
14
protected static function mergePatch ( &$ map , &$ patch ) {
@@ -27,7 +29,7 @@ protected static function mergePatch( &$map, &$patch ) {
27
29
* @return bool `true` if the given page is part of `tpc_tl_source_pages`.
28
30
*/
29
31
public static function isTLIncludedPage ( int $ namespace , string $ title ): bool {
30
- $ dbr = wfGetDB ( DB_REPLICA );
32
+ $ dbr = MediaWikiServices:: getInstance ()-> getDBLoadBalancer ()-> getConnection ( DB_REPLICA );
31
33
return $ dbr ->selectRow ( 'tpc_tl_source_pages ' , 1 , array (
32
34
'tlsp_namespace ' => $ namespace ,
33
35
'tlsp_title ' => $ title
@@ -39,7 +41,7 @@ public static function isTLIncludedPage( int $namespace, string $title ): bool {
39
41
* See tpc_patch_map.sql for the format.
40
42
*/
41
43
public static function buildTLMapping ( string $ game , string $ lang ) {
42
- $ dbr = wfGetDB ( DB_REPLICA );
44
+ $ dbr = MediaWikiServices:: getInstance ()-> getDBLoadBalancer ()-> getConnection ( DB_REPLICA );
43
45
$ tl = $ dbr ->selectRow ( 'tpc_tl_patches ' , 'tl_patch ' , array ( 'tl_code ' => $ lang ) );
44
46
if ( $ tl === false ) {
45
47
return null ;
@@ -52,7 +54,7 @@ public static function buildTLMapping( string $game, string $lang ) {
52
54
}
53
55
54
56
protected static function getMapping ( Title &$ title ) {
55
- $ dbr = wfGetDB ( DB_REPLICA );
57
+ $ dbr = MediaWikiServices:: getInstance ()-> getDBLoadBalancer ()-> getConnection ( DB_REPLICA );
56
58
// Get old value
57
59
$ map = $ dbr ->selectRow ( 'tpc_patch_map ' , '* ' , array (
58
60
'pm_namespace ' => $ title ->getNamespace (),
@@ -77,7 +79,7 @@ public static function update( $title, $patch, $game = null, $target = null ) {
77
79
return ;
78
80
}
79
81
80
- $ dbw = wfGetDB ( DB_MASTER );
82
+ $ dbw = MediaWikiServices:: getInstance ()-> getDBLoadBalancer ()-> getConnection ( DB_PRIMARY );
81
83
$ inserts = array (
82
84
'pm_namespace ' => $ title ->getNamespace (),
83
85
'pm_title ' => $ title ->getText (),
@@ -139,7 +141,7 @@ public static function isPatchRootPage( $title ) {
139
141
}
140
142
141
143
public static function getPatchRootPages () {
142
- $ dbr = wfGetDB ( DB_REPLICA );
144
+ $ dbr = MediaWikiServices:: getInstance ()-> getDBLoadBalancer ()-> getConnection ( DB_REPLICA );
143
145
return $ dbr ->select (
144
146
'page ' ,
145
147
array ( 'page_namespace ' , 'page_title ' ),
0 commit comments