diff --git a/src/public/index.php b/src/public/index.php index 2719823..cf5a096 100644 --- a/src/public/index.php +++ b/src/public/index.php @@ -50,11 +50,11 @@ foreach ($calendar->getNodes() as $day => $node) { $timeTo = strtotime('+1 day', strtotime(sprintf('%s-%s-%s 00:00', date('Y', $requestTime), date('n', $requestTime), $day))); $dbPeerTotalByTimeUpdated = $memory->getByMethodCallback( - $db, 'findPeerTotalByTimeUpdated', [$timeFrom, $timeTo] + $db, 'findPeerTotalByTimeUpdated', [$timeFrom, $timeTo], ($timeTo <= $requestTime ? 2592000 : MEMCACHED_TIMEOUT) + time() ); $dbPeerTotalByTimeAdded = $memory->getByMethodCallback( - $db, 'findPeerTotalByTimeAdded', [$timeFrom, $timeTo] + $db, 'findPeerTotalByTimeAdded', [$timeFrom, $timeTo], ($timeTo <= $requestTime ? 2592000 : MEMCACHED_TIMEOUT) + time() ); // Add daily stats @@ -68,11 +68,11 @@ foreach ($calendar->getNodes() as $day => $node) { $timeTo = strtotime(sprintf('%s-%s-%s %s:00', date('Y', $requestTime), date('n', $requestTime), $day, $hour + 1)); $dbPeerTotalByTimeUpdated = $memory->getByMethodCallback( - $db, 'findPeerTotalByTimeUpdated', [$timeFrom, $timeTo] + $db, 'findPeerTotalByTimeUpdated', [$timeFrom, $timeTo], ($timeTo <= $requestTime ? 2592000 : MEMCACHED_TIMEOUT) + time() ); $dbPeerTotalByTimeAdded = $memory->getByMethodCallback( - $db, 'findPeerTotalByTimeAdded', [$timeFrom, $timeTo] + $db, 'findPeerTotalByTimeAdded', [$timeFrom, $timeTo], ($timeTo <= $requestTime ? 2592000 : MEMCACHED_TIMEOUT) + time() ); $calendar->addNode($day, $dbPeerTotalByTimeUpdated, sprintf(_('%s:00-%s:00 online %s'), $hour, $hour + 1, $dbPeerTotalByTimeUpdated), 'green', 1); @@ -87,11 +87,11 @@ foreach ($calendar->getNodes() as $day => $node) { $timeTo = strtotime('+1 day', strtotime(sprintf('%s-%s-%s 00:00', date('Y', $requestTime), date('n', $requestTime), $day))); $dbPeerSessionSentSumByTimeUpdated = $memory->getByMethodCallback( - $db, 'findPeerSessionSentSumByTimeUpdated', [$timeFrom, $timeTo] + $db, 'findPeerSessionSentSumByTimeUpdated', [$timeFrom, $timeTo], ($timeTo <= $requestTime ? 2592000 : MEMCACHED_TIMEOUT) + time() ); $dbPeerSessionReceivedSumByTimeUpdated = $memory->getByMethodCallback( - $db, 'findPeerSessionReceivedSumByTimeUpdated', [$timeFrom, $timeTo] + $db, 'findPeerSessionReceivedSumByTimeUpdated', [$timeFrom, $timeTo], ($timeTo <= $requestTime ? 2592000 : MEMCACHED_TIMEOUT) + time() ); // Add daily stats @@ -105,11 +105,11 @@ foreach ($calendar->getNodes() as $day => $node) { $timeTo = strtotime(sprintf('%s-%s-%s %s:00', date('Y', $requestTime), date('n', $requestTime), $day, $hour + 1)); $dbPeerSessionSentSumByTimeUpdated = $memory->getByMethodCallback( - $db, 'findPeerSessionSentSumByTimeUpdated', [$timeFrom, $timeTo] + $db, 'findPeerSessionSentSumByTimeUpdated', [$timeFrom, $timeTo], ($timeTo <= $requestTime ? 2592000 : MEMCACHED_TIMEOUT) + time() ); $dbPeerSessionReceivedSumByTimeUpdated = $memory->getByMethodCallback( - $db, 'findPeerSessionReceivedSumByTimeUpdated', [$timeFrom, $timeTo] + $db, 'findPeerSessionReceivedSumByTimeUpdated', [$timeFrom, $timeTo], ($timeTo <= $requestTime ? 2592000 : MEMCACHED_TIMEOUT) + time() ); $calendar->addNode($day, $dbPeerSessionSentSumByTimeUpdated, sprintf(_('%s:00-%s:00 ↑ %s'), $hour, $hour + 1, number_format($dbPeerSessionSentSumByTimeUpdated / 1000000, 3)), 'red', 1); diff --git a/src/public/peer.php b/src/public/peer.php index 0431c3a..f8b2cd7 100644 --- a/src/public/peer.php +++ b/src/public/peer.php @@ -52,11 +52,11 @@ foreach ($calendar->getNodes() as $day => $node) { $timeTo = strtotime('+1 day', strtotime(sprintf('%s-%s-%s 00:00', date('Y', $requestTime), date('n', $requestTime), $day))); $dbPeerSessionSentSumByTimeUpdated = $memory->getByMethodCallback( - $db, 'findPeerSessionSentSumByTimeUpdated', [$timeFrom, $timeTo, $requestPeerId] + $db, 'findPeerSessionSentSumByTimeUpdated', [$timeFrom, $timeTo, $requestPeerId], ($timeTo <= $requestTime ? 2592000 : MEMCACHED_TIMEOUT) + time() ); $dbPeerSessionReceivedSumByTimeUpdated = $memory->getByMethodCallback( - $db, 'findPeerSessionReceivedSumByTimeUpdated', [$timeFrom, $timeTo, $requestPeerId] + $db, 'findPeerSessionReceivedSumByTimeUpdated', [$timeFrom, $timeTo, $requestPeerId], ($timeTo <= $requestTime ? 2592000 : MEMCACHED_TIMEOUT) + time() ); // Add daily stats @@ -70,11 +70,11 @@ foreach ($calendar->getNodes() as $day => $node) { $timeTo = strtotime(sprintf('%s-%s-%s %s:00', date('Y', $requestTime), date('n', $requestTime), $day, $hour + 1)); $dbPeerSessionSentSumByTimeUpdated = $memory->getByMethodCallback( - $db, 'findPeerSessionSentSumByTimeUpdated', [$timeFrom, $timeTo, $requestPeerId] + $db, 'findPeerSessionSentSumByTimeUpdated', [$timeFrom, $timeTo, $requestPeerId], ($timeTo <= $requestTime ? 2592000 : MEMCACHED_TIMEOUT) + time() ); $dbPeerSessionReceivedSumByTimeUpdated = $memory->getByMethodCallback( - $db, 'findPeerSessionReceivedSumByTimeUpdated', [$timeFrom, $timeTo, $requestPeerId] + $db, 'findPeerSessionReceivedSumByTimeUpdated', [$timeFrom, $timeTo, $requestPeerId], ($timeTo <= $requestTime ? 2592000 : MEMCACHED_TIMEOUT) + time() ); $calendar->addNode($day, $dbPeerSessionSentSumByTimeUpdated, sprintf(_('%s:00-%s:00 ↑ %s'), $hour, $hour + 1, number_format($dbPeerSessionSentSumByTimeUpdated / 1000000, 3)), 'red', 1);