1 | <?php |
||
16 | class DatabaseTermIdsResolver implements TermIdsResolver { |
||
17 | |||
18 | /** @var TypeIdsResolver */ |
||
19 | private $typeIdsResolver; |
||
20 | |||
21 | /** @var ILoadBalancer */ |
||
22 | private $lb; |
||
23 | |||
24 | /** @var IDatabase */ |
||
25 | private $dbr = null; |
||
26 | |||
27 | /** @var IDatabase */ |
||
28 | private $dbw = null; |
||
29 | |||
30 | /** @var string[] stash of data returned from the {@link TypeIdsResolver} */ |
||
31 | private $typeNames = []; |
||
32 | |||
33 | public function __construct( |
||
40 | |||
41 | /* |
||
42 | * Term data is first read from the replica; if that returns less rows than we asked for, |
||
43 | * then there are some new rows in the master that were not yet replicated, and we fall back |
||
44 | * to the master. As the internal relations of the term store never change (for example, |
||
45 | * a term_in_lang row will never suddenly point to a different text_in_lang), a master fallback |
||
46 | * should never be necessary in any other case. However, callers need to consider where they |
||
47 | * got the list of term IDs they pass into this method from: if it’s from a replica, they may |
||
48 | * still see outdated data overall. |
||
49 | */ |
||
50 | public function resolveTermIds( array $termIds ): array { |
||
75 | |||
76 | private function selectTerms( IDatabase $db, array $termIds ): IResultWrapper { |
||
89 | |||
90 | private function preloadTypes( IResultWrapper $result ) { |
||
100 | |||
101 | private function addResultTerms( array &$terms, stdClass $row ) { |
||
107 | |||
108 | private function lookupType( $typeId ) { |
||
116 | |||
117 | private function connectDbr() { |
||
122 | |||
123 | private function connectDbw() { |
||
128 | |||
129 | } |
||
130 |