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