Commit 8cbc839f authored by speedprogs_de's avatar speedprogs_de
Browse files

added condition to enable download counter

git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/terfe/branches/ter_fe2@52075 735d13b6-9817-0410-8766-e36946ffe9aa
parent 637a4b04
...@@ -268,16 +268,18 @@ ...@@ -268,16 +268,18 @@
} }
// Check session if user has already downloaded this file today // Check session if user has already downloaded this file today
$extensionKey = $version->getExtension()->getExtKey(); if (!empty($this->settings['enableDownloadCounter'])) {
$downloads = $this->session->get('downloads'); $extensionKey = $version->getExtension()->getExtKey();
if (empty($downloads) || !in_array($extensionKey, $downloads)) { $downloads = $this->session->get('downloads');
// Add +1 to download counter and save immediately if (empty($downloads) || !in_array($extensionKey, $downloads)) {
$version->incrementDownloadCounter(); // Add +1 to download counter and save immediately
$this->persistenceManager->persistAll(); $version->incrementDownloadCounter();
$this->persistenceManager->persistAll();
// Add extension key to session
$downloads[] = $extensionKey; // Add extension key to session
$this->session->add('downloads', $downloads); $downloads[] = $extensionKey;
$this->session->add('downloads', $downloads);
}
} }
// Send file to browser // Send file to browser
......
...@@ -21,6 +21,9 @@ plugin.tx_terfe2 { ...@@ -21,6 +21,9 @@ plugin.tx_terfe2 {
# cat=TER Frontend/settings/150; type=string; label=Media root path: Media root path for zip files and images # cat=TER Frontend/settings/150; type=string; label=Media root path: Media root path for zip files and images
mediaRootPath = fileadmin/extensionFiles/ mediaRootPath = fileadmin/extensionFiles/
# cat=TER Frontend/settings/155; type=string; label=Count downloads: Count extension downloads via download action
countDownloads = 0
terConnection { terConnection {
# cat=TER Frontend/settings/160; type=string; label=TER WSDL URI: WSDL URI to connect TER server # cat=TER Frontend/settings/160; type=string; label=TER WSDL URI: WSDL URI to connect TER server
wsdl = http://typo3.org/wsdl/tx_ter_wsdl.php wsdl = http://typo3.org/wsdl/tx_ter_wsdl.php
......
...@@ -10,6 +10,7 @@ plugin.tx_terfe2 { ...@@ -10,6 +10,7 @@ plugin.tx_terfe2 {
descriptionLength = {$plugin.tx_terfe2.settings.descriptionLength} descriptionLength = {$plugin.tx_terfe2.settings.descriptionLength}
dateFormat = {$plugin.tx_terfe2.settings.dateFormat} dateFormat = {$plugin.tx_terfe2.settings.dateFormat}
mediaRootPath = {$plugin.tx_terfe2.settings.mediaRootPath} mediaRootPath = {$plugin.tx_terfe2.settings.mediaRootPath}
countDownloads = {$plugin.tx_terfe2.settings.countDownloads}
terConnection { terConnection {
wsdl = {$plugin.tx_terfe2.settings.terConnection.wsdl} wsdl = {$plugin.tx_terfe2.settings.terConnection.wsdl}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment