installer: Allow specifying where LocalSettings.php should be saved
authorKunal Mehta <legoktm@member.fsf.org>
Mon, 20 Jun 2016 17:22:51 +0000 (10:22 -0700)
committerKunal Mehta <legoktm@member.fsf.org>
Tue, 21 Jun 2016 14:53:15 +0000 (07:53 -0700)
This allows software packages to specify where the LocalSettings.php
file should be saved to when the user is downloading it from the web
installer.

Bug: T123151
Change-Id: I06ded602be9aac0a10773e9d85c4d1585a70933b

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

index 4c4e6b7..c08212e 100644 (file)
@@ -1156,6 +1156,20 @@ class WebInstaller extends Installer {
                return Html::rawElement( 'div', [ 'class' => 'config-download-link' ], $anchor );
        }
 
+       /**
+        * If the software package wants the LocalSettings.php file
+        * to be placed in a specific location, override this function
+        * (see mw-config/overrides/README) to return the path of
+        * where the file should be saved, or false for a generic
+        * "in the base of your install"
+        *
+        * @since 1.27
+        * @return string|bool
+        */
+       public function getLocalSettingsLocation() {
+               return false;
+       }
+
        /**
         * @return bool
         */
index 11a1833..456058e 100644 (file)
@@ -37,13 +37,20 @@ class WebInstallerComplete extends WebInstallerPage {
 
                $this->startForm();
                $this->parent->disableLinkPopups();
+               $location = $this->parent->getLocalSettingsLocation();
+               $msg = 'config-install-done';
+               if ( $location !== false ) {
+                       // config-install-done-path
+                       $msg .= '-path';
+               }
                $this->addHTML(
                        $this->parent->getInfoBox(
-                               wfMessage( 'config-install-done',
+                               wfMessage( $msg,
                                        $lsUrl,
                                        $this->getVar( 'wgServer' ) .
                                        $this->getVar( 'wgScriptPath' ) . '/index.php',
-                                       '<downloadlink/>'
+                                       '<downloadlink/>',
+                                       $location ?: ''
                                )->plain(), 'tick-32.png'
                        )
                );
index 2b7886a..79383f3 100644 (file)
        "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>.",
+       "config-install-done-path": "<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 at <code>$4</code>. 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>.",
        "config-download-localsettings": "Download <code>LocalSettings.php</code>",
        "config-help": "help",
        "config-help-tooltip": "click to expand",
index 66a24c0..69a6830 100644 (file)
        "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.",
+       "config-install-done-path": "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.\n* $4 is the filesystem location of where the LocalSettings.php file should be saved to.",
        "config-download-localsettings": "The link text used in the download link in config-install-done.",
        "config-help": "This is used in help boxes.\n{{Identical|Help}}",
        "config-help-tooltip": "Tooltip for the 'help' links ({{msg-mw|config-help}}), to make it clear they'll expand in place rather than open a new page",