Installer: don't treat the existance of main page as an error
authorMax Semenik <maxsem.wiki@gmail.com>
Tue, 24 Jan 2017 00:52:37 +0000 (16:52 -0800)
committerMax Semenik <maxsem.wiki@gmail.com>
Tue, 24 Jan 2017 00:52:37 +0000 (16:52 -0800)
It results in CLI installer returning status code 1, messing various
automation such as our own Vagrant.

Change-Id: I7c14596db4ddd91339b2d2af463d851123a00ae7

includes/installer/Installer.php
includes/installer/i18n/en.json
includes/installer/i18n/qqq.json

index d887a13..9c87cf0 100644 (file)
@@ -1656,8 +1656,13 @@ abstract class Installer {
         */
        protected function createMainpage( DatabaseInstaller $installer ) {
                $status = Status::newGood();
+               $title = Title::newMainPage();
+               if ( $title->exists() ) {
+                       $status->warning( 'config-install-mainpage-exists' );
+                       return $status;
+               }
                try {
-                       $page = WikiPage::factory( Title::newMainPage() );
+                       $page = WikiPage::factory( $title );
                        $content = new WikitextContent(
                                wfMessage( 'mainpagetext' )->inContentLanguage()->text() . "\n\n" .
                                wfMessage( 'mainpagedocfooter' )->inContentLanguage()->text()
index 95d2ba3..db92652 100644 (file)
        "config-install-subscribe-fail": "Unable to subscribe to mediawiki-announce: $1",
        "config-install-subscribe-notpossible": "cURL is not installed and <code>allow_url_fopen</code> is not available.",
        "config-install-mainpage": "Creating main page with default content",
+       "config-install-mainpage-exists": "Main page already exists, skipping",
        "config-install-extension-tables": "Creating tables for enabled extensions",
        "config-install-mainpage-failed": "Could not insert main page: $1",
        "config-install-done": "<strong>Congratulations!</strong>\nYou have installed MediaWiki.\n\nThe installer has generated a <code>LocalSettings.php</code> file.\nIt contains all your configuration.\n\nYou will need to download it and put it in the base of your wiki installation (the same directory as index.php). The download should have started automatically.\n\nIf the download was not offered, or if you cancelled it, you can restart the download by clicking the link below:\n\n$3\n\n<strong>Note:</strong> If you do not do this now, this generated configuration file will not be available to you later if you exit the installation without downloading it.\n\nWhen that has been done, you can <strong>[$2 enter your wiki]</strong>.",
index 7b60ed0..8d10b51 100644 (file)
        "config-install-subscribe-fail": "{{doc-important|\"[[m:mail:mediawiki-announce|mediawiki-announce]]\" is the name of a mailing list and should not be translated.}}\nA message displayed if the MediaWiki installer encounters an error making a request to lists.wikimedia.org which hosts the mailing list.\n* $1 - the HTTP error encountered, reproduced as is (English string)",
        "config-install-subscribe-notpossible": "Error shown when automatically subscribing to the MediaWiki announcements mailing list fails.",
        "config-install-mainpage": "*{{msg-mw|Config-install-database}}\n*{{msg-mw|Config-install-tables}}\n*{{msg-mw|Config-install-schema}}\n*{{msg-mw|Config-install-user}}\n*{{msg-mw|Config-install-interwiki}}\n*{{msg-mw|Config-install-stats}}\n*{{msg-mw|Config-install-keys}}\n*{{msg-mw|Config-install-sysop}}\n*{{msg-mw|Config-install-mainpage}}",
+       "config-install-mainpage-exists": "Warning shown when installer attempts to create main page but it already exists.",
        "config-install-extension-tables": "Notice shown to the user during the install about progress.",
        "config-install-mainpage-failed": "Used as error message. Parameters:\n* $1 - detailed error message",
        "config-install-done": "Parameters:\n* $1 is the URL to LocalSettings download\n* $2 is a link to the wiki.\n* $3 is a download link with attached download icon. The config-download-localsettings message will be used as the link text.",