| Index: trunk/phase3/index.php |
| — | — | @@ -25,58 +25,17 @@ |
| 26 | 26 | # it becomes an entry point, thereby defeating its purpose. |
| 27 | 27 | define( 'MEDIAWIKI', true ); |
| 28 | 28 | require_once( './includes/Defines.php' ); |
| | 29 | +@include_once( './LocalSettings.php' ); # Will die later if not included anyway |
| 29 | 30 | |
| 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 | | - } |
| 46 | 31 | |
| 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 | | - |
| 76 | 32 | # Initialize MediaWiki base class |
| 77 | 33 | require_once( "includes/Wiki.php" ); |
| 78 | 34 | $mediaWiki = new MediaWiki(); |
| 79 | 35 | |
| 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 | + |
| 81 | 40 | OutputPage::setEncodings(); # Not really used yet |
| 82 | 41 | |
| 83 | 42 | # Query string fields |
| — | — | @@ -84,12 +43,12 @@ |
| 85 | 44 | $title = $wgRequest->getVal( 'title' ); |
| 86 | 45 | |
| 87 | 46 | $wgTitle = $mediaWiki->checkInitialQueries( $title,$action,$wgOut, $wgRequest, $wgContLang ); |
| | 47 | + |
| | 48 | +# Is this necessary? Who knows... |
| 88 | 49 | if ($wgTitle == NULL) { |
| 89 | 50 | unset( $wgTitle ); |
| 90 | 51 | } |
| 91 | 52 | |
| 92 | | -wfProfileOut( 'main-misc-setup' ); |
| 93 | | - |
| 94 | 53 | # Setting global variables in mediaWiki |
| 95 | 54 | $mediaWiki->setVal( "Server", $wgServer ); |
| 96 | 55 | $mediaWiki->setVal( "DisableInternalSearch", $wgDisableInternalSearch ); |
| Index: trunk/phase3/includes/Wiki.php |
| — | — | @@ -37,6 +37,30 @@ |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
| | 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 | + /** |
| 41 | 65 | * Initialization of ... everything |
| 42 | 66 | @return Article either the object to become $wgArticle, or NULL |
| 43 | 67 | */ |
| — | — | @@ -63,6 +87,7 @@ |
| 64 | 88 | * Note that $title here is *not* a Title object, but a string! |
| 65 | 89 | */ |
| 66 | 90 | function checkInitialQueries( $title,$action,&$output,$request, $lang) { |
| | 91 | + wfProfileIn( 'MediaWiki::checkInitialQueries' ); |
| 67 | 92 | if ($request->getVal( 'printable' ) == 'yes') { |
| 68 | 93 | $output->setPrintable(); |
| 69 | 94 | } |
| — | — | @@ -84,6 +109,7 @@ |
| 85 | 110 | $lang->findVariantLink( $title, $ret ); |
| 86 | 111 | |
| 87 | 112 | } |
| | 113 | + wfProfileOut( 'MediaWiki::checkInitialQueries' ); |
| 88 | 114 | return $ret ; |
| 89 | 115 | } |
| 90 | 116 | |
| 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 |
| 1 | 29 | + native |
| Name: svn:keywords |
| 2 | 30 | + Author Date Id Revision |