Index: trunk/phase3/includes/resourceloader/ResourceLoaderWikiModule.php |
— | — | @@ -44,6 +44,20 @@ |
45 | 45 | abstract protected function getPages( ResourceLoaderContext $context ); |
46 | 46 | |
47 | 47 | /* Protected Methods */ |
| 48 | + |
| 49 | + /** |
| 50 | + * Get the Database object used in getTitleMTimes(). Defaults to the local slave DB |
| 51 | + * but subclasses may want to override this to return a remote DB object. |
| 52 | + * |
| 53 | + * NOTE: This ONLY works for getTitleMTimes() and getModifiedTime(), NOT FOR ANYTHING ELSE. |
| 54 | + * In particular, it doesn't work for getting the content of JS and CSS pages. That functionality |
| 55 | + * will use the local DB irrespective of the return value of this method. |
| 56 | + * |
| 57 | + * @return DatabaseBase |
| 58 | + */ |
| 59 | + protected function getDB() { |
| 60 | + return wfGetDB( DB_SLAVE ); |
| 61 | + } |
48 | 62 | |
49 | 63 | /** |
50 | 64 | * @param $title Title |
— | — | @@ -168,7 +182,7 @@ |
169 | 183 | } |
170 | 184 | |
171 | 185 | if ( !$batch->isEmpty() ) { |
172 | | - $dbr = wfGetDB( DB_SLAVE ); |
| 186 | + $dbr = $this->getDB(); |
173 | 187 | $res = $dbr->select( 'page', |
174 | 188 | array( 'page_namespace', 'page_title', 'page_touched' ), |
175 | 189 | $batch->constructSet( 'page', $dbr ), |