[Fusionforge-commits] FusionForge branch master updated. 9253fd04368bfdaeb61fdbb54669b38c50a55209

Franck Villaume nerville at fusionforge.org
Thu Nov 6 15:28:41 CET 2014


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, master has been updated
       via  9253fd04368bfdaeb61fdbb54669b38c50a55209 (commit)
       via  4281628b10aa201fb49231d54982d5f2eb1bcc50 (commit)
      from  026795524cd88b32fc061fd1aec73fdf250503c4 (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 9253fd04368bfdaeb61fdbb54669b38c50a55209
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Thu Nov 6 15:28:21 2014 +0100

    fix wrong var

diff --git a/src/common/frs/FRSRelease.class.php b/src/common/frs/FRSRelease.class.php
index d7edb78..6f95752 100644
--- a/src/common/frs/FRSRelease.class.php
+++ b/src/common/frs/FRSRelease.class.php
@@ -344,15 +344,15 @@ class FRSRelease extends Error {
 	}
 
 	function hasFiles() {
-		if ($files_count != null)
-			return $files_count;
+		if ($this->files_count != null)
+			return $this->files_count;
 
 		$res = db_query_params('select count(file_id) as files_count from frs_file where release_id = $1', array($this->getID()));
 		if (db_numrows($res) >= 1) {
 			$row = db_fetch_array($res);
-			$files_count = $row['files_count'];
+			$this->files_count = $row['files_count'];
 		}
-		return $files_count;
+		return $this->files_count;
 	}
 
 	/**

commit 4281628b10aa201fb49231d54982d5f2eb1bcc50
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Thu Nov 6 15:27:45 2014 +0100

    frs: fix stats after [#737]

diff --git a/src/www/frs/download.php b/src/www/frs/download.php
index c9e2008..122cc0f 100644
--- a/src/www/frs/download.php
+++ b/src/www/frs/download.php
@@ -64,25 +64,32 @@ function send_file($filename, $filepath, $file_id = NULL, $mode = NULL) {
 	} else {
 		$us = 100;
 	}
-
 	$ip = getStringFromServer('REMOTE_ADDR');
-	if ($mode != 'latestzip') {
-		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 if ($mode == 'zip') {
-		// here $file_id is a release_id
-		$frsr = frsrelease_get_object($file_id);
-		$files = $release->getFiles();
-		foreach ($files as $fileObject) {
-			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));
+	switch ($mode) {
+		case 'file':
+		case 'latestfile': {
+			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));
+			break;
 		}
-	} else {
-		// here $file_id is a package_id
-		$Package = frspackage_get_object($file_id);
-		$release_id = $Package->getNewestReleaseID();
-		$release = frsrelease_get_object($release_id);
-		$files = $release->getFiles();
-		foreach ($files as $fileObject) {
-			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));
+		case 'zip': {
+
+			// here $file_id is a release_id
+			$frsr = frsrelease_get_object($file_id);
+			$files = $frsr->getFiles();
+			foreach ($files as $fileObject) {
+				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));
+			}
+			break;
+		}
+		case 'latestzip': {
+			// here $file_id is a package_id
+			$Package = frspackage_get_object($file_id);
+			$release_id = $Package->getNewestReleaseID();
+			$release = frsrelease_get_object($release_id);
+			$files = $release->getFiles();
+			foreach ($files as $fileObject) {
+				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));
+			}
 		}
 	}
 }
@@ -146,7 +153,7 @@ case 'file':
 	$filename = $File->getName();
 	$filepath = forge_get_config('upload_dir').'/'.$Group->getUnixName().'/'.$Package->getFileName().'/'.$Release->getFileName().'/'.$filename;
 
-	send_file ($filename, $filepath, $file_id);
+	send_file($filename, $filepath, $file_id, $mode);
 
 	break;
 
@@ -195,7 +202,7 @@ case 'latestfile':
 	$filename = $File->getName();
 	$filepath = forge_get_config('upload_dir').'/'.$Group->getUnixName().'/'.$Package->getFileName().'/'.$Release->getFileName().'/'.$filename;
 
-	send_file ($filename, $filepath, $file_id);
+	send_file($filename, $filepath, $file_id, $mode);
 
 	break;
 
@@ -215,7 +222,7 @@ case 'zip':
 	session_require_perm('frs', $frsp->getID(), 'read');
 
 	$filepath = forge_get_config('upload_dir').'/'.$Group->getUnixName().'/'.$frsp->getFileName().'/'.$file_name;
-	send_file($file_name, $filepath, $frsr->getID());
+	send_file($file_name, $filepath, $release_id, $mode);
 
 	break;
 

-----------------------------------------------------------------------

Summary of changes:
 src/common/frs/FRSRelease.class.php |    8 +++---
 src/www/frs/download.php            |   47 ++++++++++++++++++++---------------
 2 files changed, 31 insertions(+), 24 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list