MaxSem has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/333817 )

Change subject: Installer: don't treat the existance of main page as an error
......................................................................

Installer: don't treat the existance of main page as an error

It results in CLI installer returning status code 1, messing various
automation such as our own Vagrant.

Change-Id: I7c14596db4ddd91339b2d2af463d851123a00ae7
---
M includes/installer/Installer.php
M includes/installer/i18n/en.json
M includes/installer/i18n/qqq.json
3 files changed, 8 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/17/333817/1

diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php
index d887a13..9c87cf0 100644
--- a/includes/installer/Installer.php
+++ b/includes/installer/Installer.php
@@ -1656,8 +1656,13 @@
         */
        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()
diff --git a/includes/installer/i18n/en.json b/includes/installer/i18n/en.json
index 95d2ba3..db92652 100644
--- a/includes/installer/i18n/en.json
+++ b/includes/installer/i18n/en.json
@@ -298,6 +298,7 @@
        "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>.",
diff --git a/includes/installer/i18n/qqq.json b/includes/installer/i18n/qqq.json
index 7b60ed0..8d10b51 100644
--- a/includes/installer/i18n/qqq.json
+++ b/includes/installer/i18n/qqq.json
@@ -317,6 +317,7 @@
        "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.",

-- 
To view, visit https://gerrit.wikimedia.org/r/333817
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7c14596db4ddd91339b2d2af463d851123a00ae7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MaxSem <maxsem.w...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to