[Fusionforge-commits] FusionForge branch Branch_5_2 updated. 3c2008f9ce13a61e98cfa0c8d25df097a53994c3
Franck VILLAUME
nerville at fusionforge.org
Mon Apr 15 23:42:18 CEST 2013
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".
The branch, Branch_5_2 has been updated
via 3c2008f9ce13a61e98cfa0c8d25df097a53994c3 (commit)
from 0f7280b7b88361d09366e5fc6c69355008f59ec3 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 3c2008f9ce13a61e98cfa0c8d25df097a53994c3
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date: Mon Apr 15 23:41:23 2013 +0200
fix #428: latest-zip does not increment download stats
diff --git a/src/www/frs/download.php b/src/www/frs/download.php
index 593a003..3c331f7 100644
--- a/src/www/frs/download.php
+++ b/src/www/frs/download.php
@@ -5,6 +5,7 @@
* Copyright 1999-2001 (c) VA Linux Systems
* Copyright 2002-2004 (c) GForge Team
* Copyright 2010 (c) FusionForge Team
+ * Copyright 2013, Franck Villaume - TrivialDev
* http://fusionforge.org/
*
* This file is part of FusionForge. FusionForge is free software;
@@ -40,7 +41,7 @@ require_once $gfcommon.'frs/FRSFile.class.php';
* package_id)
*/
-function send_file ($filename,$filepath,$file_id=NULL) {
+function send_file($filename, $filepath, $file_id = NULL, $mode = NULL) {
if (!file_exists($filepath)) {
session_redirect404();
}
@@ -64,7 +65,17 @@ function send_file ($filename,$filepath,$file_id=NULL) {
}
$ip = getStringFromServer('REMOTE_ADDR');
- $res = db_query_params("INSERT INTO frs_dlstats_file (ip_address,file_id,month,day,user_id) VALUES ($1, $2, $3, $4, $5)", array($ip,$file_id,date('Ym'),date('d'),$us));
+ if ($mode != 'latestzip') {
+ $res = db_query_params("INSERT INTO frs_dlstats_file (ip_address,file_id,month,day,user_id) VALUES ($1, $2, $3, $4, $5)", array($ip,$file_id,date('Ym'),date('d'),$us));
+ } else {
+ // here $file_id is a package_id
+ $Package = frspackage_get_object($file_id);
+ $release = $Package->getNewestRelease();
+ $files = $release->getFiles();
+ foreach ($files as $fileObject) {
+ $res = db_query_params("INSERT INTO frs_dlstats_file (ip_address,file_id,month,day,user_id) VALUES ($1, $2, $3, $4, $5)", array($ip, $fileObject->getID(), date('Ym'), date('d'), $us));
+ }
+ }
}
$normalized_urlprefix = normalized_urlprefix();
@@ -119,7 +130,7 @@ case 'latestzip':
$filename = $Package->getNewestReleaseZipName();
$filepath = $Package->getNewestReleaseZipPath();
- send_file ($filename, $filepath);
+ send_file ($filename, $filepath, $package_id, $mode);
break;
-----------------------------------------------------------------------
Summary of changes:
src/www/frs/download.php | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
hooks/post-receive
--
FusionForge
More information about the Fusionforge-commits
mailing list