From 9db190c7e736ec8d063187d4241b59feaf7dc2d1 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 22 Jun 2011 11:28:20 +0200 Subject: update to MediaWiki 1.17.0 --- includes/specials/SpecialNewimages.php | 42 ++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 12 deletions(-) (limited to 'includes/specials/SpecialNewimages.php') diff --git a/includes/specials/SpecialNewimages.php b/includes/specials/SpecialNewimages.php index a39b56ee..cecd7dfd 100644 --- a/includes/specials/SpecialNewimages.php +++ b/includes/specials/SpecialNewimages.php @@ -1,10 +1,29 @@ freeResult( $res ); - $sql = ''; # If we were clever, we'd use this to cache. $latestTimestamp = wfTimestamp( TS_MW, $ts ); # Hardcode this for now. $limit = 48; - - if ( $parval = intval( $par ) ) { + $parval = intval( $par ); + if ( $parval ) { if ( $parval <= $limit && $parval > 0 ) { $limit = $parval; } @@ -75,14 +92,16 @@ function wfSpecialNewimages( $par, $specialPage ) { } $invertSort = false; - if( $until = $wgRequest->getVal( 'until' ) ) { + $until = $wgRequest->getVal( 'until' ); + if( $until ) { $where[] = "img_timestamp < '" . $dbr->timestamp( $until ) . "'"; } - if( $from = $wgRequest->getVal( 'from' ) ) { + $from = $wgRequest->getVal( 'from' ); + if( $from ) { $where[] = "img_timestamp >= '" . $dbr->timestamp( $from ) . "'"; $invertSort = true; } - $sql='SELECT img_size, img_name, img_user, img_user_text,'. + $sql = 'SELECT img_size, img_name, img_user, img_user_text,'. "img_description,img_timestamp FROM $image"; if( $hidebotsql ) { @@ -100,14 +119,13 @@ function wfSpecialNewimages( $par, $specialPage ) { * We have to flip things around to get the last N after a certain date */ $images = array(); - while ( $s = $dbr->fetchObject( $res ) ) { + foreach ( $res as $s ) { if( $invertSort ) { array_unshift( $images, $s ); } else { array_push( $images, $s ); } } - $dbr->freeResult( $res ); $gallery = new ImageGallery(); $firstTimestamp = null; @@ -214,9 +232,9 @@ function wfSpecialNewimages( $par, $specialPage ) { } $nextLink = wfMsgExt( 'pager-older-n', $opts, $wgLang->formatNum( $limit ) ); - if( $shownImages > $limit && $lastTimestamp ) { + if( $invertSort || ( $shownImages > $limit && $lastTimestamp ) ) { $query = array_merge( - array( 'until' => $lastTimestamp ), + array( 'until' => ( $lastTimestamp ? $lastTimestamp : "" ) ), $botpar, $searchpar ); -- cgit v1.2.2