using new commandLine.inc style, readconsole() moved to install-utils()
[lhc/web/wiklou.git] / install.php
index c74b684..dec2020 100644 (file)
@@ -1,4 +1,6 @@
-<?
+<?php
+
+die("obsolete; remove this file befor 1.3.0 release\n");
 
 # Install software and create new empty database.
 #
@@ -15,9 +17,13 @@ if ( ! ( is_readable( "./LocalSettings.php" )
 }
 
 $DP = "./includes";
-include_once( "./LocalSettings.php" );
-include_once( "./AdminSettings.php" );
-include_once( "./maintenance/InitialiseMessages.inc" );
+require_once( "./LocalSettings.php" );
+require_once( "./AdminSettings.php" );
+require_once( "./maintenance/InitialiseMessages.inc" );
+
+if( $wgSitename == "MediaWiki" ) {
+       die( "You must set the site name in \$wgSitename before installation.\n\n" );
+}
 
 if ( $wgUseTeX && ( ! is_executable( "./math/texvc" ) ) ) {
        print "To use math functions, you must first compile texvc by\n" .
@@ -48,26 +54,35 @@ print "Copying files...\n";
 
 copyfile( ".", "LocalSettings.php", $IP );
 copyfile( ".", "Version.php", $IP );
+copyfile( ".", "index.php", $IP );
+copyfile( ".", "redirect.php", $IP );
+
+# compatibility with older versions, can be removed in a year or so
+# (written in Feb 2004)
 copyfile( ".", "wiki.phtml", $IP );
 copyfile( ".", "redirect.phtml", $IP );
-copyfile( ".", "texvc.phtml", $IP );
 
 copydirectory( "./includes", $IP );
 copydirectory( "./stylesheets", $wgStyleSheetDirectory );
 
 copyfile( "./images", "wiki.png", $wgUploadDirectory );
-copyfile( "./images", "button_bold.gif", $wgUploadDirectory );
-copyfile( "./images", "button_extlink.gif", $wgUploadDirectory );
-copyfile( "./images", "button_headline.gif", $wgUploadDirectory );
-copyfile( "./images", "button_hr.gif", $wgUploadDirectory );
-copyfile( "./images", "button_image.gif", $wgUploadDirectory );
-copyfile( "./images", "button_italic.gif", $wgUploadDirectory );
-copyfile( "./images", "button_link.gif", $wgUploadDirectory );
-copyfile( "./images", "button_math.gif", $wgUploadDirectory );
-copyfile( "./images", "button_media.gif", $wgUploadDirectory );
-copyfile( "./images", "button_nowiki.gif", $wgUploadDirectory );
-copyfile( "./images", "button_sig.gif", $wgUploadDirectory );
-copyfile( "./images", "button_template.gif", $wgUploadDirectory );
+copyfile( "./images", "button_bold.png", $wgUploadDirectory );
+copyfile( "./images", "button_extlink.png", $wgUploadDirectory );
+copyfile( "./images", "button_headline.png", $wgUploadDirectory );
+copyfile( "./images", "button_hr.png", $wgUploadDirectory );
+copyfile( "./images", "button_image.png", $wgUploadDirectory );
+copyfile( "./images", "button_italic.png", $wgUploadDirectory );
+copyfile( "./images", "button_link.png", $wgUploadDirectory );
+copyfile( "./images", "button_math.png", $wgUploadDirectory );
+copyfile( "./images", "button_media.png", $wgUploadDirectory );
+copyfile( "./images", "button_nowiki.png", $wgUploadDirectory );
+copyfile( "./images", "button_sig.png", $wgUploadDirectory );
+copyfile( "./images", "button_template.png", $wgUploadDirectory );
+copyfile( "./images", "magnify-clip.png", $wgUploadDirectory );
+copyfile( "./images", "Arr_.png", $wgUploadDirectory );
+copyfile( "./images", "Arr_r.png", $wgUploadDirectory );
+copyfile( "./images", "Arr_d.png", $wgUploadDirectory );
+copyfile( "./images", "Arr_l.png", $wgUploadDirectory );
 
 copyfile( "./languages", "Language.php", $IP );
 copyfile( "./languages", "LanguageUtf8.php", $IP );
@@ -104,20 +119,22 @@ print "\n* * *\nWarning! This script will completely erase any\n" .
 $response = readconsole();
 if ( ! ( "Y" == $response{0} || "y" == $response{0} ) ) { exit(); }
 
-print "\nFor database access, we are using the data in AdminSettings.php.\n";
-print "If you get any error message, please make sure this information is correct\n";
-print "and you have the rights to create a database using the data provided.\n";
-print "(If you have already created the database, don't worry, the script will\n";
-print "simply skip that step.)\n\n";
-
-global $wgDBadminuser, $wgDBadminpassword;
+print "Please enter your root password for the database server now.\n";
+print "It is used to do the following:\n";
+print "1) Create the database\n";
+print "2) Create the users specified in AdminSettings.php and LocalSettings.php\n\n";
+print "You do not need to create any user accounts yourself!\n\n";
+print "MySQL root password (typing will be visible): ";
+$rootpw=readconsole();
 
 # Include rest of code to get things like internationalized messages.
 #
-include_once( "{$IP}/Setup.php" );
+$wgUseDatabaseMessages = false; # no DB yet
+
+require_once( "{$IP}/Setup.php" );
 $wgTitle = Title::newFromText( "Installation script" );
 
-$wgDatabase = Database::newFromParams( $wgDBserver, $wgDBadminuser, $wgDBadminpassword, "", 1 );
+$wgDatabase = Database::newFromParams( $wgDBserver, "root", $rootpw, "", 1 );
 if ( !$wgDatabase->isOpen() ) {
        print "Could not connect to database on \"{$wgDBserver}\" as root.\n";
        exit();