4 * FusionForge SCM Snapshots download page
6 * Copyright 1999-2001 (c) VA Linux Systems
7 * Copyright 2003-2004 (c) GForge
8 * Copyright 2010 (c) Franck Villaume
9 * http://fusionforge.org/
11 * This file is part of FusionForge. FusionForge is free software;
12 * you can redistribute it and/or modify it under the terms of the
13 * GNU General Public License as published by the Free Software
14 * Foundation; either version 2 of the Licence, or (at your option)
17 * FusionForge is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License along
23 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29 require_once 'env.inc.php';
30 require_once $gfcommon.'include/pre.php';
32 // Get current information
33 $group_id=getIntFromGet('group_id');
37 $group = group_get_object($group_id);
38 if (!$group || !is_object($group)) {
39 exit_error(_('Error creating group'),'home');
40 } elseif ($group->isError()) {
41 exit_error($group->getErrorMessage(),'home');
44 // Snapshot downloads require the same permissions as SCM read access
45 if (!forge_check_perm ('scm', $group->getID(), 'read')) {
46 exit_permission_denied('home');
50 $group_name=$group->getUnixName();
52 $filename=$group_name.'-scm-latest.tar.gz';
54 if (file_exists(forge_get_config('scm_snapshots_path').'/'.$filename)) {
55 Header('Content-disposition: filename="'.str_replace('"', '', $filename).'"');
56 Header('Content-type: application/x-gzip');
57 $length = filesize(forge_get_config('scm_snapshots_path').'/'.$filename);
58 Header('Content-length: '.$length);
60 readfile_chunked(forge_get_config('scm_snapshots_path').'/'.$filename);
62 session_redirect404();