r12645 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:< r12644‎ | r12645 | r12646 >
Date:12:10, 13 January 2006
Author:magnus_manske
Status:old
Tags:
Comment:
Further cleanup of index.php
Modified paths:
  • /trunk/phase3/includes/Wiki.php (modified) (history)
  • /trunk/phase3/index.php (modified) (history)
  • /trunk/phase3/setup_message.html (added) (history)

Diff [purge]

Index: trunk/phase3/index.php
——@@ -25,58 +25,17 @@
2626 # it becomes an entry point, thereby defeating its purpose.
2727 define( 'MEDIAWIKI', true );
2828 require_once( './includes/Defines.php' );
 29+@include_once( './LocalSettings.php' ); # Will die later if not included anyway
2930
30 -if( !file_exists( 'LocalSettings.php' ) ) {
31 - $IP = ".";
32 - require_once( 'includes/DefaultSettings.php' ); # used for printing the version
33 -?>
34 -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
35 -<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
36 - <head>
37 - <title>MediaWiki <?php echo $wgVersion ?></title>
38 - <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
39 - <style type='text/css' media='screen, projection'>
40 - html, body {
41 - color: #000;
42 - background-color: #fff;
43 - font-family: sans-serif;
44 - text-align: center;
45 - }
4631
47 - h1 {
48 - font-size: 150%;
49 - }
50 - </style>
51 - </head>
52 - <body>
53 - <img src='skins/common/images/mediawiki.png' alt='The MediaWiki logo' />
54 -
55 - <h1>MediaWiki <?php echo $wgVersion ?></h1>
56 - <div class='error'>
57 - <?php
58 - if ( file_exists( 'config/LocalSettings.php' ) ) {
59 - echo( "To complete the installation, move <tt>config/LocalSettings.php</tt> to the parent directory." );
60 - } else {
61 - echo( "Please <a href='config/index.php' title='setup'>setup the wiki</a> first." );
62 - }
63 - ?>
64 -
65 - </div>
66 - </body>
67 -</html>
68 -<?php
69 - die();
70 -}
71 -
72 -require_once( './LocalSettings.php' );
73 -require_once( 'includes/Setup.php' );
74 -
75 -
7632 # Initialize MediaWiki base class
7733 require_once( "includes/Wiki.php" );
7834 $mediaWiki = new MediaWiki();
7935
80 -wfProfileIn( 'main-misc-setup' );
 36+
 37+$mediaWiki->checkSetup();
 38+require_once( 'includes/Setup.php' ); # This can't be done in mdiaWiki.php for some weird reason
 39+
8140 OutputPage::setEncodings(); # Not really used yet
8241
8342 # Query string fields
——@@ -84,12 +43,12 @@
8544 $title = $wgRequest->getVal( 'title' );
8645
8746 $wgTitle = $mediaWiki->checkInitialQueries( $title,$action,$wgOut, $wgRequest, $wgContLang );
 47+
 48+# Is this necessary? Who knows...
8849 if ($wgTitle == NULL) {
8950 unset( $wgTitle );
9051 }
9152
92 -wfProfileOut( 'main-misc-setup' );
93 -
9453 # Setting global variables in mediaWiki
9554 $mediaWiki->setVal( "Server", $wgServer );
9655 $mediaWiki->setVal( "DisableInternalSearch", $wgDisableInternalSearch );
Index: trunk/phase3/includes/Wiki.php
——@@ -37,6 +37,30 @@
3838 }
3939
4040 /**
 41+ * Checks if the wiki is set up at all, or configured but not activated
 42+ */
 43+ function checkSetup() {
 44+ if ( file_exists( './LocalSettings.php' ) ) {
 45+ /* LocalSettings exists, commerce normally */
 46+ return;
 47+ }
 48+
 49+ /* LocalSettings is not in the right place, do something */
 50+ $IP = ".";
 51+ require_once( 'includes/DefaultSettings.php' ); # used for printing the version
 52+ $out = file_get_contents( "./setup_message.html" );
 53+ $out = str_replace( "$1", $wgVersion, $out );
 54+ if ( file_exists( 'config/LocalSettings.php' ) ) {
 55+ $msg = "To complete the installation, move <tt>config/LocalSettings.php</tt> to the parent directory.";
 56+ } else {
 57+ $msg = "Please <a href='config/index.php' title='setup'>setup the wiki</a> first.";
 58+ }
 59+ $out = str_replace( "$2", $msg, $out );
 60+ echo $out ;
 61+ die();
 62+ }
 63+
 64+ /**
4165 * Initialization of ... everything
4266 @return Article either the object to become $wgArticle, or NULL
4367 */
——@@ -63,6 +87,7 @@
6488 * Note that $title here is *not* a Title object, but a string!
6589 */
6690 function checkInitialQueries( $title,$action,&$output,$request, $lang) {
 91+ wfProfileIn( 'MediaWiki::checkInitialQueries' );
6792 if ($request->getVal( 'printable' ) == 'yes') {
6893 $output->setPrintable();
6994 }
——@@ -84,6 +109,7 @@
85110 $lang->findVariantLink( $title, $ret );
86111
87112 }
 113+ wfProfileOut( 'MediaWiki::checkInitialQueries' );
88114 return $ret ;
89115 }
90116
Index: trunk/phase3/setup_message.html
——@@ -0,0 +1,27 @@
 2+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 3+<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
 4+ <head>
 5+ <title>MediaWiki $1</title>
 6+ <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
 7+ <style type='text/css' media='screen, projection'>
 8+ html, body {
 9+ color: #000;
 10+ background-color: #fff;
 11+ font-family: sans-serif;
 12+ text-align: center;
 13+ }
 14+
 15+ h1 {
 16+ font-size: 150%;
 17+ }
 18+ </style>
 19+ </head>
 20+ <body>
 21+ <img src='skins/common/images/mediawiki.png' alt='The MediaWiki logo' />
 22+
 23+ <h1>MediaWiki $1</h1>
 24+ <div class='error'>
 25+ $2
 26+ </div>
 27+ </body>
 28+</html>
Property changes on: trunk/phase3/setup_message.html
___________________________________________________________________
Name: svn:eol-style
129 + native
Name: svn:keywords
230 + Author Date Id Revision

Status & tagging log