r103959 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103958‎ | r103959 | r103960 >
Date:21:26, 22 November 2011
Author:kaldari
Status:resolved (Comments)
Tags:
Comment:
fixing caching
Modified paths:
  • /trunk/extensions/ContributionReporting/DailyTotal_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ContributionReporting/DailyTotal_body.php
@@ -30,7 +30,7 @@
3131 $wgOut->disable();
3232 $this->sendHeaders();
3333
34 - $start = time(); // Get the current unix timestamp
 34+ $start = date( 'Y-m-d' ); // Get the current date
3535 $total = $this->query( $timezone, $start );
3636
3737 $content = "wgFundraisingDailyTotal = $total;";
@@ -52,8 +52,8 @@
5353 $dbr = efContributionReportingConnection();
5454 #$dbr = wfGetDB( DB_MASTER );
5555 $conditions = array(
56 - 'received >= ' . $dbr->addQuotes( wfTimestamp( TS_UNIX, $start + $timeShift ) ),
57 - 'received <= ' . $dbr->addQuotes( wfTimestamp( TS_UNIX, $start + 24 * 60 * 60 + $timeShift ) ),
 56+ 'received >= ' . $dbr->addQuotes( wfTimestamp( TS_UNIX, strtotime( $start ) + $timeShift ) ),
 57+ 'received <= ' . $dbr->addQuotes( wfTimestamp( TS_UNIX, strtotime( $start ) + 24 * 60 * 60 + $timeShift ) ),
5858 'converted_amount >= ' . $egFundraiserStatisticsMinimum,
5959 'converted_amount <= ' . $egFundraiserStatisticsMaximum
6060 );

Follow-up revisions

RevisionCommit summaryAuthorDate
r103998MFT r103884, r103947, r103959, r103967, r103991, r103996awjrichards01:24, 23 November 2011
r104000MFT r103884, r103947, r103959, r103967, r103991, r103996awjrichards01:51, 23 November 2011

Comments

#Comment by Awjrichards (talk | contribs)   22:10, 22 November 2011

Won't just changing $start to be date('Y-m-d') cause weirdness when doing timezone offsets, since now strtotime( date( 'Y-m-d' )) will basically give you the timestamp of the given day at 00:00?

Perhaps something like leaving $start = time(); but changing $key = wfMemcKey( 'fundraiserstatistics', $timezone, $start ); to:

$key = wfMemcKey( 'fundraiserstatistics', $timezone, date( 'Y-m-d', $start ));

would resolve this problem. Or... let me know if it's actually a non-problem :p

Status & tagging log