Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7478500
MysqlConnectForm.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
MysqlConnectForm.php
View Options
<?php
namespace
MediaWiki\Installer
;
use
MediaWiki\Html\Html
;
use
MediaWiki\Status\Status
;
/**
* @internal
*/
class
MysqlConnectForm
extends
DatabaseConnectForm
{
/**
* @return string
*/
public
function
getHtml
()
{
return
$this
->
getTextBox
(
'wgDBserver'
,
'config-db-host'
,
[],
$this
->
webInstaller
->
getHelpBox
(
'config-db-host-help'
)
)
.
$this
->
getCheckBox
(
'wgDBssl'
,
'config-db-ssl'
)
.
"<span class=
\"
cdx-card
\"
><span class=
\"
cdx-card__text
\"
>"
.
Html
::
element
(
'span'
,
[
'class'
=>
'cdx-card__text__title'
],
wfMessage
(
'config-db-wiki-settings'
)->
text
()
)
.
"<span class=
\"
cdx-card__text__description
\"
>"
.
$this
->
getTextBox
(
'wgDBname'
,
'config-db-name'
,
[
'dir'
=>
'ltr'
],
$this
->
webInstaller
->
getHelpBox
(
'config-db-name-help'
)
)
.
$this
->
getTextBox
(
'wgDBprefix'
,
'config-db-prefix'
,
[
'dir'
=>
'ltr'
],
$this
->
webInstaller
->
getHelpBox
(
'config-db-prefix-help'
)
)
.
"</span></span></span>"
.
$this
->
getInstallUserBox
();
}
public
function
submit
()
{
// Get variables from the request.
$newValues
=
$this
->
setVarsFromRequest
(
[
'wgDBserver'
,
'wgDBname'
,
'wgDBprefix'
,
'wgDBssl'
]
);
// Validate them.
$status
=
Status
::
newGood
();
if
(
!
strlen
(
$newValues
[
'wgDBserver'
]
)
)
{
$status
->
fatal
(
'config-missing-db-host'
);
}
if
(
!
strlen
(
$newValues
[
'wgDBname'
]
)
)
{
$status
->
fatal
(
'config-missing-db-name'
);
}
elseif
(
!
preg_match
(
'/^[a-z0-9+_-]+$/i'
,
$newValues
[
'wgDBname'
]
)
)
{
$status
->
fatal
(
'config-invalid-db-name'
,
$newValues
[
'wgDBname'
]
);
}
if
(
!
preg_match
(
'/^[a-z0-9_-]*$/i'
,
$newValues
[
'wgDBprefix'
]
)
)
{
$status
->
fatal
(
'config-invalid-db-prefix'
,
$newValues
[
'wgDBprefix'
]
);
}
if
(
!
$status
->
isOK
()
)
{
return
$status
;
}
// Submit user box
$status
=
$this
->
submitInstallUserBox
();
if
(
!
$status
->
isOK
()
)
{
return
$status
;
}
// Try to connect
$status
=
$this
->
dbInstaller
->
getConnection
(
DatabaseInstaller
::
CONN_CREATE_DATABASE
);
if
(
!
$status
->
isOK
()
)
{
return
$status
;
}
// Check version
return
MysqlInstaller
::
meetsMinimumRequirement
(
$status
->
getDB
()
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, Nov 23, 11:17 (4 d, 18 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
a2/46/7a3890b7e6fa82db38f62b97671f
Default Alt Text
MysqlConnectForm.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment