MediaWiki  1.27.2
MysqlInstaller.php
Go to the documentation of this file.
1 <?php
31 
32  protected $globalNames = [
33  'wgDBserver',
34  'wgDBname',
35  'wgDBuser',
36  'wgDBpassword',
37  'wgDBprefix',
38  'wgDBTableOptions',
39  'wgDBmysql5',
40  ];
41 
42  protected $internalDefaults = [
43  '_MysqlEngine' => 'InnoDB',
44  '_MysqlCharset' => 'binary',
45  '_InstallUser' => 'root',
46  ];
47 
48  public $supportedEngines = [ 'InnoDB', 'MyISAM' ];
49 
50  public $minimumVersion = '5.0.3';
51 
52  public $webUserPrivs = [
53  'DELETE',
54  'INSERT',
55  'SELECT',
56  'UPDATE',
57  'CREATE TEMPORARY TABLES',
58  ];
59 
63  public function getName() {
64  return 'mysql';
65  }
66 
70  public function isCompiled() {
71  return self::checkExtension( 'mysql' ) || self::checkExtension( 'mysqli' );
72  }
73 
77  public function getConnectForm() {
78  return $this->getTextBox(
79  'wgDBserver',
80  'config-db-host',
81  [],
82  $this->parent->getHelpBox( 'config-db-host-help' )
83  ) .
84  Html::openElement( 'fieldset' ) .
85  Html::element( 'legend', [], wfMessage( 'config-db-wiki-settings' )->text() ) .
86  $this->getTextBox( 'wgDBname', 'config-db-name', [ 'dir' => 'ltr' ],
87  $this->parent->getHelpBox( 'config-db-name-help' ) ) .
88  $this->getTextBox( 'wgDBprefix', 'config-db-prefix', [ 'dir' => 'ltr' ],
89  $this->parent->getHelpBox( 'config-db-prefix-help' ) ) .
90  Html::closeElement( 'fieldset' ) .
91  $this->getInstallUserBox();
92  }
93 
94  public function submitConnectForm() {
95  // Get variables from the request.
96  $newValues = $this->setVarsFromRequest( [ 'wgDBserver', 'wgDBname', 'wgDBprefix' ] );
97 
98  // Validate them.
100  if ( !strlen( $newValues['wgDBserver'] ) ) {
101  $status->fatal( 'config-missing-db-host' );
102  }
103  if ( !strlen( $newValues['wgDBname'] ) ) {
104  $status->fatal( 'config-missing-db-name' );
105  } elseif ( !preg_match( '/^[a-z0-9+_-]+$/i', $newValues['wgDBname'] ) ) {
106  $status->fatal( 'config-invalid-db-name', $newValues['wgDBname'] );
107  }
108  if ( !preg_match( '/^[a-z0-9_-]*$/i', $newValues['wgDBprefix'] ) ) {
109  $status->fatal( 'config-invalid-db-prefix', $newValues['wgDBprefix'] );
110  }
111  if ( !$status->isOK() ) {
112  return $status;
113  }
114 
115  // Submit user box
116  $status = $this->submitInstallUserBox();
117  if ( !$status->isOK() ) {
118  return $status;
119  }
120 
121  // Try to connect
122  $status = $this->getConnection();
123  if ( !$status->isOK() ) {
124  return $status;
125  }
129  $conn = $status->value;
130 
131  // Check version
132  $version = $conn->getServerVersion();
133  if ( version_compare( $version, $this->minimumVersion ) < 0 ) {
134  return Status::newFatal( 'config-mysql-old', $this->minimumVersion, $version );
135  }
136 
137  return $status;
138  }
139 
143  public function openConnection() {
145  try {
146  $db = DatabaseBase::factory( 'mysql', [
147  'host' => $this->getVar( 'wgDBserver' ),
148  'user' => $this->getVar( '_InstallUser' ),
149  'password' => $this->getVar( '_InstallPassword' ),
150  'dbname' => false,
151  'flags' => 0,
152  'tablePrefix' => $this->getVar( 'wgDBprefix' ) ] );
153  $status->value = $db;
154  } catch ( DBConnectionError $e ) {
155  $status->fatal( 'config-connection-error', $e->getMessage() );
156  }
157 
158  return $status;
159  }
160 
161  public function preUpgrade() {
163 
164  $status = $this->getConnection();
165  if ( !$status->isOK() ) {
166  $this->parent->showStatusError( $status );
167 
168  return;
169  }
173  $conn = $status->value;
174  $conn->selectDB( $this->getVar( 'wgDBname' ) );
175 
176  # Determine existing default character set
177  if ( $conn->tableExists( "revision", __METHOD__ ) ) {
178  $revision = $conn->buildLike( $this->getVar( 'wgDBprefix' ) . 'revision' );
179  $res = $conn->query( "SHOW TABLE STATUS $revision", __METHOD__ );
180  $row = $conn->fetchObject( $res );
181  if ( !$row ) {
182  $this->parent->showMessage( 'config-show-table-status' );
183  $existingSchema = false;
184  $existingEngine = false;
185  } else {
186  if ( preg_match( '/^latin1/', $row->Collation ) ) {
187  $existingSchema = 'latin1';
188  } elseif ( preg_match( '/^utf8/', $row->Collation ) ) {
189  $existingSchema = 'utf8';
190  } elseif ( preg_match( '/^binary/', $row->Collation ) ) {
191  $existingSchema = 'binary';
192  } else {
193  $existingSchema = false;
194  $this->parent->showMessage( 'config-unknown-collation' );
195  }
196  if ( isset( $row->Engine ) ) {
197  $existingEngine = $row->Engine;
198  } else {
199  $existingEngine = $row->Type;
200  }
201  }
202  } else {
203  $existingSchema = false;
204  $existingEngine = false;
205  }
206 
207  if ( $existingSchema && $existingSchema != $this->getVar( '_MysqlCharset' ) ) {
208  $this->setVar( '_MysqlCharset', $existingSchema );
209  }
210  if ( $existingEngine && $existingEngine != $this->getVar( '_MysqlEngine' ) ) {
211  $this->setVar( '_MysqlEngine', $existingEngine );
212  }
213 
214  # Normal user and password are selected after this step, so for now
215  # just copy these two
216  $wgDBuser = $this->getVar( '_InstallUser' );
217  $wgDBpassword = $this->getVar( '_InstallPassword' );
218  }
219 
225  public function getEngines() {
226  $status = $this->getConnection();
227 
231  $conn = $status->value;
232 
233  $engines = [];
234  $res = $conn->query( 'SHOW ENGINES', __METHOD__ );
235  foreach ( $res as $row ) {
236  if ( $row->Support == 'YES' || $row->Support == 'DEFAULT' ) {
237  $engines[] = $row->Engine;
238  }
239  }
240  $engines = array_intersect( $this->supportedEngines, $engines );
241 
242  return $engines;
243  }
244 
250  public function getCharsets() {
251  return [ 'binary', 'utf8' ];
252  }
253 
259  public function canCreateAccounts() {
260  $status = $this->getConnection();
261  if ( !$status->isOK() ) {
262  return false;
263  }
265  $conn = $status->value;
266 
267  // Get current account name
268  $currentName = $conn->selectField( '', 'CURRENT_USER()', '', __METHOD__ );
269  $parts = explode( '@', $currentName );
270  if ( count( $parts ) != 2 ) {
271  return false;
272  }
273  $quotedUser = $conn->addQuotes( $parts[0] ) .
274  '@' . $conn->addQuotes( $parts[1] );
275 
276  // The user needs to have INSERT on mysql.* to be able to CREATE USER
277  // The grantee will be double-quoted in this query, as required
278  $res = $conn->select( 'INFORMATION_SCHEMA.USER_PRIVILEGES', '*',
279  [ 'GRANTEE' => $quotedUser ], __METHOD__ );
280  $insertMysql = false;
281  $grantOptions = array_flip( $this->webUserPrivs );
282  foreach ( $res as $row ) {
283  if ( $row->PRIVILEGE_TYPE == 'INSERT' ) {
284  $insertMysql = true;
285  }
286  if ( $row->IS_GRANTABLE ) {
287  unset( $grantOptions[$row->PRIVILEGE_TYPE] );
288  }
289  }
290 
291  // Check for DB-specific privs for mysql.*
292  if ( !$insertMysql ) {
293  $row = $conn->selectRow( 'INFORMATION_SCHEMA.SCHEMA_PRIVILEGES', '*',
294  [
295  'GRANTEE' => $quotedUser,
296  'TABLE_SCHEMA' => 'mysql',
297  'PRIVILEGE_TYPE' => 'INSERT',
298  ], __METHOD__ );
299  if ( $row ) {
300  $insertMysql = true;
301  }
302  }
303 
304  if ( !$insertMysql ) {
305  return false;
306  }
307 
308  // Check for DB-level grant options
309  $res = $conn->select( 'INFORMATION_SCHEMA.SCHEMA_PRIVILEGES', '*',
310  [
311  'GRANTEE' => $quotedUser,
312  'IS_GRANTABLE' => 1,
313  ], __METHOD__ );
314  foreach ( $res as $row ) {
315  $regex = $conn->likeToRegex( $row->TABLE_SCHEMA );
316  if ( preg_match( $regex, $this->getVar( 'wgDBname' ) ) ) {
317  unset( $grantOptions[$row->PRIVILEGE_TYPE] );
318  }
319  }
320  if ( count( $grantOptions ) ) {
321  // Can't grant everything
322  return false;
323  }
324 
325  return true;
326  }
327 
331  public function getSettingsForm() {
332  if ( $this->canCreateAccounts() ) {
333  $noCreateMsg = false;
334  } else {
335  $noCreateMsg = 'config-db-web-no-create-privs';
336  }
337  $s = $this->getWebUserBox( $noCreateMsg );
338 
339  // Do engine selector
340  $engines = $this->getEngines();
341  // If the current default engine is not supported, use an engine that is
342  if ( !in_array( $this->getVar( '_MysqlEngine' ), $engines ) ) {
343  $this->setVar( '_MysqlEngine', reset( $engines ) );
344  }
345 
346  $s .= Xml::openElement( 'div', [
347  'id' => 'dbMyisamWarning'
348  ] );
349  $myisamWarning = 'config-mysql-myisam-dep';
350  if ( count( $engines ) === 1 ) {
351  $myisamWarning = 'config-mysql-only-myisam-dep';
352  }
353  $s .= $this->parent->getWarningBox( wfMessage( $myisamWarning )->text() );
354  $s .= Xml::closeElement( 'div' );
355 
356  if ( $this->getVar( '_MysqlEngine' ) != 'MyISAM' ) {
357  $s .= Xml::openElement( 'script' );
358  $s .= '$(\'#dbMyisamWarning\').hide();';
359  $s .= Xml::closeElement( 'script' );
360  }
361 
362  if ( count( $engines ) >= 2 ) {
363  // getRadioSet() builds a set of labeled radio buttons.
364  // For grep: The following messages are used as the item labels:
365  // config-mysql-innodb, config-mysql-myisam
366  $s .= $this->getRadioSet( [
367  'var' => '_MysqlEngine',
368  'label' => 'config-mysql-engine',
369  'itemLabelPrefix' => 'config-mysql-',
370  'values' => $engines,
371  'itemAttribs' => [
372  'MyISAM' => [
373  'class' => 'showHideRadio',
374  'rel' => 'dbMyisamWarning'
375  ],
376  'InnoDB' => [
377  'class' => 'hideShowRadio',
378  'rel' => 'dbMyisamWarning'
379  ]
380  ]
381  ] );
382  $s .= $this->parent->getHelpBox( 'config-mysql-engine-help' );
383  }
384 
385  // If the current default charset is not supported, use a charset that is
386  $charsets = $this->getCharsets();
387  if ( !in_array( $this->getVar( '_MysqlCharset' ), $charsets ) ) {
388  $this->setVar( '_MysqlCharset', reset( $charsets ) );
389  }
390 
391  // Do charset selector
392  if ( count( $charsets ) >= 2 ) {
393  // getRadioSet() builds a set of labeled radio buttons.
394  // For grep: The following messages are used as the item labels:
395  // config-mysql-binary, config-mysql-utf8
396  $s .= $this->getRadioSet( [
397  'var' => '_MysqlCharset',
398  'label' => 'config-mysql-charset',
399  'itemLabelPrefix' => 'config-mysql-',
400  'values' => $charsets
401  ] );
402  $s .= $this->parent->getHelpBox( 'config-mysql-charset-help' );
403  }
404 
405  return $s;
406  }
407 
411  public function submitSettingsForm() {
412  $this->setVarsFromRequest( [ '_MysqlEngine', '_MysqlCharset' ] );
413  $status = $this->submitWebUserBox();
414  if ( !$status->isOK() ) {
415  return $status;
416  }
417 
418  // Validate the create checkbox
419  $canCreate = $this->canCreateAccounts();
420  if ( !$canCreate ) {
421  $this->setVar( '_CreateDBAccount', false );
422  $create = false;
423  } else {
424  $create = $this->getVar( '_CreateDBAccount' );
425  }
426 
427  if ( !$create ) {
428  // Test the web account
429  try {
430  DatabaseBase::factory( 'mysql', [
431  'host' => $this->getVar( 'wgDBserver' ),
432  'user' => $this->getVar( 'wgDBuser' ),
433  'password' => $this->getVar( 'wgDBpassword' ),
434  'dbname' => false,
435  'flags' => 0,
436  'tablePrefix' => $this->getVar( 'wgDBprefix' )
437  ] );
438  } catch ( DBConnectionError $e ) {
439  return Status::newFatal( 'config-connection-error', $e->getMessage() );
440  }
441  }
442 
443  // Validate engines and charsets
444  // This is done pre-submit already so it's just for security
445  $engines = $this->getEngines();
446  if ( !in_array( $this->getVar( '_MysqlEngine' ), $engines ) ) {
447  $this->setVar( '_MysqlEngine', reset( $engines ) );
448  }
449  $charsets = $this->getCharsets();
450  if ( !in_array( $this->getVar( '_MysqlCharset' ), $charsets ) ) {
451  $this->setVar( '_MysqlCharset', reset( $charsets ) );
452  }
453 
454  return Status::newGood();
455  }
456 
457  public function preInstall() {
458  # Add our user callback to installSteps, right before the tables are created.
459  $callback = [
460  'name' => 'user',
461  'callback' => [ $this, 'setupUser' ],
462  ];
463  $this->parent->addInstallStep( $callback, 'tables' );
464  }
465 
469  public function setupDatabase() {
470  $status = $this->getConnection();
471  if ( !$status->isOK() ) {
472  return $status;
473  }
475  $conn = $status->value;
476  $dbName = $this->getVar( 'wgDBname' );
477  if ( !$conn->selectDB( $dbName ) ) {
478  $conn->query(
479  "CREATE DATABASE " . $conn->addIdentifierQuotes( $dbName ) . "CHARACTER SET utf8",
480  __METHOD__
481  );
482  $conn->selectDB( $dbName );
483  }
484  $this->setupSchemaVars();
485 
486  return $status;
487  }
488 
492  public function setupUser() {
493  $dbUser = $this->getVar( 'wgDBuser' );
494  if ( $dbUser == $this->getVar( '_InstallUser' ) ) {
495  return Status::newGood();
496  }
497  $status = $this->getConnection();
498  if ( !$status->isOK() ) {
499  return $status;
500  }
501 
502  $this->setupSchemaVars();
503  $dbName = $this->getVar( 'wgDBname' );
504  $this->db->selectDB( $dbName );
505  $server = $this->getVar( 'wgDBserver' );
506  $password = $this->getVar( 'wgDBpassword' );
507  $grantableNames = [];
508 
509  if ( $this->getVar( '_CreateDBAccount' ) ) {
510  // Before we blindly try to create a user that already has access,
511  try { // first attempt to connect to the database
512  DatabaseBase::factory( 'mysql', [
513  'host' => $server,
514  'user' => $dbUser,
515  'password' => $password,
516  'dbname' => false,
517  'flags' => 0,
518  'tablePrefix' => $this->getVar( 'wgDBprefix' )
519  ] );
520  $grantableNames[] = $this->buildFullUserName( $dbUser, $server );
521  $tryToCreate = false;
522  } catch ( DBConnectionError $e ) {
523  $tryToCreate = true;
524  }
525  } else {
526  $grantableNames[] = $this->buildFullUserName( $dbUser, $server );
527  $tryToCreate = false;
528  }
529 
530  if ( $tryToCreate ) {
531  $createHostList = [
532  $server,
533  'localhost',
534  'localhost.localdomain',
535  '%'
536  ];
537 
538  $createHostList = array_unique( $createHostList );
539  $escPass = $this->db->addQuotes( $password );
540 
541  foreach ( $createHostList as $host ) {
542  $fullName = $this->buildFullUserName( $dbUser, $host );
543  if ( !$this->userDefinitelyExists( $host, $dbUser ) ) {
544  try {
545  $this->db->begin( __METHOD__ );
546  $this->db->query( "CREATE USER $fullName IDENTIFIED BY $escPass", __METHOD__ );
547  $this->db->commit( __METHOD__ );
548  $grantableNames[] = $fullName;
549  } catch ( DBQueryError $dqe ) {
550  if ( $this->db->lastErrno() == 1396 /* ER_CANNOT_USER */ ) {
551  // User (probably) already exists
552  $this->db->rollback( __METHOD__ );
553  $status->warning( 'config-install-user-alreadyexists', $dbUser );
554  $grantableNames[] = $fullName;
555  break;
556  } else {
557  // If we couldn't create for some bizzare reason and the
558  // user probably doesn't exist, skip the grant
559  $this->db->rollback( __METHOD__ );
560  $status->warning( 'config-install-user-create-failed', $dbUser, $dqe->getText() );
561  }
562  }
563  } else {
564  $status->warning( 'config-install-user-alreadyexists', $dbUser );
565  $grantableNames[] = $fullName;
566  break;
567  }
568  }
569  }
570 
571  // Try to grant to all the users we know exist or we were able to create
572  $dbAllTables = $this->db->addIdentifierQuotes( $dbName ) . '.*';
573  foreach ( $grantableNames as $name ) {
574  try {
575  $this->db->begin( __METHOD__ );
576  $this->db->query( "GRANT ALL PRIVILEGES ON $dbAllTables TO $name", __METHOD__ );
577  $this->db->commit( __METHOD__ );
578  } catch ( DBQueryError $dqe ) {
579  $this->db->rollback( __METHOD__ );
580  $status->fatal( 'config-install-user-grant-failed', $dbUser, $dqe->getText() );
581  }
582  }
583 
584  return $status;
585  }
586 
593  private function buildFullUserName( $name, $host ) {
594  return $this->db->addQuotes( $name ) . '@' . $this->db->addQuotes( $host );
595  }
596 
604  private function userDefinitelyExists( $host, $user ) {
605  try {
606  $res = $this->db->selectRow( 'mysql.user', [ 'Host', 'User' ],
607  [ 'Host' => $host, 'User' => $user ], __METHOD__ );
608 
609  return (bool)$res;
610  } catch ( DBQueryError $dqe ) {
611  return false;
612  }
613  }
614 
621  protected function getTableOptions() {
622  $options = [];
623  if ( $this->getVar( '_MysqlEngine' ) !== null ) {
624  $options[] = "ENGINE=" . $this->getVar( '_MysqlEngine' );
625  }
626  if ( $this->getVar( '_MysqlCharset' ) !== null ) {
627  $options[] = 'DEFAULT CHARSET=' . $this->getVar( '_MysqlCharset' );
628  }
629 
630  return implode( ', ', $options );
631  }
632 
638  public function getSchemaVars() {
639  return [
640  'wgDBTableOptions' => $this->getTableOptions(),
641  'wgDBname' => $this->getVar( 'wgDBname' ),
642  'wgDBuser' => $this->getVar( 'wgDBuser' ),
643  'wgDBpassword' => $this->getVar( 'wgDBpassword' ),
644  ];
645  }
646 
647  public function getLocalSettings() {
648  $dbmysql5 = wfBoolToStr( $this->getVar( 'wgDBmysql5', true ) );
649  $prefix = LocalSettingsGenerator::escapePhpString( $this->getVar( 'wgDBprefix' ) );
651 
652  return "# MySQL specific settings
653 \$wgDBprefix = \"{$prefix}\";
654 
655 # MySQL table options to use during installation or update
656 \$wgDBTableOptions = \"{$tblOpts}\";
657 
658 # Experimental charset support for MySQL 5.0.
659 \$wgDBmysql5 = {$dbmysql5};";
660  }
661 }
static closeElement($element)
Returns "".
Definition: Html.php:306
getSchemaVars()
Get variables to substitute into tables.sql and the SQL patch files.
Class for setting up the MediaWiki database using MySQL.
userDefinitelyExists($host, $user)
Try to see if the user account exists.
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException'returning false will NOT prevent logging $e
Definition: hooks.txt:1932
$wgDBpassword
Database user's password.
static escapePhpString($string)
Returns the escaped version of a string of php code.
$wgDBuser
Database username.
getVar($var, $default=null)
Get a variable, taking local defaults into account.
when a variable name is used in a it is silently declared as a new local masking the global
Definition: design.txt:93
wfBoolToStr($value)
Convenience function converts boolean values into "true" or "false" (string) values.
static newFatal($message)
Factory function for fatal errors.
Definition: Status.php:89
getCharsets()
Get a list of character sets that are available and supported.
getConnection()
Connect to the database using the administrative user/password currently defined in the session...
$fullName
static closeElement($element)
Shortcut to close an XML element.
Definition: Xml.php:118
static openElement($element, $attribs=[])
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
Definition: Html.php:248
submitWebUserBox()
Submit the form from getWebUserBox().
setupSchemaVars()
Set appropriate schema variables in the current database connection.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context $options
Definition: hooks.txt:1004
$res
Definition: database.txt:21
static openElement($element, $attribs=null)
This opens an XML element.
Definition: Xml.php:109
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 whether this was an auto creation 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 unsetoffset-wrap String Wrap the message in html(usually something like"&lt
DatabaseBase $db
The database connection.
getWebUserBox($noCreateMsg=false)
Get a standard web-user fieldset.
static factory($dbType, $p=[])
Given a DB type, construct the name of the appropriate child class of DatabaseBase.
Definition: Database.php:580
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
Definition: design.txt:12
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
Definition: distributors.txt:9
submitInstallUserBox()
Submit a standard install user fieldset.
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 local account $user
Definition: hooks.txt:242
setVarsFromRequest($varNames)
Convenience function to set variables based on form data.
getInstallUserBox()
Get a standard install-user fieldset.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
buildFullUserName($name, $host)
Return a formal 'User'@'Host' username for use in queries.
canCreateAccounts()
Return true if the install user can create accounts.
getTextBox($var, $label, $attribs=[], $helpData="")
Get a labelled text box to configure a local variable.
Base class for DBMS-specific installation helper classes.
getEngines()
Get a list of storage engines that are available and supported.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set $status
Definition: hooks.txt:1004
setVar($name, $value)
Convenience alias for $this->parent->setVar()
$version
Definition: parserTests.php:85
getTableOptions()
Return any table options to be applied to all tables that don't override them.
getRadioSet($params)
Get a set of labelled radio buttons.
static element($element, $attribs=[], $contents= '')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
Definition: Html.php:230
static newGood($value=null)
Factory function for good results.
Definition: Status.php:101
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:310