installer: Avoid <doclink/> hack for 'config-sidebar' rendering
authorTimo Tijhof <krinklemail@gmail.com>
Thu, 4 Jul 2019 22:00:48 +0000 (23:00 +0100)
committerKrinkle <krinklemail@gmail.com>
Fri, 5 Jul 2019 18:26:53 +0000 (18:26 +0000)
Use separate messages for the link labels instead.

Bug: T227297
Change-Id: I2fda6ef98117781231a0d42c039d333ef829ea98

includes/installer/WebInstaller.php
includes/installer/WebInstallerOutput.php
includes/installer/i18n/en.json
includes/installer/i18n/qqq.json

index 82c1a69..33c06fe 100644 (file)
@@ -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.
         *
index cbb9b57..991e484 100644 (file)
@@ -299,11 +299,27 @@ class WebInstallerOutput {
        </div>
 <?php
        $message = wfMessage( 'config-sidebar' )->plain();
+       // Section 1: External links
+       // @todo FIXME: Migrate to plain link label messages (T227297).
        foreach ( explode( '----', $message ) as $section ) {
                echo '<div class="portal"><div class="body">';
                echo $this->parent->parse( $section, true );
                echo '</div></div>';
        }
+       // Section 2: Installer pages
+       echo '<div class="portal"><div class="body"><ul>';
+       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 '</ul></div></div>';
 ?>
 </div>
 
index 5b9742b..5f5e452 100644 (file)
        "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 <strong>without any warranty</strong>; without even the implied warranty of <strong>merchantability</strong> or <strong>fitness for a particular purpose</strong>.\nSee the GNU General Public License for more details.\n\nYou should have received <doclink href=Copying>a copy of the GNU General Public License</doclink> 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* <doclink href=Readme>Read me</doclink>\n* <doclink href=ReleaseNotes>Release notes</doclink>\n* <doclink href=Copying>Copying</doclink>\n* <doclink href=UpgradeDoc>Upgrading</doclink>",
+       "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.",
index ceb7586..6a821b8 100644 (file)
        "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}}",