Index: branches/REL1_12/phase3/maintenance/initStats.inc |
— | — | @@ -3,34 +3,34 @@ |
4 | 4 | function wfInitStats( $options=array() ) { |
5 | 5 | $dbr = wfGetDB( DB_SLAVE ); |
6 | 6 | |
7 | | - echo "Counting total edits..."; |
| 7 | + wfOut( "Counting total edits..." ); |
8 | 8 | $edits = $dbr->selectField( 'revision', 'COUNT(*)', '', __METHOD__ ); |
9 | 9 | $edits += $dbr->selectField( 'archive', 'COUNT(*)', '', __METHOD__ ); |
10 | | - echo "{$edits}\nCounting number of articles..."; |
| 10 | + wfOut( "{$edits}\nCounting number of articles..." ); |
11 | 11 | |
12 | 12 | global $wgContentNamespaces; |
13 | 13 | $good = $dbr->selectField( 'page', 'COUNT(*)', array( 'page_namespace' => $wgContentNamespaces, 'page_is_redirect' => 0, 'page_len > 0' ), __METHOD__ ); |
14 | | - echo "{$good}\nCounting total pages..."; |
| 14 | + wfOut( "{$good}\nCounting total pages..." ); |
15 | 15 | |
16 | 16 | $pages = $dbr->selectField( 'page', 'COUNT(*)', '', __METHOD__ ); |
17 | | - echo "{$pages}\nCounting number of users..."; |
| 17 | + wfOut( "{$pages}\nCounting number of users..." ); |
18 | 18 | |
19 | 19 | $users = $dbr->selectField( 'user', 'COUNT(*)', '', __METHOD__ ); |
20 | | - echo "{$users}\nCounting number of admins..."; |
| 20 | + wfOut( "{$users}\nCounting number of admins..." ); |
21 | 21 | |
22 | 22 | $admin = $dbr->selectField( 'user_groups', 'COUNT(*)', array( 'ug_group' => 'sysop' ), __METHOD__ ); |
23 | | - echo "{$admin}\nCounting number of images..."; |
| 23 | + wfOut( "{$admin}\nCounting number of images..." ); |
24 | 24 | |
25 | 25 | $image = $dbr->selectField( 'image', 'COUNT(*)', '', __METHOD__ ); |
26 | | - echo "{$image}\n"; |
| 26 | + wfOut( "{$image}\n" ); |
27 | 27 | |
28 | 28 | if( !isset( $options['noviews'] ) ) { |
29 | | - echo "Counting total page views..."; |
| 29 | + wfOut( "Counting total page views..." ); |
30 | 30 | $views = $dbr->selectField( 'page', 'SUM(page_counter)', '', __METHOD__ ); |
31 | | - echo "{$views}\n"; |
| 31 | + wfOut( "{$views}\n" ); |
32 | 32 | } |
33 | 33 | |
34 | | - echo "\nUpdating site statistics..."; |
| 34 | + wfOut( "\nUpdating site statistics..." ); |
35 | 35 | |
36 | 36 | $dbw = wfGetDB( DB_MASTER ); |
37 | 37 | $values = array( 'ss_total_edits' => $edits, |
— | — | @@ -49,7 +49,7 @@ |
50 | 50 | $dbw->insert( 'site_stats', array_merge( $values, $conds, $views ), __METHOD__ ); |
51 | 51 | } |
52 | 52 | |
53 | | - echo( "done.\n" ); |
| 53 | + wfOut( "done.\n" ); |
54 | 54 | } |
55 | 55 | |
56 | 56 | ?> |
\ No newline at end of file |
Index: branches/REL1_12/phase3/maintenance/updaters.inc |
— | — | @@ -142,11 +142,11 @@ |
143 | 143 | global $wgDatabase; |
144 | 144 | if ( $wgDatabase->tableExists( $from ) ) { |
145 | 145 | if ( $wgDatabase->tableExists( $to ) ) { |
146 | | - echo "...can't move table $from to $to, $to already exists.\n"; |
| 146 | + wfOut( "...can't move table $from to $to, $to already exists.\n" ); |
147 | 147 | } else { |
148 | | - echo "Moving table $from to $to..."; |
| 148 | + wfOut( "Moving table $from to $to..." ); |
149 | 149 | dbsource( archive($patch), $wgDatabase ); |
150 | | - echo "ok\n"; |
| 150 | + wfOut( "ok\n" ); |
151 | 151 | } |
152 | 152 | } else { |
153 | 153 | // Source table does not exist |
— | — | @@ -158,47 +158,47 @@ |
159 | 159 | function add_table( $name, $patch, $fullpath=false ) { |
160 | 160 | global $wgDatabase; |
161 | 161 | if ( $wgDatabase->tableExists( $name ) ) { |
162 | | - echo "...$name table already exists.\n"; |
| 162 | + wfOut( "...$name table already exists.\n" ); |
163 | 163 | } else { |
164 | | - echo "Creating $name table..."; |
| 164 | + wfOut( "Creating $name table..." ); |
165 | 165 | if( $fullpath ) { |
166 | 166 | dbsource( $patch, $wgDatabase ); |
167 | 167 | } else { |
168 | 168 | dbsource( archive($patch), $wgDatabase ); |
169 | 169 | } |
170 | | - echo "ok\n"; |
| 170 | + wfOut( "ok\n" ); |
171 | 171 | } |
172 | 172 | } |
173 | 173 | |
174 | 174 | function add_field( $table, $field, $patch, $fullpath=false ) { |
175 | 175 | global $wgDatabase; |
176 | 176 | if ( !$wgDatabase->tableExists( $table ) ) { |
177 | | - echo "...$table table does not exist, skipping new field patch\n"; |
| 177 | + wfOut( "...$table table does not exist, skipping new field patch\n" ); |
178 | 178 | } elseif ( $wgDatabase->fieldExists( $table, $field ) ) { |
179 | | - echo "...have $field field in $table table.\n"; |
| 179 | + wfOut( "...have $field field in $table table.\n" ); |
180 | 180 | } else { |
181 | | - echo "Adding $field field to table $table..."; |
| 181 | + wfOut( "Adding $field field to table $table..." ); |
182 | 182 | if( $fullpath ) { |
183 | 183 | dbsource( $patch, $wgDatabase ); |
184 | 184 | } else { |
185 | 185 | dbsource( archive($patch), $wgDatabase ); |
186 | 186 | } |
187 | | - echo "ok\n"; |
| 187 | + wfOut( "ok\n" ); |
188 | 188 | } |
189 | 189 | } |
190 | 190 | |
191 | 191 | function add_index( $table, $index, $patch, $fullpath=false ) { |
192 | 192 | global $wgDatabase; |
193 | 193 | if( $wgDatabase->indexExists( $table, $index ) ) { |
194 | | - echo "...$index key already set on $table table.\n"; |
| 194 | + wfOut( "...$index key already set on $table table.\n" ); |
195 | 195 | } else { |
196 | | - echo "Adding $index key to table $table... "; |
| 196 | + wfOut( "Adding $index key to table $table... " ); |
197 | 197 | if( $fullpath ) { |
198 | 198 | dbsource( $patch, $wgDatabase ); |
199 | 199 | } else { |
200 | 200 | dbsource( archive($patch), $wgDatabase ); |
201 | 201 | } |
202 | | - echo "ok\n"; |
| 202 | + wfOut( "ok\n" ); |
203 | 203 | } |
204 | 204 | } |
205 | 205 | |
— | — | @@ -214,11 +214,11 @@ |
215 | 215 | |
216 | 216 | global $wgDatabase; |
217 | 217 | $fname = "Update script: update_passwords()"; |
218 | | - print "\nIt appears that you need to update the user passwords in your\n" . |
| 218 | + wfOut( "\nIt appears that you need to update the user passwords in your\n" . |
219 | 219 | "database. If you have already done this (if you've run this update\n" . |
220 | 220 | "script once before, for example), doing so again will make all your\n" . |
221 | 221 | "user accounts inaccessible, so be sure you only do this once.\n" . |
222 | | - "Update user passwords? (yes/no)"; |
| 222 | + "Update user passwords? (yes/no)" ); |
223 | 223 | |
224 | 224 | $resp = readconsole(); |
225 | 225 | if ( ! ( "Y" == $resp{0} || "y" == $resp{0} ) ) { return; } |
— | — | @@ -241,15 +241,15 @@ |
242 | 242 | # Check that interwiki table exists; if it doesn't source it |
243 | 243 | global $wgDatabase, $IP; |
244 | 244 | if( $wgDatabase->tableExists( "interwiki" ) ) { |
245 | | - echo "...already have interwiki table\n"; |
| 245 | + wfOut( "...already have interwiki table\n" ); |
246 | 246 | return true; |
247 | 247 | } |
248 | | - echo "Creating interwiki table: "; |
| 248 | + wfOut( "Creating interwiki table: " ); |
249 | 249 | dbsource( archive("patch-interwiki.sql") ); |
250 | | - echo "ok\n"; |
251 | | - echo "Adding default interwiki definitions: "; |
| 250 | + wfOut( "ok\n" ); |
| 251 | + wfOut( "Adding default interwiki definitions: " ); |
252 | 252 | dbsource( "$IP/maintenance/interwiki.sql" ); |
253 | | - echo "ok\n"; |
| 253 | + wfOut( "ok\n" ); |
254 | 254 | } |
255 | 255 | |
256 | 256 | function do_index_update() { |
— | — | @@ -257,12 +257,12 @@ |
258 | 258 | global $wgDatabase; |
259 | 259 | $meta = $wgDatabase->fieldInfo( "recentchanges", "rc_timestamp" ); |
260 | 260 | if( !$meta->isMultipleKey() ) { |
261 | | - echo "Updating indexes to 20031107: "; |
| 261 | + wfOut( "Updating indexes to 20031107: " ); |
262 | 262 | dbsource( archive("patch-indexes.sql") ); |
263 | | - echo "ok\n"; |
| 263 | + wfOut( "ok\n" ); |
264 | 264 | return true; |
265 | 265 | } |
266 | | - echo "...indexes seem up to 20031107 standards\n"; |
| 266 | + wfOut( "...indexes seem up to 20031107 standards\n" ); |
267 | 267 | return false; |
268 | 268 | } |
269 | 269 | |
— | — | @@ -271,67 +271,67 @@ |
272 | 272 | |
273 | 273 | $meta = $wgDatabase->fieldInfo( "image", "img_major_mime" ); |
274 | 274 | if( !$meta->isMultipleKey() ) { |
275 | | - echo "Updating indexes to 20050912: "; |
| 275 | + wfOut( "Updating indexes to 20050912: " ); |
276 | 276 | dbsource( archive("patch-mimesearch-indexes.sql") ); |
277 | | - echo "ok\n"; |
| 277 | + wfOut( "ok\n" ); |
278 | 278 | return true; |
279 | 279 | } |
280 | | - echo "...indexes seem up to 20050912 standards\n"; |
| 280 | + wfOut( "...indexes seem up to 20050912 standards\n" ); |
281 | 281 | return false; |
282 | 282 | } |
283 | 283 | |
284 | 284 | function do_image_name_unique_update() { |
285 | 285 | global $wgDatabase; |
286 | 286 | if( $wgDatabase->indexExists( 'image', 'PRIMARY' ) ) { |
287 | | - echo "...image primary key already set.\n"; |
| 287 | + wfOut( "...image primary key already set.\n" ); |
288 | 288 | } else { |
289 | | - echo "Making img_name the primary key... "; |
| 289 | + wfOut( "Making img_name the primary key... " ); |
290 | 290 | dbsource( archive("patch-image_name_primary.sql"), $wgDatabase ); |
291 | | - echo "ok\n"; |
| 291 | + wfOut( "ok\n" ); |
292 | 292 | } |
293 | 293 | } |
294 | 294 | |
295 | 295 | function do_logging_timestamp_index() { |
296 | 296 | global $wgDatabase; |
297 | 297 | if( $wgDatabase->indexExists( 'logging', 'times' ) ) { |
298 | | - echo "...timestamp key on logging already exists.\n"; |
| 298 | + wfOut( "...timestamp key on logging already exists.\n" ); |
299 | 299 | } else { |
300 | | - echo "Adding timestamp key on logging table... "; |
| 300 | + wfOut( "Adding timestamp key on logging table... " ); |
301 | 301 | dbsource( archive("patch-logging-times-index.sql"), $wgDatabase ); |
302 | | - echo "ok\n"; |
| 302 | + wfOut( "ok\n" ); |
303 | 303 | } |
304 | 304 | } |
305 | 305 | |
306 | 306 | function do_archive_user_index() { |
307 | 307 | global $wgDatabase; |
308 | 308 | if( $wgDatabase->indexExists( 'archive', 'usertext_timestamp' ) ) { |
309 | | - echo "...usertext,timestamp key on archive already exists.\n"; |
| 309 | + wfOut( "...usertext,timestamp key on archive already exists.\n" ); |
310 | 310 | } else { |
311 | | - echo "Adding usertext,timestamp key on archive table... "; |
| 311 | + wfOut( "Adding usertext,timestamp key on archive table... " ); |
312 | 312 | dbsource( archive("patch-archive-user-index.sql"), $wgDatabase ); |
313 | | - echo "ok\n"; |
| 313 | + wfOut( "ok\n" ); |
314 | 314 | } |
315 | 315 | } |
316 | 316 | |
317 | 317 | function do_image_user_index() { |
318 | 318 | global $wgDatabase; |
319 | 319 | if( $wgDatabase->indexExists( 'image', 'img_usertext_timestamp' ) ) { |
320 | | - echo "...usertext,timestamp key on image already exists.\n"; |
| 320 | + wfOut( "...usertext,timestamp key on image already exists.\n" ); |
321 | 321 | } else { |
322 | | - echo "Adding usertext,timestamp key on image table... "; |
| 322 | + wfOut( "Adding usertext,timestamp key on image table... " ); |
323 | 323 | dbsource( archive("patch-image-user-index.sql"), $wgDatabase ); |
324 | | - echo "ok\n"; |
| 324 | + wfOut( "ok\n" ); |
325 | 325 | } |
326 | 326 | } |
327 | 327 | |
328 | 328 | function do_oldimage_user_index() { |
329 | 329 | global $wgDatabase; |
330 | 330 | if( $wgDatabase->indexExists( 'oldimage', 'oi_usertext_timestamp' ) ) { |
331 | | - echo "...usertext,timestamp key on oldimage already exists.\n"; |
| 331 | + wfOut( "...usertext,timestamp key on oldimage already exists.\n" ); |
332 | 332 | } else { |
333 | | - echo "Adding usertext,timestamp key on oldimage table... "; |
| 333 | + wfOut( "Adding usertext,timestamp key on oldimage table... " ); |
334 | 334 | dbsource( archive("patch-oldimage-user-index.sql"), $wgDatabase ); |
335 | | - echo "ok\n"; |
| 335 | + wfOut( "ok\n" ); |
336 | 336 | } |
337 | 337 | } |
338 | 338 | |
— | — | @@ -339,18 +339,18 @@ |
340 | 340 | global $wgDatabase; |
341 | 341 | $fname = 'do_watchlist_update'; |
342 | 342 | if( $wgDatabase->fieldExists( 'watchlist', 'wl_notificationtimestamp' ) ) { |
343 | | - echo "The watchlist table is already set up for email notification.\n"; |
| 343 | + wfOut( "The watchlist table is already set up for email notification.\n" ); |
344 | 344 | } else { |
345 | | - echo "Adding wl_notificationtimestamp field for email notification management."; |
| 345 | + wfOut( "Adding wl_notificationtimestamp field for email notification management." ); |
346 | 346 | /* ALTER TABLE watchlist ADD (wl_notificationtimestamp varchar(14) binary NOT NULL default '0'); */ |
347 | 347 | dbsource( archive( 'patch-email-notification.sql' ), $wgDatabase ); |
348 | | - echo "ok\n"; |
| 348 | + wfOut( "ok\n" ); |
349 | 349 | } |
350 | 350 | # Check if we need to add talk page rows to the watchlist |
351 | 351 | $talk = $wgDatabase->selectField( 'watchlist', 'count(*)', 'wl_namespace & 1', $fname ); |
352 | 352 | $nontalk = $wgDatabase->selectField( 'watchlist', 'count(*)', 'NOT (wl_namespace & 1)', $fname ); |
353 | 353 | if ( $talk != $nontalk ) { |
354 | | - echo "Adding missing watchlist talk page rows... "; |
| 354 | + wfOut( "Adding missing watchlist talk page rows... " ); |
355 | 355 | flush(); |
356 | 356 | |
357 | 357 | $wgDatabase->insertSelect( 'watchlist', 'watchlist', |
— | — | @@ -360,9 +360,9 @@ |
361 | 361 | 'wl_title' => 'wl_title', |
362 | 362 | 'wl_notificationtimestamp' => 'wl_notificationtimestamp' |
363 | 363 | ), array( 'NOT (wl_namespace & 1)' ), $fname, 'IGNORE' ); |
364 | | - echo "ok\n"; |
| 364 | + wfOut( "ok\n" ); |
365 | 365 | } else { |
366 | | - echo "...watchlist talk page rows already present\n"; |
| 366 | + wfOut( "...watchlist talk page rows already present\n" ); |
367 | 367 | } |
368 | 368 | } |
369 | 369 | |
— | — | @@ -373,7 +373,7 @@ |
374 | 374 | $res = $wgDatabase->safeQuery( 'SELECT user_id, user_ip FROM !', |
375 | 375 | $wgDatabase->tableName( 'user_newtalk' ) ); |
376 | 376 | $num_newtalks=$wgDatabase->numRows($res); |
377 | | - echo "Now converting ".$num_newtalks." user_newtalk entries to watchlist table entries ... \n"; |
| 377 | + wfOut( "Now converting $num_newtalks user_newtalk entries to watchlist table entries ... \n" ); |
378 | 378 | |
379 | 379 | $user = new User(); |
380 | 380 | for ( $i = 1; $i <= $num_newtalks; $i++ ) { |
— | — | @@ -401,18 +401,18 @@ |
402 | 402 | ); |
403 | 403 | } |
404 | 404 | } |
405 | | - echo "Done.\n"; |
| 405 | + wfOut( "Done.\n" ); |
406 | 406 | } |
407 | 407 | |
408 | 408 | |
409 | 409 | function do_user_update() { |
410 | 410 | global $wgDatabase; |
411 | 411 | if( $wgDatabase->fieldExists( 'user', 'user_emailauthenticationtimestamp' ) ) { |
412 | | - echo "User table contains old email authentication field. Dropping... "; |
| 412 | + wfOut( "User table contains old email authentication field. Dropping... " ); |
413 | 413 | dbsource( archive( 'patch-email-authentication.sql' ), $wgDatabase ); |
414 | | - echo "ok\n"; |
| 414 | + wfOut( "ok\n" ); |
415 | 415 | } else { |
416 | | - echo "...user table does not contain old email authentication field.\n"; |
| 416 | + wfOut( "...user table does not contain old email authentication field.\n" ); |
417 | 417 | } |
418 | 418 | } |
419 | 419 | |
— | — | @@ -430,11 +430,11 @@ |
431 | 431 | $wgDatabase->freeResult( $res ); |
432 | 432 | |
433 | 433 | if( in_array( 'binary', $flags ) ) { |
434 | | - echo "Logging table has correct title encoding.\n"; |
| 434 | + wfOut( "Logging table has correct title encoding.\n" ); |
435 | 435 | } else { |
436 | | - echo "Fixing title encoding on logging table... "; |
| 436 | + wfOut( "Fixing title encoding on logging table... " ); |
437 | 437 | dbsource( archive( 'patch-logging-title.sql' ), $wgDatabase ); |
438 | | - echo "ok\n"; |
| 438 | + wfOut( "ok\n" ); |
439 | 439 | } |
440 | 440 | } |
441 | 441 | |
— | — | @@ -442,11 +442,11 @@ |
443 | 443 | global $wgDatabase; |
444 | 444 | $fname="do_schema_restructuring"; |
445 | 445 | if ( $wgDatabase->tableExists( 'page' ) ) { |
446 | | - echo "...page table already exists.\n"; |
| 446 | + wfOut( "...page table already exists.\n" ); |
447 | 447 | } else { |
448 | | - echo "...converting from cur/old to page/revision/text DB structure.\n"; flush(); |
449 | | - echo wfTimestamp( TS_DB ); |
450 | | - echo "......checking for duplicate entries.\n"; flush(); |
| 448 | + wfOut( "...converting from cur/old to page/revision/text DB structure.\n" ); |
| 449 | + wfOut( wfTimestamp( TS_DB ) ); |
| 450 | + wfOut( "......checking for duplicate entries.\n" ); |
451 | 451 | |
452 | 452 | list ($cur, $old, $page, $revision, $text) = $wgDatabase->tableNamesN( 'cur', 'old', 'page', 'revision', 'text' ); |
453 | 453 | |
— | — | @@ -454,15 +454,15 @@ |
455 | 455 | FROM $cur GROUP BY cur_title, cur_namespace HAVING c>1", $fname ); |
456 | 456 | |
457 | 457 | if ( $wgDatabase->numRows( $rows ) > 0 ) { |
458 | | - echo wfTimestamp( TS_DB ); |
459 | | - echo "......<b>Found duplicate entries</b>\n"; |
460 | | - echo ( sprintf( "<b> %-60s %3s %5s</b>\n", 'Title', 'NS', 'Count' ) ); |
| 458 | + wfOut( wfTimestamp( TS_DB ) ); |
| 459 | + wfOut( "......<b>Found duplicate entries</b>\n" ); |
| 460 | + wfOut( sprintf( "<b> %-60s %3s %5s</b>\n", 'Title', 'NS', 'Count' ) ); |
461 | 461 | while ( $row = $wgDatabase->fetchObject( $rows ) ) { |
462 | 462 | if ( ! isset( $duplicate[$row->cur_namespace] ) ) { |
463 | 463 | $duplicate[$row->cur_namespace] = array(); |
464 | 464 | } |
465 | 465 | $duplicate[$row->cur_namespace][] = $row->cur_title; |
466 | | - echo ( sprintf( " %-60s %3s %5s\n", $row->cur_title, $row->cur_namespace, $row->c ) ); |
| 466 | + wfOut( sprintf( " %-60s %3s %5s\n", $row->cur_title, $row->cur_namespace, $row->c ) ); |
467 | 467 | } |
468 | 468 | $sql = "SELECT cur_title, cur_namespace, cur_id, cur_timestamp FROM $cur WHERE "; |
469 | 469 | $firstCond = true; |
— | — | @@ -502,13 +502,13 @@ |
503 | 503 | } |
504 | 504 | $sql = "DELETE FROM $cur WHERE cur_id IN ( " . join( ',', $deleteId ) . ')'; |
505 | 505 | $rows = $wgDatabase->query( $sql, $fname ); |
506 | | - echo wfTimestamp( TS_DB ); |
507 | | - echo "......<b>Deleted</b> ".$wgDatabase->affectedRows()." records.\n"; |
| 506 | + wfOut( wfTimestamp( TS_DB ) ); |
| 507 | + wfOut( "......<b>Deleted</b> ".$wgDatabase->affectedRows()." records.\n" ); |
508 | 508 | } |
509 | 509 | |
510 | 510 | |
511 | | - echo wfTimestamp( TS_DB ); |
512 | | - echo "......Creating tables.\n"; |
| 511 | + wfOut( wfTimestamp( TS_DB ) ); |
| 512 | + wfOut( "......Creating tables.\n" ); |
513 | 513 | $wgDatabase->query("CREATE TABLE $page ( |
514 | 514 | page_id int(8) unsigned NOT NULL auto_increment, |
515 | 515 | page_namespace int NOT NULL, |
— | — | @@ -546,26 +546,26 @@ |
547 | 547 | INDEX usertext_timestamp (rev_user_text,rev_timestamp) |
548 | 548 | ) TYPE=InnoDB", $fname ); |
549 | 549 | |
550 | | - echo wfTimestamp( TS_DB ); |
551 | | - echo "......Locking tables.\n"; |
| 550 | + wfOut( wfTimestamp( TS_DB ) ); |
| 551 | + wfOut( "......Locking tables.\n" ); |
552 | 552 | $wgDatabase->query( "LOCK TABLES $page WRITE, $revision WRITE, $old WRITE, $cur WRITE", $fname ); |
553 | 553 | |
554 | 554 | $maxold = intval( $wgDatabase->selectField( 'old', 'max(old_id)', '', $fname ) ); |
555 | | - echo wfTimestamp( TS_DB ); |
556 | | - echo "......maxold is {$maxold}\n"; |
| 555 | + wfOut( wfTimestamp( TS_DB ) ); |
| 556 | + wfOut( "......maxold is {$maxold}\n" ); |
557 | 557 | |
558 | | - echo wfTimestamp( TS_DB ); |
| 558 | + wfOut( wfTimestamp( TS_DB ) ); |
559 | 559 | global $wgLegacySchemaConversion; |
560 | 560 | if( $wgLegacySchemaConversion ) { |
561 | 561 | // Create HistoryBlobCurStub entries. |
562 | 562 | // Text will be pulled from the leftover 'cur' table at runtime. |
563 | | - echo "......Moving metadata from cur; using blob references to text in cur table.\n"; |
| 563 | + wfOut( "......Moving metadata from cur; using blob references to text in cur table.\n" ); |
564 | 564 | $cur_text = "concat('O:18:\"historyblobcurstub\":1:{s:6:\"mCurId\";i:',cur_id,';}')"; |
565 | 565 | $cur_flags = "'object'"; |
566 | 566 | } else { |
567 | 567 | // Copy all cur text in immediately: this may take longer but avoids |
568 | 568 | // having to keep an extra table around. |
569 | | - echo "......Moving text from cur.\n"; |
| 569 | + wfOut( "......Moving text from cur.\n" ); |
570 | 570 | $cur_text = 'cur_text'; |
571 | 571 | $cur_flags = "''"; |
572 | 572 | } |
— | — | @@ -574,16 +574,16 @@ |
575 | 575 | SELECT cur_namespace, cur_title, $cur_text, cur_comment, cur_user, cur_user_text, cur_timestamp, cur_minor_edit, $cur_flags |
576 | 576 | FROM $cur", $fname ); |
577 | 577 | |
578 | | - echo wfTimestamp( TS_DB ); |
579 | | - echo "......Setting up revision table.\n"; |
| 578 | + wfOut( wfTimestamp( TS_DB ) ); |
| 579 | + wfOut( "......Setting up revision table.\n" ); |
580 | 580 | $wgDatabase->query( "INSERT INTO $revision (rev_id, rev_page, rev_comment, rev_user, rev_user_text, rev_timestamp, |
581 | 581 | rev_minor_edit) |
582 | 582 | SELECT old_id, cur_id, old_comment, old_user, old_user_text, |
583 | 583 | old_timestamp, old_minor_edit |
584 | 584 | FROM $old,$cur WHERE old_namespace=cur_namespace AND old_title=cur_title", $fname ); |
585 | 585 | |
586 | | - echo wfTimestamp( TS_DB ); |
587 | | - echo "......Setting up page table.\n"; |
| 586 | + wfOut( wfTimestamp( TS_DB ) ); |
| 587 | + wfOut( "......Setting up page table.\n" ); |
588 | 588 | $wgDatabase->query( "INSERT INTO $page (page_id, page_namespace, page_title, page_restrictions, page_counter, |
589 | 589 | page_is_redirect, page_is_new, page_random, page_touched, page_latest, page_len) |
590 | 590 | SELECT cur_id, cur_namespace, cur_title, cur_restrictions, cur_counter, cur_is_redirect, cur_is_new, |
— | — | @@ -591,38 +591,38 @@ |
592 | 592 | FROM $cur,$revision |
593 | 593 | WHERE cur_id=rev_page AND rev_timestamp=cur_timestamp AND rev_id > {$maxold}", $fname ); |
594 | 594 | |
595 | | - echo wfTimestamp( TS_DB ); |
596 | | - echo "......Unlocking tables.\n"; |
| 595 | + wfOut( wfTimestamp( TS_DB ) ); |
| 596 | + wfOut( "......Unlocking tables.\n" ); |
597 | 597 | $wgDatabase->query( "UNLOCK TABLES", $fname ); |
598 | 598 | |
599 | | - echo wfTimestamp( TS_DB ); |
600 | | - echo "......Renaming old.\n"; |
| 599 | + wfOut( wfTimestamp( TS_DB ) ); |
| 600 | + wfOut( "......Renaming old.\n" ); |
601 | 601 | $wgDatabase->query( "ALTER TABLE $old RENAME TO $text", $fname ); |
602 | 602 | |
603 | | - echo wfTimestamp( TS_DB ); |
604 | | - echo "...done.\n"; |
| 603 | + wfOut( wfTimestamp( TS_DB ) ); |
| 604 | + wfOut( "...done.\n" ); |
605 | 605 | } |
606 | 606 | } |
607 | 607 | |
608 | 608 | function do_inverse_timestamp() { |
609 | 609 | global $wgDatabase; |
610 | 610 | if( $wgDatabase->fieldExists( 'revision', 'inverse_timestamp' ) ) { |
611 | | - echo "Removing revision.inverse_timestamp and fixing indexes... "; |
| 611 | + wfOut( "Removing revision.inverse_timestamp and fixing indexes... " ); |
612 | 612 | dbsource( archive( 'patch-inverse_timestamp.sql' ), $wgDatabase ); |
613 | | - echo "ok\n"; |
| 613 | + wfOut( "ok\n" ); |
614 | 614 | } else { |
615 | | - echo "revision timestamp indexes already up to 2005-03-13\n"; |
| 615 | + wfOut( "revision timestamp indexes already up to 2005-03-13\n" ); |
616 | 616 | } |
617 | 617 | } |
618 | 618 | |
619 | 619 | function do_text_id() { |
620 | 620 | global $wgDatabase; |
621 | 621 | if( $wgDatabase->fieldExists( 'revision', 'rev_text_id' ) ) { |
622 | | - echo "...rev_text_id already in place.\n"; |
| 622 | + wfOut( "...rev_text_id already in place.\n" ); |
623 | 623 | } else { |
624 | | - echo "Adding rev_text_id field... "; |
| 624 | + wfOut( "Adding rev_text_id field... " ); |
625 | 625 | dbsource( archive( 'patch-rev_text_id.sql' ), $wgDatabase ); |
626 | | - echo "ok\n"; |
| 626 | + wfOut( "ok\n" ); |
627 | 627 | } |
628 | 628 | } |
629 | 629 | |
— | — | @@ -653,25 +653,25 @@ |
654 | 654 | $wgDatabase->freeResult( $result ); |
655 | 655 | |
656 | 656 | if( substr( $info->Type, 0, 3 ) == 'int' ) { |
657 | | - echo "...$field is already a full int ($info->Type).\n"; |
| 657 | + wfOut( "...$field is already a full int ($info->Type).\n" ); |
658 | 658 | } else { |
659 | | - echo "Promoting $field from $info->Type to int... "; |
| 659 | + wfOut( "Promoting $field from $info->Type to int... " ); |
660 | 660 | |
661 | 661 | $sql = "ALTER TABLE $tablename MODIFY $field int NOT NULL"; |
662 | 662 | $wgDatabase->query( $sql ); |
663 | 663 | |
664 | | - echo "ok\n"; |
| 664 | + wfOut( "ok\n" ); |
665 | 665 | } |
666 | 666 | } |
667 | 667 | |
668 | 668 | function do_pagelinks_update() { |
669 | 669 | global $wgDatabase; |
670 | 670 | if( $wgDatabase->tableExists( 'pagelinks' ) ) { |
671 | | - echo "...already have pagelinks table.\n"; |
| 671 | + wfOut( "...already have pagelinks table.\n" ); |
672 | 672 | } else { |
673 | | - echo "Converting links and brokenlinks tables to pagelinks... "; |
| 673 | + wfOut( "Converting links and brokenlinks tables to pagelinks... " ); |
674 | 674 | dbsource( archive( 'patch-pagelinks.sql' ), $wgDatabase ); |
675 | | - echo "ok\n"; |
| 675 | + wfOut( "ok\n" ); |
676 | 676 | flush(); |
677 | 677 | |
678 | 678 | global $wgCanonicalNamespaceNames; |
— | — | @@ -687,7 +687,7 @@ |
688 | 688 | global $wgDatabase, $wgContLang; |
689 | 689 | |
690 | 690 | $ns = intval( $namespace ); |
691 | | - echo "Cleaning up broken links for namespace $ns... "; |
| 691 | + wfOut( "Cleaning up broken links for namespace $ns... " ); |
692 | 692 | |
693 | 693 | $pagelinks = $wgDatabase->tableName( 'pagelinks' ); |
694 | 694 | $name = $wgContLang->getNsText( $ns ); |
— | — | @@ -701,25 +701,25 @@ |
702 | 702 | AND pl_title LIKE '$likeprefix:%'"; |
703 | 703 | |
704 | 704 | $wgDatabase->query( $sql, 'do_pagelinks_namespace' ); |
705 | | - echo "ok\n"; |
| 705 | + wfOut( "ok\n" ); |
706 | 706 | } |
707 | 707 | |
708 | 708 | function do_drop_img_type() { |
709 | 709 | global $wgDatabase; |
710 | 710 | |
711 | 711 | if( $wgDatabase->fieldExists( 'image', 'img_type' ) ) { |
712 | | - echo "Dropping unused img_type field in image table... "; |
| 712 | + wfOut( "Dropping unused img_type field in image table... " ); |
713 | 713 | dbsource( archive( 'patch-drop_img_type.sql' ), $wgDatabase ); |
714 | | - echo "ok\n"; |
| 714 | + wfOut( "ok\n" ); |
715 | 715 | } else { |
716 | | - echo "No img_type field in image table; Good.\n"; |
| 716 | + wfOut( "No img_type field in image table; Good.\n" ); |
717 | 717 | } |
718 | 718 | } |
719 | 719 | |
720 | 720 | function do_old_links_update() { |
721 | 721 | global $wgDatabase; |
722 | 722 | if( $wgDatabase->tableExists( 'pagelinks' ) ) { |
723 | | - echo "Already have pagelinks; skipping old links table updates.\n"; |
| 723 | + wfOut( "Already have pagelinks; skipping old links table updates.\n" ); |
724 | 724 | } else { |
725 | 725 | convertLinks(); flush(); |
726 | 726 | } |
— | — | @@ -729,14 +729,14 @@ |
730 | 730 | global $wgDatabase; |
731 | 731 | $duper = new UserDupes( $wgDatabase ); |
732 | 732 | if( $duper->hasUniqueIndex() ) { |
733 | | - echo "Already have unique user_name index.\n"; |
| 733 | + wfOut( "Already have unique user_name index.\n" ); |
734 | 734 | } else { |
735 | 735 | if( !$duper->clearDupes() ) { |
736 | | - echo "WARNING: This next step will probably fail due to unfixed duplicates...\n"; |
| 736 | + wfOut( "WARNING: This next step will probably fail due to unfixed duplicates...\n" ); |
737 | 737 | } |
738 | | - echo "Adding unique index on user_name... "; |
| 738 | + wfOut( "Adding unique index on user_name... " ); |
739 | 739 | dbsource( archive( 'patch-user_nameindex.sql' ), $wgDatabase ); |
740 | | - echo "ok\n"; |
| 740 | + wfOut( "ok\n" ); |
741 | 741 | } |
742 | 742 | } |
743 | 743 | |
— | — | @@ -745,28 +745,28 @@ |
746 | 746 | global $wgDatabase; |
747 | 747 | |
748 | 748 | if( $wgDatabase->tableExists( 'user_groups' ) ) { |
749 | | - echo "...user_groups table already exists.\n"; |
| 749 | + wfOut( "...user_groups table already exists.\n" ); |
750 | 750 | return do_user_groups_reformat(); |
751 | 751 | } |
752 | 752 | |
753 | | - echo "Adding user_groups table... "; |
| 753 | + wfOut( "Adding user_groups table... " ); |
754 | 754 | dbsource( archive( 'patch-user_groups.sql' ), $wgDatabase ); |
755 | | - echo "ok\n"; |
| 755 | + wfOut( "ok\n" ); |
756 | 756 | |
757 | 757 | if( !$wgDatabase->tableExists( 'user_rights' ) ) { |
758 | 758 | if( $wgDatabase->fieldExists( 'user', 'user_rights' ) ) { |
759 | | - echo "Upgrading from a 1.3 or older database? Breaking out user_rights for conversion..."; |
| 759 | + wfOut( "Upgrading from a 1.3 or older database? Breaking out user_rights for conversion..." ); |
760 | 760 | dbsource( archive( 'patch-user_rights.sql' ), $wgDatabase ); |
761 | | - echo "ok\n"; |
| 761 | + wfOut( "ok\n" ); |
762 | 762 | } else { |
763 | | - echo "*** WARNING: couldn't locate user_rights table or field for upgrade.\n"; |
764 | | - echo "*** You may need to manually configure some sysops by manipulating\n"; |
765 | | - echo "*** the user_groups table.\n"; |
| 763 | + wfOut( "*** WARNING: couldn't locate user_rights table or field for upgrade.\n" ); |
| 764 | + wfOut( "*** You may need to manually configure some sysops by manipulating\n" ); |
| 765 | + wfOut( "*** the user_groups table.\n" ); |
766 | 766 | return; |
767 | 767 | } |
768 | 768 | } |
769 | 769 | |
770 | | - echo "Converting user_rights table to user_groups... "; |
| 770 | + wfOut( "Converting user_rights table to user_groups... " ); |
771 | 771 | $result = $wgDatabase->select( 'user_rights', |
772 | 772 | array( 'ur_user', 'ur_rights' ), |
773 | 773 | array( "ur_rights != ''" ), |
— | — | @@ -786,7 +786,7 @@ |
787 | 787 | } |
788 | 788 | } |
789 | 789 | $wgDatabase->freeResult( $result ); |
790 | | - echo "ok\n"; |
| 790 | + wfOut( "ok\n" ); |
791 | 791 | } |
792 | 792 | |
793 | 793 | function do_user_groups_reformat() { |
— | — | @@ -797,20 +797,20 @@ |
798 | 798 | if( $info->type() == 'int' ) { |
799 | 799 | $oldug = $wgDatabase->tableName( 'user_groups' ); |
800 | 800 | $newug = $wgDatabase->tableName( 'user_groups_bogus' ); |
801 | | - echo "user_groups is in bogus intermediate format. Renaming to $newug... "; |
| 801 | + wfOut( "user_groups is in bogus intermediate format. Renaming to $newug... " ); |
802 | 802 | $wgDatabase->query( "ALTER TABLE $oldug RENAME TO $newug" ); |
803 | | - echo "ok\n"; |
| 803 | + wfOut( "ok\n" ); |
804 | 804 | |
805 | | - echo "Re-adding fresh user_groups table... "; |
| 805 | + wfOut( "Re-adding fresh user_groups table... " ); |
806 | 806 | dbsource( archive( 'patch-user_groups.sql' ), $wgDatabase ); |
807 | | - echo "ok\n"; |
| 807 | + wfOut( "ok\n" ); |
808 | 808 | |
809 | | - echo "***\n"; |
810 | | - echo "*** WARNING: You will need to manually fix up user permissions in the user_groups\n"; |
811 | | - echo "*** table. Old 1.5 alpha versions did some pretty funky stuff...\n"; |
812 | | - echo "***\n"; |
| 809 | + wfOut( "***\n" ); |
| 810 | + wfOut( "*** WARNING: You will need to manually fix up user permissions in the user_groups\n" ); |
| 811 | + wfOut( "*** table. Old 1.5 alpha versions did some pretty funky stuff...\n" ); |
| 812 | + wfOut( "***\n" ); |
813 | 813 | } else { |
814 | | - echo "...user_groups is in current format.\n"; |
| 814 | + wfOut( "...user_groups is in current format.\n" ); |
815 | 815 | } |
816 | 816 | |
817 | 817 | } |
— | — | @@ -822,11 +822,11 @@ |
823 | 823 | $info = $wgDatabase->fieldInfo( 'watchlist', 'wl_notificationtimestamp' ); |
824 | 824 | |
825 | 825 | if( !$info->nullable() ) { |
826 | | - echo "Making wl_notificationtimestamp nullable... "; |
| 826 | + wfOut( "Making wl_notificationtimestamp nullable... " ); |
827 | 827 | dbsource( archive( 'patch-watchlist-null.sql' ), $wgDatabase ); |
828 | | - echo "ok\n"; |
| 828 | + wfOut( "ok\n" ); |
829 | 829 | } else { |
830 | | - echo "...wl_notificationtimestamp is already nullable.\n"; |
| 830 | + wfOut( "...wl_notificationtimestamp is already nullable.\n" ); |
831 | 831 | } |
832 | 832 | |
833 | 833 | } |
— | — | @@ -837,13 +837,13 @@ |
838 | 838 | function do_page_random_update() { |
839 | 839 | global $wgDatabase; |
840 | 840 | |
841 | | - echo "Setting page_random to a random value on rows where it equals 0..."; |
| 841 | + wfOut( "Setting page_random to a random value on rows where it equals 0..." ); |
842 | 842 | |
843 | 843 | $page = $wgDatabase->tableName( 'page' ); |
844 | 844 | $wgDatabase->query( "UPDATE $page SET page_random = RAND() WHERE page_random = 0", 'do_page_random_update' ); |
845 | 845 | $rows = $wgDatabase->affectedRows(); |
846 | 846 | |
847 | | - echo "changed $rows rows\n"; |
| 847 | + wfOut( "changed $rows rows\n" ); |
848 | 848 | } |
849 | 849 | |
850 | 850 | function do_templatelinks_update() { |
— | — | @@ -851,12 +851,12 @@ |
852 | 852 | $fname = 'do_templatelinks_update'; |
853 | 853 | |
854 | 854 | if ( $wgDatabase->tableExists( 'templatelinks' ) ) { |
855 | | - echo "...templatelinks table already exists\n"; |
| 855 | + wfOut( "...templatelinks table already exists\n" ); |
856 | 856 | return; |
857 | 857 | } |
858 | | - echo "Creating templatelinks table...\n"; |
| 858 | + wfOut( "Creating templatelinks table...\n" ); |
859 | 859 | dbsource( archive('patch-templatelinks.sql'), $wgDatabase ); |
860 | | - echo "Populating...\n"; |
| 860 | + wfOut( "Populating...\n" ); |
861 | 861 | if ( isset( $wgLoadBalancer ) && $wgLoadBalancer->getServerCount() > 1 ) { |
862 | 862 | // Slow, replication-friendly update |
863 | 863 | $res = $wgDatabase->select( 'pagelinks', array( 'pl_from', 'pl_namespace', 'pl_title' ), |
— | — | @@ -893,14 +893,14 @@ |
894 | 894 | ), $fname |
895 | 895 | ); |
896 | 896 | } |
897 | | - echo "Done. Please run maintenance/refreshLinks.php for a more thorough templatelinks update.\n"; |
| 897 | + wfOut( "Done. Please run maintenance/refreshLinks.php for a more thorough templatelinks update.\n" ); |
898 | 898 | } |
899 | 899 | |
900 | 900 | // Add index on ( rc_namespace, rc_user_text ) [Jul. 2006] |
901 | 901 | // Add index on ( rc_user_text, rc_timestamp ) [Nov. 2006] |
902 | 902 | function do_rc_indices_update() { |
903 | 903 | global $wgDatabase; |
904 | | - echo( "Checking for additional recent changes indices...\n" ); |
| 904 | + wfOut( "Checking for additional recent changes indices...\n" ); |
905 | 905 | |
906 | 906 | $indexes = array( |
907 | 907 | 'rc_ns_usertext' => 'patch-recentchanges-utindex.sql', |
— | — | @@ -910,33 +910,33 @@ |
911 | 911 | foreach( $indexes as $index => $patch ) { |
912 | 912 | $info = $wgDatabase->indexInfo( 'recentchanges', $index, __METHOD__ ); |
913 | 913 | if( !$info ) { |
914 | | - echo( "...index `{$index}` not found; adding..." ); |
| 914 | + wfOut( "...index `{$index}` not found; adding..." ); |
915 | 915 | dbsource( archive( $patch ) ); |
916 | | - echo( "done.\n" ); |
| 916 | + wfOut( "done.\n" ); |
917 | 917 | } else { |
918 | | - echo( "...index `{$index}` seems ok.\n" ); |
| 918 | + wfOut( "...index `{$index}` seems ok.\n" ); |
919 | 919 | } |
920 | 920 | } |
921 | 921 | } |
922 | 922 | |
923 | 923 | function index_has_field($table, $index, $field) { |
924 | 924 | global $wgDatabase; |
925 | | - echo( "Checking if $table index $index includes field $field...\n" ); |
| 925 | + wfOut( "Checking if $table index $index includes field $field...\n" ); |
926 | 926 | $info = $wgDatabase->indexInfo( $table, $index, __METHOD__ ); |
927 | 927 | if( $info ) { |
928 | 928 | foreach($info as $row) { |
929 | 929 | if($row->Column_name == $field) { |
930 | | - echo( "...index $index on table $table seems to be ok\n" ); |
| 930 | + wfOut( "...index $index on table $table seems to be ok\n" ); |
931 | 931 | return true; |
932 | 932 | } |
933 | 933 | } |
934 | 934 | } |
935 | | - echo( "...index $index on table $table has no field $field; adding\n" ); |
| 935 | + wfOut( "...index $index on table $table has no field $field; adding\n" ); |
936 | 936 | return false; |
937 | 937 | } |
938 | 938 | |
939 | 939 | function do_backlinking_indices_update() { |
940 | | - echo( "Checking for backlinking indices...\n" ); |
| 940 | + wfOut( "Checking for backlinking indices...\n" ); |
941 | 941 | if (!index_has_field('pagelinks', 'pl_namespace', 'pl_from') || |
942 | 942 | !index_has_field('templatelinks', 'tl_namespace', 'tl_from') || |
943 | 943 | !index_has_field('imagelinks', 'il_to', 'il_from')) |
— | — | @@ -946,7 +946,7 @@ |
947 | 947 | } |
948 | 948 | |
949 | 949 | function do_categorylinks_indices_update() { |
950 | | - echo( "Checking for categorylinks indices...\n" ); |
| 950 | + wfOut( "Checking for categorylinks indices...\n" ); |
951 | 951 | if (!index_has_field('categorylinks', 'cl_sortkey', 'cl_from')) |
952 | 952 | { |
953 | 953 | dbsource( archive( 'patch-categorylinksindex.sql' ) ); |
— | — | @@ -956,16 +956,15 @@ |
957 | 957 | function do_stats_init() { |
958 | 958 | // Sometimes site_stats table is not properly populated. |
959 | 959 | global $wgDatabase; |
960 | | - echo "Checking site_stats row..."; |
| 960 | + wfOut( "Checking site_stats row..." ); |
961 | 961 | $row = $wgDatabase->selectRow( 'site_stats', '*', array( 'ss_row_id' => 1 ), __METHOD__ ); |
962 | 962 | if( $row === false ) { |
963 | | - echo "data is missing! rebuilding...\n"; |
964 | | - |
| 963 | + wfOut( "data is missing! rebuilding...\n" ); |
965 | 964 | global $IP; |
966 | 965 | require_once "$IP/maintenance/initStats.inc"; |
967 | 966 | wfInitStats(); |
968 | 967 | } else { |
969 | | - echo "ok.\n"; |
| 968 | + wfOut( "ok.\n" ); |
970 | 969 | } |
971 | 970 | } |
972 | 971 | |
— | — | @@ -973,9 +972,9 @@ |
974 | 973 | global $wgDatabase; |
975 | 974 | # We can't guarantee that the user will be able to use TRUNCATE, |
976 | 975 | # but we know that DELETE is available to us |
977 | | - echo( "Purging caches..." ); |
| 976 | + wfOut( "Purging caches..." ); |
978 | 977 | $wgDatabase->delete( 'objectcache', '*', __METHOD__ ); |
979 | | - echo( "done.\n" ); |
| 978 | + wfOut( "done.\n" ); |
980 | 979 | } |
981 | 980 | |
982 | 981 | function do_all_updates( $shared = false, $purge = true ) { |
— | — | @@ -1019,15 +1018,14 @@ |
1020 | 1019 | } |
1021 | 1020 | |
1022 | 1021 | |
1023 | | - echo "Deleting old default messages (this may take a long time!)..."; flush(); |
| 1022 | + wfOut( "Deleting old default messages (this may take a long time!)..." ); |
1024 | 1023 | deleteDefaultMessages(); |
1025 | | - echo "Done\n"; flush(); |
| 1024 | + wfOut( "Done\n" ); |
1026 | 1025 | |
1027 | | - do_stats_init(); flush(); |
| 1026 | + do_stats_init(); |
1028 | 1027 | |
1029 | 1028 | if( $purge ) { |
1030 | 1029 | purge_cache(); |
1031 | | - flush(); |
1032 | 1030 | } |
1033 | 1031 | } |
1034 | 1032 | |
— | — | @@ -1053,14 +1051,14 @@ |
1054 | 1052 | $patch2 = 'patch-page_restrictions_sortkey.sql'; |
1055 | 1053 | |
1056 | 1054 | if ( $wgDatabase->tableExists( $name ) ) { |
1057 | | - echo "...$name table already exists.\n"; |
| 1055 | + wfOut( "...$name table already exists.\n" ); |
1058 | 1056 | } else { |
1059 | | - echo "Creating $name table..."; |
| 1057 | + wfOut( "Creating $name table..." ); |
1060 | 1058 | dbsource( archive($patch), $wgDatabase ); |
1061 | 1059 | dbsource( archive($patch2), $wgDatabase ); |
1062 | | - echo "ok\n"; |
| 1060 | + wfOut( "ok\n" ); |
1063 | 1061 | |
1064 | | - echo "Migrating old restrictions to new table..."; |
| 1062 | + wfOut( "Migrating old restrictions to new table..." ); |
1065 | 1063 | |
1066 | 1064 | $res = $wgDatabase->select( 'page', array( 'page_id', 'page_restrictions' ), array("page_restrictions!=''", "page_restrictions!='edit=:move='"), __METHOD__ ); |
1067 | 1065 | |
— | — | @@ -1112,7 +1110,7 @@ |
1113 | 1111 | __METHOD__ ); |
1114 | 1112 | } |
1115 | 1113 | } |
1116 | | - print "ok\n"; |
| 1114 | + wfOut( "ok\n" ); |
1117 | 1115 | } |
1118 | 1116 | |
1119 | 1117 | } |
— | — | @@ -1270,12 +1268,12 @@ |
1271 | 1269 | $newpath = array(); |
1272 | 1270 | if( $wgDBmwschema === 'mediawiki' ) { |
1273 | 1271 | if (!array_key_exists( 'search_path', $conf ) or strpos( $conf['search_path'],$wgDBmwschema ) === false ) { |
1274 | | - echo "Adding in schema \"$wgDBmwschema\" to search_path for user \"$wgDBuser\"\n"; |
| 1272 | + wfOut( "Adding in schema \"$wgDBmwschema\" to search_path for user \"$wgDBuser\"\n" ); |
1275 | 1273 | $newpath[$wgDBmwschema] = 1; |
1276 | 1274 | } |
1277 | 1275 | } |
1278 | 1276 | if( !array_key_exists( 'search_path', $conf ) or strpos( $conf['search_path'],$wgDBts2schema ) === false ) { |
1279 | | - echo "Adding in schema \"$wgDBts2schema\" to search_path for user \"$wgDBuser\"\n"; |
| 1277 | + wfOut( "Adding in schema \"$wgDBts2schema\" to search_path for user \"$wgDBuser\"\n" ); |
1280 | 1278 | $newpath[$wgDBts2schema] = 1; |
1281 | 1279 | } |
1282 | 1280 | $searchpath = implode( ',', array_keys( $newpath ) ); |
— | — | @@ -1285,7 +1283,7 @@ |
1286 | 1284 | } |
1287 | 1285 | else { |
1288 | 1286 | $path = $conf['search_path']; |
1289 | | - echo "... search_path for user \"$wgDBuser\" looks correct ($path)\n"; |
| 1287 | + wfOut( "... search_path for user \"$wgDBuser\" looks correct ($path)\n" ); |
1290 | 1288 | } |
1291 | 1289 | $goodconf = array( |
1292 | 1290 | 'client_min_messages' => 'error', |
— | — | @@ -1295,12 +1293,12 @@ |
1296 | 1294 | foreach( array_keys( $goodconf ) AS $key ) { |
1297 | 1295 | $value = $goodconf[$key]; |
1298 | 1296 | if( !array_key_exists( $key, $conf ) or $conf[$key] !== $value ) { |
1299 | | - echo "Setting $key to '$value' for user \"$wgDBuser\"\n"; |
| 1297 | + wfOut( "Setting $key to '$value' for user \"$wgDBuser\"\n" ); |
1300 | 1298 | $wgDatabase->doQuery( "ALTER USER $wgDBuser SET $key = '$value'" ); |
1301 | 1299 | $wgDatabase->doQuery( "SET $key = '$value'" ); |
1302 | 1300 | } |
1303 | 1301 | else { |
1304 | | - echo "... default value of \"$key\" is correctly set to \"$value\" for user \"$wgDBuser\"\n"; |
| 1302 | + wfOut( "... default value of \"$key\" is correctly set to \"$value\" for user \"$wgDBuser\"\n" ); |
1305 | 1303 | } |
1306 | 1304 | } |
1307 | 1305 | |
— | — | @@ -1414,62 +1412,62 @@ |
1415 | 1413 | |
1416 | 1414 | foreach ($newsequences as $ns) { |
1417 | 1415 | if ($wgDatabase->sequenceExists($ns)) { |
1418 | | - echo "... sequence \"$ns\" already exists\n"; |
| 1416 | + wfOut( "... sequence \"$ns\" already exists\n" ); |
1419 | 1417 | continue; |
1420 | 1418 | } |
1421 | 1419 | |
1422 | | - echo "Creating sequence \"$ns\"\n"; |
| 1420 | + wfOut( "Creating sequence \"$ns\"\n" ); |
1423 | 1421 | $wgDatabase->query("CREATE SEQUENCE $ns"); |
1424 | 1422 | } |
1425 | 1423 | |
1426 | 1424 | foreach ($newtables as $nt) { |
1427 | 1425 | if ($wgDatabase->tableExists($nt[0])) { |
1428 | | - echo "... table \"$nt[0]\" already exists\n"; |
| 1426 | + wfOut( "... table \"$nt[0]\" already exists\n" ); |
1429 | 1427 | continue; |
1430 | 1428 | } |
1431 | 1429 | |
1432 | | - echo "Creating table \"$nt[0]\"\n"; |
| 1430 | + wfOut( "Creating table \"$nt[0]\"\n" ); |
1433 | 1431 | dbsource(archive($nt[1])); |
1434 | 1432 | } |
1435 | 1433 | |
1436 | 1434 | ## Needed before newcols |
1437 | 1435 | if ($wgDatabase->tableExists("archive2")) { |
1438 | | - echo "Converting \"archive2\" back to normal archive table\n"; |
| 1436 | + wfOut( "Converting \"archive2\" back to normal archive table\n" ); |
1439 | 1437 | if ($wgDatabase->ruleExists("archive", "archive_insert")) { |
1440 | | - echo "Dropping rule \"archive_insert\"\n"; |
| 1438 | + wfOut( "Dropping rule \"archive_insert\"\n" ); |
1441 | 1439 | $wgDatabase->query("DROP RULE archive_insert ON archive"); |
1442 | 1440 | } |
1443 | 1441 | if ($wgDatabase->ruleExists("archive", "archive_delete")) { |
1444 | | - echo "Dropping rule \"archive_delete\"\n"; |
| 1442 | + wfOut( "Dropping rule \"archive_delete\"\n" ); |
1445 | 1443 | $wgDatabase->query("DROP RULE archive_delete ON archive"); |
1446 | 1444 | } |
1447 | 1445 | dbsource(archive("patch-remove-archive2.sql")); |
1448 | 1446 | } |
1449 | 1447 | else |
1450 | | - echo "... obsolete table \"archive2\" does not exist\n"; |
| 1448 | + wfOut( "... obsolete table \"archive2\" does not exist\n" ); |
1451 | 1449 | |
1452 | 1450 | foreach ($newcols as $nc) { |
1453 | 1451 | $fi = $wgDatabase->fieldInfo($nc[0], $nc[1]); |
1454 | 1452 | if (!is_null($fi)) { |
1455 | | - echo "... column \"$nc[0].$nc[1]\" already exists\n"; |
| 1453 | + wfOut( "... column \"$nc[0].$nc[1]\" already exists\n" ); |
1456 | 1454 | continue; |
1457 | 1455 | } |
1458 | 1456 | |
1459 | | - echo "Adding column \"$nc[0].$nc[1]\"\n"; |
| 1457 | + wfOut( "Adding column \"$nc[0].$nc[1]\"\n" ); |
1460 | 1458 | $wgDatabase->query("ALTER TABLE $nc[0] ADD $nc[1] $nc[2]"); |
1461 | 1459 | } |
1462 | 1460 | |
1463 | 1461 | foreach ($typechanges as $tc) { |
1464 | 1462 | $fi = $wgDatabase->fieldInfo($tc[0], $tc[1]); |
1465 | 1463 | if (is_null($fi)) { |
1466 | | - echo "... error: expected column $tc[0].$tc[1] to exist\n"; |
| 1464 | + wfOut( "... error: expected column $tc[0].$tc[1] to exist\n" ); |
1467 | 1465 | exit(1); |
1468 | 1466 | } |
1469 | 1467 | |
1470 | 1468 | if ($fi->type() === $tc[2]) |
1471 | | - echo "... column \"$tc[0].$tc[1]\" is already of type \"$tc[2]\"\n"; |
| 1469 | + wfOut( "... column \"$tc[0].$tc[1]\" is already of type \"$tc[2]\"\n" ); |
1472 | 1470 | else { |
1473 | | - echo "Changing column type of \"$tc[0].$tc[1]\" from \"{$fi->type()}\" to \"$tc[2]\"\n"; |
| 1471 | + wfOut( "Changing column type of \"$tc[0].$tc[1]\" from \"{$fi->type()}\" to \"$tc[2]\"\n" ); |
1474 | 1472 | $sql = "ALTER TABLE $tc[0] ALTER $tc[1] TYPE $tc[2]"; |
1475 | 1473 | if (strlen($tc[3])) { |
1476 | 1474 | $default = array(); |
— | — | @@ -1486,78 +1484,78 @@ |
1487 | 1485 | } |
1488 | 1486 | |
1489 | 1487 | if ($wgDatabase->fieldInfo('oldimage','oi_deleted')->type() !== 'smallint') { |
1490 | | - echo "Changing \"oldimage.oi_deleted\" to type \"smallint\"\n"; |
| 1488 | + wfOut( "Changing \"oldimage.oi_deleted\" to type \"smallint\"\n" ); |
1491 | 1489 | $wgDatabase->query( "ALTER TABLE oldimage ALTER oi_deleted DROP DEFAULT" ); |
1492 | 1490 | $wgDatabase->query( "ALTER TABLE oldimage ALTER oi_deleted TYPE SMALLINT USING (oi_deleted::smallint)" ); |
1493 | 1491 | $wgDatabase->query( "ALTER TABLE oldimage ALTER oi_deleted SET DEFAULT 0" ); |
1494 | 1492 | } |
1495 | 1493 | else |
1496 | | - echo "... column \"oldimage.oi_deleted\" is already of type \"smallint\"\n"; |
| 1494 | + wfOut( "... column \"oldimage.oi_deleted\" is already of type \"smallint\"\n" ); |
1497 | 1495 | |
1498 | 1496 | |
1499 | 1497 | foreach ($newindexes as $ni) { |
1500 | 1498 | if (pg_index_exists($ni[0], $ni[1])) { |
1501 | | - echo "... index \"$ni[1]\" on table \"$ni[0]\" already exists\n"; |
| 1499 | + wfOut( "... index \"$ni[1]\" on table \"$ni[0]\" already exists\n" ); |
1502 | 1500 | continue; |
1503 | 1501 | } |
1504 | | - echo "Creating index \"$ni[1]\" on table \"$ni[0]\" $ni[2]\n"; |
| 1502 | + wfOut( "Creating index \"$ni[1]\" on table \"$ni[0]\" $ni[2]\n" ); |
1505 | 1503 | $wgDatabase->query( "CREATE INDEX $ni[1] ON $ni[0] $ni[2]" ); |
1506 | 1504 | } |
1507 | 1505 | |
1508 | 1506 | foreach ($newrules as $nr) { |
1509 | 1507 | if ($wgDatabase->ruleExists($nr[0], $nr[1])) { |
1510 | | - echo "... rule \"$nr[1]\" on table \"$nr[0]\" already exists\n"; |
| 1508 | + wfOut( "... rule \"$nr[1]\" on table \"$nr[0]\" already exists\n" ); |
1511 | 1509 | continue; |
1512 | 1510 | } |
1513 | | - echo "Adding rule \"$nr[1]\" to table \"$nr[0]\"\n"; |
| 1511 | + wfOut( "Adding rule \"$nr[1]\" to table \"$nr[0]\"\n" ); |
1514 | 1512 | dbsource(archive($nr[2])); |
1515 | 1513 | } |
1516 | 1514 | |
1517 | 1515 | if ($wgDatabase->hasConstraint("oldimage_oi_name_fkey")) { |
1518 | | - echo "Making foriegn key on table \"oldimage\" (to image) a cascade delete\n"; |
| 1516 | + wfOut( "Making foriegn key on table \"oldimage\" (to image) a cascade delete\n" ); |
1519 | 1517 | $wgDatabase->query( "ALTER TABLE oldimage DROP CONSTRAINT oldimage_oi_name_fkey" ); |
1520 | 1518 | $wgDatabase->query( "ALTER TABLE oldimage ADD CONSTRAINT oldimage_oi_name_fkey_cascade ". |
1521 | 1519 | "FOREIGN KEY (oi_name) REFERENCES image(img_name) ON DELETE CASCADE" ); |
1522 | 1520 | } |
1523 | 1521 | else |
1524 | | - echo "... table \"oldimage\" has correct cascade delete foreign key to image\n"; |
| 1522 | + wfOut( "... table \"oldimage\" has correct cascade delete foreign key to image\n" ); |
1525 | 1523 | |
1526 | 1524 | if (!$wgDatabase->triggerExists("page", "page_deleted")) { |
1527 | | - echo "Adding function and trigger \"page_deleted\" to table \"page\"\n"; |
| 1525 | + wfOut( "Adding function and trigger \"page_deleted\" to table \"page\"\n" ); |
1528 | 1526 | dbsource(archive('patch-page_deleted.sql')); |
1529 | 1527 | } |
1530 | 1528 | else |
1531 | | - echo "... table \"page\" has \"page_deleted\" trigger\n"; |
| 1529 | + wfOut( "... table \"page\" has \"page_deleted\" trigger\n" ); |
1532 | 1530 | |
1533 | 1531 | $fi = $wgDatabase->fieldInfo("recentchanges", "rc_cur_id"); |
1534 | 1532 | if (!$fi->nullable()) { |
1535 | | - echo "Removing NOT NULL constraint from \"recentchanges.rc_cur_id\"\n"; |
| 1533 | + wfOut( "Removing NOT NULL constraint from \"recentchanges.rc_cur_id\"\n" ); |
1536 | 1534 | dbsource(archive('patch-rc_cur_id-not-null.sql')); |
1537 | 1535 | } |
1538 | 1536 | else |
1539 | | - echo "... column \"recentchanges.rc_cur_id\" has a NOT NULL constraint\n"; |
| 1537 | + wfOut( "... column \"recentchanges.rc_cur_id\" has a NOT NULL constraint\n" ); |
1540 | 1538 | |
1541 | 1539 | $pu = pg_describe_index("pagelink_unique"); |
1542 | 1540 | if (!is_null($pu) && ($pu[0] != "pl_from" || $pu[1] != "pl_namespace" || $pu[2] != "pl_title")) { |
1543 | | - echo "Dropping obsolete version of index \"pagelink_unique index\"\n"; |
| 1541 | + wfOut( "Dropping obsolete version of index \"pagelink_unique index\"\n" ); |
1544 | 1542 | $wgDatabase->query("DROP INDEX pagelink_unique"); |
1545 | 1543 | $pu = null; |
1546 | 1544 | } |
1547 | 1545 | else |
1548 | | - echo "... obsolete version of index \"pagelink_unique index\" does not exist\n"; |
| 1546 | + wfOut( "... obsolete version of index \"pagelink_unique index\" does not exist\n" ); |
1549 | 1547 | |
1550 | 1548 | if (is_null($pu)) { |
1551 | | - echo "Creating index \"pagelink_unique index\"\n"; |
| 1549 | + wfOut( "Creating index \"pagelink_unique index\"\n" ); |
1552 | 1550 | $wgDatabase->query("CREATE UNIQUE INDEX pagelink_unique ON pagelinks (pl_from,pl_namespace,pl_title)"); |
1553 | 1551 | } |
1554 | 1552 | else |
1555 | | - echo "... index \"pagelink_unique_index\" aready exists\n"; |
| 1553 | + wfOut( "... index \"pagelink_unique_index\" already exists\n" ); |
1556 | 1554 | |
1557 | 1555 | if (pg_fkey_deltype("revision_rev_user_fkey") == 'r') { |
1558 | | - echo "... constraint \"revision_rev_user_fkey\" is ON DELETE RESTRICT\n"; |
| 1556 | + wfOut( "... constraint \"revision_rev_user_fkey\" is ON DELETE RESTRICT\n" ); |
1559 | 1557 | } |
1560 | 1558 | else { |
1561 | | - echo "Changing constraint \"revision_rev_user_fkey\" to ON DELETE RESTRICT\n"; |
| 1559 | + wfOut( "Changing constraint \"revision_rev_user_fkey\" to ON DELETE RESTRICT\n" ); |
1562 | 1560 | dbsource(archive('patch-revision_rev_user_fkey.sql')); |
1563 | 1561 | } |
1564 | 1562 | |
— | — | @@ -1565,29 +1563,29 @@ |
1566 | 1564 | # Add missing extension tables |
1567 | 1565 | foreach ( $wgExtNewTables as $nt ) { |
1568 | 1566 | if ($wgDatabase->tableExists($nt[0])) { |
1569 | | - echo "... table \"$nt[0]\" already exists\n"; |
| 1567 | + wfOut( "... table \"$nt[0]\" already exists\n" ); |
1570 | 1568 | continue; |
1571 | 1569 | } |
1572 | | - echo "Creating table \"$nt[0]\"\n"; |
| 1570 | + wfOut( "Creating table \"$nt[0]\"\n" ); |
1573 | 1571 | dbsource($nt[1]); |
1574 | 1572 | } |
1575 | 1573 | # Add missing extension fields |
1576 | 1574 | foreach ( $wgExtPGNewFields as $nc ) { |
1577 | 1575 | $fi = $wgDatabase->fieldInfo($nc[0], $nc[1]); |
1578 | 1576 | if (!is_null($fi)) { |
1579 | | - echo "... column \"$nc[0].$nc[1]\" already exists\n"; |
| 1577 | + wfOut( "... column \"$nc[0].$nc[1]\" already exists\n" ); |
1580 | 1578 | continue; |
1581 | 1579 | } |
1582 | | - echo "Adding column \"$nc[0].$nc[1]\"\n"; |
| 1580 | + wfOut( "Adding column \"$nc[0].$nc[1]\"\n" ); |
1583 | 1581 | $wgDatabase->query( "ALTER TABLE $nc[0] ADD $nc[1] $nc[2]" ); |
1584 | 1582 | } |
1585 | 1583 | # Add missing extension indexes |
1586 | 1584 | foreach ( $wgExtNewIndexes as $ni ) { |
1587 | 1585 | if (pg_index_exists($ni[0], $ni[1])) { |
1588 | | - echo "... index \"$ni[1]\" on table \"$ni[0]\" already exists\n"; |
| 1586 | + wfOut( "... index \"$ni[1]\" on table \"$ni[0]\" already exists\n" ); |
1589 | 1587 | continue; |
1590 | 1588 | } |
1591 | | - echo "Creating index \"$ni[1]\" on table \"$ni[0]\"\n"; |
| 1589 | + wfOut( "Creating index \"$ni[1]\" on table \"$ni[0]\"\n" ); |
1592 | 1590 | dbsource($ni[2]); |
1593 | 1591 | } |
1594 | 1592 | |
Index: branches/REL1_12/phase3/maintenance/userDupes.inc |
— | — | @@ -39,7 +39,7 @@ |
40 | 40 | $fname = 'UserDupes::hasUniqueIndex'; |
41 | 41 | $info = $this->db->indexInfo( 'user', 'user_name', $fname ); |
42 | 42 | 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" ); |
44 | 44 | return false; |
45 | 45 | } |
46 | 46 | |
— | — | @@ -86,11 +86,11 @@ |
87 | 87 | |
88 | 88 | $this->lock(); |
89 | 89 | |
90 | | - echo "Checking for duplicate accounts...\n"; |
| 90 | + wfOut( "Checking for duplicate accounts...\n" ); |
91 | 91 | $dupes = $this->getDupes(); |
92 | 92 | $count = count( $dupes ); |
93 | 93 | |
94 | | - echo "Found $count accounts with duplicate records on ".wfWikiID().".\n"; |
| 94 | + wfOut( "Found $count accounts with duplicate records on ".wfWikiID().".\n" ); |
95 | 95 | $this->trimmed = 0; |
96 | 96 | $this->reassigned = 0; |
97 | 97 | $this->failed = 0; |
— | — | @@ -100,34 +100,34 @@ |
101 | 101 | |
102 | 102 | $this->unlock(); |
103 | 103 | |
104 | | - echo "\n"; |
| 104 | + wfOut( "\n" ); |
105 | 105 | |
106 | 106 | if( $this->reassigned > 0 ) { |
107 | 107 | if( $doDelete ) { |
108 | | - echo "$this->reassigned duplicate accounts had edits reassigned to a canonical record id.\n"; |
| 108 | + wfOut( "$this->reassigned duplicate accounts had edits reassigned to a canonical record id.\n" ); |
109 | 109 | } else { |
110 | | - echo "$this->reassigned duplicate accounts need to have edits reassigned.\n"; |
| 110 | + wfOut( "$this->reassigned duplicate accounts need to have edits reassigned.\n" ); |
111 | 111 | } |
112 | 112 | } |
113 | 113 | |
114 | 114 | if( $this->trimmed > 0 ) { |
115 | 115 | if( $doDelete ) { |
116 | | - echo "$this->trimmed duplicate user records were deleted from ".wfWikiID().".\n"; |
| 116 | + wfOut( "$this->trimmed duplicate user records were deleted from ".wfWikiID().".\n" ); |
117 | 117 | } else { |
118 | | - echo "$this->trimmed duplicate user accounts were found on ".wfWikiID()." which can be removed safely.\n"; |
| 118 | + wfOut( "$this->trimmed duplicate user accounts were found on ".wfWikiID()." which can be removed safely.\n" ); |
119 | 119 | } |
120 | 120 | } |
121 | 121 | |
122 | 122 | if( $this->failed > 0 ) { |
123 | | - echo "Something terribly awry; $this->failed duplicate accounts were not removed.\n"; |
| 123 | + wfOut( "Something terribly awry; $this->failed duplicate accounts were not removed.\n" ); |
124 | 124 | return false; |
125 | 125 | } |
126 | 126 | |
127 | 127 | if( $this->trimmed == 0 || $doDelete ) { |
128 | | - echo "It is now safe to apply the unique index on user_name.\n"; |
| 128 | + wfOut( "It is now safe to apply the unique index on user_name.\n" ); |
129 | 129 | return true; |
130 | 130 | } else { |
131 | | - echo "Run this script again with the --fix option to automatically delete them.\n"; |
| 131 | + wfOut( "Run this script again with the --fix option to automatically delete them.\n" ); |
132 | 132 | return false; |
133 | 133 | } |
134 | 134 | } |
— | — | @@ -209,36 +209,36 @@ |
210 | 210 | |
211 | 211 | $firstRow = $this->db->fetchObject( $result ); |
212 | 212 | $firstId = $firstRow->user_id; |
213 | | - echo "Record that will be used for '$name' is user_id=$firstId\n"; |
| 213 | + wfOut( "Record that will be used for '$name' is user_id=$firstId\n" ); |
214 | 214 | |
215 | 215 | while( $row = $this->db->fetchObject( $result ) ) { |
216 | 216 | $dupeId = $row->user_id; |
217 | | - echo "... dupe id $dupeId: "; |
| 217 | + wfOut( "... dupe id $dupeId: " ); |
218 | 218 | $edits = $this->editCount( $dupeId ); |
219 | 219 | if( $edits > 0 ) { |
220 | 220 | $this->reassigned++; |
221 | | - echo "has $edits edits! "; |
| 221 | + wfOut( "has $edits edits! " ); |
222 | 222 | if( $doDelete ) { |
223 | 223 | $this->reassignEdits( $dupeId, $firstId ); |
224 | 224 | $newEdits = $this->editCount( $dupeId ); |
225 | 225 | if( $newEdits == 0 ) { |
226 | | - echo "confirmed cleaned. "; |
| 226 | + wfOut( "confirmed cleaned. " ); |
227 | 227 | } else { |
228 | 228 | $this->failed++; |
229 | | - echo "WARNING! $newEdits remaining edits for $dupeId; NOT deleting user.\n"; |
| 229 | + wfOut( "WARNING! $newEdits remaining edits for $dupeId; NOT deleting user.\n" ); |
230 | 230 | continue; |
231 | 231 | } |
232 | 232 | } else { |
233 | | - echo "(will need to reassign edits on fix)"; |
| 233 | + wfOut( "(will need to reassign edits on fix)" ); |
234 | 234 | } |
235 | 235 | } else { |
236 | | - echo "ok, no edits. "; |
| 236 | + wfOut( "ok, no edits. " ); |
237 | 237 | } |
238 | 238 | $this->trimmed++; |
239 | 239 | if( $doDelete ) { |
240 | 240 | $this->trimAccount( $dupeId ); |
241 | 241 | } |
242 | | - echo "\n"; |
| 242 | + wfOut( "\n" ); |
243 | 243 | } |
244 | 244 | $this->db->freeResult( $result ); |
245 | 245 | } |
— | — | @@ -300,12 +300,12 @@ |
301 | 301 | */ |
302 | 302 | function reassignEditsOn( $table, $field, $from, $to ) { |
303 | 303 | $fname = 'UserDupes::reassignEditsOn'; |
304 | | - echo "reassigning on $table... "; |
| 304 | + wfOut( "reassigning on $table... " ); |
305 | 305 | $this->db->update( $table, |
306 | 306 | array( $field => $to ), |
307 | 307 | array( $field => $from ), |
308 | 308 | $fname ); |
309 | | - echo "ok. "; |
| 309 | + wfOut( "ok. " ); |
310 | 310 | } |
311 | 311 | |
312 | 312 | /** |
— | — | @@ -315,9 +315,9 @@ |
316 | 316 | */ |
317 | 317 | function trimAccount( $userid ) { |
318 | 318 | $fname = 'UserDupes::trimAccount'; |
319 | | - echo "deleting..."; |
| 319 | + wfOut( "deleting..." ); |
320 | 320 | $this->db->delete( 'user', array( 'user_id' => $userid ), $fname ); |
321 | | - echo " ok"; |
| 321 | + wfOut( " ok" ); |
322 | 322 | } |
323 | 323 | |
324 | 324 | } |
Index: branches/REL1_12/phase3/maintenance/convertLinks.inc |
— | — | @@ -8,11 +8,11 @@ |
9 | 9 | function convertLinks() { |
10 | 10 | global $wgDBtype; |
11 | 11 | if( $wgDBtype == 'postgres' ) { |
12 | | - print "Links table already ok on Postgres.\n"; |
| 12 | + wfOut( "Links table already ok on Postgres.\n" ); |
13 | 13 | return; |
14 | 14 | } |
15 | 15 | |
16 | | - print "Converting links table to ID-ID...\n"; |
| 16 | + wfOut( "Converting links table to ID-ID...\n" ); |
17 | 17 | |
18 | 18 | global $wgLang, $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname; |
19 | 19 | global $noKeys, $logPerformance, $fh; |
— | — | @@ -47,7 +47,7 @@ |
48 | 48 | |
49 | 49 | $res = $dbw->query( "SELECT l_from FROM $links LIMIT 1" ); |
50 | 50 | if ( $dbw->fieldType( $res, 0 ) == "int" ) { |
51 | | - print "Schema already converted\n"; |
| 51 | + wfOut( "Schema already converted\n" ); |
52 | 52 | return; |
53 | 53 | } |
54 | 54 | |
— | — | @@ -57,13 +57,13 @@ |
58 | 58 | $dbw->freeResult( $res ); |
59 | 59 | |
60 | 60 | if ( $numRows == 0 ) { |
61 | | - print "Updating schema (no rows to convert)...\n"; |
| 61 | + wfOut( "Updating schema (no rows to convert)...\n" ); |
62 | 62 | createTempTable(); |
63 | 63 | } else { |
64 | 64 | if ( $logPerformance ) { $fh = fopen ( $perfLogFilename, "w" ); } |
65 | 65 | $baseTime = $startTime = getMicroTime(); |
66 | 66 | # Create a title -> cur_id map |
67 | | - print "Loading IDs from $cur table...\n"; |
| 67 | + wfOut( "Loading IDs from $cur table...\n" ); |
68 | 68 | performanceLog ( "Reading $numRows rows from cur table...\n" ); |
69 | 69 | performanceLog ( "rows read vs seconds elapsed:\n" ); |
70 | 70 | |
— | — | @@ -81,13 +81,13 @@ |
82 | 82 | if ($reportCurReadProgress) { |
83 | 83 | if (($curRowsRead % $curReadReportInterval) == 0) { |
84 | 84 | performanceLog( $curRowsRead . " " . (getMicroTime() - $baseTime) . "\n" ); |
85 | | - print "\t$curRowsRead rows of $cur table read.\n"; |
| 85 | + wfOut( "\t$curRowsRead rows of $cur table read.\n" ); |
86 | 86 | } |
87 | 87 | } |
88 | 88 | } |
89 | 89 | $dbw->freeResult( $res ); |
90 | 90 | $dbw->bufferResults( true ); |
91 | | - print "Finished loading IDs.\n\n"; |
| 91 | + wfOut( "Finished loading IDs.\n\n" ); |
92 | 92 | performanceLog( "Took " . (getMicroTime() - $baseTime) . " seconds to load IDs.\n\n" ); |
93 | 93 | #-------------------------------------------------------------------- |
94 | 94 | |
— | — | @@ -96,7 +96,7 @@ |
97 | 97 | createTempTable(); |
98 | 98 | performanceLog( "Resetting timer.\n\n" ); |
99 | 99 | $baseTime = getMicroTime(); |
100 | | - print "Processing $numRows rows from $links table...\n"; |
| 100 | + wfOut( "Processing $numRows rows from $links table...\n" ); |
101 | 101 | performanceLog( "Processing $numRows rows from $links table...\n" ); |
102 | 102 | performanceLog( "rows inserted vs seconds elapsed:\n" ); |
103 | 103 | |
— | — | @@ -126,19 +126,19 @@ |
127 | 127 | } |
128 | 128 | } |
129 | 129 | $dbw->freeResult($res); |
130 | | - #print "rowOffset: $rowOffset\ttuplesAdded: $tuplesAdded\tnumBadLinks: $numBadLinks\n"; |
| 130 | + #wfOut( "rowOffset: $rowOffset\ttuplesAdded: $tuplesAdded\tnumBadLinks: $numBadLinks\n" ); |
131 | 131 | if ( $tuplesAdded != 0 ) { |
132 | 132 | if ($reportLinksConvProgress) { |
133 | | - print "Inserting $tuplesAdded tuples into $links_temp..."; |
| 133 | + wfOut( "Inserting $tuplesAdded tuples into $links_temp..." ); |
134 | 134 | } |
135 | 135 | $dbw->query( implode("",$sqlWrite) ); |
136 | 136 | $totalTuplesInserted += $tuplesAdded; |
137 | 137 | if ($reportLinksConvProgress) |
138 | | - print " done. Total $totalTuplesInserted tuples inserted.\n"; |
| 138 | + wfOut( " done. Total $totalTuplesInserted tuples inserted.\n" ); |
139 | 139 | performanceLog( $totalTuplesInserted . " " . (getMicroTime() - $baseTime) . "\n" ); |
140 | 140 | } |
141 | 141 | } |
142 | | - print "$totalTuplesInserted valid titles and $numBadLinks invalid titles were processed.\n\n"; |
| 142 | + wfOut( "$totalTuplesInserted valid titles and $numBadLinks invalid titles were processed.\n\n" ); |
143 | 143 | performanceLog( "$totalTuplesInserted valid titles and $numBadLinks invalid titles were processed.\n" ); |
144 | 144 | performanceLog( "Total execution time: " . (getMicroTime() - $startTime) . " seconds.\n" ); |
145 | 145 | if ( $logPerformance ) { fclose ( $fh ); } |
— | — | @@ -148,25 +148,25 @@ |
149 | 149 | if ( $overwriteLinksTable ) { |
150 | 150 | $dbConn = Database::newFromParams( $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname ); |
151 | 151 | if (!($dbConn->isOpen())) { |
152 | | - print "Opening connection to database failed.\n"; |
| 152 | + wfOut( "Opening connection to database failed.\n" ); |
153 | 153 | return; |
154 | 154 | } |
155 | 155 | # Check for existing links_backup, and delete it if it exists. |
156 | | - print "Dropping backup links table if it exists..."; |
| 156 | + wfOut( "Dropping backup links table if it exists..." ); |
157 | 157 | $dbConn->query( "DROP TABLE IF EXISTS $links_backup", DB_MASTER); |
158 | | - print " done.\n"; |
| 158 | + wfOut( " done.\n" ); |
159 | 159 | |
160 | 160 | # Swap in the new table, and move old links table to links_backup |
161 | | - print "Swapping tables '$links' to '$links_backup'; '$links_temp' to '$links'..."; |
| 161 | + wfOut( "Swapping tables '$links' to '$links_backup'; '$links_temp' to '$links'..." ); |
162 | 162 | $dbConn->query( "RENAME TABLE links TO $links_backup, $links_temp TO $links", DB_MASTER ); |
163 | | - print " done.\n\n"; |
| 163 | + wfOut( " done.\n\n" ); |
164 | 164 | |
165 | 165 | $dbConn->close(); |
166 | | - print "Conversion complete. The old table remains at $links_backup;\n"; |
167 | | - print "delete at your leisure.\n"; |
| 166 | + wfOut( "Conversion complete. The old table remains at $links_backup;\n" ); |
| 167 | + wfOut( "delete at your leisure.\n" ); |
168 | 168 | } else { |
169 | | - print "Conversion complete. The converted table is at $links_temp;\n"; |
170 | | - print "the original links table is unchanged.\n"; |
| 169 | + wfOut( "Conversion complete. The converted table is at $links_temp;\n" ); |
| 170 | + wfOut( "the original links table is unchanged.\n" ); |
171 | 171 | } |
172 | 172 | } |
173 | 173 | |
— | — | @@ -178,16 +178,16 @@ |
179 | 179 | $dbConn = Database::newFromParams( $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname ); |
180 | 180 | |
181 | 181 | if (!($dbConn->isOpen())) { |
182 | | - print "Opening connection to database failed.\n"; |
| 182 | + wfOut( "Opening connection to database failed.\n" ); |
183 | 183 | return; |
184 | 184 | } |
185 | 185 | $links_temp = $dbConn->tableName( 'links_temp' ); |
186 | 186 | |
187 | | - print "Dropping temporary links table if it exists..."; |
| 187 | + wfOut( "Dropping temporary links table if it exists..." ); |
188 | 188 | $dbConn->query( "DROP TABLE IF EXISTS $links_temp"); |
189 | | - print " done.\n"; |
| 189 | + wfOut( " done.\n" ); |
190 | 190 | |
191 | | - print "Creating temporary links table..."; |
| 191 | + wfOut( "Creating temporary links table..." ); |
192 | 192 | if ( $noKeys ) { |
193 | 193 | $dbConn->query( "CREATE TABLE $links_temp ( " . |
194 | 194 | "l_from int(8) unsigned NOT NULL default '0', " . |
— | — | @@ -199,7 +199,7 @@ |
200 | 200 | "UNIQUE KEY l_from(l_from,l_to), " . |
201 | 201 | "KEY (l_to))"); |
202 | 202 | } |
203 | | - print " done.\n\n"; |
| 203 | + wfOut( " done.\n\n" ); |
204 | 204 | } |
205 | 205 | |
206 | 206 | function performanceLog( $text ) { |
Index: branches/REL1_12/phase3/includes/GlobalFunctions.php |
— | — | @@ -2405,3 +2405,18 @@ |
2406 | 2406 | echo "Waiting for a database server: $lag seconds lagged\n"; |
2407 | 2407 | } |
2408 | 2408 | } |
| 2409 | + |
| 2410 | +/** |
| 2411 | + * Output some plain text in command-line mode or in the installer (updaters.inc). |
| 2412 | + * Do not use it in any other context, its behaviour is subject to change. |
| 2413 | + */ |
| 2414 | +function wfOut( $s ) { |
| 2415 | + static $lineStarted = false; |
| 2416 | + global $wgCommandLineMode; |
| 2417 | + if ( $wgCommandLineMode && !defined( 'MEDIAWIKI_INSTALL' ) ) { |
| 2418 | + echo $s; |
| 2419 | + } else { |
| 2420 | + echo htmlspecialchars( $s ); |
| 2421 | + } |
| 2422 | + flush(); |
| 2423 | +} |
Index: branches/REL1_12/phase3/config/index.php |
— | — | @@ -72,7 +72,8 @@ |
73 | 73 | <html> |
74 | 74 | <head> |
75 | 75 | <meta http-equiv="Content-type" content="text/html; charset=utf-8"> |
76 | | - <title>MediaWiki <?php echo( $wgVersion ); ?> Installation</title> |
| 76 | + <meta name="robots" content="noindex,nofollow"/> |
| 77 | + <title>MediaWiki <?php echo htmlspecialchars( $wgVersion ); ?> Installation</title> |
77 | 78 | <style type="text/css"> |
78 | 79 | |
79 | 80 | @import "../skins/monobook/main.css"; |
— | — | @@ -190,7 +191,7 @@ |
191 | 192 | <div id="content"> |
192 | 193 | <div id="bodyContent"> |
193 | 194 | |
194 | | -<h1>MediaWiki <?php print $wgVersion ?> Installation</h1> |
| 195 | +<h1>MediaWiki <?php print htmlspecialchars( $wgVersion ) ?> Installation</h1> |
195 | 196 | |
196 | 197 | <?php |
197 | 198 | |
— | — | @@ -289,7 +290,7 @@ |
290 | 291 | install_version_checks(); |
291 | 292 | $self = 'Installer'; # Maintenance script name, to please Setup.php |
292 | 293 | |
293 | | -print "<li>PHP " . phpversion() . " installed</li>\n"; |
| 294 | +print "<li>PHP " . htmlspecialchars( phpversion() ) . " installed</li>\n"; |
294 | 295 | |
295 | 296 | error_reporting( 0 ); |
296 | 297 | $phpdatabases = array(); |
— | — | @@ -388,7 +389,7 @@ |
389 | 390 | $conf->safeMode = false; |
390 | 391 | } |
391 | 392 | |
392 | | -$sapi = php_sapi_name(); |
| 393 | +$sapi = htmlspecialchars( php_sapi_name() ); |
393 | 394 | print "<li>PHP server API is $sapi; "; |
394 | 395 | $script = defined('MW_INSTALL_PHP5_EXT') ? 'index.php5' : 'index.php'; |
395 | 396 | if( $wgUsePathInfo ) { |
— | — | @@ -571,6 +572,9 @@ |
572 | 573 | : $_SERVER["SERVER_ADMIN"]; |
573 | 574 | $conf->EmergencyContact = importPost( "EmergencyContact", $defaultEmail ); |
574 | 575 | $conf->DBtype = importPost( "DBtype", $DefaultDBtype ); |
| 576 | + if ( !isset( $ourdb[$conf->DBtype] ) ) { |
| 577 | + $conf->DBtype = $DefaultDBtype; |
| 578 | + } |
575 | 579 | ?> |
576 | 580 | |
577 | 581 | <?php |
— | — | @@ -738,7 +742,7 @@ |
739 | 743 | $errs["DBtype"] = "Unknown database type '$conf->DBtype'"; |
740 | 744 | continue; |
741 | 745 | } |
742 | | - print "<li>Database type: {$conf->DBtypename}</li>\n"; |
| 746 | + print "<li>Database type: " . htmlspecialchars( $conf->DBtypename ) . "</li>\n"; |
743 | 747 | $dbclass = 'Database'.ucfirst($conf->DBtype); |
744 | 748 | $wgDBtype = $conf->DBtype; |
745 | 749 | $wgDBadminuser = "root"; |
— | — | @@ -761,7 +765,7 @@ |
762 | 766 | |
763 | 767 | $wgTitle = Title::newFromText( "Installation script" ); |
764 | 768 | error_reporting( E_ALL ); |
765 | | - print "<li>Loading class: $dbclass"; |
| 769 | + print "<li>Loading class: " . htmlspecialchars( $dbclass ) . "</li>\n"; |
766 | 770 | $dbc = new $dbclass; |
767 | 771 | |
768 | 772 | if( $conf->DBtype == 'mysql' ) { |
— | — | @@ -785,7 +789,7 @@ |
786 | 790 | } |
787 | 791 | |
788 | 792 | # Attempt to connect |
789 | | - echo( "<li>Attempting to connect to database server as $db_user..." ); |
| 793 | + echo( "<li>Attempting to connect to database server as " . htmlspecialchars( $db_user ) . "..." ); |
790 | 794 | $wgDatabase = Database::newFromParams( $wgDBserver, $db_user, $db_pass, '', 1 ); |
791 | 795 | |
792 | 796 | # Check the connection and respond to errors |
— | — | @@ -820,7 +824,7 @@ |
821 | 825 | case 2003: |
822 | 826 | default: |
823 | 827 | # General connection problem |
824 | | - echo( "failed with error [$errno] $errtx.</li>\n" ); |
| 828 | + echo( htmlspecialchars( "failed with error [$errno] $errtx." ) . "</li>\n" ); |
825 | 829 | $errs["DBserver"] = "Connection failed"; |
826 | 830 | break; |
827 | 831 | } # switch |
— | — | @@ -834,10 +838,11 @@ |
835 | 839 | ## Possible connect as a superuser |
836 | 840 | if( $useRoot ) { |
837 | 841 | $wgDBsuperuser = $conf->RootUser; |
838 | | - echo( "<li>Attempting to connect to database \"postgres\" as superuser \"$wgDBsuperuser\"..." ); |
| 842 | + echo( "<li>Attempting to connect to database \"postgres\" as superuser \"" . |
| 843 | + htmlspecialchars( $wgDBsuperuser ) . "\"..." ); |
839 | 844 | $wgDatabase = $dbc->newFromParams($wgDBserver, $wgDBsuperuser, $conf->RootPW, "postgres", 1); |
840 | 845 | if (!$wgDatabase->isOpen()) { |
841 | | - print " error: " . $wgDatabase->lastError() . "</li>\n"; |
| 846 | + print " error: " . htmlspecialchars( $wgDatabase->lastError() ) . "</li>\n"; |
842 | 847 | $errs["DBserver"] = "Could not connect to database as superuser"; |
843 | 848 | $errs["RootUser"] = "Check username"; |
844 | 849 | $errs["RootPW"] = "and password"; |
— | — | @@ -845,10 +850,11 @@ |
846 | 851 | } |
847 | 852 | $wgDatabase->initial_setup($conf->RootPW, 'postgres'); |
848 | 853 | } |
849 | | - echo( "<li>Attempting to connect to database \"$wgDBname\" as \"$wgDBuser\"..." ); |
| 854 | + echo( "<li>Attempting to connect to database \"" . htmlspecialchars( $wgDBname ) . |
| 855 | + "\" as \"" . htmlspecialchars( $wgDBuser ) . "\"..." ); |
850 | 856 | $wgDatabase = $dbc->newFromParams($wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1); |
851 | 857 | if (!$wgDatabase->isOpen()) { |
852 | | - print " error: " . $wgDatabase->lastError() . "</li>\n"; |
| 858 | + print " error: " . htmlspecialchars( $wgDatabase->lastError() ) . "</li>\n"; |
853 | 859 | } else { |
854 | 860 | $myver = $wgDatabase->getServerVersion(); |
855 | 861 | } |
— | — | @@ -860,7 +866,7 @@ |
861 | 867 | continue; |
862 | 868 | } |
863 | 869 | |
864 | | - print "<li>Connected to $myver"; |
| 870 | + print "<li>Connected to " . htmlspecialchars( $myver ); |
865 | 871 | if ($conf->DBtype == 'mysql') { |
866 | 872 | if( version_compare( $myver, "4.0.14" ) < 0 ) { |
867 | 873 | dieout( " -- mysql 4.0.14 or later required. Aborting." ); |
— | — | @@ -946,15 +952,19 @@ |
947 | 953 | } |
948 | 954 | } |
949 | 955 | if ( $existingSchema && $existingSchema != $conf->DBschema ) { |
950 | | - print "<li><strong>Warning:</strong> you requested the {$conf->DBschema} schema, " . |
951 | | - "but the existing database has the $existingSchema schema. This upgrade script ". |
952 | | - "can't convert it, so it will remain $existingSchema.</li>\n"; |
| 956 | + $encExisting = htmlspecialchars( $existingSchema ); |
| 957 | + $encRequested = htmlspecialchars( $conf->DBschema ); |
| 958 | + print "<li><strong>Warning:</strong> you requested the $encRequested schema, " . |
| 959 | + "but the existing database has the $encExisting schema. This upgrade script ". |
| 960 | + "can't convert it, so it will remain $encExisting.</li>\n"; |
953 | 961 | $conf->setSchema( $existingSchema, $conf->DBengine ); |
954 | 962 | } |
955 | 963 | if ( $existingEngine && $existingEngine != $conf->DBengine ) { |
956 | | - print "<li><strong>Warning:</strong> you requested the {$conf->DBengine} storage " . |
957 | | - "engine, but the existing database uses the $existingEngine engine. This upgrade " . |
958 | | - "script can't convert it, so it will remain $existingEngine.</li>\n"; |
| 964 | + $encExisting = htmlspecialchars( $existingEngine ); |
| 965 | + $encRequested = htmlspecialchars( $conf->DBengine ); |
| 966 | + print "<li><strong>Warning:</strong> you requested the $encRequested storage " . |
| 967 | + "engine, but the existing database uses the $encExisting engine. This upgrade " . |
| 968 | + "script can't convert it, so it will remain $encExisting.</li>\n"; |
959 | 969 | $conf->setSchema( $conf->DBschema, $existingEngine ); |
960 | 970 | } |
961 | 971 | } |
— | — | @@ -995,7 +1005,8 @@ |
996 | 1006 | } |
997 | 1007 | $wgDatabase->freeResult( $res ); |
998 | 1008 | if ( !$found && $conf->DBengine != 'MyISAM' ) { |
999 | | - echo "<li><strong>Warning:</strong> {$conf->DBengine} storage engine not available, " . |
| 1009 | + echo "<li><strong>Warning:</strong> " . htmlspecialchars( $conf->DBengine ) . |
| 1010 | + " storage engine not available, " . |
1000 | 1011 | "using MyISAM instead</li>\n"; |
1001 | 1012 | $conf->setSchema( $conf->DBschema, 'MyISAM' ); |
1002 | 1013 | } |
— | — | @@ -1034,10 +1045,10 @@ |
1035 | 1046 | if( $wgDatabase2->isOpen() ) { |
1036 | 1047 | # Nope, just close the test connection and continue |
1037 | 1048 | $wgDatabase2->close(); |
1038 | | - echo( "<li>User $wgDBuser exists. Skipping grants.</li>\n" ); |
| 1049 | + echo( "<li>User " . htmlspecialchars( $wgDBuser ) . " exists. Skipping grants.</li>\n" ); |
1039 | 1050 | } else { |
1040 | 1051 | # Yes, so run the grants |
1041 | | - echo( "<li>Granting user permissions to $wgDBuser on $wgDBname..." ); |
| 1052 | + echo( "<li>" . htmlspecialchars( "Granting user permissions to $wgDBuser on $wgDBname..." ) ); |
1042 | 1053 | dbsource( "../maintenance/users.sql", $wgDatabase ); |
1043 | 1054 | echo( "success.</li>\n" ); |
1044 | 1055 | } |
— | — | @@ -1151,7 +1162,9 @@ |
1152 | 1163 | $list = getLanguageList(); |
1153 | 1164 | foreach( $list as $code => $name ) { |
1154 | 1165 | $sel = ($code == $conf->LanguageCode) ? 'selected="selected"' : ''; |
1155 | | - echo "\t\t<option value=\"$code\" $sel>$name</option>\n"; |
| 1166 | + $encCode = htmlspecialchars( $code ); |
| 1167 | + $encName = htmlspecialchars( $name ); |
| 1168 | + echo "\n\t\t<option value=\"$encCode\" $sel>$encName</option>"; |
1156 | 1169 | } |
1157 | 1170 | ?> |
1158 | 1171 | </select> |
— | — | @@ -1316,7 +1329,7 @@ |
1317 | 1330 | <div class="config-section"> |
1318 | 1331 | <div class="config-input"> |
1319 | 1332 | <label class='column'>Database type:</label> |
1320 | | -<?php if (isset($errs['DBpicktype'])) print "<span class='error'>$errs[DBpicktype]</span>\n"; ?> |
| 1333 | +<?php if (isset($errs['DBpicktype'])) print "<span class='error'>" . htmlspecialchars( $errs['DBpicktype'] ) . "</span>\n"; ?> |
1321 | 1334 | <ul class='plain'><?php database_picker($conf) ?></ul> |
1322 | 1335 | </div> |
1323 | 1336 | |
— | — | @@ -1434,7 +1447,7 @@ |
1435 | 1448 | </div> |
1436 | 1449 | |
1437 | 1450 | <script type="text/javascript"> |
1438 | | -window.onload = toggleDBarea('<?php echo $conf->DBtype; ?>', |
| 1451 | +window.onload = toggleDBarea('<?php echo Xml::encodeJsVar( $conf->DBtype ); ?>', |
1439 | 1452 | <?php |
1440 | 1453 | ## If they passed in a root user name, don't populate it on page load |
1441 | 1454 | echo strlen(importPost('RootUser', '')) ? 0 : 1; |
— | — | @@ -1727,10 +1740,8 @@ |
1728 | 1741 | return importVar( $_REQUEST, $name, $default ); |
1729 | 1742 | } |
1730 | 1743 | |
1731 | | -$radioCount = 0; |
1732 | | - |
1733 | 1744 | function aField( &$conf, $field, $text, $type = "text", $value = "", $onclick = '' ) { |
1734 | | - global $radioCount; |
| 1745 | + static $radioCount = 0; |
1735 | 1746 | if( $type != "" ) { |
1736 | 1747 | $xtype = "type=\"$type\""; |
1737 | 1748 | } else { |
— | — | @@ -1772,7 +1783,9 @@ |
1773 | 1784 | } |
1774 | 1785 | |
1775 | 1786 | global $errs; |
1776 | | - if(isset($errs[$field])) echo "<span class='error'>" . $errs[$field] . "</span>\n"; |
| 1787 | + if(isset($errs[$field])) { |
| 1788 | + echo "<span class='error'>" . htmlspecialchars( $errs[$field] ) . "</span>\n"; |
| 1789 | + } |
1777 | 1790 | } |
1778 | 1791 | |
1779 | 1792 | function getLanguageList() { |
— | — | @@ -1865,7 +1878,7 @@ |
1866 | 1879 | fclose( $fp ); |
1867 | 1880 | } |
1868 | 1881 | if ( !$errstr ) { |
1869 | | - echo "<li>Connected to memcached on $host:$port successfully"; |
| 1882 | + echo "<li>Connected to memcached on " . htmlspecialchars( "$host:$port" ) ." successfully</li>"; |
1870 | 1883 | } |
1871 | 1884 | return $errstr; |
1872 | 1885 | } |