Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F12420510
MappableSettings.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
MappableSettings.php
View Options
<?php
namespace
Nasqueron\SAAS\MediaWiki\Configuration
;
///
/// Temporary hack to get clean configuration.
///
/// Plan is to deploy the MediaWiki SaaS on a dedicated node.
///
/// Meanwhile, as we share the main Nasqueron MySQL database,
/// with a history of databases going back to 2001, we need
/// to map nicely named site key to actual databases names.
abstract
class
MappableSettings
{
abstract
static
public
function
getDatabaseMap
()
:
array
;
abstract
static
public
function
getMappedSettings
()
:
array
;
static
public
function
getSettings
()
:
array
{
$settings
=
[];
foreach
(
static
::
getMappedSettings
()
as
$setting
=>
$values
)
{
$settings
[
$setting
]
=
self
::
mapDatabases
(
$values
);
}
return
$settings
;
}
static
private
function
mapDatabases
(
$items
)
{
$setting
=
[];
foreach
(
$items
as
$key
=>
$value
)
{
$mappedKey
=
self
::
mapDatabase
(
$key
);
$setting
[
$mappedKey
]
=
$value
;
}
return
$setting
;
}
static
private
function
mapDatabase
(
$key
)
{
foreach
(
static
::
getDatabaseMap
()
as
$canonical
=>
$actual
)
{
if
(
$key
===
$canonical
)
{
return
$actual
;
}
}
return
$key
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Thu, Nov 6, 11:18 (1 d, 13 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3128514
Default Alt Text
MappableSettings.php (1 KB)
Attached To
Mode
rSAASMW SaaS MediaWiki
Attached
Detach File
Event Timeline
Log In to Comment