MediaWiki  1.23.15
MysqlInstaller.php
Go to the documentation of this file.
1 <?php
31 
32  protected $globalNames = array(
33  'wgDBserver',
34  'wgDBname',
35  'wgDBuser',
36  'wgDBpassword',
37  'wgDBprefix',
38  'wgDBTableOptions',
39  'wgDBmysql5',
40  );
41 
42  protected $internalDefaults = array(
43  '_MysqlEngine' => 'InnoDB',
44  '_MysqlCharset' => 'binary',
45  '_InstallUser' => 'root',
46  );
47 
48  public $supportedEngines = array( 'InnoDB', 'MyISAM' );
49 
50  public $minimumVersion = '5.0.2';
51 
52  public $webUserPrivs = array(
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  array(),
82  $this->parent->getHelpBox( 'config-db-host-help' )
83  ) .
84  Html::openElement( 'fieldset' ) .
85  Html::element( 'legend', array(), wfMessage( 'config-db-wiki-settings' )->text() ) .
86  $this->getTextBox( 'wgDBname', 'config-db-name', array( 'dir' => 'ltr' ),
87  $this->parent->getHelpBox( 'config-db-name-help' ) ) .
88  $this->getTextBox( 'wgDBprefix', 'config-db-prefix', array( '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( array(
97  'wgDBserver', 'wgDBname', 'wgDBprefix', '_InstallUser', '_InstallPassword'
98  ) );
99 
100  // Validate them.
101  $status = Status::newGood();
102  if ( !strlen( $newValues['wgDBserver'] ) ) {
103  $status->fatal( 'config-missing-db-host' );
104  }
105  if ( !strlen( $newValues['wgDBname'] ) ) {
106  $status->fatal( 'config-missing-db-name' );
107  } elseif ( !preg_match( '/^[a-z0-9+_-]+$/i', $newValues['wgDBname'] ) ) {
108  $status->fatal( 'config-invalid-db-name', $newValues['wgDBname'] );
109  }
110  if ( !preg_match( '/^[a-z0-9_-]*$/i', $newValues['wgDBprefix'] ) ) {
111  $status->fatal( 'config-invalid-db-prefix', $newValues['wgDBprefix'] );
112  }
113  if ( !strlen( $newValues['_InstallUser'] ) ) {
114  $status->fatal( 'config-db-username-empty' );
115  }
116  if (!strlen( $newValues['_InstallPassword'] ) ) {
117  $status->fatal( 'config-db-password-empty', $newValues['_InstallUser'] );
118  }
119  if ( !$status->isOK() ) {
120  return $status;
121  }
122 
123  // Submit user box
124  $status = $this->submitInstallUserBox();
125  if ( !$status->isOK() ) {
126  return $status;
127  }
128 
129  // Try to connect
130  $status = $this->getConnection();
131  if ( !$status->isOK() ) {
132  return $status;
133  }
137  $conn = $status->value;
138 
139  // Check version
140  $version = $conn->getServerVersion();
141  if ( version_compare( $version, $this->minimumVersion ) < 0 ) {
142  return Status::newFatal( 'config-mysql-old', $this->minimumVersion, $version );
143  }
144 
145  return $status;
146  }
147 
151  public function openConnection() {
152  $status = Status::newGood();
153  try {
154  $db = DatabaseBase::factory( 'mysql', array(
155  'host' => $this->getVar( 'wgDBserver' ),
156  'user' => $this->getVar( '_InstallUser' ),
157  'password' => $this->getVar( '_InstallPassword' ),
158  'dbname' => false,
159  'flags' => 0,
160  'tablePrefix' => $this->getVar( 'wgDBprefix' ) ) );
161  $status->value = $db;
162  } catch ( DBConnectionError $e ) {
163  $status->fatal( 'config-connection-error', $e->getMessage() );
164  }
165 
166  return $status;
167  }
168 
169  public function preUpgrade() {
170  global $wgDBuser, $wgDBpassword;
171 
172  $status = $this->getConnection();
173  if ( !$status->isOK() ) {
174  $this->parent->showStatusError( $status );
175 
176  return;
177  }
181  $conn = $status->value;
182  $conn->selectDB( $this->getVar( 'wgDBname' ) );
183 
184  # Determine existing default character set
185  if ( $conn->tableExists( "revision", __METHOD__ ) ) {
186  $revision = $conn->buildLike( $this->getVar( 'wgDBprefix' ) . 'revision' );
187  $res = $conn->query( "SHOW TABLE STATUS $revision", __METHOD__ );
188  $row = $conn->fetchObject( $res );
189  if ( !$row ) {
190  $this->parent->showMessage( 'config-show-table-status' );
191  $existingSchema = false;
192  $existingEngine = false;
193  } else {
194  if ( preg_match( '/^latin1/', $row->Collation ) ) {
195  $existingSchema = 'latin1';
196  } elseif ( preg_match( '/^utf8/', $row->Collation ) ) {
197  $existingSchema = 'utf8';
198  } elseif ( preg_match( '/^binary/', $row->Collation ) ) {
199  $existingSchema = 'binary';
200  } else {
201  $existingSchema = false;
202  $this->parent->showMessage( 'config-unknown-collation' );
203  }
204  if ( isset( $row->Engine ) ) {
205  $existingEngine = $row->Engine;
206  } else {
207  $existingEngine = $row->Type;
208  }
209  }
210  } else {
211  $existingSchema = false;
212  $existingEngine = false;
213  }
214 
215  if ( $existingSchema && $existingSchema != $this->getVar( '_MysqlCharset' ) ) {
216  $this->setVar( '_MysqlCharset', $existingSchema );
217  }
218  if ( $existingEngine && $existingEngine != $this->getVar( '_MysqlEngine' ) ) {
219  $this->setVar( '_MysqlEngine', $existingEngine );
220  }
221 
222  # Normal user and password are selected after this step, so for now
223  # just copy these two
224  $wgDBuser = $this->getVar( '_InstallUser' );
225  $wgDBpassword = $this->getVar( '_InstallPassword' );
226  }
227 
233  public function getEngines() {
234  $status = $this->getConnection();
235 
239  $conn = $status->value;
240 
241  $engines = array();
242  $res = $conn->query( 'SHOW ENGINES', __METHOD__ );
243  foreach ( $res as $row ) {
244  if ( $row->Support == 'YES' || $row->Support == 'DEFAULT' ) {
245  $engines[] = $row->Engine;
246  }
247  }
248  $engines = array_intersect( $this->supportedEngines, $engines );
249 
250  return $engines;
251  }
252 
258  public function getCharsets() {
259  return array( 'binary', 'utf8' );
260  }
261 
267  public function canCreateAccounts() {
268  $status = $this->getConnection();
269  if ( !$status->isOK() ) {
270  return false;
271  }
273  $conn = $status->value;
274 
275  // Get current account name
276  $currentName = $conn->selectField( '', 'CURRENT_USER()', '', __METHOD__ );
277  $parts = explode( '@', $currentName );
278  if ( count( $parts ) != 2 ) {
279  return false;
280  }
281  $quotedUser = $conn->addQuotes( $parts[0] ) .
282  '@' . $conn->addQuotes( $parts[1] );
283 
284  // The user needs to have INSERT on mysql.* to be able to CREATE USER
285  // The grantee will be double-quoted in this query, as required
286  $res = $conn->select( 'INFORMATION_SCHEMA.USER_PRIVILEGES', '*',
287  array( 'GRANTEE' => $quotedUser ), __METHOD__ );
288  $insertMysql = false;
289  $grantOptions = array_flip( $this->webUserPrivs );
290  foreach ( $res as $row ) {
291  if ( $row->PRIVILEGE_TYPE == 'INSERT' ) {
292  $insertMysql = true;
293  }
294  if ( $row->IS_GRANTABLE ) {
295  unset( $grantOptions[$row->PRIVILEGE_TYPE] );
296  }
297  }
298 
299  // Check for DB-specific privs for mysql.*
300  if ( !$insertMysql ) {
301  $row = $conn->selectRow( 'INFORMATION_SCHEMA.SCHEMA_PRIVILEGES', '*',
302  array(
303  'GRANTEE' => $quotedUser,
304  'TABLE_SCHEMA' => 'mysql',
305  'PRIVILEGE_TYPE' => 'INSERT',
306  ), __METHOD__ );
307  if ( $row ) {
308  $insertMysql = true;
309  }
310  }
311 
312  if ( !$insertMysql ) {
313  return false;
314  }
315 
316  // Check for DB-level grant options
317  $res = $conn->select( 'INFORMATION_SCHEMA.SCHEMA_PRIVILEGES', '*',
318  array(
319  'GRANTEE' => $quotedUser,
320  'IS_GRANTABLE' => 1,
321  ), __METHOD__ );
322  foreach ( $res as $row ) {
323  $regex = $conn->likeToRegex( $row->TABLE_SCHEMA );
324  if ( preg_match( $regex, $this->getVar( 'wgDBname' ) ) ) {
325  unset( $grantOptions[$row->PRIVILEGE_TYPE] );
326  }
327  }
328  if ( count( $grantOptions ) ) {
329  // Can't grant everything
330  return false;
331  }
332 
333  return true;
334  }
335 
339  public function getSettingsForm() {
340  if ( $this->canCreateAccounts() ) {
341  $noCreateMsg = false;
342  } else {
343  $noCreateMsg = 'config-db-web-no-create-privs';
344  }
345  $s = $this->getWebUserBox( $noCreateMsg );
346 
347  // Do engine selector
348  $engines = $this->getEngines();
349  // If the current default engine is not supported, use an engine that is
350  if ( !in_array( $this->getVar( '_MysqlEngine' ), $engines ) ) {
351  $this->setVar( '_MysqlEngine', reset( $engines ) );
352  }
353 
354  $s .= Xml::openElement( 'div', array(
355  'id' => 'dbMyisamWarning'
356  ) );
357  $myisamWarning = 'config-mysql-myisam-dep';
358  if ( count( $engines ) === 1 ) {
359  $myisamWarning = 'config-mysql-only-myisam-dep';
360  }
361  $s .= $this->parent->getWarningBox( wfMessage( $myisamWarning )->text() );
362  $s .= Xml::closeElement( 'div' );
363 
364  if ( $this->getVar( '_MysqlEngine' ) != 'MyISAM' ) {
365  $s .= Xml::openElement( 'script', array( 'type' => 'text/javascript' ) );
366  $s .= '$(\'#dbMyisamWarning\').hide();';
367  $s .= Xml::closeElement( 'script' );
368  }
369 
370  if ( count( $engines ) >= 2 ) {
371  // getRadioSet() builds a set of labeled radio buttons.
372  // For grep: The following messages are used as the item labels:
373  // config-mysql-innodb, config-mysql-myisam
374  $s .= $this->getRadioSet( array(
375  'var' => '_MysqlEngine',
376  'label' => 'config-mysql-engine',
377  'itemLabelPrefix' => 'config-mysql-',
378  'values' => $engines,
379  'itemAttribs' => array(
380  'MyISAM' => array(
381  'class' => 'showHideRadio',
382  'rel' => 'dbMyisamWarning'
383  ),
384  'InnoDB' => array(
385  'class' => 'hideShowRadio',
386  'rel' => 'dbMyisamWarning'
387  )
388  )
389  ) );
390  $s .= $this->parent->getHelpBox( 'config-mysql-engine-help' );
391  }
392 
393  // If the current default charset is not supported, use a charset that is
394  $charsets = $this->getCharsets();
395  if ( !in_array( $this->getVar( '_MysqlCharset' ), $charsets ) ) {
396  $this->setVar( '_MysqlCharset', reset( $charsets ) );
397  }
398 
399  // Do charset selector
400  if ( count( $charsets ) >= 2 ) {
401  // getRadioSet() builds a set of labeled radio buttons.
402  // For grep: The following messages are used as the item labels:
403  // config-mysql-binary, config-mysql-utf8
404  $s .= $this->getRadioSet( array(
405  'var' => '_MysqlCharset',
406  'label' => 'config-mysql-charset',
407  'itemLabelPrefix' => 'config-mysql-',
408  'values' => $charsets
409  ) );
410  $s .= $this->parent->getHelpBox( 'config-mysql-charset-help' );
411  }
412 
413  return $s;
414  }
415 
419  public function submitSettingsForm() {
420  $this->setVarsFromRequest( array( '_MysqlEngine', '_MysqlCharset' ) );
421  $status = $this->submitWebUserBox();
422  if ( !$status->isOK() ) {
423  return $status;
424  }
425 
426  // Validate the create checkbox
427  $canCreate = $this->canCreateAccounts();
428  if ( !$canCreate ) {
429  $this->setVar( '_CreateDBAccount', false );
430  $create = false;
431  } else {
432  $create = $this->getVar( '_CreateDBAccount' );
433  }
434 
435  if ( !$create ) {
436  // Test the web account
437  try {
438  DatabaseBase::factory( 'mysql', array(
439  'host' => $this->getVar( 'wgDBserver' ),
440  'user' => $this->getVar( 'wgDBuser' ),
441  'password' => $this->getVar( 'wgDBpassword' ),
442  'dbname' => false,
443  'flags' => 0,
444  'tablePrefix' => $this->getVar( 'wgDBprefix' )
445  ) );
446  } catch ( DBConnectionError $e ) {
447  return Status::newFatal( 'config-connection-error', $e->getMessage() );
448  }
449  }
450 
451  // Validate engines and charsets
452  // This is done pre-submit already so it's just for security
453  $engines = $this->getEngines();
454  if ( !in_array( $this->getVar( '_MysqlEngine' ), $engines ) ) {
455  $this->setVar( '_MysqlEngine', reset( $engines ) );
456  }
457  $charsets = $this->getCharsets();
458  if ( !in_array( $this->getVar( '_MysqlCharset' ), $charsets ) ) {
459  $this->setVar( '_MysqlCharset', reset( $charsets ) );
460  }
461 
462  return Status::newGood();
463  }
464 
465  public function preInstall() {
466  # Add our user callback to installSteps, right before the tables are created.
467  $callback = array(
468  'name' => 'user',
469  'callback' => array( $this, 'setupUser' ),
470  );
471  $this->parent->addInstallStep( $callback, 'tables' );
472  }
473 
477  public function setupDatabase() {
478  $status = $this->getConnection();
479  if ( !$status->isOK() ) {
480  return $status;
481  }
483  $conn = $status->value;
484  $dbName = $this->getVar( 'wgDBname' );
485  if ( !$conn->selectDB( $dbName ) ) {
486  $conn->query(
487  "CREATE DATABASE " . $conn->addIdentifierQuotes( $dbName ) . "CHARACTER SET utf8",
488  __METHOD__
489  );
490  $conn->selectDB( $dbName );
491  }
492  $this->setupSchemaVars();
493 
494  return $status;
495  }
496 
500  public function setupUser() {
501  $dbUser = $this->getVar( 'wgDBuser' );
502  if ( $dbUser == $this->getVar( '_InstallUser' ) ) {
503  return Status::newGood();
504  }
505  $status = $this->getConnection();
506  if ( !$status->isOK() ) {
507  return $status;
508  }
509 
510  $this->setupSchemaVars();
511  $dbName = $this->getVar( 'wgDBname' );
512  $this->db->selectDB( $dbName );
513  $server = $this->getVar( 'wgDBserver' );
514  $password = $this->getVar( 'wgDBpassword' );
515  $grantableNames = array();
516 
517  if ( $this->getVar( '_CreateDBAccount' ) ) {
518  // Before we blindly try to create a user that already has access,
519  try { // first attempt to connect to the database
520  DatabaseBase::factory( 'mysql', array(
521  'host' => $server,
522  'user' => $dbUser,
523  'password' => $password,
524  'dbname' => false,
525  'flags' => 0,
526  'tablePrefix' => $this->getVar( 'wgDBprefix' )
527  ) );
528  $grantableNames[] = $this->buildFullUserName( $dbUser, $server );
529  $tryToCreate = false;
530  } catch ( DBConnectionError $e ) {
531  $tryToCreate = true;
532  }
533  } else {
534  $grantableNames[] = $this->buildFullUserName( $dbUser, $server );
535  $tryToCreate = false;
536  }
537 
538  if ( $tryToCreate ) {
539  $createHostList = array(
540  $server,
541  'localhost',
542  'localhost.localdomain',
543  '%'
544  );
545 
546  $createHostList = array_unique( $createHostList );
547  $escPass = $this->db->addQuotes( $password );
548 
549  foreach ( $createHostList as $host ) {
550  $fullName = $this->buildFullUserName( $dbUser, $host );
551  if ( !$this->userDefinitelyExists( $dbUser, $host ) ) {
552  try {
553  $this->db->begin( __METHOD__ );
554  $this->db->query( "CREATE USER $fullName IDENTIFIED BY $escPass", __METHOD__ );
555  $this->db->commit( __METHOD__ );
556  $grantableNames[] = $fullName;
557  } catch ( DBQueryError $dqe ) {
558  if ( $this->db->lastErrno() == 1396 /* ER_CANNOT_USER */ ) {
559  // User (probably) already exists
560  $this->db->rollback( __METHOD__ );
561  $status->warning( 'config-install-user-alreadyexists', $dbUser );
562  $grantableNames[] = $fullName;
563  break;
564  } else {
565  // If we couldn't create for some bizzare reason and the
566  // user probably doesn't exist, skip the grant
567  $this->db->rollback( __METHOD__ );
568  $status->warning( 'config-install-user-create-failed', $dbUser, $dqe->getText() );
569  }
570  }
571  } else {
572  $status->warning( 'config-install-user-alreadyexists', $dbUser );
573  $grantableNames[] = $fullName;
574  break;
575  }
576  }
577  }
578 
579  // Try to grant to all the users we know exist or we were able to create
580  $dbAllTables = $this->db->addIdentifierQuotes( $dbName ) . '.*';
581  foreach ( $grantableNames as $name ) {
582  try {
583  $this->db->begin( __METHOD__ );
584  $this->db->query( "GRANT ALL PRIVILEGES ON $dbAllTables TO $name", __METHOD__ );
585  $this->db->commit( __METHOD__ );
586  } catch ( DBQueryError $dqe ) {
587  $this->db->rollback( __METHOD__ );
588  $status->fatal( 'config-install-user-grant-failed', $dbUser, $dqe->getText() );
589  }
590  }
591 
592  return $status;
593  }
594 
601  private function buildFullUserName( $name, $host ) {
602  return $this->db->addQuotes( $name ) . '@' . $this->db->addQuotes( $host );
603  }
604 
612  private function userDefinitelyExists( $host, $user ) {
613  try {
614  $res = $this->db->selectRow( 'mysql.user', array( 'Host', 'User' ),
615  array( 'Host' => $host, 'User' => $user ), __METHOD__ );
616 
617  return (bool)$res;
618  } catch ( DBQueryError $dqe ) {
619  return false;
620  }
621  }
622 
629  protected function getTableOptions() {
630  $options = array();
631  if ( $this->getVar( '_MysqlEngine' ) !== null ) {
632  $options[] = "ENGINE=" . $this->getVar( '_MysqlEngine' );
633  }
634  if ( $this->getVar( '_MysqlCharset' ) !== null ) {
635  $options[] = 'DEFAULT CHARSET=' . $this->getVar( '_MysqlCharset' );
636  }
637 
638  return implode( ', ', $options );
639  }
640 
646  public function getSchemaVars() {
647  return array(
648  'wgDBTableOptions' => $this->getTableOptions(),
649  'wgDBname' => $this->getVar( 'wgDBname' ),
650  'wgDBuser' => $this->getVar( 'wgDBuser' ),
651  'wgDBpassword' => $this->getVar( 'wgDBpassword' ),
652  );
653  }
654 
655  public function getLocalSettings() {
656  $dbmysql5 = wfBoolToStr( $this->getVar( 'wgDBmysql5', true ) );
657  $prefix = LocalSettingsGenerator::escapePhpString( $this->getVar( 'wgDBprefix' ) );
659 
660  return "# MySQL specific settings
661 \$wgDBprefix = \"{$prefix}\";
662 
663 # MySQL table options to use during installation or update
664 \$wgDBTableOptions = \"{$tblOpts}\";
665 
666 # Experimental charset support for MySQL 5.0.
667 \$wgDBmysql5 = {$dbmysql5};";
668  }
669 }
MysqlInstaller\getTableOptions
getTableOptions()
Return any table options to be applied to all tables that don't override them.
Definition: MysqlInstaller.php:629
MysqlInstaller\submitSettingsForm
submitSettingsForm()
Definition: MysqlInstaller.php:419
DBExpectedError\getText
getText()
Definition: DatabaseError.php:53
MysqlInstaller\getEngines
getEngines()
Get a list of storage engines that are available and supported.
Definition: MysqlInstaller.php:233
php
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
Definition: skin.txt:62
DatabaseInstaller\checkExtension
static checkExtension( $name)
Convenience function.
Definition: DatabaseInstaller.php:326
MysqlInstaller\getSettingsForm
getSettingsForm()
Definition: MysqlInstaller.php:339
MysqlInstaller\$supportedEngines
$supportedEngines
Definition: MysqlInstaller.php:48
text
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
MysqlInstaller\setupUser
setupUser()
Definition: MysqlInstaller.php:500
MysqlInstaller\userDefinitelyExists
userDefinitelyExists( $host, $user)
Try to see if the user account exists.
Definition: MysqlInstaller.php:612
DatabaseInstaller\getConnection
getConnection()
Connect to the database using the administrative user/password currently defined in the session.
Definition: DatabaseInstaller.php:145
MysqlInstaller\preInstall
preInstall()
Allow DB installers a chance to make last-minute changes before installation occurs.
Definition: MysqlInstaller.php:465
MysqlInstaller\getLocalSettings
getLocalSettings()
Get the DBMS-specific options for LocalSettings.php generation.
Definition: MysqlInstaller.php:655
Status\newGood
static newGood( $value=null)
Factory function for good results.
Definition: Status.php:77
$s
$s
Definition: mergeMessageFileList.php:156
MysqlInstaller\openConnection
openConnection()
Definition: MysqlInstaller.php:151
MysqlInstaller\$minimumVersion
$minimumVersion
Definition: MysqlInstaller.php:50
Xml\openElement
static openElement( $element, $attribs=null)
This opens an XML element.
Definition: Xml.php:109
DatabaseInstaller\getTextBox
getTextBox( $var, $label, $attribs=array(), $helpData="")
Get a labelled text box to configure a local variable.
Definition: DatabaseInstaller.php:398
MysqlInstaller\getName
getName()
Definition: MysqlInstaller.php:63
MysqlInstaller\buildFullUserName
buildFullUserName( $name, $host)
Return a formal 'User'@'Host' username for use in queries.
Definition: MysqlInstaller.php:601
wfBoolToStr
wfBoolToStr( $value)
Convenience function converts boolean values into "true" or "false" (string) values.
Definition: GlobalFunctions.php:3835
Html\closeElement
static closeElement( $element)
Returns "</$element>".
Definition: Html.php:218
Html\openElement
static openElement( $element, $attribs=array())
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
Definition: Html.php:159
DBQueryError
Definition: DatabaseError.php:306
MysqlInstaller\isCompiled
isCompiled()
Definition: MysqlInstaller.php:70
Html\element
static element( $element, $attribs=array(), $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
Definition: Html.php:141
DatabaseInstaller\submitWebUserBox
submitWebUserBox()
Submit the form from getWebUserBox().
Definition: DatabaseInstaller.php:587
wfMessage
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 "&lt
DatabaseInstaller\setupSchemaVars
setupSchemaVars()
Set appropriate schema variables in the current database connection.
Definition: DatabaseInstaller.php:237
MysqlInstaller\submitConnectForm
submitConnectForm()
Set variables based on the request array, assuming it was submitted via the form returned by getConne...
Definition: MysqlInstaller.php:94
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
DBConnectionError
Definition: DatabaseError.php:98
DatabaseBase\factory
static factory( $dbType, $p=array())
Given a DB type, construct the name of the appropriate child class of DatabaseBase.
Definition: Database.php:808
DatabaseInstaller\getWebUserBox
getWebUserBox( $noCreateMsg=false)
Get a standard web-user fieldset.
Definition: DatabaseInstaller.php:560
MysqlInstaller\$internalDefaults
$internalDefaults
Definition: MysqlInstaller.php:42
DatabaseInstaller\getRadioSet
getRadioSet( $params)
Get a set of labelled radio buttons.
Definition: DatabaseInstaller.php:478
$options
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 & $options
Definition: hooks.txt:1530
DatabaseInstaller\$db
DatabaseBase $db
The database connection.
Definition: DatabaseInstaller.php:44
MysqlInstaller\preUpgrade
preUpgrade()
Allow DB installers a chance to make checks before upgrade.
Definition: MysqlInstaller.php:169
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:336
DatabaseInstaller\getVar
getVar( $var, $default=null)
Get a variable, taking local defaults into account.
Definition: DatabaseInstaller.php:368
MysqlInstaller\getSchemaVars
getSchemaVars()
Get variables to substitute into tables.sql and the SQL patch files.
Definition: MysqlInstaller.php:646
DatabaseInstaller\submitInstallUserBox
submitInstallUserBox()
Submit a standard install user fieldset.
Definition: DatabaseInstaller.php:547
$version
$version
Definition: parserTests.php:86
DatabaseInstaller
Base class for DBMS-specific installation helper classes.
Definition: DatabaseInstaller.php:30
MysqlInstaller\getCharsets
getCharsets()
Get a list of character sets that are available and supported.
Definition: MysqlInstaller.php:258
MysqlInstaller
Class for setting up the MediaWiki database using MySQL.
Definition: MysqlInstaller.php:30
$user
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
Definition: hooks.txt:237
$password
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
Definition: hooks.txt:2708
MysqlInstaller\setupDatabase
setupDatabase()
Definition: MysqlInstaller.php:477
Xml\closeElement
static closeElement( $element)
Shortcut to close an XML element.
Definition: Xml.php:118
MysqlInstaller\$globalNames
$globalNames
Definition: MysqlInstaller.php:32
as
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
DatabaseInstaller\setVar
setVar( $name, $value)
Convenience alias for $this->parent->setVar()
Definition: DatabaseInstaller.php:385
DatabaseInstaller\getInstallUserBox
getInstallUserBox()
Get a standard install-user fieldset.
Definition: DatabaseInstaller.php:525
DatabaseInstaller\setVarsFromRequest
setVarsFromRequest( $varNames)
Convenience function to set variables based on form data.
Definition: DatabaseInstaller.php:492
LocalSettingsGenerator\escapePhpString
static escapePhpString( $string)
Returns the escaped version of a string of php code.
Definition: LocalSettingsGenerator.php:111
MysqlInstaller\getConnectForm
getConnectForm()
Definition: MysqlInstaller.php:77
MysqlInstaller\$webUserPrivs
$webUserPrivs
Definition: MysqlInstaller.php:52
MysqlInstaller\canCreateAccounts
canCreateAccounts()
Return true if the install user can create accounts.
Definition: MysqlInstaller.php:267
$res
$res
Definition: database.txt:21
$e
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e
Definition: hooks.txt:1632
Status\newFatal
static newFatal( $message)
Factory function for fatal errors.
Definition: Status.php:63