Go to the documentation of this file.
39 'wgDBWindowsAuthentication',
43 '_InstallUser' =>
'sa',
44 '_InstallWindowsAuthentication' =>
'sqlauth',
45 '_WebWindowsAuthentication' =>
'sqlauth',
79 if ( $this->
getVar(
'_InstallWindowsAuthentication' ) ==
'windowsauth' ) {
80 $displayStyle =
'display: none;';
82 $displayStyle =
'display: block;';
89 $this->parent->getHelpBox(
'config-db-host-help' )
93 $this->
getTextBox(
'wgDBname',
'config-db-name',
array(
'dir' =>
'ltr' ),
94 $this->parent->getHelpBox(
'config-db-name-help' ) ) .
95 $this->
getTextBox(
'wgDBmwschema',
'config-db-schema',
array(
'dir' =>
'ltr' ),
96 $this->parent->getHelpBox(
'config-db-schema-help' ) ) .
97 $this->
getTextBox(
'wgDBprefix',
'config-db-prefix',
array(
'dir' =>
'ltr' ),
98 $this->parent->getHelpBox(
'config-db-prefix-help' ) ) .
103 'var' =>
'_InstallWindowsAuthentication',
104 'label' =>
'config-mssql-auth',
105 'itemLabelPrefix' =>
'config-mssql-',
106 'values' =>
array(
'sqlauth',
'windowsauth' ),
107 'itemAttribs' =>
array(
109 'class' =>
'showHideRadio',
110 'rel' =>
'dbCredentialBox',
112 'windowsauth' =>
array(
113 'class' =>
'hideShowRadio',
114 'rel' =>
'dbCredentialBox',
117 'help' => $this->parent->getHelpBox(
'config-mssql-install-auth' )
122 'config-db-username',
123 array(
'dir' =>
'ltr' ),
124 $this->parent->getHelpBox(
'config-db-install-username' )
128 'config-db-password',
129 array(
'dir' =>
'ltr' ),
130 $this->parent->getHelpBox(
'config-db-install-password' )
142 if ( !strlen( $newValues[
'wgDBserver'] ) ) {
143 $status->fatal(
'config-missing-db-host' );
145 if ( !strlen( $newValues[
'wgDBname'] ) ) {
146 $status->fatal(
'config-missing-db-name' );
147 } elseif ( !preg_match(
'/^[a-z0-9_]+$/i', $newValues[
'wgDBname'] ) ) {
148 $status->fatal(
'config-invalid-db-name', $newValues[
'wgDBname'] );
150 if ( !preg_match(
'/^[a-z0-9_]*$/i', $newValues[
'wgDBmwschema'] ) ) {
151 $status->fatal(
'config-invalid-schema', $newValues[
'wgDBmwschema'] );
153 if ( !preg_match(
'/^[a-z0-9_]*$/i', $newValues[
'wgDBprefix'] ) ) {
154 $status->fatal(
'config-invalid-db-prefix', $newValues[
'wgDBprefix'] );
156 if ( !$status->isOK() ) {
161 if ( $newValues[
'wgDBmwschema'] ===
'' ) {
162 $this->
setVar(
'wgDBmwschema',
'dbo' );
170 if ( !$status->isOK() ) {
176 $conn = $status->value;
179 $version = $conn->getServerVersion();
180 if ( version_compare(
$version, $this->minimumVersion ) < 0 ) {
191 global $wgDBWindowsAuthentication;
196 if ( $this->
getVar(
'_InstallWindowsAuthentication' ) ==
'windowsauth' ) {
198 $wgDBWindowsAuthentication =
true;
200 $wgDBWindowsAuthentication =
false;
205 'host' => $this->
getVar(
'wgDBserver' ),
210 'tablePrefix' => $this->
getVar(
'wgDBprefix' ) ) );
211 $db->prepareStatements(
false );
212 $db->scrollableCursor(
false );
213 $status->value =
$db;
215 $status->fatal(
'config-connection-error',
$e->getMessage() );
222 global $wgDBuser, $wgDBpassword;
225 if ( !$status->isOK() ) {
226 $this->parent->showStatusError( $status );
233 $conn = $status->value;
234 $conn->selectDB( $this->
getVar(
'wgDBname' ) );
236 # Normal user and password are selected after this step, so for now
237 # just copy these two
238 $wgDBuser = $this->
getVar(
'_InstallUser' );
239 $wgDBpassword = $this->
getVar(
'_InstallPassword' );
249 if ( !$status->isOK() ) {
253 $conn = $status->value;
256 $res = $conn->query(
"SELECT permission_name FROM sys.fn_my_permissions( NULL, 'SERVER' )" );
257 $serverPrivs =
array(
258 'ALTER ANY LOGIN' =>
false,
259 'CONTROL SERVER' =>
false,
262 foreach (
$res as $row ) {
263 $serverPrivs[$row->permission_name] =
true;
266 if ( !$serverPrivs[
'ALTER ANY LOGIN'] ) {
277 'DELETE' =>
array(
'DELETE',
'CONTROL SERVER' ),
278 'EXECUTE' =>
array(
'EXECUTE',
'CONTROL SERVER' ),
279 'INSERT' =>
array(
'INSERT',
'CONTROL SERVER' ),
280 'SELECT' =>
array(
'SELECT',
'CONTROL SERVER' ),
281 'UPDATE' =>
array(
'UPDATE',
'CONTROL SERVER' ),
284 $grantOptions = array_flip( $this->webUserPrivs );
287 $schemaPrivs = $dbPrivs =
array(
295 $dbPrivs[
'ALTER ANY USER'] =
false;
298 $conn->selectDB( $this->
getVar(
'wgDBname' ) );
299 $res = $conn->query(
"SELECT permission_name FROM sys.fn_my_permissions( NULL, 'DATABASE' )" );
301 foreach (
$res as $row ) {
302 $dbPrivs[$row->permission_name] =
true;
306 if ( !$dbPrivs[
'ALTER ANY USER'] ) {
312 $res = $conn->query(
"SELECT permission_name FROM sys.fn_my_permissions( '{$this->getVar( 'wgDBmwschema' )}', 'SCHEMA' )" );
314 foreach (
$res as $row ) {
315 $schemaPrivs[$row->permission_name] =
true;
321 foreach ( $this->webUserPrivs
as $permission ) {
322 if ( ( isset( $schemaPrivs[$permission] ) && $schemaPrivs[$permission] )
323 || ( isset( $dbPrivs[$implied[$permission][0]] ) && $dbPrivs[$implied[$permission][0]] )
324 || ( isset( $serverPrivs[$implied[$permission][1]] ) && $serverPrivs[$implied[$permission][1]] ) ) {
326 unset( $grantOptions[$permission] );
330 if ( count( $grantOptions ) ) {
343 $noCreateMsg =
false;
345 $noCreateMsg =
'config-db-web-no-create-privs';
347 $wrapperStyle = $this->
getVar(
'_SameAccount' ) ?
'display: none' :
'';
348 $displayStyle = $this->
getVar(
'_WebWindowsAuthentication' ) ==
'windowsauth' ?
'display: none' :
'';
352 '_SameAccount',
'config-db-web-account-same',
353 array(
'class' =>
'hideShowRadio',
'rel' =>
'dbOtherAccount' )
357 'var' =>
'_WebWindowsAuthentication',
358 'label' =>
'config-mssql-auth',
359 'itemLabelPrefix' =>
'config-mssql-',
360 'values' =>
array(
'sqlauth',
'windowsauth' ),
361 'itemAttribs' =>
array(
363 'class' =>
'showHideRadio',
364 'rel' =>
'dbCredentialBox',
366 'windowsauth' =>
array(
367 'class' =>
'hideShowRadio',
368 'rel' =>
'dbCredentialBox',
371 'help' => $this->parent->getHelpBox(
'config-mssql-web-auth' )
374 $this->
getTextBox(
'wgDBuser',
'config-db-username' ) .
378 if ( $noCreateMsg ) {
379 $s .= $this->parent->getWarningBox(
wfMessage( $noCreateMsg )->plain() );
381 $s .= $this->
getCheckBox(
'_CreateDBAccount',
'config-db-web-create' );
394 array(
'wgDBuser',
'wgDBpassword',
'_SameAccount',
'_CreateDBAccount',
'_WebWindowsAuthentication' )
397 if ( $this->
getVar(
'_SameAccount' ) ) {
398 $this->
setVar(
'_WebWindowsAuthentication', $this->
getVar(
'_InstallWindowsAuthentication' ) );
399 $this->
setVar(
'wgDBuser', $this->
getVar(
'_InstallUser' ) );
400 $this->
setVar(
'wgDBpassword', $this->
getVar(
'_InstallPassword' ) );
403 if ( $this->
getVar(
'_WebWindowsAuthentication' ) ==
'windowsauth' ) {
404 $this->
setVar(
'wgDBuser',
'' );
405 $this->
setVar(
'wgDBpassword',
'' );
406 $this->
setVar(
'wgDBWindowsAuthentication',
true );
408 $this->
setVar(
'wgDBWindowsAuthentication',
false );
411 if ( $this->
getVar(
'_CreateDBAccount' ) && $this->
getVar(
'_WebWindowsAuthentication' ) ==
'sqlauth' && strval( $this->
getVar(
'wgDBpassword' ) ) ==
'' ) {
418 $this->
setVar(
'_CreateDBAccount',
false );
421 $create = $this->
getVar(
'_CreateDBAccount' );
429 if ( $this->
getVar(
'_WebWindowsAuthentication' ) ==
'windowsauth' ) {
430 $user =
'windowsauth';
436 'host' => $this->
getVar(
'wgDBserver' ),
441 'tablePrefix' => $this->
getVar(
'wgDBprefix' ),
442 'schema' => $this->
getVar(
'wgDBmwschema' ),
453 # Add our user callback to installSteps, right before the tables are created.
456 'callback' =>
array( $this,
'setupUser' ),
458 $this->parent->addInstallStep( $callback,
'tables' );
466 if ( !$status->isOK() ) {
470 $conn = $status->value;
471 $dbName = $this->
getVar(
'wgDBname' );
472 $schemaName = $this->
getVar(
'wgDBmwschema' );
474 $conn->query(
"CREATE DATABASE " . $conn->addIdentifierQuotes( $dbName ), __METHOD__ );
475 $conn->selectDB( $dbName );
477 $conn->query(
"CREATE SCHEMA " . $conn->addIdentifierQuotes( $schemaName ), __METHOD__ );
480 $conn->query(
"CREATE FULLTEXT CATALOG " . $conn->addIdentifierQuotes( $schemaName ), __METHOD__ );
492 $dbUser = $this->
getVar(
'wgDBuser' );
493 if ( $dbUser == $this->
getVar(
'_InstallUser' )
494 || ( $this->
getVar(
'_InstallWindowsAuthentication' ) ==
'windowsauth'
495 && $this->
getVar(
'_WebWindowsAuthentication' ) ==
'windowsauth' ) ) {
499 if ( !$status->isOK() ) {
504 $dbName = $this->
getVar(
'wgDBname' );
505 $this->db->selectDB( $dbName );
506 $server = $this->
getVar(
'wgDBserver' );
508 $schemaName = $this->
getVar(
'wgDBmwschema' );
510 if ( $this->
getVar(
'_WebWindowsAuthentication' ) ==
'windowsauth' ) {
511 $dbUser =
'windowsauth';
515 if ( $this->
getVar(
'_CreateDBAccount' ) ) {
518 $tryToCreate =
false;
521 $escUser = $this->db->addIdentifierQuotes( $dbUser );
522 $escDb = $this->db->addIdentifierQuotes( $dbName );
523 $escSchema = $this->db->addIdentifierQuotes( $schemaName );
524 $grantableNames =
array();
525 if ( $tryToCreate ) {
526 $escPass = $this->db->addQuotes(
$password );
531 $this->db->selectDB(
'master' );
532 $logintype = $this->
getVar(
'_WebWindowsAuthentication' ) ==
'windowsauth' ?
'FROM WINDOWS' :
"WITH PASSWORD = $escPass";
533 $this->db->query(
"CREATE LOGIN $escUser $logintype" );
534 $this->db->selectDB( $dbName );
535 $this->db->query(
"CREATE USER $escUser FOR LOGIN $escUser WITH DEFAULT_SCHEMA = $escSchema" );
537 $grantableNames[] = $dbUser;
539 $this->db->rollback();
540 $status->warning(
'config-install-user-create-failed', $dbUser, $dqe->
getText() );
545 $this->db->selectDB( $dbName );
546 $this->db->query(
"CREATE USER $escUser FOR LOGIN $escUser WITH DEFAULT_SCHEMA = $escSchema" );
548 $grantableNames[] = $dbUser;
550 $this->db->rollback();
551 $status->warning(
'config-install-user-create-failed', $dbUser, $dqe->
getText() );
554 $status->warning(
'config-install-user-alreadyexists', $dbUser );
555 $grantableNames[] = $dbUser;
560 $this->db->selectDB( $dbName );
561 foreach ( $grantableNames
as $name ) {
564 $fullPrivArr =
array(
565 'BACKUP DATABASE',
'BACKUP LOG',
'CREATE FUNCTION',
'CREATE PROCEDURE',
566 'CREATE TABLE',
'CREATE VIEW',
'CREATE FULLTEXT CATALOG',
'SHOWPLAN'
568 $fullPrivList = implode(
', ', $fullPrivArr );
570 $this->db->query(
"GRANT $fullPrivList ON DATABASE :: $escDb TO $escUser", __METHOD__ );
571 $this->db->query(
"GRANT CONTROL ON SCHEMA :: $escSchema TO $escUser", __METHOD__ );
576 $privList = implode(
', ', $this->webUserPrivs );
577 $this->db->rollback();
579 $this->db->query(
"GRANT $privList ON SCHEMA :: $escSchema TO $escUser", __METHOD__ );
582 $this->db->rollback();
583 $status->fatal(
'config-install-user-grant-failed', $dbUser, $dqe->
getText() );
589 $this->db->query(
"GRANT SHOWPLAN ON DATABASE :: $escDb TO $escUser", __METHOD__ );
599 $status = parent::createTables();
602 if ( $status->isOk() ) {
603 $searchindex = $this->db->tableName(
'searchindex' );
604 $schema = $this->db->addIdentifierQuotes( $this->
getVar(
'wgDBmwschema' ) );
606 $this->db->query(
"CREATE FULLTEXT INDEX ON $searchindex (si_title, si_text) KEY INDEX si_page ON $schema" );
608 $status->fatal(
'config-install-tables-failed', $dqe->
getText() );
621 $res = $this->db->selectField(
'sys.sql_logins', 1,
array(
'name' =>
$user ) );
632 $res = $this->db->selectField(
'sys.sysusers', 1,
array(
'name' =>
$user ) );
642 $res = $this->db->selectField(
'sys.databases', 1,
array(
'name' => $dbName ) );
653 $res = $this->db->selectField(
'sys.schemas', 1,
array(
'name' => $schemaName ) );
664 $res = $this->db->selectField(
'sys.fulltext_catalogs', 1,
array(
'name' => $catalogName ) );
675 'wgDBname' => $this->
getVar(
'wgDBname' ),
676 'wgDBmwschema' => $this->
getVar(
'wgDBmwschema' ),
677 'wgDBuser' => $this->
getVar(
'wgDBuser' ),
678 'wgDBpassword' => $this->
getVar(
'wgDBpassword' ),
685 $windowsauth = $this->
getVar(
'wgDBWindowsAuthentication' ) ?
'true' :
'false';
687 return "# MSSQL specific settings
688 \$wgDBWindowsAuthentication = {$windowsauth};
689 \$wgDBmwschema = \"{$schema}\";
690 \$wgDBprefix = \"{$prefix}\";";
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
submitConnectForm()
Set variables based on the request array, assuming it was submitted via the form returned by getConne...
loginExists( $user)
Try to see if the login exists.
static checkExtension( $name)
Convenience function.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
getConnection()
Connect to the database using the administrative user/password currently defined in the session.
getPasswordBox( $var, $label, $attribs=array(), $helpData="")
Get a labelled password box to configure a local variable.
static newGood( $value=null)
Factory function for good results.
getCheckBox( $var, $label, $attribs=array(), $helpData="")
Get a labelled checkbox to configure a local boolean variable.
createTables()
Create database tables from scratch.
getTextBox( $var, $label, $attribs=array(), $helpData="")
Get a labelled text box to configure a local variable.
getLocalSettings()
Get the DBMS-specific options for LocalSettings.php generation.
static closeElement( $element)
Returns "</$element>", except if $wgWellFormedXml is off, in which case it returns the empty string w...
static openElement( $element, $attribs=array())
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
static element( $element, $attribs=array(), $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
getSchemaVars()
Get variables to substitute into tables.sql and the SQL patch files.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing after in associative array form externallinks including delete and has completed for all link tables default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<
setupSchemaVars()
Set appropriate schema variables in the current database connection.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
static factory( $dbType, $p=array())
Given a DB type, construct the name of the appropriate child class of DatabaseBase.
getRadioSet( $params)
Get a set of labelled radio buttons.
catalogExists( $catalogName)
Try to see if a given fulltext catalog exists We assume we already have the appropriate database sele...
DatabaseBase $db
The database connection.
userExists( $user)
Try to see if the user account exists We assume we already have the appropriate database selected.
Allows to change the fields on the form that will be generated $name
getVar( $var, $default=null)
Get a variable, taking local defaults into account.
preInstall()
Allow DB installers a chance to make last-minute changes before installation occurs.
schemaExists( $schemaName)
Try to see if a given schema exists We assume we already have the appropriate database selected.
Base class for DBMS-specific installation helper classes.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
preUpgrade()
Allow DB installers a chance to make checks before upgrade.
databaseExists( $dbName)
Try to see if a given database exists.
return false to override stock group addition can be modified try getUserPermissionsErrors userCan checks are continued by internal code can override on output return false to not delete it return false to override the default password checks this Boolean value will be checked to determine if the password was valid return false to implement your own hashing method & $password
Class for setting up the MediaWiki database using Microsoft SQL Server.
canCreateAccounts()
Return true if the install user can create accounts.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
setVar( $name, $value)
Convenience alias for $this->parent->setVar()
setVarsFromRequest( $varNames)
Convenience function to set variables based on form data.
static escapePhpString( $string)
Returns the escaped version of a string of php code.
static newFatal( $message)
Factory function for fatal errors.