Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 9 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| SchemaHookHandler | |
0.00% |
0 / 9 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
| onLoadExtensionSchemaUpdates | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |||
| populateProjectsTable | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Extension\ReadingLists; |
| 4 | |
| 5 | use MediaWiki\Installer\DatabaseUpdater; |
| 6 | use MediaWiki\Installer\Hook\LoadExtensionSchemaUpdatesHook; |
| 7 | |
| 8 | /** |
| 9 | * Static entry points for hooks. |
| 10 | */ |
| 11 | class SchemaHookHandler implements LoadExtensionSchemaUpdatesHook { |
| 12 | |
| 13 | /** |
| 14 | * @param DatabaseUpdater $updater |
| 15 | */ |
| 16 | public function onLoadExtensionSchemaUpdates( $updater ) { |
| 17 | $baseDir = dirname( __DIR__ ) . '/sql/' . $updater->getDB()->getType(); |
| 18 | $updater->addExtensionUpdateOnVirtualDomain( |
| 19 | [ Utils::VIRTUAL_DOMAIN, 'addTable', 'reading_list', "$baseDir/tables-generated.sql", true ] |
| 20 | ); |
| 21 | $updater->addExtensionUpdateOnVirtualDomain( |
| 22 | [ Utils::VIRTUAL_DOMAIN, [ self::class, 'populateProjectsTable' ] ] |
| 23 | ); |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * Populates the projects table if necessary. |
| 28 | */ |
| 29 | public static function populateProjectsTable() { |
| 30 | $repository = Utils::makeMaintenanceRepository(); |
| 31 | $repository->initializeProjectIfNeeded(); |
| 32 | } |
| 33 | |
| 34 | } |