Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4106288
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
->
addExtensionUpdateOnVirtualDomain
(
[
'virtual-oathauth'
,
'runMaintenance'
,
UpdateForMultipleDevicesSupport
::
class
,
]
);
$updater
->
addExtensionUpdateOnVirtualDomain
(
[
'virtual-oathauth'
,
'dropTable'
,
'oathauth_users'
]
);
}
// add new updates here
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Aug 18, 19:25 (2 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
77/3b/0c4b23fa8e05222bfd6ffa9b2e6a
Default Alt Text
UpdateTables.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment