compatibility modifications in preparation for the new memcached client
[lhc/web/wiklou.git] / install.php
index 21c1deb..2d8db90 100644 (file)
@@ -65,6 +65,7 @@ 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 );
 
@@ -96,17 +97,20 @@ 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.
 #
@@ -173,20 +177,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();