X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Finstaller%2FDatabaseInstaller.php;h=79bd961d47266489bfadf96c5ebe87234efe298d;hp=6ccf2d55d34b49eb2388315b412a9ccd8f892183;hb=e3bd13db0c285f312e31bb1b7271af4628cca80c;hpb=9e331cd4c3c13bce12bbd6f5ab24ce8c0016e3bb diff --git a/includes/installer/DatabaseInstaller.php b/includes/installer/DatabaseInstaller.php index 6ccf2d55d3..79bd961d47 100644 --- a/includes/installer/DatabaseInstaller.php +++ b/includes/installer/DatabaseInstaller.php @@ -50,14 +50,14 @@ abstract class DatabaseInstaller { * * @var array */ - protected $internalDefaults = array(); + protected $internalDefaults = []; /** * Array of MW configuration globals this class uses. * * @var array */ - protected $globalNames = array(); + protected $globalNames = []; /** * Return the internal name, e.g. 'mysql', or 'sqlite'. @@ -192,7 +192,7 @@ abstract class DatabaseInstaller { $this->db->begin( __METHOD__ ); $error = $this->db->sourceFile( - call_user_func( array( $this->db, $sourceFileMethod ) ) + call_user_func( [ $this->db, $sourceFileMethod ] ) ); if ( $error !== true ) { $this->db->reportQueryError( $error, 0, '', __METHOD__ ); @@ -202,7 +202,7 @@ abstract class DatabaseInstaller { $this->db->commit( __METHOD__ ); } // Resume normal operations - if ( $status->isOk() ) { + if ( $status->isOK() ) { $this->enableLB(); } @@ -238,7 +238,7 @@ abstract class DatabaseInstaller { } // Now run updates to create tables for old extensions - DatabaseUpdater::newForDB( $this->db )->doUpdates( array( 'extensions' ) ); + DatabaseUpdater::newForDB( $this->db )->doUpdates( [ 'extensions' ] ); return $status; } @@ -256,7 +256,7 @@ abstract class DatabaseInstaller { * @return array */ public function getSchemaVars() { - return array(); + return []; } /** @@ -287,8 +287,8 @@ abstract class DatabaseInstaller { if ( !$status->isOK() ) { throw new MWException( __METHOD__ . ': unexpected DB connection error' ); } - LBFactory::setInstance( new LBFactorySingle( array( - 'connection' => $status->value ) ) ); + LBFactory::setInstance( new LBFactorySingle( [ + 'connection' => $status->value ] ) ); } /** @@ -301,7 +301,7 @@ abstract class DatabaseInstaller { $this->enableLB(); $ret = true; - ob_start( array( $this, 'outputHandler' ) ); + ob_start( [ $this, 'outputHandler' ] ); $up = DatabaseUpdater::newForDB( $this->db ); try { $up->doUpdates(); @@ -373,7 +373,7 @@ abstract class DatabaseInstaller { * @return array */ public function getGlobalDefaults() { - $defaults = array(); + $defaults = []; foreach ( $this->getGlobalNames() as $var ) { if ( isset( $GLOBALS[$var] ) ) { $defaults[$var] = $GLOBALS[$var]; @@ -426,21 +426,21 @@ abstract class DatabaseInstaller { * @param string $helpData * @return string */ - public function getTextBox( $var, $label, $attribs = array(), $helpData = "" ) { + public function getTextBox( $var, $label, $attribs = [], $helpData = "" ) { $name = $this->getName() . '_' . $var; $value = $this->getVar( $var ); if ( !isset( $attribs ) ) { - $attribs = array(); + $attribs = []; } - return $this->parent->getTextBox( array( + return $this->parent->getTextBox( [ 'var' => $var, 'label' => $label, 'attribs' => $attribs, 'controlName' => $name, 'value' => $value, 'help' => $helpData - ) ); + ] ); } /** @@ -453,21 +453,21 @@ abstract class DatabaseInstaller { * @param string $helpData * @return string */ - public function getPasswordBox( $var, $label, $attribs = array(), $helpData = "" ) { + public function getPasswordBox( $var, $label, $attribs = [], $helpData = "" ) { $name = $this->getName() . '_' . $var; $value = $this->getVar( $var ); if ( !isset( $attribs ) ) { - $attribs = array(); + $attribs = []; } - return $this->parent->getPasswordBox( array( + return $this->parent->getPasswordBox( [ 'var' => $var, 'label' => $label, 'attribs' => $attribs, 'controlName' => $name, 'value' => $value, 'help' => $helpData - ) ); + ] ); } /** @@ -479,18 +479,18 @@ abstract class DatabaseInstaller { * @param string $helpData Optional. * @return string */ - public function getCheckBox( $var, $label, $attribs = array(), $helpData = "" ) { + public function getCheckBox( $var, $label, $attribs = [], $helpData = "" ) { $name = $this->getName() . '_' . $var; $value = $this->getVar( $var ); - return $this->parent->getCheckBox( array( + return $this->parent->getCheckBox( [ 'var' => $var, 'label' => $label, 'attribs' => $attribs, 'controlName' => $name, 'value' => $value, 'help' => $helpData - ) ); + ] ); } /** @@ -554,17 +554,17 @@ abstract class DatabaseInstaller { */ public function getInstallUserBox() { return Html::openElement( 'fieldset' ) . - Html::element( 'legend', array(), wfMessage( 'config-db-install-account' )->text() ) . + Html::element( 'legend', [], wfMessage( 'config-db-install-account' )->text() ) . $this->getTextBox( '_InstallUser', 'config-db-username', - array( 'dir' => 'ltr' ), + [ 'dir' => 'ltr' ], $this->parent->getHelpBox( 'config-db-install-username' ) ) . $this->getPasswordBox( '_InstallPassword', 'config-db-password', - array( 'dir' => 'ltr' ), + [ 'dir' => 'ltr' ], $this->parent->getHelpBox( 'config-db-install-password' ) ) . Html::closeElement( 'fieldset' ); @@ -575,7 +575,7 @@ abstract class DatabaseInstaller { * @return Status */ public function submitInstallUserBox() { - $this->setVarsFromRequest( array( '_InstallUser', '_InstallPassword' ) ); + $this->setVarsFromRequest( [ '_InstallUser', '_InstallPassword' ] ); return Status::newGood(); } @@ -590,12 +590,12 @@ abstract class DatabaseInstaller { public function getWebUserBox( $noCreateMsg = false ) { $wrapperStyle = $this->getVar( '_SameAccount' ) ? 'display: none' : ''; $s = Html::openElement( 'fieldset' ) . - Html::element( 'legend', array(), wfMessage( 'config-db-web-account' )->text() ) . + Html::element( 'legend', [], wfMessage( 'config-db-web-account' )->text() ) . $this->getCheckBox( '_SameAccount', 'config-db-web-account-same', - array( 'class' => 'hideShowRadio', 'rel' => 'dbOtherAccount' ) + [ 'class' => 'hideShowRadio', 'rel' => 'dbOtherAccount' ] ) . - Html::openElement( 'div', array( 'id' => 'dbOtherAccount', 'style' => $wrapperStyle ) ) . + Html::openElement( 'div', [ 'id' => 'dbOtherAccount', 'style' => $wrapperStyle ] ) . $this->getTextBox( 'wgDBuser', 'config-db-username' ) . $this->getPasswordBox( 'wgDBpassword', 'config-db-password' ) . $this->parent->getHelpBox( 'config-db-web-help' ); @@ -616,7 +616,7 @@ abstract class DatabaseInstaller { */ public function submitWebUserBox() { $this->setVarsFromRequest( - array( 'wgDBuser', 'wgDBpassword', '_SameAccount', '_CreateDBAccount' ) + [ 'wgDBuser', 'wgDBpassword', '_SameAccount', '_CreateDBAccount' ] ); if ( $this->getVar( '_SameAccount' ) ) { @@ -643,17 +643,17 @@ abstract class DatabaseInstaller { } $this->db->selectDB( $this->getVar( 'wgDBname' ) ); - if ( $this->db->selectRow( 'interwiki', '*', array(), __METHOD__ ) ) { + if ( $this->db->selectRow( 'interwiki', '*', [], __METHOD__ ) ) { $status->warning( 'config-install-interwiki-exists' ); return $status; } global $IP; - wfSuppressWarnings(); + MediaWiki\suppressWarnings(); $rows = file( "$IP/maintenance/interwiki.list", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES ); - wfRestoreWarnings(); - $interwikis = array(); + MediaWiki\restoreWarnings(); + $interwikis = []; if ( !$rows ) { return Status::newFatal( 'config-install-interwiki-list' ); } @@ -664,7 +664,7 @@ abstract class DatabaseInstaller { } $row .= "|"; $interwikis[] = array_combine( - array( 'iw_prefix', 'iw_url', 'iw_local', 'iw_api', 'iw_wikiid' ), + [ 'iw_prefix', 'iw_url', 'iw_local', 'iw_api', 'iw_wikiid' ], explode( '|', $row ) ); }