diff --git a/src/public/index.php b/src/public/index.php index 6984280..eb3d28a 100644 --- a/src/public/index.php +++ b/src/public/index.php @@ -46,9 +46,9 @@ foreach ($calendar->getNodes() as $day => $node) { case 'peers': + $timeThis = strtotime(sprintf('%s-%s-%s 00:00', date('Y'), date('n'), $day)); $timeFrom = strtotime(sprintf('%s-%s-%s 00:00', date('Y', $requestTime), date('n', $requestTime), $day)); $timeTo = strtotime('+1 day', strtotime(sprintf('%s-%s-%s 00:00', date('Y', $requestTime), date('n', $requestTime), $day))); - $timeThis = strtotime('+1 day', strtotime(sprintf('%s-%s-%s 00:00', date('Y'), date('n'), $day))); $dbPeerTotalByTimeUpdated = $memory->getByMethodCallback( $db, 'findPeerTotalByTimeUpdated', [$timeFrom, $timeTo], ($timeTo <= $timeThis ? 2592000 : MEMCACHED_TIMEOUT) + time() @@ -65,9 +65,9 @@ foreach ($calendar->getNodes() as $day => $node) { // Add hourly stats for ($hour = 0; $hour < 24; $hour++) { + $timeThis = strtotime(sprintf('%s-%s-%s %s:00', date('Y'), date('n'), $day, $hour)); $timeFrom = strtotime(sprintf('%s-%s-%s %s:00', date('Y', $requestTime), date('n', $requestTime), $day, $hour)); $timeTo = strtotime(sprintf('%s-%s-%s %s:00', date('Y', $requestTime), date('n', $requestTime), $day, $hour + 1)); - $timeThis = strtotime(sprintf('%s-%s-%s %s:00', date('Y'), date('n'), $day, $hour + 1)); $dbPeerTotalByTimeUpdated = $memory->getByMethodCallback( $db, 'findPeerTotalByTimeUpdated', [$timeFrom, $timeTo], ($timeTo <= $timeThis ? 2592000 : MEMCACHED_TIMEOUT) + time() @@ -84,9 +84,9 @@ foreach ($calendar->getNodes() as $day => $node) { break; case 'traffic': + $timeThis = strtotime(sprintf('%s-%s-%s 00:00', date('Y'), date('n'), $day)); $timeFrom = strtotime(sprintf('%s-%s-%s 00:00', date('Y', $requestTime), date('n', $requestTime), $day)); $timeTo = strtotime('+1 day', strtotime(sprintf('%s-%s-%s 00:00', date('Y', $requestTime), date('n', $requestTime), $day))); - $timeThis = strtotime('+1 day', strtotime(sprintf('%s-%s-%s 00:00', date('Y'), date('n'), $day))); $dbPeerSessionSentSumByTimeUpdated = $memory->getByMethodCallback( $db, 'findPeerSessionSentSumByTimeUpdated', [$timeFrom, $timeTo], ($timeTo <= $timeThis ? 2592000 : MEMCACHED_TIMEOUT) + time() @@ -103,9 +103,9 @@ foreach ($calendar->getNodes() as $day => $node) { // Add hourly stats for ($hour = 0; $hour < 24; $hour++) { + $timeThis = strtotime(sprintf('%s-%s-%s %s:00', date('Y'), date('n'), $day, $hour)); $timeFrom = strtotime(sprintf('%s-%s-%s %s:00', date('Y', $requestTime), date('n', $requestTime), $day, $hour)); $timeTo = strtotime(sprintf('%s-%s-%s %s:00', date('Y', $requestTime), date('n', $requestTime), $day, $hour + 1)); - $timeThis = strtotime(sprintf('%s-%s-%s %s:00', date('Y'), date('n'), $day, $hour + 1)); $dbPeerSessionSentSumByTimeUpdated = $memory->getByMethodCallback( $db, 'findPeerSessionSentSumByTimeUpdated', [$timeFrom, $timeTo], ($timeTo <= $timeThis ? 2592000 : MEMCACHED_TIMEOUT) + time() diff --git a/src/public/peer.php b/src/public/peer.php index 6ada70d..1e36839 100644 --- a/src/public/peer.php +++ b/src/public/peer.php @@ -48,9 +48,9 @@ foreach ($calendar->getNodes() as $day => $node) { case 'traffic': + $timeThis = strtotime(sprintf('%s-%s-%s 00:00', date('Y'), date('n'), $day)); $timeFrom = strtotime(sprintf('%s-%s-%s 00:00', date('Y', $requestTime), date('n', $requestTime), $day)); $timeTo = strtotime('+1 day', strtotime(sprintf('%s-%s-%s 00:00', date('Y', $requestTime), date('n', $requestTime), $day))); - $timeThis = strtotime('+1 day', strtotime(sprintf('%s-%s-%s 00:00', date('Y'), date('n'), $day))); $dbPeerSessionSentSumByTimeUpdated = $memory->getByMethodCallback( $db, 'findPeerSessionSentSumByTimeUpdated', [$timeFrom, $timeTo, $requestPeerId], ($timeTo <= $timeThis ? 2592000 : MEMCACHED_TIMEOUT) + time() @@ -67,9 +67,9 @@ foreach ($calendar->getNodes() as $day => $node) { // Add hourly stats for ($hour = 0; $hour < 24; $hour++) { + $timeThis = strtotime(sprintf('%s-%s-%s %s:00', date('Y'), date('n'), $day, $hour)); $timeFrom = strtotime(sprintf('%s-%s-%s %s:00', date('Y', $requestTime), date('n', $requestTime), $day, $hour)); $timeTo = strtotime(sprintf('%s-%s-%s %s:00', date('Y', $requestTime), date('n', $requestTime), $day, $hour + 1)); - $timeThis = strtotime(sprintf('%s-%s-%s %s:00', date('Y'), date('n'), $day, $hour + 1)); $dbPeerSessionSentSumByTimeUpdated = $memory->getByMethodCallback( $db, 'findPeerSessionSentSumByTimeUpdated', [$timeFrom, $timeTo, $requestPeerId], ($timeTo <= $timeThis ? 2592000 : MEMCACHED_TIMEOUT) + time()