colours
[lhc/web/wiklou.git] / update.php
index f91a80c..ce96eab 100644 (file)
@@ -1,9 +1,12 @@
-<?
+<?php
+
+die("obsolete; remove this file befor 1.3.0 release\n");
 
 # Update already-installed software
 #
 
-include( "./install-utils.inc" );
+include_once( "./install-utils.inc" );
+require_once( "./maintenance/updaters.inc" );
 install_version_checks();
 
 if ( ! ( is_readable( "./LocalSettings.php" )
@@ -14,10 +17,14 @@ if ( ! ( is_readable( "./LocalSettings.php" )
 }
 
 $IP = "./includes";
-include_once( "./LocalSettings.php" );
-include_once( "./AdminSettings.php" );
+require_once( "./LocalSettings.php" );
+require_once( "./AdminSettings.php" );
+
+include_once( "$IP/Version.php" );
 
-include( "$IP/Version.php" );
+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" .
@@ -33,29 +40,37 @@ do_update_files();
 $wgDBuser                      = $wgDBadminuser;
 $wgDBpassword          = $wgDBadminpassword;
 
-include_once( "{$IP}/Setup.php" );
-include_once( "./maintenance/InitialiseMessages.inc" );
+require_once( "{$IP}/Setup.php" );
+require_once( "./maintenance/InitialiseMessages.inc" );
 
 $wgTitle = Title::newFromText( "Update script" );
 
 #
 # Check the database for things that need to be fixed...
 #
-       print "Checking database for necessary updates...\n";
+print "Checking database for necessary updates...\n";
+
+$wgDatabase = Database::newFromParams( $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname, 
+       1, false, true, false);
+if ( !$wgDatabase->isOpen() ) {
+       print "Unable to connect to database: " . $wgDatabase->lastError() . "\n";
+       exit();
+}
 
-       $rconn = mysql_connect( $wgDBserver, $wgDBadminuser, $wgDBadminpassword );
-       mysql_select_db( $wgDBname );
+do_revision_updates();
 
-       do_revision_updates();
-       
-       do_ipblocks_update();
-       do_interwiki_update();
-       do_index_update();
-       do_linkscc_update();
+do_ipblocks_update();
+do_interwiki_update();
+do_index_update();
+do_linkscc_update();
+do_linkscc_1_3_update();
+do_hitcounter_update();
+do_recentchanges_update();
+do_user_real_name_update();
 
-       initialiseMessages();
+initialiseMessages();
 
-       mysql_close( $rconn );
+$wgDatabase->close();
 
 print "Done.\n";
 exit();
@@ -68,15 +83,38 @@ function do_update_files() {
        global $IP, $wgStyleSheetDirectory, $wgUploadDirectory, $wgLanguageCode, $wgDebugLogFile;
        print "Copying files... ";
        
+       copyfile( ".", "LocalSettings.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.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 );
        copyfile( "./languages", "Language" . ucfirst( $wgLanguageCode ) . ".php", $IP );
        
        if( !empty( $wgDebugLogFile ) ) {
@@ -101,87 +139,4 @@ function do_update_files() {
        print "ok\n";
 }
 
-function do_revision_updates() {
-       global $wgSoftwareRevision;
-       if ( $wgSoftwareRevision < 1001 ) {
-               update_passwords();
-       }
-}
-
-function update_passwords() {
-       $fname = "Update script: update_passwords()";
-       print "\nIt appears that you need to update the user passwords in your\n" .
-         "database. If you have already done this (if you've run this update\n" .
-         "script once before, for example), doing so again will make all your\n" .
-         "user accounts inaccessible, so be sure you only do this once.\n" .
-         "Update user passwords? (yes/no)";
-
-       $resp = readconsole();
-    if ( ! ( "Y" == $resp{0} || "y" == $resp{0} ) ) { return; }
-
-       $sql = "SELECT user_id,user_password FROM user";
-       $source = wfQuery( $sql, DB_READ, fname );
-
-       while ( $row = mysql_fetch_object( $source ) ) {
-               $id = $row->user_id;
-               $oldpass = $row->user_password;
-               $newpass = md5( "{$id}-{$oldpass}" );
-
-               $sql = "UPDATE user SET user_password='{$newpass}' " .
-                 "WHERE user_id={$id}";
-               wfQuery( $sql, DB_WRITE, $fname );
-       }
-}
-
-function do_ipblocks_update() {
-       if ( wfFieldExists( "ipblocks", "ipb_id" ) ) {
-               echo "...ipblocks table is up to date.\n";
-       } else {
-               echo "Updating ipblocks table... ";
-               dbsource( "maintenance/archives/patch-ipblocks.sql" );
-               echo "ok\n";
-       }
-}
-
-
-function do_interwiki_update() {
-       # Check that interwiki table exists; if it doesn't source it
-       if( table_exists( "interwiki" ) ) {
-               echo "...already have interwiki table\n";
-               return true;
-       }
-       echo "Creating interwiki table: ";
-       dbsource( "maintenance/archives/patch-interwiki.sql" );
-       echo "ok\n";
-       echo "Adding default interwiki definitions: ";
-       dbsource( "maintenance/interwiki.sql" );
-       echo "ok\n";
-}
-
-function do_index_update() {
-       # Check that proper indexes are in place
-       $meta = field_info( "recentchanges", "rc_timestamp" );
-       if( $meta->multiple_key == 0 ) {
-               echo "Updating indexes to 20031107: ";
-               dbsource( "maintenance/archives/patch-indexes.sql" );
-               echo "ok\n";
-               return true;
-       }
-       echo "...indexes seem up to 20031107 standards\n";
-       return false;
-}
-
-function do_linkscc_update() {
-       // Create linkscc if necessary
-       global $rconn;
-       if( table_exists( "linkscc" ) ) {
-               echo "...have linkscc table.\n";
-       } else {
-               echo "Adding linkscc table... ";
-               dbsource( "maintenance/archives/patch-linkscc.sql" );
-               echo "ok\n";
-       }
-}
-
-
 ?>