+ [ 'href' => $this->getUrl( [ 'localsettings' => 1 ] ) ],
+ wfMessage( 'config-download-localsettings' )->parse()
+ );
+
+ 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
+ */
+ public function envCheckPath() {
+ // PHP_SELF isn't available sometimes, such as when PHP is CGI but
+ // cgi.fix_pathinfo is disabled. In that case, fall back to SCRIPT_NAME
+ // to get the path to the current script... hopefully it's reliable. SIGH
+ $path = false;
+ if ( !empty( $_SERVER['PHP_SELF'] ) ) {
+ $path = $_SERVER['PHP_SELF'];
+ } elseif ( !empty( $_SERVER['SCRIPT_NAME'] ) ) {
+ $path = $_SERVER['SCRIPT_NAME'];
+ }
+ if ( $path === false ) {
+ $this->showError( 'config-no-uri' );
+ return false;
+ }
+
+ return parent::envCheckPath();
+ }
+
+ public function envPrepPath() {
+ parent::envPrepPath();
+ // PHP_SELF isn't available sometimes, such as when PHP is CGI but
+ // cgi.fix_pathinfo is disabled. In that case, fall back to SCRIPT_NAME
+ // to get the path to the current script... hopefully it's reliable. SIGH
+ $path = false;
+ if ( !empty( $_SERVER['PHP_SELF'] ) ) {
+ $path = $_SERVER['PHP_SELF'];
+ } elseif ( !empty( $_SERVER['SCRIPT_NAME'] ) ) {
+ $path = $_SERVER['SCRIPT_NAME'];
+ }
+ if ( $path !== false ) {
+ $scriptPath = preg_replace( '{^(.*)/(mw-)?config.*$}', '$1', $path );
+
+ $this->setVar( 'wgScriptPath', "$scriptPath" );
+ // Update variables set from Setup.php that are derived from wgScriptPath
+ $this->setVar( 'wgScript', "$scriptPath/index.php" );
+ $this->setVar( 'wgLoadScript', "$scriptPath/load.php" );
+ $this->setVar( 'wgStylePath', "$scriptPath/skins" );
+ $this->setVar( 'wgLocalStylePath', "$scriptPath/skins" );
+ $this->setVar( 'wgExtensionAssetsPath', "$scriptPath/extensions" );
+ $this->setVar( 'wgUploadPath', "$scriptPath/images" );
+ $this->setVar( 'wgResourceBasePath', "$scriptPath" );
+ }
+ }
+
+ /**
+ * @return string
+ */
+ protected function envGetDefaultServer() {
+ return WebRequest::detectServer();