Index: branches/stable/phase3/includes/GlobalFunctions.php |
— | — | @@ -390,10 +390,13 @@ |
391 | 391 | "img_user_text FROM image WHERE img_name='" . wfStrencode( $name ) . "'"; |
392 | 392 | $res = wfQuery( $sql, $fname ); |
393 | 393 | |
| 394 | + $now = wfTimestampNow(); |
| 395 | + $won = wfInvertTimestamp( $now ); |
| 396 | + |
394 | 397 | if ( 0 == wfNumRows( $res ) ) { |
395 | 398 | $sql = "INSERT INTO image (img_name,img_size,img_timestamp," . |
396 | 399 | "img_description,img_user,img_user_text) VALUES ('" . |
397 | | - wfStrencode( $name ) . "',{$size},'" . wfTimestampNow() . "','" . |
| 400 | + wfStrencode( $name ) . "',{$size},'{$now}','" . |
398 | 401 | wfStrencode( $desc ) . "', '" . $wgUser->getID() . |
399 | 402 | "', '" . wfStrencode( $wgUser->getName() ) . "')"; |
400 | 403 | wfQuery( $sql, $fname ); |
— | — | @@ -403,8 +406,6 @@ |
404 | 407 | wfStrencode( $name ) . "'"; |
405 | 408 | $res = wfQuery( $sql, $fname ); |
406 | 409 | if ( 0 == wfNumRows( $res ) ) { |
407 | | - $now = wfTimestampNow(); |
408 | | - $won = wfInvertTimestamp( $now ); |
409 | 410 | $common = |
410 | 411 | Namespace::getImage() . ",'" . |
411 | 412 | wfStrencode( $name ) . "','" . |
— | — | @@ -413,9 +414,9 @@ |
414 | 415 | "',1"; |
415 | 416 | $sql = "INSERT INTO cur (cur_namespace,cur_title," . |
416 | 417 | "cur_comment,cur_user,cur_user_text,cur_timestamp,cur_is_new," . |
417 | | - "cur_text,inverse_timestamp) VALUES (" . |
| 418 | + "cur_text,inverse_timestamp,cur_touched) VALUES (" . |
418 | 419 | $common . |
419 | | - ",'" . wfStrencode( $desc ) . "','{$won}')"; |
| 420 | + ",'" . wfStrencode( $desc ) . "','{$won}','{$now}')"; |
420 | 421 | wfQuery( $sql, $fname ); |
421 | 422 | $id = wfInsertId() or 0; # We should throw an error instead |
422 | 423 | $sql = "INSERT INTO recentchanges (rc_namespace,rc_title, |
— | — | @@ -445,6 +446,11 @@ |
446 | 447 | wfStrencode( $desc ) . "' WHERE img_name='" . |
447 | 448 | wfStrencode( $name ) . "'"; |
448 | 449 | wfQuery( $sql, $fname ); |
| 450 | + |
| 451 | + $sql = "UPDATE cur SET cur_touched='{$now}' WHERE cur_namespace=" . |
| 452 | + Namespace::getImage() . " AND cur_title='" . |
| 453 | + wfStrencode( $name ) . "'"; |
| 454 | + wfQuery( $sql, $fname ); |
449 | 455 | } |
450 | 456 | |
451 | 457 | $log = new LogPage( wfMsg( "uploadlogpage" ), wfMsg( "uploadlogpagetext" ) ); |