tables sql script for postgresql, totally untested stuff as we dont even have a postg...
[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_linkscc_1_3_update();
67 do_hitcounter_update();
68 do_recentchanges_update();
69 do_user_real_name_update();
70
71 initialiseMessages();
72
73 $wgDatabase->close();
74
75 print "Done.\n";
76 exit();
77
78 #
79 #
80 #
81
82 function do_update_files() {
83 global $IP, $wgStyleSheetDirectory, $wgUploadDirectory, $wgLanguageCode, $wgDebugLogFile;
84 print "Copying files... ";
85
86 copyfile( ".", "LocalSettings.php", $IP );
87 copyfile( ".", "index.php", $IP );
88 copyfile( ".", "redirect.php", $IP );
89 # compatibility with older versions, can be removed in a year or so
90 # (written in Feb 2004)
91 copyfile( ".", "wiki.phtml", $IP );
92 copyfile( ".", "redirect.phtml", $IP );
93
94 copydirectory( "./includes", $IP );
95 copydirectory( "./stylesheets", $wgStyleSheetDirectory );
96
97 copyfile( "./images", "wiki.png", $wgUploadDirectory );
98 copyfile( "./images", "button_bold.png", $wgUploadDirectory );
99 copyfile( "./images", "button_extlink.png", $wgUploadDirectory );
100 copyfile( "./images", "button_headline.png", $wgUploadDirectory );
101 copyfile( "./images", "button_hr.png", $wgUploadDirectory );
102 copyfile( "./images", "button_image.png", $wgUploadDirectory );
103 copyfile( "./images", "button_italic.png", $wgUploadDirectory );
104 copyfile( "./images", "button_link.png", $wgUploadDirectory );
105 copyfile( "./images", "button_math.png", $wgUploadDirectory );
106 copyfile( "./images", "button_media.png", $wgUploadDirectory );
107 copyfile( "./images", "button_nowiki.png", $wgUploadDirectory );
108 copyfile( "./images", "button_sig.png", $wgUploadDirectory );
109 copyfile( "./images", "button_template.png", $wgUploadDirectory );
110 copyfile( "./images", "magnify-clip.png", $wgUploadDirectory );
111 copyfile( "./images", "Arr_.png", $wgUploadDirectory );
112 copyfile( "./images", "Arr_r.png", $wgUploadDirectory );
113 copyfile( "./images", "Arr_d.png", $wgUploadDirectory );
114 copyfile( "./images", "Arr_l.png", $wgUploadDirectory );
115
116 copyfile( "./languages", "Language.php", $IP );
117 copyfile( "./languages", "LanguageUtf8.php", $IP );
118 copyfile( "./languages", "Language" . ucfirst( $wgLanguageCode ) . ".php", $IP );
119
120 if( !empty( $wgDebugLogFile ) ) {
121 $fp = fopen( $wgDebugLogFile, "w" );
122 if ( false === $fp ) {
123 print "Could not create log file \"{$wgDebugLogFile}\".\n";
124 exit();
125 }
126 $d = date( "Y-m-d H:i:s" );
127 fwrite( $fp, "Wiki debug log file created {$d}\n\n" );
128 fclose( $fp );
129 }
130
131 if ( $wgUseTeX ) {
132 copyfile( "./math", "texvc", "{$IP}/math", 0775 );
133 copyfile( "./math", "texvc_test", "{$IP}/math", 0775 );
134 copyfile( "./math", "texvc_tex", "{$IP}/math", 0775 );
135 }
136
137 copyfile( ".", "Version.php", $IP );
138
139 print "ok\n";
140 }
141
142 ?>