4 * Copyright 2003 (c) GFDL
6 * This file is part of FMS.
8 * FMS is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * FMS is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with FMS; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US
21 * -------------- Gforge team comment ------------
22 * This file was proposed by Brett N DiFrischia
23 * with the following description:
24 * The GFDL uses many large files that could not be uploaded to our GForge site.
25 * At this time, such files are updated manually. This cronjob updates file sizes
26 * for all files that have the incorrect size. Note that this cronjob checks all files
27 * instead of recently updated ones. This could put a major damper on large systems.
28 * Updates are only performed for incorrect file sizes.
33 require_once $gfcommon.'include/pre.php';
37 $fms_filesize_res = db_query_params ('SELECT frs_file.filename,frs_file.file_id,
38 groups.unix_group_name,frs_file.file_size
39 FROM frs_package,frs_release,frs_file,groups
40 WHERE frs_release.release_id=frs_file.release_id
41 AND groups.group_id=frs_package.group_id
42 AND frs_release.package_id=frs_package.package_id
43 AND frs_file.post_date > $1',
44 array (time() - (7 * 24 * 60 * 60))) ;
47 while ( $fms_filesize_row = db_fetch_array( $fms_filesize_res ) ) {
49 $fms_file_path = forge_get_config('upload_dir') . '/' .
50 $fms_filesize_row['unix_group_name'] . '/' .
51 $fms_filesize_row['filename'];
53 $fms_curr_size = filesize( $fms_file_path );
55 if ( $fms_curr_size != $fms_filesize_row['file_size'] ) {
56 db_query_params ('UPDATE frs_file SET file_size=$1 WHERE file_id=$2',
57 array ($fms_curr_size,
58 $fms_filesize_row['file_id']));