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 'schema' => $this->
getVar(
'wgDBmwschema' ),
211 'tablePrefix' => $this->
getVar(
'wgDBprefix' ) ) );
212 $db->prepareStatements(
false );
213 $db->scrollableCursor(
false );
214 $status->value =
$db;
216 $status->fatal(
'config-connection-error',
$e->getMessage() );
223 global $wgDBuser, $wgDBpassword;
226 if ( !$status->isOK() ) {
227 $this->parent->showStatusError( $status );
234 $conn = $status->value;
235 $conn->selectDB( $this->
getVar(
'wgDBname' ) );
237 # Normal user and password are selected after this step, so for now
238 # just copy these two
239 $wgDBuser = $this->
getVar(
'_InstallUser' );
240 $wgDBpassword = $this->
getVar(
'_InstallPassword' );
250 if ( !$status->isOK() ) {
254 $conn = $status->value;
257 $res = $conn->query(
"SELECT permission_name FROM sys.fn_my_permissions( NULL, 'SERVER' )" );
258 $serverPrivs =
array(
259 'ALTER ANY LOGIN' =>
false,
260 'CONTROL SERVER' =>
false,
263 foreach (
$res as $row ) {
264 $serverPrivs[$row->permission_name] =
true;
267 if ( !$serverPrivs[
'ALTER ANY LOGIN'] ) {
278 'DELETE' =>
array(
'DELETE',
'CONTROL SERVER' ),
279 'EXECUTE' =>
array(
'EXECUTE',
'CONTROL SERVER' ),
280 'INSERT' =>
array(
'INSERT',
'CONTROL SERVER' ),
281 'SELECT' =>
array(
'SELECT',
'CONTROL SERVER' ),
282 'UPDATE' =>
array(
'UPDATE',
'CONTROL SERVER' ),
285 $grantOptions = array_flip( $this->webUserPrivs );
288 $schemaPrivs = $dbPrivs =
array(
296 $dbPrivs[
'ALTER ANY USER'] =
false;
299 $conn->selectDB( $this->
getVar(
'wgDBname' ) );
300 $res = $conn->query(
"SELECT permission_name FROM sys.fn_my_permissions( NULL, 'DATABASE' )" );
302 foreach (
$res as $row ) {
303 $dbPrivs[$row->permission_name] =
true;
307 if ( !$dbPrivs[
'ALTER ANY USER'] ) {
313 $res = $conn->query(
"SELECT permission_name FROM sys.fn_my_permissions( '{$this->getVar( 'wgDBmwschema' )}', 'SCHEMA' )" );
315 foreach (
$res as $row ) {
316 $schemaPrivs[$row->permission_name] =
true;
322 foreach ( $this->webUserPrivs
as $permission ) {
323 if ( ( isset( $schemaPrivs[$permission] ) && $schemaPrivs[$permission] )
324 || ( isset( $dbPrivs[$implied[$permission][0]] ) && $dbPrivs[$implied[$permission][0]] )
325 || ( isset( $serverPrivs[$implied[$permission][1]] ) && $serverPrivs[$implied[$permission][1]] ) ) {
327 unset( $grantOptions[$permission] );
331 if ( count( $grantOptions ) ) {
344 $noCreateMsg =
false;
346 $noCreateMsg =
'config-db-web-no-create-privs';
348 $wrapperStyle = $this->
getVar(
'_SameAccount' ) ?
'display: none' :
'';
349 $displayStyle = $this->
getVar(
'_WebWindowsAuthentication' ) ==
'windowsauth' ?
'display: none' :
'';
353 '_SameAccount',
'config-db-web-account-same',
354 array(
'class' =>
'hideShowRadio',
'rel' =>
'dbOtherAccount' )
358 'var' =>
'_WebWindowsAuthentication',
359 'label' =>
'config-mssql-auth',
360 'itemLabelPrefix' =>
'config-mssql-',
361 'values' =>
array(
'sqlauth',
'windowsauth' ),
362 'itemAttribs' =>
array(
364 'class' =>
'showHideRadio',
365 'rel' =>
'dbCredentialBox',
367 'windowsauth' =>
array(
368 'class' =>
'hideShowRadio',
369 'rel' =>
'dbCredentialBox',
372 'help' => $this->parent->getHelpBox(
'config-mssql-web-auth' )
375 $this->
getTextBox(
'wgDBuser',
'config-db-username' ) .
379 if ( $noCreateMsg ) {
380 $s .= $this->parent->getWarningBox(
wfMessage( $noCreateMsg )->plain() );
382 $s .= $this->
getCheckBox(
'_CreateDBAccount',
'config-db-web-create' );
395 array(
'wgDBuser',
'wgDBpassword',
'_SameAccount',
'_CreateDBAccount',
'_WebWindowsAuthentication' )
398 if ( $this->
getVar(
'_SameAccount' ) ) {
399 $this->
setVar(
'_WebWindowsAuthentication', $this->
getVar(
'_InstallWindowsAuthentication' ) );
400 $this->
setVar(
'wgDBuser', $this->
getVar(
'_InstallUser' ) );
401 $this->
setVar(
'wgDBpassword', $this->
getVar(
'_InstallPassword' ) );
404 if ( $this->
getVar(
'_WebWindowsAuthentication' ) ==
'windowsauth' ) {
405 $this->
setVar(
'wgDBuser',
'' );
406 $this->
setVar(
'wgDBpassword',
'' );
407 $this->
setVar(
'wgDBWindowsAuthentication',
true );
409 $this->
setVar(
'wgDBWindowsAuthentication',
false );
412 if ( $this->
getVar(
'_CreateDBAccount' ) && $this->
getVar(
'_WebWindowsAuthentication' ) ==
'sqlauth' && strval( $this->
getVar(
'wgDBpassword' ) ) ==
'' ) {
419 $this->
setVar(
'_CreateDBAccount',
false );
422 $create = $this->
getVar(
'_CreateDBAccount' );
430 if ( $this->
getVar(
'_WebWindowsAuthentication' ) ==
'windowsauth' ) {
431 $user =
'windowsauth';
437 'host' => $this->
getVar(
'wgDBserver' ),
442 'tablePrefix' => $this->
getVar(
'wgDBprefix' ),
443 'schema' => $this->
getVar(
'wgDBmwschema' ),
454 # Add our user callback to installSteps, right before the tables are created.
457 'callback' =>
array( $this,
'setupUser' ),
459 $this->parent->addInstallStep( $callback,
'tables' );
467 if ( !$status->isOK() ) {
471 $conn = $status->value;
472 $dbName = $this->
getVar(
'wgDBname' );
473 $schemaName = $this->
getVar(
'wgDBmwschema' );
475 $conn->query(
"CREATE DATABASE " . $conn->addIdentifierQuotes( $dbName ), __METHOD__ );
476 $conn->selectDB( $dbName );
478 $conn->query(
"CREATE SCHEMA " . $conn->addIdentifierQuotes( $schemaName ), __METHOD__ );
481 $conn->query(
"CREATE FULLTEXT CATALOG " . $conn->addIdentifierQuotes( $schemaName ), __METHOD__ );
493 $dbUser = $this->
getVar(
'wgDBuser' );
494 if ( $dbUser == $this->
getVar(
'_InstallUser' )
495 || ( $this->
getVar(
'_InstallWindowsAuthentication' ) ==
'windowsauth'
496 && $this->
getVar(
'_WebWindowsAuthentication' ) ==
'windowsauth' ) ) {
500 if ( !$status->isOK() ) {
505 $dbName = $this->
getVar(
'wgDBname' );
506 $this->db->selectDB( $dbName );
507 $server = $this->
getVar(
'wgDBserver' );
509 $schemaName = $this->
getVar(
'wgDBmwschema' );
511 if ( $this->
getVar(
'_WebWindowsAuthentication' ) ==
'windowsauth' ) {
512 $dbUser =
'windowsauth';
516 if ( $this->
getVar(
'_CreateDBAccount' ) ) {
519 $tryToCreate =
false;
522 $escUser = $this->db->addIdentifierQuotes( $dbUser );
523 $escDb = $this->db->addIdentifierQuotes( $dbName );
524 $escSchema = $this->db->addIdentifierQuotes( $schemaName );
525 $grantableNames =
array();
526 if ( $tryToCreate ) {
527 $escPass = $this->db->addQuotes(
$password );
532 $this->db->selectDB(
'master' );
533 $logintype = $this->
getVar(
'_WebWindowsAuthentication' ) ==
'windowsauth' ?
'FROM WINDOWS' :
"WITH PASSWORD = $escPass";
534 $this->db->query(
"CREATE LOGIN $escUser $logintype" );
535 $this->db->selectDB( $dbName );
536 $this->db->query(
"CREATE USER $escUser FOR LOGIN $escUser WITH DEFAULT_SCHEMA = $escSchema" );
538 $grantableNames[] = $dbUser;
540 $this->db->rollback();
541 $status->warning(
'config-install-user-create-failed', $dbUser, $dqe->
getText() );
546 $this->db->selectDB( $dbName );
547 $this->db->query(
"CREATE USER $escUser FOR LOGIN $escUser WITH DEFAULT_SCHEMA = $escSchema" );
549 $grantableNames[] = $dbUser;
551 $this->db->rollback();
552 $status->warning(
'config-install-user-create-failed', $dbUser, $dqe->
getText() );
555 $status->warning(
'config-install-user-alreadyexists', $dbUser );
556 $grantableNames[] = $dbUser;
561 $this->db->selectDB( $dbName );
562 foreach ( $grantableNames
as $name ) {
565 $fullPrivArr =
array(
566 'BACKUP DATABASE',
'BACKUP LOG',
'CREATE FUNCTION',
'CREATE PROCEDURE',
567 'CREATE TABLE',
'CREATE VIEW',
'CREATE FULLTEXT CATALOG',
'SHOWPLAN'
569 $fullPrivList = implode(
', ', $fullPrivArr );
571 $this->db->query(
"GRANT $fullPrivList ON DATABASE :: $escDb TO $escUser", __METHOD__ );
572 $this->db->query(
"GRANT CONTROL ON SCHEMA :: $escSchema TO $escUser", __METHOD__ );
577 $privList = implode(
', ', $this->webUserPrivs );
578 $this->db->rollback();
580 $this->db->query(
"GRANT $privList ON SCHEMA :: $escSchema TO $escUser", __METHOD__ );
583 $this->db->rollback();
584 $status->fatal(
'config-install-user-grant-failed', $dbUser, $dqe->
getText() );
590 $this->db->query(
"GRANT SHOWPLAN ON DATABASE :: $escDb TO $escUser", __METHOD__ );
600 $status = parent::createTables();
603 if ( $status->isOk() ) {
604 $searchindex = $this->db->tableName(
'searchindex' );
605 $schema = $this->db->addIdentifierQuotes( $this->
getVar(
'wgDBmwschema' ) );
607 $this->db->query(
"CREATE FULLTEXT INDEX ON $searchindex (si_title, si_text) KEY INDEX si_page ON $schema" );
609 $status->fatal(
'config-install-tables-failed', $dqe->
getText() );
619 return array_merge( parent::getGlobalDefaults(),
array(
620 'wgDBmwschema' =>
'mediawiki',
630 $res = $this->db->selectField(
'sys.sql_logins', 1,
array(
'name' =>
$user ) );
641 $res = $this->db->selectField(
'sys.sysusers', 1,
array(
'name' =>
$user ) );
651 $res = $this->db->selectField(
'sys.databases', 1,
array(
'name' => $dbName ) );
662 $res = $this->db->selectField(
'sys.schemas', 1,
array(
'name' => $schemaName ) );
673 $res = $this->db->selectField(
'sys.fulltext_catalogs', 1,
array(
'name' => $catalogName ) );
684 'wgDBname' => $this->
getVar(
'wgDBname' ),
685 'wgDBmwschema' => $this->
getVar(
'wgDBmwschema' ),
686 'wgDBuser' => $this->
getVar(
'wgDBuser' ),
687 'wgDBpassword' => $this->
getVar(
'wgDBpassword' ),
694 $windowsauth = $this->
getVar(
'wgDBWindowsAuthentication' ) ?
'true' :
'false';
696 return "# MSSQL specific settings
697 \$wgDBWindowsAuthentication = {$windowsauth};
698 \$wgDBmwschema = \"{$schema}\";
699 \$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>".
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.
getGlobalDefaults()
Get a name=>value map of MW configuration globals for the default values.
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e
static newFatal( $message)
Factory function for fatal errors.