keep unwrapped text arounf
[lhc/web/wiklou.git] / update.php
index 3d81288..94dba69 100644 (file)
@@ -1,8 +1,14 @@
-<?
+<?php
+
+die("obsolete; remove this file befor 1.3.0 release\n");
 
 # Update already-installed software
 #
 
+include( "./install-utils.inc" );
+require_once( "./maintenance/updaters.inc" );
+install_version_checks();
+
 if ( ! ( is_readable( "./LocalSettings.php" )
   && is_readable( "./AdminSettings.php" ) ) ) {
        print "A copy of your installation's LocalSettings.php\n" .
@@ -10,9 +16,15 @@ if ( ! ( is_readable( "./LocalSettings.php" )
        exit();
 }
 
-$DP = "./includes";
-include_once( "./LocalSettings.php" );
-include_once( "./AdminSettings.php" );
+$IP = "./includes";
+require_once( "./LocalSettings.php" );
+require_once( "./AdminSettings.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" .
@@ -20,66 +32,111 @@ if ( $wgUseTeX && ( ! is_executable( "./math/texvc" ) ) ) {
        exit();
 }
 
-umask( 000 );
-set_time_limit( 0 );
-
 #
 # Copy files into installation directories
 #
-print "Copying files...\n";
+do_update_files();
 
-copyfile( ".", "wiki.phtml", $IP );
-copyfile( ".", "redirect.phtml", $IP );
-copyfile( ".", "texvc.phtml", $IP );
+$wgDBuser                      = $wgDBadminuser;
+$wgDBpassword          = $wgDBadminpassword;
 
-$handle = opendir( "./includes" );
-while ( false !== ( $f = readdir( $handle ) ) ) {
-       if ( "." == $f{0} ) continue;
-       copyfile( "./includes", $f, $IP );
-}
+require_once( "{$IP}/Setup.php" );
+require_once( "./maintenance/InitialiseMessages.inc" );
 
-$handle = opendir( "./stylesheets" );
-while ( false !== ( $f = readdir( $handle ) ) ) {
-       if ( "." == $f{0} ) continue;
-       copyfile( "./stylesheets", $f, $wgStyleSheetDirectory );
-}
+$wgTitle = Title::newFromText( "Update script" );
 
-copyfile( "./images", "wiki.png", $wgUploadDirectory );
-copyfile( "./languages", "Language.php", $IP );
-copyfile( "./languages", "Language" . ucfirst( $wgLanguageCode ) . ".php", $IP );
+#
+# Check the database for things that need to be fixed...
+#
+print "Checking database for necessary updates...\n";
 
-$fp = fopen( $wgDebugLogFile, "w" );
-if ( false === $fp ) {
-       print "Could not create log file \"{$wgDebugLogFile}\".\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();
 }
-$d = date( "Y-m-d H:i:s" );
-fwrite( $fp, "Wiki debug log file created {$d}\n\n" );
-fclose( $fp );
-
-if ( $wgUseTeX ) {
-       copyfile( "./math", "texvc", "{$IP}/math", 0775 );
-       copyfile( "./math", "texvc_test", "{$IP}/math", 0775 );
-       copyfile( "./math", "texvc_tex", "{$IP}/math", 0775 );
-}
 
-print "Done.\nIf any database changes are necessary, you may have to run\n" .
-  "one or more \"patch\" files from the maintenance directory.\n";
+do_revision_updates();
+
+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();
+
+$wgDatabase->close();
+
+print "Done.\n";
 exit();
 
-function copyfile( $sdir, $name, $ddir, $perms = 0644 ) {
-       global $installOwner, $installGroup;
-
-       $d = "{$ddir}/{$name}";
-       if ( copy( "{$sdir}/{$name}", $d ) ) {
-               if ( isset( $installOwner ) ) { chown( $d, $installOwner ); }
-               if ( isset( $installGroup ) ) { chgrp( $d, $installGroup ); }
-               chmod( $d, $perms );
-               # print "Copied \"{$name}\" to \"{$ddir}\".\n";
-       } else {
-               print "Failed to copy file \"{$name}\" to \"{$ddir}\".\n";
-               exit();
+#
+#
+#
+
+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 );
+       
+       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 ) ) {
+               $fp = fopen( $wgDebugLogFile, "w" );
+               if ( false === $fp ) {
+                       print "Could not create log file \"{$wgDebugLogFile}\".\n";
+                       exit();
+               }
+               $d = date( "Y-m-d H:i:s" );
+               fwrite( $fp, "Wiki debug log file created {$d}\n\n" );
+               fclose( $fp );
        }
+       
+       if ( $wgUseTeX ) {
+               copyfile( "./math", "texvc", "{$IP}/math", 0775 );
+               copyfile( "./math", "texvc_test", "{$IP}/math", 0775 );
+               copyfile( "./math", "texvc_tex", "{$IP}/math", 0775 );
+       }
+       
+       copyfile( ".", "Version.php", $IP );
+
+       print "ok\n";
 }
 
 ?>