Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4137119
UpdateTables.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
UpdateTables.php
View Options
<?php
namespace
MediaWiki\Extension\OATHAuth\Hook
;
use
MediaWiki\Extension\OATHAuth\Maintenance\UpdateForMultipleDevicesSupport
;
use
MediaWiki\Extension\OATHAuth\Maintenance\UpdateTOTPScratchTokensToArray
;
use
MediaWiki\Installer\DatabaseUpdater
;
use
MediaWiki\Installer\Hook\LoadExtensionSchemaUpdatesHook
;
class
UpdateTables
implements
LoadExtensionSchemaUpdatesHook
{
/**
* @param DatabaseUpdater $updater
*/
public
function
onLoadExtensionSchemaUpdates
(
$updater
)
{
$type
=
$updater
->
getDB
()->
getType
();
$baseDir
=
dirname
(
__DIR__
,
2
);
$typePath
=
"$baseDir/sql/$type"
;
$updater
->
addExtensionUpdateOnVirtualDomain
(
[
'virtual-oathauth'
,
'addTable'
,
'oathauth_types'
,
"$typePath/tables-generated.sql"
,
true
]
);
// Ensure that the oathauth_users table is up-to-date if it exists, so that the migration
// from the old schema to the new one can be done properly.
if
(
$updater
->
tableExists
(
'oathauth_users'
)
)
{
switch
(
$type
)
{
case
'mysql'
:
case
'sqlite'
:
// 1.36
$updater
->
addExtensionUpdate
(
[
'runMaintenance'
,
UpdateTOTPScratchTokensToArray
::
class
,
]
);
break
;
case
'postgres'
:
// 1.38
$updater
->
addExtensionUpdateOnVirtualDomain
(
[
'virtual-oathauth'
,
'modifyTable'
,
'oathauth_users'
,
"$typePath/patch-oathauth_users-drop-oathauth_users_id_seq.sql"
,
true
]
);
break
;
}
// 1.41
$updater
->
addExtensionUpdate
(
[
'runMaintenance'
,
UpdateForMultipleDevicesSupport
::
class
,
]
);
$updater
->
addExtensionUpdateOnVirtualDomain
(
[
'virtual-oathauth'
,
'dropTable'
,
'oathauth_users'
]
);
}
// add new updates here
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, Aug 19, 14:00 (3 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
34/ce/186f3c11d20d28662fccbf28f57c
Default Alt Text
UpdateTables.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment