MediaWiki  1.23.16
MssqlInstaller.php
Go to the documentation of this file.
1 <?php
31 
32  protected $globalNames = array(
33  'wgDBserver',
34  'wgDBname',
35  'wgDBuser',
36  'wgDBpassword',
37  'wgDBmwschema',
38  'wgDBprefix',
39  'wgDBWindowsAuthentication',
40  );
41 
42  protected $internalDefaults = array(
43  '_InstallUser' => 'sa',
44  '_InstallWindowsAuthentication' => 'sqlauth',
45  '_WebWindowsAuthentication' => 'sqlauth',
46  );
47 
48  public $minimumVersion = '9.00.1399'; // SQL Server 2005 RTM (TODO: are SQL Express version numbers different?)
49 
50  // These are schema-level privs
51  // Note: the web user will be created will full permissions if possible, this permission
52  // list is only used if we are unable to grant full permissions.
53  public $webUserPrivs = array(
54  'DELETE',
55  'INSERT',
56  'SELECT',
57  'UPDATE',
58  'EXECUTE',
59  );
60 
64  public function getName() {
65  return 'mssql';
66  }
67 
71  public function isCompiled() {
72  return self::checkExtension( 'sqlsrv' );
73  }
74 
78  public function getConnectForm() {
79  if ( $this->getVar( '_InstallWindowsAuthentication' ) == 'windowsauth' ) {
80  $displayStyle = 'display: none;';
81  } else {
82  $displayStyle = 'display: block;';
83  }
84 
85  return $this->getTextBox(
86  'wgDBserver',
87  'config-db-host',
88  array(),
89  $this->parent->getHelpBox( 'config-db-host-help' )
90  ) .
91  Html::openElement( 'fieldset' ) .
92  Html::element( 'legend', array(), wfMessage( 'config-db-wiki-settings' )->text() ) .
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' ) ) .
99  Html::closeElement( 'fieldset' ) .
100  Html::openElement( 'fieldset' ) .
101  Html::element( 'legend', array(), wfMessage( 'config-db-install-account' )->text() ) .
102  $this->getRadioSet( array(
103  'var' => '_InstallWindowsAuthentication',
104  'label' => 'config-mssql-auth',
105  'itemLabelPrefix' => 'config-mssql-',
106  'values' => array( 'sqlauth', 'windowsauth' ),
107  'itemAttribs' => array(
108  'sqlauth' => array(
109  'class' => 'showHideRadio',
110  'rel' => 'dbCredentialBox',
111  ),
112  'windowsauth' => array(
113  'class' => 'hideShowRadio',
114  'rel' => 'dbCredentialBox',
115  )
116  ),
117  'help' => $this->parent->getHelpBox( 'config-mssql-install-auth' )
118  ) ) .
119  Html::openElement( 'div', array( 'id' => 'dbCredentialBox', 'style' => $displayStyle ) ) .
120  $this->getTextBox(
121  '_InstallUser',
122  'config-db-username',
123  array( 'dir' => 'ltr' ),
124  $this->parent->getHelpBox( 'config-db-install-username' )
125  ) .
126  $this->getPasswordBox(
127  '_InstallPassword',
128  'config-db-password',
129  array( 'dir' => 'ltr' ),
130  $this->parent->getHelpBox( 'config-db-install-password' )
131  ) .
132  Html::closeElement( 'div' ) .
133  Html::closeElement( 'fieldset' );
134  }
135 
136  public function submitConnectForm() {
137  // Get variables from the request.
138  $newValues = $this->setVarsFromRequest( array( 'wgDBserver', 'wgDBname', 'wgDBmwschema', 'wgDBprefix' ) );
139 
140  // Validate them.
141  $status = Status::newGood();
142  if ( !strlen( $newValues['wgDBserver'] ) ) {
143  $status->fatal( 'config-missing-db-host' );
144  }
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'] );
149  }
150  if ( !preg_match( '/^[a-z0-9_]*$/i', $newValues['wgDBmwschema'] ) ) {
151  $status->fatal( 'config-invalid-schema', $newValues['wgDBmwschema'] );
152  }
153  if ( !preg_match( '/^[a-z0-9_]*$/i', $newValues['wgDBprefix'] ) ) {
154  $status->fatal( 'config-invalid-db-prefix', $newValues['wgDBprefix'] );
155  }
156  if ( !$status->isOK() ) {
157  return $status;
158  }
159 
160  // Check for blank schema and remap to dbo
161  if ( $newValues['wgDBmwschema'] === '' ) {
162  $this->setVar( 'wgDBmwschema', 'dbo' );
163  }
164 
165  // User box
166  $this->setVarsFromRequest( array( '_InstallUser', '_InstallPassword', '_InstallWindowsAuthentication' ) );
167 
168  // Try to connect
169  $status = $this->getConnection();
170  if ( !$status->isOK() ) {
171  return $status;
172  }
176  $conn = $status->value;
177 
178  // Check version
179  $version = $conn->getServerVersion();
180  if ( version_compare( $version, $this->minimumVersion ) < 0 ) {
181  return Status::newFatal( 'config-mssql-old', $this->minimumVersion, $version );
182  }
183 
184  return $status;
185  }
186 
190  public function openConnection() {
191  global $wgDBWindowsAuthentication;
192  $status = Status::newGood();
193  $user = $this->getVar( '_InstallUser' );
194  $password = $this->getVar( '_InstallPassword' );
195 
196  if ( $this->getVar( '_InstallWindowsAuthentication' ) == 'windowsauth' ) {
197  // Use Windows authentication for this connection
198  $wgDBWindowsAuthentication = true;
199  } else {
200  $wgDBWindowsAuthentication = false;
201  }
202 
203  try {
204  $db = DatabaseBase::factory( 'mssql', array(
205  'host' => $this->getVar( 'wgDBserver' ),
206  'user' => $user,
207  'password' => $password,
208  'dbname' => false,
209  'flags' => 0,
210  'schema' => $this->getVar( 'wgDBmwschema' ),
211  'tablePrefix' => $this->getVar( 'wgDBprefix' ) ) );
212  $db->prepareStatements( false );
213  $db->scrollableCursor( false );
214  $status->value = $db;
215  } catch ( DBConnectionError $e ) {
216  $status->fatal( 'config-connection-error', $e->getMessage() );
217  }
218 
219  return $status;
220  }
221 
222  public function preUpgrade() {
223  global $wgDBuser, $wgDBpassword;
224 
225  $status = $this->getConnection();
226  if ( !$status->isOK() ) {
227  $this->parent->showStatusError( $status );
228 
229  return;
230  }
234  $conn = $status->value;
235  $conn->selectDB( $this->getVar( 'wgDBname' ) );
236 
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' );
241  }
242 
248  public function canCreateAccounts() {
249  $status = $this->getConnection();
250  if ( !$status->isOK() ) {
251  return false;
252  }
254  $conn = $status->value;
255 
256  // We need the server-level ALTER ANY LOGIN permission to create new accounts
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,
261  );
262 
263  foreach ( $res as $row ) {
264  $serverPrivs[$row->permission_name] = true;
265  }
266 
267  if ( !$serverPrivs['ALTER ANY LOGIN'] ) {
268  return false;
269  }
270 
271  // Check to ensure we can grant everything needed as well
272  // We can't actually tell if we have WITH GRANT OPTION for a given permission, so we assume we do
273  // and just check for the permission
274  // http://technet.microsoft.com/en-us/library/ms178569.aspx
275  // The following array sets up which permissions imply whatever permissions we specify
276  $implied = array(
277  // schema database server
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' ),
283  );
284 
285  $grantOptions = array_flip( $this->webUserPrivs );
286 
287  // Check for schema and db-level permissions, but only if the schema/db exists
288  $schemaPrivs = $dbPrivs = array(
289  'DELETE' => false,
290  'EXECUTE' => false,
291  'INSERT' => false,
292  'SELECT' => false,
293  'UPDATE' => false,
294  );
295 
296  $dbPrivs['ALTER ANY USER'] = false;
297 
298  if ( $this->databaseExists( $this->getVar( 'wgDBname' ) ) ) {
299  $conn->selectDB( $this->getVar( 'wgDBname' ) );
300  $res = $conn->query( "SELECT permission_name FROM sys.fn_my_permissions( NULL, 'DATABASE' )" );
301 
302  foreach ( $res as $row ) {
303  $dbPrivs[$row->permission_name] = true;
304  }
305 
306  // If the db exists, we need ALTER ANY USER privs on it to make a new user
307  if ( !$dbPrivs['ALTER ANY USER'] ) {
308  return false;
309  }
310 
311  if ( $this->schemaExists( $this->getVar( 'wgDBmwschema' ) ) ) {
312  // wgDBmwschema is validated to only contain alphanumeric + underscore, so this is safe
313  $res = $conn->query( "SELECT permission_name FROM sys.fn_my_permissions( '{$this->getVar( 'wgDBmwschema' )}', 'SCHEMA' )" );
314 
315  foreach ( $res as $row ) {
316  $schemaPrivs[$row->permission_name] = true;
317  }
318  }
319  }
320 
321  // Now check all the grants we'll need to be doing to see if we can
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]] ) ) {
326 
327  unset( $grantOptions[$permission] );
328  }
329  }
330 
331  if ( count( $grantOptions ) ) {
332  // Can't grant everything
333  return false;
334  }
335 
336  return true;
337  }
338 
342  public function getSettingsForm() {
343  if ( $this->canCreateAccounts() ) {
344  $noCreateMsg = false;
345  } else {
346  $noCreateMsg = 'config-db-web-no-create-privs';
347  }
348  $wrapperStyle = $this->getVar( '_SameAccount' ) ? 'display: none' : '';
349  $displayStyle = $this->getVar( '_WebWindowsAuthentication' ) == 'windowsauth' ? 'display: none' : '';
350  $s = Html::openElement( 'fieldset' ) .
351  Html::element( 'legend', array(), wfMessage( 'config-db-web-account' )->text() ) .
352  $this->getCheckBox(
353  '_SameAccount', 'config-db-web-account-same',
354  array( 'class' => 'hideShowRadio', 'rel' => 'dbOtherAccount' )
355  ) .
356  Html::openElement( 'div', array( 'id' => 'dbOtherAccount', 'style' => $wrapperStyle ) ) .
357  $this->getRadioSet( array(
358  'var' => '_WebWindowsAuthentication',
359  'label' => 'config-mssql-auth',
360  'itemLabelPrefix' => 'config-mssql-',
361  'values' => array( 'sqlauth', 'windowsauth' ),
362  'itemAttribs' => array(
363  'sqlauth' => array(
364  'class' => 'showHideRadio',
365  'rel' => 'dbCredentialBox',
366  ),
367  'windowsauth' => array(
368  'class' => 'hideShowRadio',
369  'rel' => 'dbCredentialBox',
370  )
371  ),
372  'help' => $this->parent->getHelpBox( 'config-mssql-web-auth' )
373  ) ) .
374  Html::openElement( 'div', array( 'id' => 'dbCredentialBox', 'style' => $displayStyle ) ) .
375  $this->getTextBox( 'wgDBuser', 'config-db-username' ) .
376  $this->getPasswordBox( 'wgDBpassword', 'config-db-password' ) .
377  Html::closeElement( 'div' );
378 
379  if ( $noCreateMsg ) {
380  $s .= $this->parent->getWarningBox( wfMessage( $noCreateMsg )->plain() );
381  } else {
382  $s .= $this->getCheckBox( '_CreateDBAccount', 'config-db-web-create' );
383  }
384 
385  $s .= Html::closeElement( 'div' ) . Html::closeElement( 'fieldset' );
386 
387  return $s;
388  }
389 
393  public function submitSettingsForm() {
394  $this->setVarsFromRequest(
395  array( 'wgDBuser', 'wgDBpassword', '_SameAccount', '_CreateDBAccount', '_WebWindowsAuthentication' )
396  );
397 
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' ) );
402  }
403 
404  if ( $this->getVar( '_WebWindowsAuthentication' ) == 'windowsauth' ) {
405  $this->setVar( 'wgDBuser', '' );
406  $this->setVar( 'wgDBpassword', '' );
407  $this->setVar( 'wgDBWindowsAuthentication', true );
408  } else {
409  $this->setVar( 'wgDBWindowsAuthentication', false );
410  }
411 
412  if ( $this->getVar( '_CreateDBAccount' ) && $this->getVar( '_WebWindowsAuthentication' ) == 'sqlauth' && strval( $this->getVar( 'wgDBpassword' ) ) == '' ) {
413  return Status::newFatal( 'config-db-password-empty', $this->getVar( 'wgDBuser' ) );
414  }
415 
416  // Validate the create checkbox
417  $canCreate = $this->canCreateAccounts();
418  if ( !$canCreate ) {
419  $this->setVar( '_CreateDBAccount', false );
420  $create = false;
421  } else {
422  $create = $this->getVar( '_CreateDBAccount' );
423  }
424 
425  if ( !$create ) {
426  // Test the web account
427  $user = $this->getVar( 'wgDBuser' );
428  $password = $this->getVar( 'wgDBpassword' );
429 
430  if ( $this->getVar( '_WebWindowsAuthentication' ) == 'windowsauth' ) {
431  $user = 'windowsauth';
432  $password = 'windowsauth';
433  }
434 
435  try {
436  DatabaseBase::factory( 'mssql', array(
437  'host' => $this->getVar( 'wgDBserver' ),
438  'user' => $user,
439  'password' => $password,
440  'dbname' => false,
441  'flags' => 0,
442  'tablePrefix' => $this->getVar( 'wgDBprefix' ),
443  'schema' => $this->getVar( 'wgDBmwschema' ),
444  ) );
445  } catch ( DBConnectionError $e ) {
446  return Status::newFatal( 'config-connection-error', $e->getMessage() );
447  }
448  }
449 
450  return Status::newGood();
451  }
452 
453  public function preInstall() {
454  # Add our user callback to installSteps, right before the tables are created.
455  $callback = array(
456  'name' => 'user',
457  'callback' => array( $this, 'setupUser' ),
458  );
459  $this->parent->addInstallStep( $callback, 'tables' );
460  }
461 
465  public function setupDatabase() {
466  $status = $this->getConnection();
467  if ( !$status->isOK() ) {
468  return $status;
469  }
471  $conn = $status->value;
472  $dbName = $this->getVar( 'wgDBname' );
473  $schemaName = $this->getVar( 'wgDBmwschema' );
474  if ( !$this->databaseExists( $dbName ) ) {
475  $conn->query( "CREATE DATABASE " . $conn->addIdentifierQuotes( $dbName ), __METHOD__ );
476  $conn->selectDB( $dbName );
477  if ( !$this->schemaExists( $schemaName ) ) {
478  $conn->query( "CREATE SCHEMA " . $conn->addIdentifierQuotes( $schemaName ), __METHOD__ );
479  }
480  if ( !$this->catalogExists( $schemaName ) ) {
481  $conn->query( "CREATE FULLTEXT CATALOG " . $conn->addIdentifierQuotes( $schemaName ), __METHOD__ );
482  }
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  || ( $this->getVar( '_InstallWindowsAuthentication' ) == 'windowsauth'
496  && $this->getVar( '_WebWindowsAuthentication' ) == 'windowsauth' ) ) {
497  return Status::newGood();
498  }
499  $status = $this->getConnection();
500  if ( !$status->isOK() ) {
501  return $status;
502  }
503 
504  $this->setupSchemaVars();
505  $dbName = $this->getVar( 'wgDBname' );
506  $this->db->selectDB( $dbName );
507  $server = $this->getVar( 'wgDBserver' );
508  $password = $this->getVar( 'wgDBpassword' );
509  $schemaName = $this->getVar( 'wgDBmwschema' );
510 
511  if ( $this->getVar( '_WebWindowsAuthentication' ) == 'windowsauth' ) {
512  $dbUser = 'windowsauth';
513  $password = 'windowsauth';
514  }
515 
516  if ( $this->getVar( '_CreateDBAccount' ) ) {
517  $tryToCreate = true;
518  } else {
519  $tryToCreate = false;
520  }
521 
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 );
528 
529  if ( !$this->loginExists( $dbUser ) ) {
530  try {
531  $this->db->begin();
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" );
537  $this->db->commit();
538  $grantableNames[] = $dbUser;
539  } catch ( DBQueryError $dqe ) {
540  $this->db->rollback();
541  $status->warning( 'config-install-user-create-failed', $dbUser, $dqe->getText() );
542  }
543  } elseif ( !$this->userExists( $dbUser ) ) {
544  try {
545  $this->db->begin();
546  $this->db->selectDB( $dbName );
547  $this->db->query( "CREATE USER $escUser FOR LOGIN $escUser WITH DEFAULT_SCHEMA = $escSchema" );
548  $this->db->commit();
549  $grantableNames[] = $dbUser;
550  } catch ( DBQueryError $dqe ) {
551  $this->db->rollback();
552  $status->warning( 'config-install-user-create-failed', $dbUser, $dqe->getText() );
553  }
554  } else {
555  $status->warning( 'config-install-user-alreadyexists', $dbUser );
556  $grantableNames[] = $dbUser;
557  }
558  }
559 
560  // Try to grant to all the users we know exist or we were able to create
561  $this->db->selectDB( $dbName );
562  foreach ( $grantableNames as $name ) {
563  try {
564  // First try to grant full permissions
565  $fullPrivArr = array(
566  'BACKUP DATABASE', 'BACKUP LOG', 'CREATE FUNCTION', 'CREATE PROCEDURE',
567  'CREATE TABLE', 'CREATE VIEW', 'CREATE FULLTEXT CATALOG', 'SHOWPLAN'
568  );
569  $fullPrivList = implode( ', ', $fullPrivArr );
570  $this->db->begin();
571  $this->db->query( "GRANT $fullPrivList ON DATABASE :: $escDb TO $escUser", __METHOD__ );
572  $this->db->query( "GRANT CONTROL ON SCHEMA :: $escSchema TO $escUser", __METHOD__ );
573  $this->db->commit();
574  } catch ( DBQueryError $dqe ) {
575  // If that fails, try to grant the limited subset specified in $this->webUserPrivs
576  try {
577  $privList = implode( ', ', $this->webUserPrivs );
578  $this->db->rollback();
579  $this->db->begin();
580  $this->db->query( "GRANT $privList ON SCHEMA :: $escSchema TO $escUser", __METHOD__ );
581  $this->db->commit();
582  } catch ( DBQueryError $dqe ) {
583  $this->db->rollback();
584  $status->fatal( 'config-install-user-grant-failed', $dbUser, $dqe->getText() );
585  }
586  // Also try to grant SHOWPLAN on the db, but don't fail if we can't
587  // (just makes a couple things in mediawiki run slower since
588  // we have to run SELECT COUNT(*) instead of getting the query plan)
589  try {
590  $this->db->query( "GRANT SHOWPLAN ON DATABASE :: $escDb TO $escUser", __METHOD__ );
591  } catch ( DBQueryError $dqe ) {
592  }
593  }
594  }
595 
596  return $status;
597  }
598 
599  public function createTables() {
600  $status = parent::createTables();
601 
602  // Do last-minute stuff like fulltext indexes (since they can't be inside a transaction)
603  if ( $status->isOk() ) {
604  $searchindex = $this->db->tableName( 'searchindex' );
605  $schema = $this->db->addIdentifierQuotes( $this->getVar( 'wgDBmwschema' ) );
606  try {
607  $this->db->query( "CREATE FULLTEXT INDEX ON $searchindex (si_title, si_text) KEY INDEX si_page ON $schema" );
608  } catch ( DBQueryError $dqe ) {
609  $status->fatal( 'config-install-tables-failed', $dqe->getText() );
610  }
611  }
612 
613  return $status;
614  }
615 
616  public function getGlobalDefaults() {
617  // The default $wgDBmwschema is null, which breaks Postgres and other DBMSes that require
618  // the use of a schema, so we need to set it here
619  return array_merge( parent::getGlobalDefaults(), array(
620  'wgDBmwschema' => 'mediawiki',
621  ) );
622  }
623 
629  private function loginExists( $user ) {
630  $res = $this->db->selectField( 'sys.sql_logins', 1, array( 'name' => $user ) );
631  return (bool)$res;
632  }
633 
640  private function userExists( $user ) {
641  $res = $this->db->selectField( 'sys.sysusers', 1, array( 'name' => $user ) );
642  return (bool)$res;
643  }
644 
650  private function databaseExists( $dbName ) {
651  $res = $this->db->selectField( 'sys.databases', 1, array( 'name' => $dbName ) );
652  return (bool)$res;
653  }
654 
661  private function schemaExists( $schemaName ) {
662  $res = $this->db->selectField( 'sys.schemas', 1, array( 'name' => $schemaName ) );
663  return (bool)$res;
664  }
665 
672  private function catalogExists( $catalogName ) {
673  $res = $this->db->selectField( 'sys.fulltext_catalogs', 1, array( 'name' => $catalogName ) );
674  return (bool)$res;
675  }
676 
682  public function getSchemaVars() {
683  return array(
684  'wgDBname' => $this->getVar( 'wgDBname' ),
685  'wgDBmwschema' => $this->getVar( 'wgDBmwschema' ),
686  'wgDBuser' => $this->getVar( 'wgDBuser' ),
687  'wgDBpassword' => $this->getVar( 'wgDBpassword' ),
688  );
689  }
690 
691  public function getLocalSettings() {
692  $schema = LocalSettingsGenerator::escapePhpString( $this->getVar( 'wgDBmwschema' ) );
693  $prefix = LocalSettingsGenerator::escapePhpString( $this->getVar( 'wgDBprefix' ) );
694  $windowsauth = $this->getVar( 'wgDBWindowsAuthentication' ) ? 'true' : 'false';
695 
696  return "# MSSQL specific settings
697 \$wgDBWindowsAuthentication = {$windowsauth};
698 \$wgDBmwschema = \"{$schema}\";
699 \$wgDBprefix = \"{$prefix}\";";
700  }
701 }
DBExpectedError\getText
getText()
Definition: DatabaseError.php:53
MssqlInstaller\submitSettingsForm
submitSettingsForm()
Definition: MssqlInstaller.php:393
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
MssqlInstaller\submitConnectForm
submitConnectForm()
Set variables based on the request array, assuming it was submitted via the form returned by getConne...
Definition: MssqlInstaller.php:136
MssqlInstaller\loginExists
loginExists( $user)
Try to see if the login exists.
Definition: MssqlInstaller.php:629
DatabaseInstaller\checkExtension
static checkExtension( $name)
Convenience function.
Definition: DatabaseInstaller.php:326
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
DatabaseInstaller\getConnection
getConnection()
Connect to the database using the administrative user/password currently defined in the session.
Definition: DatabaseInstaller.php:145
DatabaseInstaller\getPasswordBox
getPasswordBox( $var, $label, $attribs=array(), $helpData="")
Get a labelled password box to configure a local variable.
Definition: DatabaseInstaller.php:425
MssqlInstaller\$webUserPrivs
$webUserPrivs
Definition: MssqlInstaller.php:53
Status\newGood
static newGood( $value=null)
Factory function for good results.
Definition: Status.php:77
DatabaseInstaller\getCheckBox
getCheckBox( $var, $label, $attribs=array(), $helpData="")
Get a labelled checkbox to configure a local boolean variable.
Definition: DatabaseInstaller.php:451
$s
$s
Definition: mergeMessageFileList.php:156
MssqlInstaller\setupUser
setupUser()
Definition: MssqlInstaller.php:492
MssqlInstaller\createTables
createTables()
Create database tables from scratch.
Definition: MssqlInstaller.php:599
DatabaseInstaller\getTextBox
getTextBox( $var, $label, $attribs=array(), $helpData="")
Get a labelled text box to configure a local variable.
Definition: DatabaseInstaller.php:398
MssqlInstaller\getLocalSettings
getLocalSettings()
Get the DBMS-specific options for LocalSettings.php generation.
Definition: MssqlInstaller.php:691
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
MssqlInstaller\isCompiled
isCompiled()
Definition: MssqlInstaller.php:71
DBQueryError
Definition: DatabaseError.php:306
MssqlInstaller\getConnectForm
getConnectForm()
Definition: MssqlInstaller.php:78
Html\element
static element( $element, $attribs=array(), $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
Definition: Html.php:141
MssqlInstaller\getSchemaVars
getSchemaVars()
Get variables to substitute into tables.sql and the SQL patch files.
Definition: MssqlInstaller.php:682
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
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\getRadioSet
getRadioSet( $params)
Get a set of labelled radio buttons.
Definition: DatabaseInstaller.php:478
MssqlInstaller\catalogExists
catalogExists( $catalogName)
Try to see if a given fulltext catalog exists We assume we already have the appropriate database sele...
Definition: MssqlInstaller.php:672
DatabaseInstaller\$db
DatabaseBase $db
The database connection.
Definition: DatabaseInstaller.php:44
MssqlInstaller\setupDatabase
setupDatabase()
Definition: MssqlInstaller.php:465
MssqlInstaller\$globalNames
$globalNames
Definition: MssqlInstaller.php:32
MssqlInstaller\userExists
userExists( $user)
Try to see if the user account exists We assume we already have the appropriate database selected.
Definition: MssqlInstaller.php:640
$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
MssqlInstaller\preInstall
preInstall()
Allow DB installers a chance to make last-minute changes before installation occurs.
Definition: MssqlInstaller.php:453
$version
$version
Definition: parserTests.php:86
MssqlInstaller\schemaExists
schemaExists( $schemaName)
Try to see if a given schema exists We assume we already have the appropriate database selected.
Definition: MssqlInstaller.php:661
DatabaseInstaller
Base class for DBMS-specific installation helper classes.
Definition: DatabaseInstaller.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
MssqlInstaller\preUpgrade
preUpgrade()
Allow DB installers a chance to make checks before upgrade.
Definition: MssqlInstaller.php:222
MssqlInstaller\databaseExists
databaseExists( $dbName)
Try to see if a given database exists.
Definition: MssqlInstaller.php:650
$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
MssqlInstaller
Class for setting up the MediaWiki database using Microsoft SQL Server.
Definition: MssqlInstaller.php:30
MssqlInstaller\getName
getName()
Definition: MssqlInstaller.php:64
MssqlInstaller\openConnection
openConnection()
Definition: MssqlInstaller.php:190
MssqlInstaller\canCreateAccounts
canCreateAccounts()
Return true if the install user can create accounts.
Definition: MssqlInstaller.php:248
MssqlInstaller\$minimumVersion
$minimumVersion
Definition: MssqlInstaller.php:48
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\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
MssqlInstaller\getGlobalDefaults
getGlobalDefaults()
Get a name=>value map of MW configuration globals for the default values.
Definition: MssqlInstaller.php:616
MssqlInstaller\getSettingsForm
getSettingsForm()
Definition: MssqlInstaller.php:342
MssqlInstaller\$internalDefaults
$internalDefaults
Definition: MssqlInstaller.php:42
$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