From 4dba618ae0eae04ef8902be45fa98fd55ef73483 Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Mon, 20 Jun 2016 10:22:51 -0700 Subject: [PATCH] installer: Allow specifying where LocalSettings.php should be saved 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 | 14 ++++++++++++++ includes/installer/WebInstallerComplete.php | 11 +++++++++-- includes/installer/i18n/en.json | 1 + includes/installer/i18n/qqq.json | 1 + 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/includes/installer/WebInstaller.php b/includes/installer/WebInstaller.php index 4c4e6b7ed0..c08212e390 100644 --- a/includes/installer/WebInstaller.php +++ b/includes/installer/WebInstaller.php @@ -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 */ diff --git a/includes/installer/WebInstallerComplete.php b/includes/installer/WebInstallerComplete.php index 11a183314a..456058e455 100644 --- a/includes/installer/WebInstallerComplete.php +++ b/includes/installer/WebInstallerComplete.php @@ -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', - '' + '', + $location ?: '' )->plain(), 'tick-32.png' ) ); diff --git a/includes/installer/i18n/en.json b/includes/installer/i18n/en.json index 2b7886ac74..79383f3818 100644 --- a/includes/installer/i18n/en.json +++ b/includes/installer/i18n/en.json @@ -298,6 +298,7 @@ "config-install-extension-tables": "Creating tables for enabled extensions", "config-install-mainpage-failed": "Could not insert main page: $1", "config-install-done": "Congratulations!\nYou have installed MediaWiki.\n\nThe installer has generated a LocalSettings.php 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\nNote: 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 [$2 enter your wiki].", + "config-install-done-path": "Congratulations!\nYou have installed MediaWiki.\n\nThe installer has generated a LocalSettings.php file.\nIt contains all your configuration.\n\nYou will need to download it and put it at $4. 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\nNote: 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 [$2 enter your wiki].", "config-download-localsettings": "Download LocalSettings.php", "config-help": "help", "config-help-tooltip": "click to expand", diff --git a/includes/installer/i18n/qqq.json b/includes/installer/i18n/qqq.json index 66a24c05c1..69a6830b1b 100644 --- a/includes/installer/i18n/qqq.json +++ b/includes/installer/i18n/qqq.json @@ -316,6 +316,7 @@ "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", -- 2.20.1