r46899 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r46898‎ | r46899 | r46900 >
Date:06:29, 6 February 2009
Author:tstarling
Status:deferred
Tags:
Comment:
Backported r46840, r46843, r46889 (installer XSS fixes)
Modified paths:
  • /branches/REL1_6/phase3/config/index.php (modified) (history)
  • /branches/REL1_6/phase3/includes/GlobalFunctions.php (modified) (history)
  • /branches/REL1_6/phase3/maintenance/convertLinks.inc (modified) (history)
  • /branches/REL1_6/phase3/maintenance/updaters.inc (modified) (history)
  • /branches/REL1_6/phase3/maintenance/userDupes.inc (modified) (history)

Diff [purge]

Index: branches/REL1_6/phase3/maintenance/userDupes.inc
@@ -39,7 +39,7 @@
4040 $fname = 'UserDupes::hasUniqueIndex';
4141 $info = $this->db->indexInfo( 'user', 'user_name', $fname );
4242 if( !$info ) {
43 - echo "WARNING: doesn't seem to have user_name index at all!\n";
 43+ wfOut( "WARNING: doesn't seem to have user_name index at all!\n" );
4444 return false;
4545 }
4646
@@ -88,11 +88,11 @@
8989
9090 $this->lock();
9191
92 - echo "Checking for duplicate accounts...\n";
 92+ wfOut( "Checking for duplicate accounts...\n" );
9393 $dupes = $this->getDupes();
9494 $count = count( $dupes );
9595
96 - echo "Found $count accounts with duplicate records on $wgDBname.\n";
 96+ wfOut( "Found $count accounts with duplicate records on $wgDBname.\n" );
9797 $this->trimmed = 0;
9898 $this->reassigned = 0;
9999 $this->failed = 0;
@@ -102,34 +102,34 @@
103103
104104 $this->unlock();
105105
106 - echo "\n";
 106+ wfOut( "\n" );
107107
108108 if( $this->reassigned > 0 ) {
109109 if( $doDelete ) {
110 - echo "$this->reassigned duplicate accounts had edits reassigned to a canonical record id.\n";
 110+ wfOut( "$this->reassigned duplicate accounts had edits reassigned to a canonical record id.\n" );
111111 } else {
112 - echo "$this->reassigned duplicate accounts need to have edits reassigned.\n";
 112+ wfOut( "$this->reassigned duplicate accounts need to have edits reassigned.\n" );
113113 }
114114 }
115115
116116 if( $this->trimmed > 0 ) {
117117 if( $doDelete ) {
118 - echo "$this->trimmed duplicate user records were deleted from $wgDBname.\n";
 118+ wfOut( "$this->trimmed duplicate user records were deleted from $wgDBname.\n" );
119119 } else {
120 - echo "$this->trimmed duplicate user accounts were found on $wgDBname which can be removed safely.\n";
 120+ wfOut( "$this->trimmed duplicate user accounts were found on $wgDBname which can be removed safely.\n" );
121121 }
122122 }
123123
124124 if( $this->failed > 0 ) {
125 - echo "Something terribly awry; $this->failed duplicate accounts were not removed.\n";
 125+ wfOut( "Something terribly awry; $this->failed duplicate accounts were not removed.\n" );
126126 return false;
127127 }
128128
129129 if( $this->trimmed == 0 || $doDelete ) {
130 - echo "It is now safe to apply the unique index on user_name.\n";
 130+ wfOut( "It is now safe to apply the unique index on user_name.\n" );
131131 return true;
132132 } else {
133 - echo "Run this script again with the --fix option to automatically delete them.\n";
 133+ wfOut( "Run this script again with the --fix option to automatically delete them.\n" );
134134 return false;
135135 }
136136 }
@@ -211,36 +211,36 @@
212212
213213 $firstRow = $this->db->fetchObject( $result );
214214 $firstId = $firstRow->user_id;
215 - echo "Record that will be used for '$name' is user_id=$firstId\n";
 215+ wfOut( "Record that will be used for '$name' is user_id=$firstId\n" );
216216
217217 while( $row = $this->db->fetchObject( $result ) ) {
218218 $dupeId = $row->user_id;
219 - echo "... dupe id $dupeId: ";
 219+ wfOut( "... dupe id $dupeId: " );
220220 $edits = $this->editCount( $dupeId );
221221 if( $edits > 0 ) {
222222 $this->reassigned++;
223 - echo "has $edits edits! ";
 223+ wfOut( "has $edits edits! " );
224224 if( $doDelete ) {
225225 $this->reassignEdits( $dupeId, $firstId );
226226 $newEdits = $this->editCount( $dupeId );
227227 if( $newEdits == 0 ) {
228 - echo "confirmed cleaned. ";
 228+ wfOut( "confirmed cleaned. " );
229229 } else {
230230 $this->failed++;
231 - echo "WARNING! $newEdits remaining edits for $dupeId; NOT deleting user.\n";
 231+ wfOut( "WARNING! $newEdits remaining edits for $dupeId; NOT deleting user.\n" );
232232 continue;
233233 }
234234 } else {
235 - echo "(will need to reassign edits on fix)";
 235+ wfOut( "(will need to reassign edits on fix)" );
236236 }
237237 } else {
238 - echo "ok, no edits. ";
 238+ wfOut( "ok, no edits. " );
239239 }
240240 $this->trimmed++;
241241 if( $doDelete ) {
242242 $this->trimAccount( $dupeId );
243243 }
244 - echo "\n";
 244+ wfOut( "\n" );
245245 }
246246 $this->db->freeResult( $result );
247247 }
@@ -302,12 +302,12 @@
303303 */
304304 function reassignEditsOn( $table, $field, $from, $to ) {
305305 $fname = 'UserDupes::reassignEditsOn';
306 - echo "reassigning on $table... ";
 306+ wfOut( "reassigning on $table... " );
307307 $result = $this->db->update( $table,
308308 array( $field => $to ),
309309 array( $field => $from ),
310310 $fname );
311 - echo "ok. ";
 311+ wfOut( "ok. " );
312312 }
313313
314314 /**
@@ -317,12 +317,12 @@
318318 */
319319 function trimAccount( $userid ) {
320320 $fname = 'UserDupes::trimAccount';
321 - echo "deleting...";
 321+ wfOut( "deleting..." );
322322 $this->db->delete( 'user', array( 'user_id' => $userid ), $fname );
323 - echo " ok";
 323+ wfOut( " ok" );
324324 }
325325
326326 }
327327
328328
329 -?>
\ No newline at end of file
 329+?>
Index: branches/REL1_6/phase3/maintenance/convertLinks.inc
@@ -9,11 +9,11 @@
1010 function convertLinks() {
1111 global $wgDBtype;
1212 if( $wgDBtype == 'PostgreSQL' ) {
13 - print "Links table already ok on PostgreSQL.\n";
 13+ wfOut( "Links table already ok on PostgreSQL.\n" );
1414 return;
1515 }
1616
17 - print "Converting links table to ID-ID...\n";
 17+ wfOut( "Converting links table to ID-ID...\n" );
1818
1919 global $wgLang, $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname;
2020 global $noKeys, $logPerformance, $fh;
@@ -48,7 +48,7 @@
4949
5050 $res = $dbw->query( "SELECT l_from FROM $links LIMIT 1" );
5151 if ( $dbw->fieldType( $res, 0 ) == "int" ) {
52 - print "Schema already converted\n";
 52+ wfOut( "Schema already converted\n" );
5353 return;
5454 }
5555
@@ -58,13 +58,13 @@
5959 $dbw->freeResult( $res );
6060
6161 if ( $numRows == 0 ) {
62 - print "Updating schema (no rows to convert)...\n";
 62+ wfOut( "Updating schema (no rows to convert)...\n" );
6363 createTempTable();
6464 } else {
6565 if ( $logPerformance ) { $fh = fopen ( $perfLogFilename, "w" ); }
6666 $baseTime = $startTime = getMicroTime();
6767 # Create a title -> cur_id map
68 - print "Loading IDs from $cur table...\n";
 68+ wfOut( "Loading IDs from $cur table...\n" );
6969 performanceLog ( "Reading $numRows rows from cur table...\n" );
7070 performanceLog ( "rows read vs seconds elapsed:\n" );
7171
@@ -82,13 +82,13 @@
8383 if ($reportCurReadProgress) {
8484 if (($curRowsRead % $curReadReportInterval) == 0) {
8585 performanceLog( $curRowsRead . " " . (getMicroTime() - $baseTime) . "\n" );
86 - print "\t$curRowsRead rows of $cur table read.\n";
 86+ wfOut( "\t$curRowsRead rows of $cur table read.\n" );
8787 }
8888 }
8989 }
9090 $dbw->freeResult( $res );
9191 $dbw->bufferResults( true );
92 - print "Finished loading IDs.\n\n";
 92+ wfOut( "Finished loading IDs.\n\n" );
9393 performanceLog( "Took " . (getMicroTime() - $baseTime) . " seconds to load IDs.\n\n" );
9494 #--------------------------------------------------------------------
9595
@@ -97,7 +97,7 @@
9898 createTempTable();
9999 performanceLog( "Resetting timer.\n\n" );
100100 $baseTime = getMicroTime();
101 - print "Processing $numRows rows from $links table...\n";
 101+ wfOut( "Processing $numRows rows from $links table...\n" );
102102 performanceLog( "Processing $numRows rows from $links table...\n" );
103103 performanceLog( "rows inserted vs seconds elapsed:\n" );
104104
@@ -127,19 +127,19 @@
128128 }
129129 }
130130 $dbw->freeResult($res);
131 - #print "rowOffset: $rowOffset\ttuplesAdded: $tuplesAdded\tnumBadLinks: $numBadLinks\n";
 131+ #wfOut( "rowOffset: $rowOffset\ttuplesAdded: $tuplesAdded\tnumBadLinks: $numBadLinks\n" );
132132 if ( $tuplesAdded != 0 ) {
133133 if ($reportLinksConvProgress) {
134 - print "Inserting $tuplesAdded tuples into $links_temp...";
 134+ wfOut( "Inserting $tuplesAdded tuples into $links_temp..." );
135135 }
136136 $dbw->query( implode("",$sqlWrite) );
137137 $totalTuplesInserted += $tuplesAdded;
138138 if ($reportLinksConvProgress)
139 - print " done. Total $totalTuplesInserted tuples inserted.\n";
 139+ wfOut( " done. Total $totalTuplesInserted tuples inserted.\n" );
140140 performanceLog( $totalTuplesInserted . " " . (getMicroTime() - $baseTime) . "\n" );
141141 }
142142 }
143 - print "$totalTuplesInserted valid titles and $numBadLinks invalid titles were processed.\n\n";
 143+ wfOut( "$totalTuplesInserted valid titles and $numBadLinks invalid titles were processed.\n\n" );
144144 performanceLog( "$totalTuplesInserted valid titles and $numBadLinks invalid titles were processed.\n" );
145145 performanceLog( "Total execution time: " . (getMicroTime() - $startTime) . " seconds.\n" );
146146 if ( $logPerformance ) { fclose ( $fh ); }
@@ -149,25 +149,25 @@
150150 if ( $overwriteLinksTable ) {
151151 $dbConn = Database::newFromParams( $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname );
152152 if (!($dbConn->isOpen())) {
153 - print "Opening connection to database failed.\n";
 153+ wfOut( "Opening connection to database failed.\n" );
154154 return;
155155 }
156156 # Check for existing links_backup, and delete it if it exists.
157 - print "Dropping backup links table if it exists...";
 157+ wfOut( "Dropping backup links table if it exists..." );
158158 $dbConn->query( "DROP TABLE IF EXISTS $links_backup", DB_MASTER);
159 - print " done.\n";
 159+ wfOut( " done.\n" );
160160
161161 # Swap in the new table, and move old links table to links_backup
162 - print "Swapping tables '$links' to '$links_backup'; '$links_temp' to '$links'...";
 162+ wfOut( "Swapping tables '$links' to '$links_backup'; '$links_temp' to '$links'..." );
163163 $dbConn->query( "RENAME TABLE links TO $links_backup, $links_temp TO $links", DB_MASTER );
164 - print " done.\n\n";
 164+ wfOut( " done.\n\n" );
165165
166166 $dbConn->close();
167 - print "Conversion complete. The old table remains at $links_backup;\n";
168 - print "delete at your leisure.\n";
 167+ wfOut( "Conversion complete. The old table remains at $links_backup;\n" );
 168+ wfOut( "delete at your leisure.\n" );
169169 } else {
170 - print "Conversion complete. The converted table is at $links_temp;\n";
171 - print "the original links table is unchanged.\n";
 170+ wfOut( "Conversion complete. The converted table is at $links_temp;\n" );
 171+ wfOut( "the original links table is unchanged.\n" );
172172 }
173173 }
174174
@@ -179,16 +179,16 @@
180180 $dbConn = Database::newFromParams( $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname );
181181
182182 if (!($dbConn->isOpen())) {
183 - print "Opening connection to database failed.\n";
 183+ wfOut( "Opening connection to database failed.\n" );
184184 return;
185185 }
186186 $links_temp = $dbConn->tableName( 'links_temp' );
187187
188 - print "Dropping temporary links table if it exists...";
 188+ wfOut( "Dropping temporary links table if it exists..." );
189189 $dbConn->query( "DROP TABLE IF EXISTS $links_temp");
190 - print " done.\n";
 190+ wfOut( " done.\n" );
191191
192 - print "Creating temporary links table...";
 192+ wfOut( "Creating temporary links table..." );
193193 if ( $noKeys ) {
194194 $dbConn->query( "CREATE TABLE $links_temp ( " .
195195 "l_from int(8) unsigned NOT NULL default '0', " .
@@ -200,7 +200,7 @@
201201 "UNIQUE KEY l_from(l_from,l_to), " .
202202 "KEY (l_to))");
203203 }
204 - print " done.\n\n";
 204+ wfOut( " done.\n\n" );
205205 }
206206
207207 function performanceLog( $text ) {
Index: branches/REL1_6/phase3/maintenance/updaters.inc
@@ -61,11 +61,11 @@
6262 global $wgDatabase;
6363 if ( $wgDatabase->tableExists( $from ) ) {
6464 if ( $wgDatabase->tableExists( $to ) ) {
65 - echo "...can't move table $from to $to, $to already exists.\n";
 65+ wfOut( "...can't move table $from to $to, $to already exists.\n" );
6666 } else {
67 - echo "Moving table $from to $to...";
 67+ wfOut( "Moving table $from to $to..." );
6868 dbsource( archive($patch), $wgDatabase );
69 - echo "ok\n";
 69+ wfOut( "ok\n" );
7070 }
7171 } else {
7272 // Source table does not exist
@@ -77,24 +77,24 @@
7878 function add_table( $name, $patch ) {
7979 global $wgDatabase;
8080 if ( $wgDatabase->tableExists( $name ) ) {
81 - echo "...$name table already exists.\n";
 81+ wfOut( "...$name table already exists.\n" );
8282 } else {
83 - echo "Creating $name table...";
 83+ wfOut( "Creating $name table..." );
8484 dbsource( archive($patch), $wgDatabase );
85 - echo "ok\n";
 85+ wfOut( "ok\n" );
8686 }
8787 }
8888
8989 function add_field( $table, $field, $patch ) {
9090 global $wgDatabase;
9191 if ( !$wgDatabase->tableExists( $table ) ) {
92 - echo "...$table table does not exist, skipping new field patch\n";
 92+ wfOut( "...$table table does not exist, skipping new field patch\n" );
9393 } elseif ( $wgDatabase->fieldExists( $table, $field ) ) {
94 - echo "...have $field field in $table table.\n";
 94+ wfOut( "...have $field field in $table table.\n" );
9595 } else {
96 - echo "Adding $field field to table $table...";
 96+ wfOut( "Adding $field field to table $table..." );
9797 dbsource( archive($patch) , $wgDatabase );
98 - echo "ok\n";
 98+ wfOut( "ok\n" );
9999 }
100100 }
101101
@@ -110,11 +110,11 @@
111111
112112 global $wgDatabase;
113113 $fname = "Update script: update_passwords()";
114 - print "\nIt appears that you need to update the user passwords in your\n" .
 114+ wfOut( "\nIt appears that you need to update the user passwords in your\n" .
115115 "database. If you have already done this (if you've run this update\n" .
116116 "script once before, for example), doing so again will make all your\n" .
117117 "user accounts inaccessible, so be sure you only do this once.\n" .
118 - "Update user passwords? (yes/no)";
 118+ "Update user passwords? (yes/no)" );
119119
120120 $resp = readconsole();
121121 if ( ! ( "Y" == $resp{0} || "y" == $resp{0} ) ) { return; }
@@ -137,15 +137,15 @@
138138 # Check that interwiki table exists; if it doesn't source it
139139 global $wgDatabase, $IP;
140140 if( $wgDatabase->tableExists( "interwiki" ) ) {
141 - echo "...already have interwiki table\n";
 141+ wfOut( "...already have interwiki table\n" );
142142 return true;
143143 }
144 - echo "Creating interwiki table: ";
 144+ wfOut( "Creating interwiki table: " );
145145 dbsource( archive("patch-interwiki.sql") );
146 - echo "ok\n";
147 - echo "Adding default interwiki definitions: ";
 146+ wfOut( "ok\n" );
 147+ wfOut( "Adding default interwiki definitions: " );
148148 dbsource( "$IP/maintenance/interwiki.sql" );
149 - echo "ok\n";
 149+ wfOut( "ok\n" );
150150 }
151151
152152 function do_index_update() {
@@ -153,12 +153,12 @@
154154 global $wgDatabase;
155155 $meta = $wgDatabase->fieldInfo( "recentchanges", "rc_timestamp" );
156156 if( $meta->multiple_key == 0 ) {
157 - echo "Updating indexes to 20031107: ";
 157+ wfOut( "Updating indexes to 20031107: " );
158158 dbsource( archive("patch-indexes.sql") );
159 - echo "ok\n";
 159+ wfOut( "ok\n" );
160160 return true;
161161 }
162 - echo "...indexes seem up to 20031107 standards\n";
 162+ wfOut( "...indexes seem up to 20031107 standards\n" );
163163 return false;
164164 }
165165
@@ -167,34 +167,34 @@
168168
169169 $meta = $wgDatabase->fieldInfo( "image", "img_major_mime" );
170170 if( $meta->multiple_key == 0 ) {
171 - echo "Updating indexes to 20050912: ";
 171+ wfOut( "Updating indexes to 20050912: " );
172172 dbsource( archive("patch-mimesearch-indexes.sql") );
173 - echo "ok\n";
 173+ wfOut( "ok\n" );
174174 return true;
175175 }
176 - echo "...indexes seem up to 20050912 standards\n";
 176+ wfOut( "...indexes seem up to 20050912 standards\n" );
177177 return false;
178178 }
179179
180180 function do_image_name_unique_update() {
181181 global $wgDatabase;
182182 if( $wgDatabase->indexExists( 'image', 'PRIMARY' ) ) {
183 - echo "...image primary key already set.\n";
 183+ wfOut( "...image primary key already set.\n" );
184184 } else {
185 - echo "Making img_name the primary key... ";
 185+ wfOut( "Making img_name the primary key... " );
186186 dbsource( archive("patch-image_name_primary.sql"), $wgDatabase );
187 - echo "ok\n";
 187+ wfOut( "ok\n" );
188188 }
189189 }
190190
191191 function do_logging_timestamp_index() {
192192 global $wgDatabase;
193193 if( $wgDatabase->indexExists( 'logging', 'times' ) ) {
194 - echo "...timestamp key on logging already exists.\n";
 194+ wfOut( "...timestamp key on logging already exists.\n" );
195195 } else {
196 - echo "Adding timestamp key on logging table... ";
 196+ wfOut( "Adding timestamp key on logging table... " );
197197 dbsource( archive("patch-logging-times-index.sql"), $wgDatabase );
198 - echo "ok\n";
 198+ wfOut( "ok\n" );
199199 }
200200 }
201201
@@ -203,18 +203,18 @@
204204 global $wgDatabase;
205205 $fname = 'do_watchlist_update';
206206 if( $wgDatabase->fieldExists( 'watchlist', 'wl_notificationtimestamp' ) ) {
207 - echo "The watchlist table is already set up for email notification.\n";
 207+ wfOut( "The watchlist table is already set up for email notification.\n" );
208208 } else {
209 - echo "Adding wl_notificationtimestamp field for email notification management.";
 209+ wfOut( "Adding wl_notificationtimestamp field for email notification management." );
210210 /* ALTER TABLE watchlist ADD (wl_notificationtimestamp varchar(14) binary NOT NULL default '0'); */
211211 dbsource( archive( 'patch-email-notification.sql' ), $wgDatabase );
212 - echo "ok\n";
 212+ wfOut( "ok\n" );
213213 }
214214 # Check if we need to add talk page rows to the watchlist
215215 $talk = $wgDatabase->selectField( 'watchlist', 'count(*)', 'wl_namespace & 1', $fname );
216216 $nontalk = $wgDatabase->selectField( 'watchlist', 'count(*)', 'NOT (wl_namespace & 1)', $fname );
217217 if ( $talk != $nontalk ) {
218 - echo "Adding missing watchlist talk page rows... ";
 218+ wfOut( "Adding missing watchlist talk page rows... " );
219219 flush();
220220
221221 $wgDatabase->insertSelect( 'watchlist', 'watchlist',
@@ -224,9 +224,9 @@
225225 'wl_title' => 'wl_title',
226226 'wl_notificationtimestamp' => 'wl_notificationtimestamp'
227227 ), array( 'NOT (wl_namespace & 1)' ), $fname, 'IGNORE' );
228 - echo "ok\n";
 228+ wfOut( "ok\n" );
229229 } else {
230 - echo "...watchlist talk page rows already present\n";
 230+ wfOut( "...watchlist talk page rows already present\n" );
231231 }
232232 }
233233
@@ -237,7 +237,7 @@
238238 $res = $wgDatabase->safeQuery( 'SELECT user_id, user_ip FROM !',
239239 $wgDatabase->tableName( 'user_newtalk' ) );
240240 $num_newtalks=$wgDatabase->numRows($res);
241 - echo "Now converting ".$num_newtalks." user_newtalk entries to watchlist table entries ... \n";
 241+ wfOut( "Now converting $num_newtalks user_newtalk entries to watchlist table entries ... \n" );
242242
243243 $user = new User();
244244 for ( $i = 1; $i <= $num_newtalks; $i++ ) {
@@ -265,18 +265,18 @@
266266 );
267267 }
268268 }
269 - echo "Done.\n";
 269+ wfOut( "Done.\n" );
270270 }
271271
272272
273273 function do_user_update() {
274274 global $wgDatabase;
275275 if( $wgDatabase->fieldExists( 'user', 'user_emailauthenticationtimestamp' ) ) {
276 - echo "User table contains old email authentication field. Dropping... ";
 276+ wfOut( "User table contains old email authentication field. Dropping... " );
277277 dbsource( archive( 'patch-email-authentication.sql' ), $wgDatabase );
278 - echo "ok\n";
 278+ wfOut( "ok\n" );
279279 } else {
280 - echo "...user table does not contain old email authentication field.\n";
 280+ wfOut( "...user table does not contain old email authentication field.\n" );
281281 }
282282 }
283283
@@ -294,11 +294,11 @@
295295 $wgDatabase->freeResult( $res );
296296
297297 if( in_array( 'binary', $flags ) ) {
298 - echo "Logging table has correct title encoding.\n";
 298+ wfOut( "Logging table has correct title encoding.\n" );
299299 } else {
300 - echo "Fixing title encoding on logging table... ";
 300+ wfOut( "Fixing title encoding on logging table... " );
301301 dbsource( archive( 'patch-logging-title.sql' ), $wgDatabase );
302 - echo "ok\n";
 302+ wfOut( "ok\n" );
303303 }
304304 }
305305
@@ -306,11 +306,11 @@
307307 global $wgDatabase;
308308 $fname="do_schema_restructuring";
309309 if ( $wgDatabase->tableExists( 'page' ) ) {
310 - echo "...page table already exists.\n";
 310+ wfOut( "...page table already exists.\n" );
311311 } else {
312 - echo "...converting from cur/old to page/revision/text DB structure.\n"; flush();
313 - echo wfTimestamp();
314 - echo "......checking for duplicate entries.\n"; flush();
 312+ wfOut( "...converting from cur/old to page/revision/text DB structure.\n" );
 313+ wfOut( wfTimestamp() );
 314+ wfOut( "......checking for duplicate entries.\n" );
315315
316316 extract( $wgDatabase->tableNames( 'cur', 'old', 'page', 'revision', 'text' ) );
317317
@@ -318,15 +318,15 @@
319319 FROM $cur GROUP BY cur_title, cur_namespace HAVING c>1", $fname );
320320
321321 if ( $wgDatabase->numRows( $rows ) > 0 ) {
322 - echo wfTimestamp();
323 - echo "......<b>Found duplicate entries</b>\n";
324 - echo ( sprintf( "<b> %-60s %3s %5s</b>\n", 'Title', 'NS', 'Count' ) );
 322+ wfOut( wfTimestamp() );
 323+ wfOut( "......<b>Found duplicate entries</b>\n" );
 324+ wfOut( sprintf( "<b> %-60s %3s %5s</b>\n", 'Title', 'NS', 'Count' ) );
325325 while ( $row = $wgDatabase->fetchObject( $rows ) ) {
326326 if ( ! isset( $duplicate[$row->cur_namespace] ) ) {
327327 $duplicate[$row->cur_namespace] = array();
328328 }
329329 $duplicate[$row->cur_namespace][] = $row->cur_title;
330 - echo ( sprintf( " %-60s %3s %5s\n", $row->cur_title, $row->cur_namespace, $row->c ) );
 330+ wfOut( sprintf( " %-60s %3s %5s\n", $row->cur_title, $row->cur_namespace, $row->c ) );
331331 }
332332 $sql = "SELECT cur_title, cur_namespace, cur_id, cur_timestamp FROM $cur WHERE ";
333333 $firstCond = true;
@@ -366,13 +366,13 @@
367367 }
368368 $sql = "DELETE FROM $cur WHERE cur_id IN ( " . join( ',', $deleteId ) . ')';
369369 $rows = $wgDatabase->query( $sql, $fname );
370 - echo wfTimestamp();
371 - echo "......<b>Deleted</b> ".$wgDatabase->affectedRows()." records.\n";
 370+ wfOut( wfTimestamp() );
 371+ wfOut( "......<b>Deleted</b> ".$wgDatabase->affectedRows()." records.\n" );
372372 }
373373
374374
375 - echo wfTimestamp();
376 - echo "......Creating tables.\n";
 375+ wfOut( wfTimestamp() );
 376+ wfOut( "......Creating tables.\n" );
377377 $wgDatabase->query("CREATE TABLE $page (
378378 page_id int(8) unsigned NOT NULL auto_increment,
379379 page_namespace int NOT NULL,
@@ -409,26 +409,26 @@
410410 INDEX usertext_timestamp (rev_user_text,rev_timestamp)
411411 ) TYPE=InnoDB", $fname );
412412
413 - echo wfTimestamp();
414 - echo "......Locking tables.\n";
 413+ wfOut( wfTimestamp() );
 414+ wfOut( "......Locking tables.\n" );
415415 $wgDatabase->query( "LOCK TABLES $page WRITE, $revision WRITE, $old WRITE, $cur WRITE", $fname );
416416
417417 $maxold = intval( $wgDatabase->selectField( 'old', 'max(old_id)', '', $fname ) );
418 - echo wfTimestamp();
419 - echo "......maxold is {$maxold}\n";
 418+ wfOut( wfTimestamp() );
 419+ wfOut( "......maxold is {$maxold}\n" );
420420
421 - echo wfTimestamp();
 421+ wfOut( wfTimestamp() );
422422 global $wgLegacySchemaConversion;
423423 if( $wgLegacySchemaConversion ) {
424424 // Create HistoryBlobCurStub entries.
425425 // Text will be pulled from the leftover 'cur' table at runtime.
426 - echo "......Moving metadata from cur; using blob references to text in cur table.\n";
 426+ wfOut( "......Moving metadata from cur; using blob references to text in cur table.\n" );
427427 $cur_text = "concat('O:18:\"historyblobcurstub\":1:{s:6:\"mCurId\";i:',cur_id,';}')";
428428 $cur_flags = "'object'";
429429 } else {
430430 // Copy all cur text in immediately: this may take longer but avoids
431431 // having to keep an extra table around.
432 - echo "......Moving text from cur.\n";
 432+ wfOut( "......Moving text from cur.\n" );
433433 $cur_text = 'cur_text';
434434 $cur_flags = "''";
435435 }
@@ -437,16 +437,16 @@
438438 SELECT cur_namespace, cur_title, $cur_text, cur_comment, cur_user, cur_user_text, cur_timestamp, cur_minor_edit, $cur_flags
439439 FROM $cur", $fname );
440440
441 - echo wfTimestamp();
442 - echo "......Setting up revision table.\n";
 441+ wfOut( wfTimestamp() );
 442+ wfOut( "......Setting up revision table.\n" );
443443 $wgDatabase->query( "INSERT INTO $revision (rev_id, rev_page, rev_comment, rev_user, rev_user_text, rev_timestamp,
444444 rev_minor_edit)
445445 SELECT old_id, cur_id, old_comment, old_user, old_user_text,
446446 old_timestamp, old_minor_edit
447447 FROM $old,$cur WHERE old_namespace=cur_namespace AND old_title=cur_title", $fname );
448448
449 - echo wfTimestamp();
450 - echo "......Setting up page table.\n";
 449+ wfOut( wfTimestamp() );
 450+ wfOut( "......Setting up page table.\n" );
451451 $wgDatabase->query( "INSERT INTO $page (page_id, page_namespace, page_title, page_restrictions, page_counter,
452452 page_is_redirect, page_is_new, page_random, page_touched, page_latest, page_len)
453453 SELECT cur_id, cur_namespace, cur_title, cur_restrictions, cur_counter, cur_is_redirect, cur_is_new,
@@ -454,16 +454,16 @@
455455 FROM $cur,$revision
456456 WHERE cur_id=rev_page AND rev_timestamp=cur_timestamp AND rev_id > {$maxold}", $fname );
457457
458 - echo wfTimestamp();
459 - echo "......Unlocking tables.\n";
 458+ wfOut( wfTimestamp() );
 459+ wfOut( "......Unlocking tables.\n" );
460460 $wgDatabase->query( "UNLOCK TABLES", $fname );
461461
462 - echo wfTimestamp();
463 - echo "......Renaming old.\n";
 462+ wfOut( wfTimestamp() );
 463+ wfOut( "......Renaming old.\n" );
464464 $wgDatabase->query( "ALTER TABLE $old RENAME TO $text", $fname );
465465
466 - echo wfTimestamp();
467 - echo "...done.\n";
 466+ wfOut( wfTimestamp() );
 467+ wfOut( "...done.\n" );
468468 }
469469 }
470470
@@ -471,22 +471,22 @@
472472 global $wgDatabase;
473473 $fname="do_schema_restructuring";
474474 if( $wgDatabase->fieldExists( 'revision', 'inverse_timestamp' ) ) {
475 - echo "Removing revision.inverse_timestamp and fixing indexes... ";
 475+ wfOut( "Removing revision.inverse_timestamp and fixing indexes... " );
476476 dbsource( archive( 'patch-inverse_timestamp.sql' ), $wgDatabase );
477 - echo "ok\n";
 477+ wfOut( "ok\n" );
478478 } else {
479 - echo "revision timestamp indexes already up to 2005-03-13\n";
 479+ wfOut( "revision timestamp indexes already up to 2005-03-13\n" );
480480 }
481481 }
482482
483483 function do_text_id() {
484484 global $wgDatabase;
485485 if( $wgDatabase->fieldExists( 'revision', 'rev_text_id' ) ) {
486 - echo "...rev_text_id already in place.\n";
 486+ wfOut( "...rev_text_id already in place.\n" );
487487 } else {
488 - echo "Adding rev_text_id field... ";
 488+ wfOut( "Adding rev_text_id field... " );
489489 dbsource( archive( 'patch-rev_text_id.sql' ), $wgDatabase );
490 - echo "ok\n";
 490+ wfOut( "ok\n" );
491491 }
492492 }
493493
@@ -517,25 +517,25 @@
518518 $wgDatabase->freeResult( $result );
519519
520520 if( substr( $info->Type, 0, 3 ) == 'int' ) {
521 - echo "...$field is already a full int ($info->Type).\n";
 521+ wfOut( "...$field is already a full int ($info->Type).\n" );
522522 } else {
523 - echo "Promoting $field from $info->Type to int... ";
 523+ wfOut( "Promoting $field from $info->Type to int... " );
524524
525525 $sql = "ALTER TABLE $tablename MODIFY $field int NOT NULL";
526526 $wgDatabase->query( $sql );
527527
528 - echo "ok\n";
 528+ wfOut( "ok\n" );
529529 }
530530 }
531531
532532 function do_pagelinks_update() {
533533 global $wgDatabase;
534534 if( $wgDatabase->tableExists( 'pagelinks' ) ) {
535 - echo "...already have pagelinks table.\n";
 535+ wfOut( "...already have pagelinks table.\n" );
536536 } else {
537 - echo "Converting links and brokenlinks tables to pagelinks... ";
 537+ wfOut( "Converting links and brokenlinks tables to pagelinks... " );
538538 dbsource( archive( 'patch-pagelinks.sql' ), $wgDatabase );
539 - echo "ok\n";
 539+ wfOut( "ok\n" );
540540 flush();
541541
542542 global $wgCanonicalNamespaceNames;
@@ -551,7 +551,7 @@
552552 global $wgDatabase, $wgContLang;
553553
554554 $ns = intval( $namespace );
555 - echo "Cleaning up broken links for namespace $ns... ";
 555+ wfOut( "Cleaning up broken links for namespace $ns... " );
556556
557557 $pagelinks = $wgDatabase->tableName( 'pagelinks' );
558558 $name = $wgContLang->getNsText( $ns );
@@ -565,25 +565,25 @@
566566 AND pl_title LIKE '$likeprefix:%'";
567567
568568 $wgDatabase->query( $sql, 'do_pagelinks_namespace' );
569 - echo "ok\n";
 569+ wfOut( "ok\n" );
570570 }
571571
572572 function do_drop_img_type() {
573573 global $wgDatabase;
574574
575575 if( $wgDatabase->fieldExists( 'image', 'img_type' ) ) {
576 - echo "Dropping unused img_type field in image table... ";
 576+ wfOut( "Dropping unused img_type field in image table... " );
577577 dbsource( archive( 'patch-drop_img_type.sql' ), $wgDatabase );
578 - echo "ok\n";
 578+ wfOut( "ok\n" );
579579 } else {
580 - echo "No img_type field in image table; Good.\n";
 580+ wfOut( "No img_type field in image table; Good.\n" );
581581 }
582582 }
583583
584584 function do_old_links_update() {
585585 global $wgDatabase;
586586 if( $wgDatabase->tableExists( 'pagelinks' ) ) {
587 - echo "Already have pagelinks; skipping old links table updates.\n";
 587+ wfOut( "Already have pagelinks; skipping old links table updates.\n" );
588588 } else {
589589 convertLinks(); flush();
590590 }
@@ -593,14 +593,14 @@
594594 global $wgDatabase;
595595 $duper = new UserDupes( $wgDatabase );
596596 if( $duper->hasUniqueIndex() ) {
597 - echo "Already have unique user_name index.\n";
 597+ wfOut( "Already have unique user_name index.\n" );
598598 } else {
599599 if( !$duper->clearDupes() ) {
600 - echo "WARNING: This next step will probably fail due to unfixed duplicates...\n";
 600+ wfOut( "WARNING: This next step will probably fail due to unfixed duplicates...\n" );
601601 }
602 - echo "Adding unique index on user_name... ";
 602+ wfOut( "Adding unique index on user_name... " );
603603 dbsource( archive( 'patch-user_nameindex.sql' ), $wgDatabase );
604 - echo "ok\n";
 604+ wfOut( "ok\n" );
605605 }
606606 }
607607
@@ -609,28 +609,28 @@
610610 global $wgDatabase;
611611
612612 if( $wgDatabase->tableExists( 'user_groups' ) ) {
613 - echo "...user_groups table already exists.\n";
 613+ wfOut( "...user_groups table already exists.\n" );
614614 return do_user_groups_reformat();
615615 }
616616
617 - echo "Adding user_groups table... ";
 617+ wfOut( "Adding user_groups table... " );
618618 dbsource( archive( 'patch-user_groups.sql' ), $wgDatabase );
619 - echo "ok\n";
 619+ wfOut( "ok\n" );
620620
621621 if( !$wgDatabase->tableExists( 'user_rights' ) ) {
622622 if( $wgDatabase->fieldExists( 'user', 'user_rights' ) ) {
623 - echo "Upgrading from a 1.3 or older database? Breaking out user_rights for conversion...";
 623+ wfOut( "Upgrading from a 1.3 or older database? Breaking out user_rights for conversion..." );
624624 dbsource( archive( 'patch-user_rights.sql' ), $wgDatabase );
625 - echo "ok\n";
 625+ wfOut( "ok\n" );
626626 } else {
627 - echo "*** WARNING: couldn't locate user_rights table or field for upgrade.\n";
628 - echo "*** You may need to manually configure some sysops by manipulating\n";
629 - echo "*** the user_groups table.\n";
 627+ wfOut( "*** WARNING: couldn't locate user_rights table or field for upgrade.\n" );
 628+ wfOut( "*** You may need to manually configure some sysops by manipulating\n" );
 629+ wfOut( "*** the user_groups table.\n" );
630630 return;
631631 }
632632 }
633633
634 - echo "Converting user_rights table to user_groups... ";
 634+ wfOut( "Converting user_rights table to user_groups... " );
635635 $result = $wgDatabase->select( 'user_rights',
636636 array( 'ur_user', 'ur_rights' ),
637637 array( "ur_rights != ''" ),
@@ -650,7 +650,7 @@
651651 }
652652 }
653653 $wgDatabase->freeResult( $result );
654 - echo "ok\n";
 654+ wfOut( "ok\n" );
655655 }
656656
657657 function do_user_groups_reformat() {
@@ -661,20 +661,20 @@
662662 if( $info->type == 'int' ) {
663663 $oldug = $wgDatabase->tableName( 'user_groups' );
664664 $newug = $wgDatabase->tableName( 'user_groups_bogus' );
665 - echo "user_groups is in bogus intermediate format. Renaming to $newug... ";
 665+ wfOut( "user_groups is in bogus intermediate format. Renaming to $newug... " );
666666 $wgDatabase->query( "ALTER TABLE $oldug RENAME TO $newug" );
667 - echo "ok\n";
 667+ wfOut( "ok\n" );
668668
669 - echo "Re-adding fresh user_groups table... ";
 669+ wfOut( "Re-adding fresh user_groups table... " );
670670 dbsource( archive( 'patch-user_groups.sql' ), $wgDatabase );
671 - echo "ok\n";
 671+ wfOut( "ok\n" );
672672
673 - echo "***\n";
674 - echo "*** WARNING: You will need to manually fix up user permissions in the user_groups\n";
675 - echo "*** table. Old 1.5 alpha versions did some pretty funky stuff...\n";
676 - echo "***\n";
 673+ wfOut( "***\n" );
 674+ wfOut( "*** WARNING: You will need to manually fix up user permissions in the user_groups\n" );
 675+ wfOut( "*** table. Old 1.5 alpha versions did some pretty funky stuff...\n" );
 676+ wfOut( "***\n" );
677677 } else {
678 - echo "...user_groups is in current format.\n";
 678+ wfOut( "...user_groups is in current format.\n" );
679679 }
680680
681681 }
@@ -686,11 +686,11 @@
687687 $info = $wgDatabase->fieldInfo( 'watchlist', 'wl_notificationtimestamp' );
688688
689689 if( $info->not_null ) {
690 - echo "Making wl_notificationtimestamp nullable... ";
 690+ wfOut( "Making wl_notificationtimestamp nullable... " );
691691 dbsource( archive( 'patch-watchlist-null.sql' ), $wgDatabase );
692 - echo "ok\n";
 692+ wfOut( "ok\n" );
693693 } else {
694 - echo "...wl_notificationtimestamp is already nullable.\n";
 694+ wfOut( "...wl_notificationtimestamp is already nullable.\n" );
695695 }
696696
697697 }
@@ -701,13 +701,13 @@
702702 function do_page_random_update() {
703703 global $wgDatabase;
704704
705 - echo "Setting page_random to a random value on rows where it equals 0...";
 705+ wfOut( "Setting page_random to a random value on rows where it equals 0..." );
706706
707707 $page = $wgDatabase->tableName( 'page' );
708708 $wgDatabase->query( "UPDATE $page SET page_random = RAND() WHERE page_random = 0", 'do_page_random_update' );
709709 $rows = $wgDatabase->affectedRows();
710710
711 - echo "changed $rows rows\n";
 711+ wfOut( "changed $rows rows\n" );
712712 }
713713
714714 function do_templatelinks_update() {
@@ -715,12 +715,12 @@
716716 $fname = 'do_templatelinks_update';
717717
718718 if ( $wgDatabase->tableExists( 'templatelinks' ) ) {
719 - echo "...templatelinks table already exists\n";
 719+ wfOut( "...templatelinks table already exists\n" );
720720 return;
721721 }
722 - echo "Creating templatelinks table...\n";
 722+ wfOut( "Creating templatelinks table...\n" );
723723 dbsource( archive('patch-templatelinks.sql'), $wgDatabase );
724 - echo "Populating...\n";
 724+ wfOut( "Populating...\n" );
725725 if ( isset( $wgLoadBalancer ) && $wgLoadBalancer->getServerCount() > 1 ) {
726726 // Slow, replication-friendly update
727727 $res = $wgDatabase->select( 'pagelinks', array( 'pl_from', 'pl_namespace', 'pl_title' ),
@@ -757,7 +757,7 @@
758758 ), $fname
759759 );
760760 }
761 - echo "Done. Please run maintenance/refreshLinks.php for a more thorough templatelinks update.\n";
 761+ wfOut( "Done. Please run maintenance/refreshLinks.php for a more thorough templatelinks update.\n" );
762762 }
763763
764764 function do_all_updates( $doShared = false ) {
Index: branches/REL1_6/phase3/config/index.php
@@ -47,7 +47,8 @@
4848 <html>
4949 <head>
5050 <meta http-equiv="Content-type" content="text/html; charset=utf-8">
51 - <title>MediaWiki <?php echo( $wgVersion ); ?> Installation</title>
 51+ <meta name="robots" content="noindex,nofollow"/>
 52+ <title>MediaWiki <?php echo htmlspecialchars( $wgVersion ); ?> Installation</title>
5253 <style type="text/css">
5354
5455 @import "../skins/monobook/main.css";
@@ -134,7 +135,7 @@
135136 <div id="content">
136137 <div id="bodyContent">
137138
138 -<h1>MediaWiki <?php print $wgVersion ?> Installation</h1>
 139+<h1>MediaWiki <?php print htmlspecialchars( $wgVersion ) ?> Installation</h1>
139140
140141 <?php
141142
@@ -204,7 +205,7 @@
205206
206207 install_version_checks();
207208
208 -print "<li>PHP " . phpversion() . " installed</li>\n";
 209+print "<li>PHP " . htmlspecialchars( phpversion() ) . " installed</li>\n";
209210
210211 if( ini_get( "register_globals" ) ) {
211212 ?>
@@ -260,7 +261,7 @@
261262 $conf->safeMode = false;
262263 }
263264
264 -$sapi = php_sapi_name();
 265+$sapi = htmlspecialchars( php_sapi_name() );
265266 $conf->prettyURLs = true;
266267 print "<li>PHP server API is $sapi; ";
267268 switch( $sapi ) {
@@ -395,6 +396,12 @@
396397 : $_SERVER["SERVER_ADMIN"];
397398 $conf->EmergencyContact = importPost( "EmergencyContact", $defaultEmail );
398399 $conf->DBtype = importPost( "DBtype", "mysql" );
 400+ if ( !in_array( $conf->DBtype, array( 'mysql', 'oracle' ) ) ) {
 401+ $conf->DBtype = 'mysql';
 402+ }
 403+?>
 404+
 405+<?php
399406 $conf->DBserver = importPost( "DBserver", "localhost" );
400407 $conf->DBname = importPost( "DBname", "wikidb" );
401408 $conf->DBuser = importPost( "DBuser", "wikiuser" );
@@ -490,7 +497,7 @@
491498 $errs["DBtype"] = "Unknown database type.";
492499 continue;
493500 }
494 - print "<li>Database type: {$conf->DBtype}</li>\n";
 501+ print "<li>Database type: " . htmlspecialchars( $conf->DBtype ) . "</li>\n";
495502 $dbclass = 'Database'.ucfirst($conf->DBtype);
496503 require_once("$dbclass.php");
497504 $wgDBtype = $conf->DBtype;
@@ -531,7 +538,7 @@
532539 }
533540
534541 # Attempt to connect
535 - echo( "<li>Attempting to connect to database server as $db_user..." );
 542+ echo( "<li>Attempting to connect to database server as " . htmlspecialchars( $db_user ) . "..." );
536543 $wgDatabase = Database::newFromParams( $wgDBserver, $db_user, $db_pass, '', 1 );
537544
538545 # Check the connection and respond to errors
@@ -566,7 +573,7 @@
567574 case 2003:
568575 default:
569576 # General connection problem
570 - echo( "failed with error [$errno] $errtx.</li>\n" );
 577+ echo( htmlspecialchars( "failed with error [$errno] $errtx." ) . "</li>\n" );
571578 $errs["DBserver"] = "Connection failed";
572579 break;
573580 } # switch
@@ -578,7 +585,7 @@
579586 print "<li>Connecting to SQL server...";
580587 $wgDatabase = $dbc->newFromParams($wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1);
581588 if (!$wgDatabase->isOpen()) {
582 - print " error: " . $wgDatabase->lastError() . "</li>\n";
 589+ print " error: " . htmlspecialchars( $wgDatabase->lastError() ) . "</li>\n";
583590 } else {
584591 $wgDatabase->ignoreErrors(true);
585592 $myver = get_db_version();
@@ -590,7 +597,7 @@
591598 continue;
592599 }
593600
594 - print "<li>Connected to $myver";
 601+ print "<li>Connected to " . htmlspecialchars( $myver );
595602 if( version_compare( $myver, "4.0.14" ) < 0 ) {
596603 die( " -- mysql 4.0.14 or later required. Aborting." );
597604 }
@@ -694,10 +701,10 @@
695702 if( $wgDatabase2->isOpen() ) {
696703 # Nope, just close the test connection and continue
697704 $wgDatabase2->close();
698 - echo( "<li>User $wgDBuser exists. Skipping grants.</li>" );
 705+ echo( "<li>User " . htmlspecialchars( $wgDBuser ) . " exists. Skipping grants.</li>\n" );
699706 } else {
700707 # Yes, so run the grants
701 - echo( "<li>Granting user permissions to $wgDBuser on $wgDBname..." );
 708+ echo( "<li>" . htmlspecialchars( "Granting user permissions to $wgDBuser on $wgDBname..." ) );
702709 dbsource( "../maintenance/users.sql", $wgDatabase );
703710 echo( "success.</li>" );
704711 }
@@ -816,7 +823,9 @@
817824 $list = getLanguageList();
818825 foreach( $list as $code => $name ) {
819826 $sel = ($code == $conf->LanguageCode) ? 'selected="selected"' : '';
820 - echo "\t\t<option value=\"$code\" $sel>$name</option>\n";
 827+ $encCode = htmlspecialchars( $code );
 828+ $encName = htmlspecialchars( $name );
 829+ echo "\n\t\t<option value=\"$encCode\" $sel>$encName</option>";
821830 }
822831 ?>
823832 </select>
@@ -1328,10 +1337,8 @@
13291338 return importVar( $_REQUEST, $name, $default );
13301339 }
13311340
1332 -$radioCount = 0;
1333 -
13341341 function aField( &$conf, $field, $text, $type = "text", $value = "" ) {
1335 - global $radioCount;
 1342+ static $radioCount = 0;
13361343 if( $type != "" ) {
13371344 $xtype = "type=\"$type\"";
13381345 } else {
@@ -1367,7 +1374,9 @@
13681375 }
13691376
13701377 global $errs;
1371 - if(isset($errs[$field])) echo "<span class='error'>" . $errs[$field] . "</span>\n";
 1378+ if(isset($errs[$field])) {
 1379+ echo "<span class='error'>" . htmlspecialchars( $errs[$field] ) . "</span>\n";
 1380+ }
13721381 }
13731382
13741383 function getLanguageList() {
@@ -1469,7 +1478,7 @@
14701479 fclose( $fp );
14711480 }
14721481 if ( !$errstr ) {
1473 - echo "<li>Connected to memcached on $host:$port successfully";
 1482+ echo "<li>Connected to memcached on " . htmlspecialchars( "$host:$port" ) ." successfully</li>";
14741483 }
14751484 return $errstr;
14761485 }
Index: branches/REL1_6/phase3/includes/GlobalFunctions.php
@@ -1772,4 +1772,18 @@
17731773 }
17741774 }
17751775
 1776+/**
 1777+ * Output some plain text in command-line mode or in the installer (updaters.inc).
 1778+ * Do not use it in any other context, its behaviour is subject to change.
 1779+ */
 1780+function wfOut( $s ) {
 1781+ static $lineStarted = false;
 1782+ global $wgCommandLineMode;
 1783+ if ( $wgCommandLineMode && !defined( 'MEDIAWIKI_INSTALL' ) ) {
 1784+ echo $s;
 1785+ } else {
 1786+ echo htmlspecialchars( $s );
 1787+ }
 1788+ flush();
 1789+}
17761790 ?>

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r46840* Fixed a whole lot of XSS vulnerabilities in the installer. All require a li...tstarling08:56, 5 February 2009
r46843(bug 17366) fix for r46840: Xml::encodeJsVar() already escapes and quotes $co...ialex11:59, 5 February 2009
r46889More installer XSStstarling03:46, 6 February 2009

Status & tagging log