r89624 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89623‎ | r89624 | r89625 >
Date:05:11, 7 June 2011
Author:tstarling
Status:resolved
Tags:
Comment:
* Restored the page shown when LocalSettings.php is missing to how it was before r85918. That template is a welcome page, not a "catastrophic error".
* Fixed attempted remote loading of the logo image in index.php's wfDie(). Use the distributed mediawiki.png instead, that's what it's there for.
Modified paths:
  • /trunk/phase3/includes/WebStart.php (modified) (history)
  • /trunk/phase3/includes/templates/NoLocalSettings.php (added) (history)
  • /trunk/phase3/index.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/WebStart.php
@@ -111,26 +111,8 @@
112112 # the wiki installer needs to be launched or the generated file uploaded to
113113 # the root wiki directory
114114 if( !file_exists( MW_CONFIG_FILE ) ) {
115 - $script = $_SERVER['SCRIPT_NAME'];
116 - $path = htmlspecialchars( str_replace( '//', '/', pathinfo( $script, PATHINFO_DIRNAME ) ) );
117 - $ext = htmlspecialchars( pathinfo( $script, PATHINFO_EXTENSION ) );
118 -
119 - # Check to see if the installer is running
120 - if ( !function_exists( 'session_name' ) ) {
121 - $installerStarted = false;
122 - } else {
123 - session_name( 'mw_installer_session' );
124 - $oldReporting = error_reporting( E_ALL & ~E_NOTICE );
125 - $success = session_start();
126 - error_reporting( $oldReporting );
127 - $installerStarted = ( $success && isset( $_SESSION['installData'] ) );
128 - }
129 -
130 - $please = $installerStarted
131 - ? "Please <a href=\"$path/mw-config/index.$ext\"> complete the installation</a> and download LocalSettings.php."
132 - : "Please <a href=\"$path/mw-config/index.$ext\"> set up the wiki</a> first.";
133 -
134 - wfDie( "<p>LocalSettings.php not found.</p><p>$please</p>" );
 115+ require_once( "$IP/includes/templates/NoLocalSettings.php" );
 116+ die();
135117 }
136118
137119 # Include site settings. $IP may be changed (hopefully before the AutoLoader is invoked)
Index: trunk/phase3/includes/templates/NoLocalSettings.php
@@ -0,0 +1,64 @@
 2+<?php
 3+/**
 4+ * Template used when there is no LocalSettings.php file
 5+ *
 6+ * @file
 7+ * @ingroup Templates
 8+ */
 9+
 10+if ( !isset( $wgVersion ) ) {
 11+ $wgVersion = 'VERSION';
 12+}
 13+$script = $_SERVER['SCRIPT_NAME'];
 14+$path = pathinfo( $script, PATHINFO_DIRNAME ) . '/';
 15+$path = str_replace( '//', '/', $path );
 16+$ext = pathinfo( $script, PATHINFO_EXTENSION );
 17+
 18+# Check to see if the installer is running
 19+if ( !function_exists( 'session_name' ) ) {
 20+ $installerStarted = false;
 21+} else {
 22+ session_name( 'mw_installer_session' );
 23+ $oldReporting = error_reporting( E_ALL & ~E_NOTICE );
 24+ $success = session_start();
 25+ error_reporting( $oldReporting );
 26+ $installerStarted = ( $success && isset( $_SESSION['installData'] ) );
 27+}
 28+?>
 29+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 30+<html xmlns='http://www.w3.org/1999/xhtml' lang='en'>
 31+ <head>
 32+ <title>MediaWiki <?php echo htmlspecialchars( $wgVersion ) ?></title>
 33+ <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
 34+ <style type='text/css' media='screen'>
 35+ html, body {
 36+ color: #000;
 37+ background-color: #fff;
 38+ font-family: sans-serif;
 39+ text-align: center;
 40+ }
 41+
 42+ h1 {
 43+ font-size: 150%;
 44+ }
 45+ </style>
 46+ </head>
 47+ <body>
 48+ <img src="<?php echo htmlspecialchars( $path ) ?>skins/common/images/mediawiki.png" alt='The MediaWiki logo' />
 49+
 50+ <h1>MediaWiki <?php echo htmlspecialchars( $wgVersion ) ?></h1>
 51+ <div class='error'>
 52+ <p>LocalSettings.php not found.</p>
 53+ <p>
 54+ <?php
 55+ if ( $installerStarted ) {
 56+ echo( "Please <a href=\"" . htmlspecialchars( $path ) . "mw-config/index." . htmlspecialchars( $ext ) . "\"> complete the installation</a> and download LocalSettings.php." );
 57+ } else {
 58+ echo( "Please <a href=\"" . htmlspecialchars( $path ) . "mw-config/index." . htmlspecialchars( $ext ) . "\"> set up the wiki</a> first." );
 59+ }
 60+ ?>
 61+ </p>
 62+
 63+ </div>
 64+ </body>
 65+</html>
Property changes on: trunk/phase3/includes/templates/NoLocalSettings.php
___________________________________________________________________
Added: svn:mergeinfo
166 Merged /branches/REL1_15/phase3/includes/templates/NoLocalSettings.php:r51646
267 Merged /branches/sqlite/includes/templates/NoLocalSettings.php:r58211-58321
368 Merged /branches/new-installer/phase3/includes/templates/NoLocalSettings.php:r43664-66004
469 Merged /branches/wmf-deployment/includes/templates/NoLocalSettings.php:r53381
Added: svn:eol-style
570 + native
Index: trunk/phase3/index.php
@@ -180,9 +180,15 @@
181181 $version = isset( $wgVersion ) && $wgVersion
182182 ? htmlspecialchars( $wgVersion )
183183 : '';
 184+
 185+ $script = $_SERVER['SCRIPT_NAME'];
 186+ $path = pathinfo( $script, PATHINFO_DIRNAME ) . '/';
 187+ $path = str_replace( '//', '/', $path );
 188+
184189 $logo = isset( $wgLogo ) && $wgLogo
185190 ? $wgLogo
186 - : 'http://upload.wikimedia.org/wikipedia/commons/1/1c/MediaWiki_logo.png';
 191+ : $path . 'skins/common/images/mediawiki.png';
 192+ $encLogo = htmlspecialchars( $logo );
187193
188194 header( $_SERVER['SERVER_PROTOCOL'] . ' 500 MediaWiki configuration Error', true, 500 );
189195 header( 'Content-type: text/html; charset=UTF-8' );

Follow-up revisions

RevisionCommit summaryAuthorDate
r89625* Fix for r89624: fixed logo HTML escapingtstarling05:22, 7 June 2011
r89626MFT r89624, r89625: restored NoLocalSettings.phptstarling05:39, 7 June 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r85918Improvements to handling of 'catastrophic' errors, like unsupported PHP versi...happy-melon20:38, 12 April 2011

Status & tagging log