Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
GlobalBlockingConnectionProvider
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
3
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getPrimaryGlobalBlockingDatabase
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getReplicaGlobalBlockingDatabase
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace MediaWiki\Extension\GlobalBlocking\Services;
4
5use Wikimedia\Rdbms\IConnectionProvider;
6use Wikimedia\Rdbms\IDatabase;
7use Wikimedia\Rdbms\IReadableDatabase;
8
9/**
10 * Provides database connections to the virtual-globalblocking database domain where the
11 * globalblocks table is stored.
12 *
13 * @since 1.42
14 */
15class GlobalBlockingConnectionProvider {
16
17    private IConnectionProvider $connectionProvider;
18
19    public function __construct( IConnectionProvider $connectionProvider ) {
20        $this->connectionProvider = $connectionProvider;
21    }
22
23    public function getPrimaryGlobalBlockingDatabase(): IDatabase {
24        return $this->connectionProvider->getPrimaryDatabase( 'virtual-globalblocking' );
25    }
26
27    public function getReplicaGlobalBlockingDatabase(): IReadableDatabase {
28        return $this->connectionProvider->getReplicaDatabase( 'virtual-globalblocking' );
29    }
30}