Skip to content

Commit 7d2a3ac

Browse files
committed
Revert "Count download file for press only #10837"
This reverts commit 951f30e.
1 parent ac75472 commit 7d2a3ac

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

server/Application/Handler/DownloadFile.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,21 @@ class DownloadFile extends AbstractHandler
1616
public function handle(ServerRequestInterface $request): ResponseInterface
1717
{
1818
$path = 'data/download-file-counter/alternative_groceries_report_nov_2024.pdf';
19-
$cookie_name = 'artisans_pdf_download_2';
19+
$cookie_name = 'artisans_pdf_download_1';
2020

2121
// Increment counter if no cookie = first visit
22-
if (!isset($_COOKIE[$cookie_name]) && isset($_REQUEST['press'])) {
22+
if (!isset($_COOKIE[$cookie_name])) {
2323
$download_count = 0;
2424
if (file_exists(self::COUNTER_PATH)) {
2525
$download_count = (int) (file_get_contents(self::COUNTER_PATH));
2626
}
2727
++$download_count;
2828
file_put_contents(self::COUNTER_PATH, $download_count);
29-
30-
// Flag cookie
31-
setcookie($cookie_name, 'true', time() + (86400 * 1000), '/'); // 1000 days
3229
}
3330

31+
// Flag cookie
32+
setcookie($cookie_name, 'true', time() + (86400 * 60), '/'); // 60 days
33+
3434
if (!is_readable($path)) {
3535
return $this->createError('File not found on disk, or not readable');
3636
}

0 commit comments

Comments
 (0)