added $wgUseValidation
[lhc/web/wiklou.git] / install.php
index 21c1deb..c1b3a8c 100644 (file)
@@ -1,9 +1,11 @@
-<?
+<?php
+
+die("obsolete; remove this file befor 1.3.0 release\n");
 
 # Install software and create new empty database.
 #
 
-include( "./install-utils.inc" );
+include_once( "./install-utils.inc" );
 install_version_checks();
 
 if ( ! ( is_readable( "./LocalSettings.php" )
@@ -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,25 +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_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 );
@@ -96,21 +112,26 @@ copyfile( ".", "Version.php", $IP );
 #
 # Make and initialize database
 #
-print "\n* * *\nWarning! This script will completely erase the\n" .
+print "\n* * *\nWarning! This script will completely erase any\n" .
   "existing database \"{$wgDBname}\" and all its contents.\n" .
   "Are you sure you want to do this? (yes/no) ";
 
 $response = readconsole();
 if ( ! ( "Y" == $response{0} || "y" == $response{0} ) ) { exit(); }
 
-print "\nYou should have already created a root password for the database.\n" .
-  "Enter the root password here: ";
-
-$rootpw = readconsole();
+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, "root", $rootpw, "", 1 );
@@ -173,20 +194,49 @@ function populatedata() {
        $sql = "DELETE FROM user";
        $wgDatabase->query( $sql, $fname );
 
-       $u = User::newFromName( "WikiSysop" );
-       if ( 0 == $u->idForName() ) {
-               $u->addToDatabase();
-               $u->setPassword( $wgDBadminpassword );
-               $u->addRight( "sysop" );
-               $u->saveSettings();
+       print "Do you want to create a sysop account? A sysop can protect,\n";
+       print "delete and undelete pages and ban users. Recomended. [Y/n] ";
+       $response = readconsole();
+       if(strtolower($response)!="n") {
+               print "Enter the username [Sysop]: ";
+               $sysop_user=readconsole();
+               if(!$sysop_user) { $sysop_user="Sysop"; }
+               while(!$sysop_password) {
+                       print "Enter the password: ";
+                       $sysop_password=readconsole();
+               }
+               $u = User::newFromName( $sysop_user );
+               if ( 0 == $u->idForName() ) {
+                       $u->addToDatabase();
+                       $u->setPassword( $sysop_password );
+                       $u->addRight( "sysop" );
+                       $u->saveSettings();
+               } else {
+                       print "Could not create user - already exists!\n";
+               }
        }
-       $u = User::newFromName( "WikiDeveloper" );
-       if ( 0 == $u->idForName() ) {
-               $u->addToDatabase();
-               $u->setPassword( $wgDBadminpassword );
-               $u->addRight( "sysop" );
-               $u->addRight( "developer" );
-               $u->saveSettings();
+       print "Do you want to create a sysop+developer account? A developer\n";
+       print "can switch the database to read-only mode and run any type of\n";
+       print "query through a web interface. [Y/n] ";
+       $response=readconsole();
+       if(strtolower($response)!="n") {
+               print "Enter the username [Developer]: ";
+               $developer_user=readconsole();
+               if(!$developer_user) { $developer_user="Developer"; }
+               while (!$developer_password) {
+                       print "Enter the password: ";
+                       $developer_password=readconsole();
+               }               
+               $u = User::newFromName( $developer_user );
+               if ( 0 == $u->idForName() ) {
+                       $u->addToDatabase();
+                       $u->setPassword( $developer_password );
+                       $u->addRight( "sysop" );
+                       $u->addRight( "developer" );
+                       $u->saveSettings();
+               } else {
+                       print "Could not create user - already exists!\n";
+               }
        }
        
        $wns = Namespace::getWikipedia();