bug fix
[lhc/web/wiklou.git] / update.php
1 <?php
2
3 die("obsolete; remove this file befor 1.3.0 release\n");
4
5 # Update already-installed software
6 #
7
8 include( "./install-utils.inc" );
9 require_once( "./maintenance/updaters.inc" );
10 install_version_checks();
11
12 if ( ! ( is_readable( "./LocalSettings.php" )
13 && is_readable( "./AdminSettings.php" ) ) ) {
14 print "A copy of your installation's LocalSettings.php\n" .
15 "and AdminSettings.php must exist in this source directory.\n";
16 exit();
17 }
18
19 $IP = "./includes";
20 require_once( "./LocalSettings.php" );
21 require_once( "./AdminSettings.php" );
22
23 include( "$IP/Version.php" );
24
25 if( $wgSitename == "MediaWiki" ) {
26 die( "You must set the site name in \$wgSitename before installation.\n\n" );
27 }
28
29 if ( $wgUseTeX && ( ! is_executable( "./math/texvc" ) ) ) {
30 print "To use math functions, you must first compile texvc by\n" .
31 "running \"make\" in the math directory.\n";
32 exit();
33 }
34
35 #
36 # Copy files into installation directories
37 #
38 do_update_files();
39
40 $wgDBuser = $wgDBadminuser;
41 $wgDBpassword = $wgDBadminpassword;
42
43 require_once( "{$IP}/Setup.php" );
44 require_once( "./maintenance/InitialiseMessages.inc" );
45
46 $wgTitle = Title::newFromText( "Update script" );
47
48 #
49 # Check the database for things that need to be fixed...
50 #
51 print "Checking database for necessary updates...\n";
52
53 $wgDatabase = Database::newFromParams( $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname,
54 1, false, true, false);
55 if ( !$wgDatabase->isOpen() ) {
56 print "Unable to connect to database: " . $wgDatabase->lastError() . "\n";
57 exit();
58 }
59
60 do_revision_updates();
61
62 do_ipblocks_update();
63 do_interwiki_update();
64 do_index_update();
65 do_linkscc_update();
66 do_hitcounter_update();
67 do_recentchanges_update();
68 do_user_real_name_update();
69
70 initialiseMessages();
71
72 $wgDatabase->close();
73
74 print "Done.\n";
75 exit();
76
77 #
78 #
79 #
80
81 function do_update_files() {
82 global $IP, $wgStyleSheetDirectory, $wgUploadDirectory, $wgLanguageCode, $wgDebugLogFile;
83 print "Copying files... ";
84
85 copyfile( ".", "LocalSettings.php", $IP );
86 copyfile( ".", "index.php", $IP );
87 copyfile( ".", "redirect.php", $IP );
88 # compatibility with older versions, can be removed in a year or so
89 # (written in Feb 2004)
90 copyfile( ".", "wiki.phtml", $IP );
91 copyfile( ".", "redirect.phtml", $IP );
92
93 copydirectory( "./includes", $IP );
94 copydirectory( "./stylesheets", $wgStyleSheetDirectory );
95
96 copyfile( "./images", "wiki.png", $wgUploadDirectory );
97 copyfile( "./images", "button_bold.png", $wgUploadDirectory );
98 copyfile( "./images", "button_extlink.png", $wgUploadDirectory );
99 copyfile( "./images", "button_headline.png", $wgUploadDirectory );
100 copyfile( "./images", "button_hr.png", $wgUploadDirectory );
101 copyfile( "./images", "button_image.png", $wgUploadDirectory );
102 copyfile( "./images", "button_italic.png", $wgUploadDirectory );
103 copyfile( "./images", "button_link.png", $wgUploadDirectory );
104 copyfile( "./images", "button_math.png", $wgUploadDirectory );
105 copyfile( "./images", "button_media.png", $wgUploadDirectory );
106 copyfile( "./images", "button_nowiki.png", $wgUploadDirectory );
107 copyfile( "./images", "button_sig.png", $wgUploadDirectory );
108 copyfile( "./images", "button_template.png", $wgUploadDirectory );
109 copyfile( "./images", "magnify-clip.png", $wgUploadDirectory );
110 copyfile( "./images", "Arr_.png", $wgUploadDirectory );
111 copyfile( "./images", "Arr_r.png", $wgUploadDirectory );
112 copyfile( "./images", "Arr_d.png", $wgUploadDirectory );
113 copyfile( "./images", "Arr_l.png", $wgUploadDirectory );
114
115 copyfile( "./languages", "Language.php", $IP );
116 copyfile( "./languages", "LanguageUtf8.php", $IP );
117 copyfile( "./languages", "Language" . ucfirst( $wgLanguageCode ) . ".php", $IP );
118
119 if( !empty( $wgDebugLogFile ) ) {
120 $fp = fopen( $wgDebugLogFile, "w" );
121 if ( false === $fp ) {
122 print "Could not create log file \"{$wgDebugLogFile}\".\n";
123 exit();
124 }
125 $d = date( "Y-m-d H:i:s" );
126 fwrite( $fp, "Wiki debug log file created {$d}\n\n" );
127 fclose( $fp );
128 }
129
130 if ( $wgUseTeX ) {
131 copyfile( "./math", "texvc", "{$IP}/math", 0775 );
132 copyfile( "./math", "texvc_test", "{$IP}/math", 0775 );
133 copyfile( "./math", "texvc_tex", "{$IP}/math", 0775 );
134 }
135
136 copyfile( ".", "Version.php", $IP );
137
138 print "ok\n";
139 }
140
141 ?>