Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F1431505
PostgresCreateSchemaTask.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
PostgresCreateSchemaTask.php
View Options
<?php
namespace
MediaWiki\Installer\Task
;
use
MediaWiki\MainConfigNames
;
use
MediaWiki\Status\Status
;
use
Wikimedia\Rdbms\DatabasePostgres
;
use
Wikimedia\Rdbms\DBQueryError
;
/**
* Create the PostgreSQL schema
*
* @internal For use by the installer
*/
class
PostgresCreateSchemaTask
extends
Task
{
/** @inheritDoc */
public
function
getName
()
{
return
'schema'
;
}
/** @inheritDoc */
public
function
getDependencies
()
{
return
'user'
;
}
public
function
execute
():
Status
{
// Get a connection to the target database
$status
=
$this
->
getConnection
(
ITaskContext
::
CONN_CREATE_SCHEMA
);
if
(
!
$status
->
isOK
()
)
{
return
$status
;
}
$conn
=
$status
->
getDB
();
'@phan-var DatabasePostgres $conn'
;
/** @var DatabasePostgres $conn */
// Create the schema if necessary
$schema
=
$this
->
getConfigVar
(
MainConfigNames
::
DBmwschema
);
$safeschema
=
$conn
->
addIdentifierQuotes
(
$schema
);
$safeuser
=
$conn
->
addIdentifierQuotes
(
$this
->
getConfigVar
(
MainConfigNames
::
DBuser
)
);
if
(
!
$conn
->
schemaExists
(
$schema
)
)
{
try
{
$conn
->
query
(
"CREATE SCHEMA $safeschema AUTHORIZATION $safeuser"
,
__METHOD__
);
}
catch
(
DBQueryError
)
{
return
Status
::
newFatal
(
'config-install-pg-schema-failed'
,
$this
->
getOption
(
'InstallUser'
),
$schema
);
}
}
return
Status
::
newGood
();
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 16, 20:39 (1 d, 3 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
7c/49/b0a1172759fb83461bd597ff9677
Default Alt Text
PostgresCreateSchemaTask.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment