Bartosz Dziewoński has uploaded a new change for review. https://gerrit.wikimedia.org/r/160224
Change subject: Support for enabling skins in the command-line installer ...................................................................... Support for enabling skins in the command-line installer Whoops, I kind of forgot that this exists. Follow-up to a957836f. Bug: 70815 Change-Id: I6944fe1b1f7a8b77d32fafbca2349645320571f5 --- M includes/installer/CliInstaller.php M includes/installer/Installer.php M includes/installer/WebInstallerPage.php 3 files changed, 27 insertions(+), 18 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/24/160224/1 diff --git a/includes/installer/CliInstaller.php b/includes/installer/CliInstaller.php index 1c7762b..7290740 100644 --- a/includes/installer/CliInstaller.php +++ b/includes/installer/CliInstaller.php @@ -107,6 +107,15 @@ if ( isset( $option['pass'] ) ) { $this->setVar( '_AdminPassword', $option['pass'] ); } + + // Set up the default skins + $skins = $this->findExtensions( 'skins' ); + $this->setVar( '_Skins', $skins ); + + if ( $skins ) { + $skinNames = array_map( 'strtolower', $skins ); + $this->setVar( 'wgDefaultSkin', $this->getDefaultSkin( $skinNames ) ); + } } /** diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index 987925c..7dc1635 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -1469,6 +1469,22 @@ } /** + * Returns a default value to be used for $wgDefaultSkin: the preferred skin, if available among + * the installed skins, or any other one otherwise. + * + * @param string[] $skinNames Names of installed skins. + * @return string + */ + public function getDefaultSkin( array $skinNames ) { + $defaultSkin = $GLOBALS['wgDefaultSkin']; + if ( in_array( $defaultSkin, $skinNames ) ) { + return $defaultSkin; + } else { + return $skinNames[0]; + } + } + + /** * Installs the auto-detected extensions. * * @return Status diff --git a/includes/installer/WebInstallerPage.php b/includes/installer/WebInstallerPage.php index 2a9c54c..2e31e41 100644 --- a/includes/installer/WebInstallerPage.php +++ b/includes/installer/WebInstallerPage.php @@ -1037,7 +1037,7 @@ 'var' => 'wgDefaultSkin', 'itemLabels' => array_fill_keys( $skinNames, 'config-skins-use-as-default' ), 'values' => $skinNames, - 'value' => $this->getVar( 'wgDefaultSkin', $this->getDefaultSkin( $skinNames ) ), + 'value' => $this->getVar( 'wgDefaultSkin', $this->parent->getDefaultSkin( $skinNames ) ), ) ); foreach ( $skins as $skin ) { @@ -1255,22 +1255,6 @@ } /** - * Returns a default value to be used for $wgDefaultSkin: the preferred skin, if available among - * the installed skins, or any other one otherwise. - * - * @param string[] $skinNames Names of installed skins. - * @return string - */ - public function getDefaultSkin( array $skinNames ) { - $defaultSkin = $GLOBALS['wgDefaultSkin']; - if ( in_array( $defaultSkin, $skinNames ) ) { - return $defaultSkin; - } else { - return $skinNames[0]; - } - } - - /** * If the user skips this installer page, we still need to set up the default skins, but ignore * everything else. * @@ -1282,7 +1266,7 @@ if ( $skins ) { $skinNames = array_map( 'strtolower', $skins ); - $this->parent->setVar( 'wgDefaultSkin', $this->getDefaultSkin( $skinNames ) ); + $this->parent->setVar( 'wgDefaultSkin', $this->parent->getDefaultSkin( $skinNames ) ); } return true; -- To view, visit https://gerrit.wikimedia.org/r/160224 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6944fe1b1f7a8b77d32fafbca2349645320571f5 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Bartosz Dziewoński <matma....@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits