PageHistory, UserContributions and BackLinks Interwiki prefixes
[lhc/web/wiklou.git] / install.php
index 25c18ae..333c433 100644 (file)
@@ -10,16 +10,16 @@ if ( ! ( is_readable( "./LocalSettings.php" )
          "source directory before running this install script.\n";
        exit();
 }
-if ( $wgUseTeX && ( ! is_executable( "./math/texvc" ) ) ) {
-       print "To use math functions, you must first compile texvc by\n" .
-         "running \"make\" in the math directory.\n";
-       exit();
-}
 
 $DP = "./includes";
 include_once( "./LocalSettings.php" );
 include_once( "./AdminSettings.php" );
 
+if ( $wgUseTeX && ( ! is_executable( "./math/texvc" ) ) ) {
+       print "To use math functions, you must first compile texvc by\n" .
+         "running \"make\" in the math directory.\n";
+       exit();
+}
 if ( is_file( "{$IP}/Version.php" ) ) {
        print "There appears to be an installation of the software\n" .
          "already present on \"{$IP}\". You may want to run the update\n" .
@@ -53,7 +53,7 @@ copyfile( ".", "redirect.phtml", $IP );
 copyfile( ".", "texvc.phtml", $IP );
 
 copydirectory( "./includes", $IP );
-copydirectory( "./stylesheets", $wgStyleSheetsDirectory );
+copydirectory( "./stylesheets", $wgStyleSheetDirectory );
 
 copyfile( "./images", "wiki.png", $wgUploadDirectory );
 copyfile( "./languages", "Language.php", $IP );
@@ -246,11 +246,21 @@ function populatedata() {
        $sql = "DELETE FROM user";
        wfQuery( $sql, $fname );
 
-       $sql = "INSERT INTO user (user_name, user_password, user_rights)" .
-         "VALUES ('WikiSysop','" . User::encryptPassword( $wgDBadminpassword ) .
-         "','sysop'),('WikiDeveloper','" . User::encryptPassword(
-         $wgDBadminpassword ) . "','sysop,developer')";
-       wfQuery( $sql, $fname );
+       $u = User::newFromName( "WikiSysop" );
+       if ( 0 == $u->idForName() ) {
+               $u->addToDatabase();
+               $u->setPassword( $wgDBadminpassword );
+               $u->addRight( "sysop" );
+               $u->saveSettings();
+       }
+       $u = User::newFromName( "WikiDeveloper" );
+       if ( 0 == $u->idForName() ) {
+               $u->addToDatabase();
+               $u->setPassword( $wgDBadminpassword );
+               $u->addRight( "sysop" );
+               $u->addRight( "developer" );
+               $u->saveSettings();
+       }
        
        $wns = Namespace::getWikipedia();
        $ulp = addslashes( wfMsg( "uploadlogpage" ) );