Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 19 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| UpdateTables | |
0.00% |
0 / 19 |
|
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
| onLoadExtensionSchemaUpdates | |
0.00% |
0 / 19 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Extension\OATHAuth\Hook; |
| 4 | |
| 5 | use MediaWiki\Extension\OATHAuth\Maintenance\MoveRecoveryCodesFromTOTP; |
| 6 | use MediaWiki\Extension\OATHAuth\Maintenance\PopulateUserHandles; |
| 7 | use MediaWiki\Extension\OATHAuth\Maintenance\UpdateForMultipleDevicesSupport; |
| 8 | use MediaWiki\Installer\Hook\LoadExtensionSchemaUpdatesHook; |
| 9 | |
| 10 | class UpdateTables implements LoadExtensionSchemaUpdatesHook { |
| 11 | |
| 12 | /** @inheritDoc */ |
| 13 | public function onLoadExtensionSchemaUpdates( $updater ) { |
| 14 | $type = $updater->getDB()->getType(); |
| 15 | $baseDir = dirname( __DIR__, 2 ); |
| 16 | $typePath = "$baseDir/sql/$type"; |
| 17 | |
| 18 | $updater->addExtensionUpdateOnVirtualDomain( |
| 19 | [ 'virtual-oathauth', 'addTable', 'oathauth_types', "$typePath/tables-generated.sql", true ] |
| 20 | ); |
| 21 | |
| 22 | // Ensure that the oathauth_users table is up-to-date if it exists, so that the migration |
| 23 | // from the old schema to the new one can be done properly. |
| 24 | if ( $updater->tableExists( 'oathauth_users' ) ) { |
| 25 | // 1.41 |
| 26 | $updater->addExtensionUpdateOnVirtualDomain( [ |
| 27 | 'virtual-oathauth', |
| 28 | 'runMaintenance', |
| 29 | UpdateForMultipleDevicesSupport::class, |
| 30 | ] ); |
| 31 | $updater->addExtensionUpdateOnVirtualDomain( [ 'virtual-oathauth', 'dropTable', 'oathauth_users' ] ); |
| 32 | } |
| 33 | |
| 34 | // 1.45 |
| 35 | $updater->addPostDatabaseUpdateMaintenance( MoveRecoveryCodesFromTOTP::class ); |
| 36 | |
| 37 | // 1.46 |
| 38 | $updater->addExtensionUpdateOnVirtualDomain( [ |
| 39 | 'virtual-oathauth', 'addTable', 'oathauth_user_handles', |
| 40 | "$typePath/patch-add-oathauth_user_handles.sql", true |
| 41 | ] ); |
| 42 | $updater->addPostDatabaseUpdateMaintenance( PopulateUserHandles::class ); |
| 43 | |
| 44 | // add new updates here |
| 45 | } |
| 46 | } |