From 43ec5d6a9d7052f46f77b788029d99eb6f48d0cf Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Thu, 4 Jul 2019 23:00:48 +0100 Subject: [PATCH] installer: Avoid hack for 'config-sidebar' rendering Use separate messages for the link labels instead. Bug: T227297 Change-Id: I2fda6ef98117781231a0d42c039d333ef829ea98 --- includes/installer/WebInstaller.php | 18 ++++++++++++++++-- includes/installer/WebInstallerOutput.php | 16 ++++++++++++++++ includes/installer/i18n/en.json | 6 +++++- includes/installer/i18n/qqq.json | 4 ++++ 4 files changed, 41 insertions(+), 3 deletions(-) diff --git a/includes/installer/WebInstaller.php b/includes/installer/WebInstaller.php index 82c1a69c1e..33c06fedc0 100644 --- a/includes/installer/WebInstaller.php +++ b/includes/installer/WebInstaller.php @@ -1092,11 +1092,11 @@ class WebInstaller extends Installer { /** * Helper for Installer::docLink() * + * @internal For use by WebInstallerOutput * @param string $page - * * @return string */ - protected function getDocUrl( $page ) { + public function getDocUrl( $page ) { $query = [ 'page' => $page ]; if ( in_array( $this->currentPageName, $this->pageSequence ) ) { @@ -1121,6 +1121,20 @@ class WebInstaller extends Installer { return Html::element( 'a', [ 'href' => $url ], $linkText ); } + /** + * Helper for sidebar links. + * + * @internal For use in WebInstallerOutput class + * @param string $url + * @param string $linkText + * @return string HTML + */ + public function makeLinkItem( $url, $linkText ) { + return Html::rawElement( 'li', [], + Html::element( 'a', [ 'href' => $url ], $linkText ) + ); + } + /** * Helper for "Download LocalSettings" link. * diff --git a/includes/installer/WebInstallerOutput.php b/includes/installer/WebInstallerOutput.php index cbb9b573df..991e484da7 100644 --- a/includes/installer/WebInstallerOutput.php +++ b/includes/installer/WebInstallerOutput.php @@ -299,11 +299,27 @@ class WebInstallerOutput { plain(); + // Section 1: External links + // @todo FIXME: Migrate to plain link label messages (T227297). foreach ( explode( '----', $message ) as $section ) { echo '
'; echo $this->parent->parse( $section, true ); echo '
'; } + // Section 2: Installer pages + echo '
    '; + foreach ( [ + 'config-sidebar-readme' => 'Readme', + 'config-sidebar-relnotes' => 'ReleaseNotes', + 'config-sidebar-license' => 'Copying', + 'config-sidebar-upgrade' => 'UpgradeDoc', + ] as $msgKey => $pageName ) { + echo $this->parent->makeLinkItem( + $this->parent->getDocUrl( $pageName ), + wfMessage( $msgKey )->text() + ); + } + echo '
'; ?> diff --git a/includes/installer/i18n/en.json b/includes/installer/i18n/en.json index 5b9742b0ca..5f5e452ab0 100644 --- a/includes/installer/i18n/en.json +++ b/includes/installer/i18n/en.json @@ -40,7 +40,11 @@ "config-restart": "Yes, restart it", "config-welcome": "=== Environmental checks ===\nBasic checks will now be performed to see if this environment is suitable for MediaWiki installation.\nRemember to include this information if you seek support on how to complete the installation.", "config-copyright": "=== Copyright and Terms ===\n\n$1\n\nThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.\nSee the GNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA, or [https://www.gnu.org/copyleft/gpl.html read it online].", - "config-sidebar": "* [https://www.mediawiki.org MediaWiki home]\n* [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents User's Guide]\n* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Contents Administrator's Guide]\n* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ FAQ]\n----\n* Read me\n* Release notes\n* Copying\n* Upgrading", + "config-sidebar": "* [https://www.mediawiki.org MediaWiki home]\n* [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents User's Guide]\n* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Contents Administrator's Guide]\n* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ FAQ]", + "config-sidebar-readme": "Read me", + "config-sidebar-relnotes": "Release notes", + "config-sidebar-license": "Copying", + "config-sidebar-upgrade": "Upgrading", "config-env-good": "The environment has been checked.\nYou can install MediaWiki.", "config-env-bad": "The environment has been checked.\nYou cannot install MediaWiki.", "config-env-php": "PHP $1 is installed.", diff --git a/includes/installer/i18n/qqq.json b/includes/installer/i18n/qqq.json index ceb7586c42..6a821b8cff 100644 --- a/includes/installer/i18n/qqq.json +++ b/includes/installer/i18n/qqq.json @@ -65,6 +65,10 @@ "config-welcome": "Notice that the installer is about to check as to whether MediaWiki can be installed.", "config-copyright": "This message follows {{msg-mw|config-env-good}}.\n\nParameters:\n* $1 - copyright and author list", "config-sidebar": "Maximum width for words is 24 characters. Only visible part of the translation counts to this limit.", + "config-sidebar-readme": "Link in sidebar to read the README documentation", + "config-sidebar-relnotes": "Link in sidebar to read the RELEASE-NOTES documentation", + "config-sidebar-license": "Link in sidebar to read the COPYING file, containing the full license text", + "config-sidebar-upgrade": "Link in sidebar to read the UPGRADE documentation", "config-env-good": "See also:\n* {{msg-mw|Config-env-bad}}", "config-env-bad": "See also:\n* {{msg-mw|Config-env-good}}", "config-env-php": "Parameters:\n* $1 - the version of PHP that has been installed\nSee also:\n* {{msg-mw|config-env-php-toolow}}", -- 2.20.1