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 along
19 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 * -------------- FusionForge team comment ------------
23 * This file was proposed by Brett N DiFrischia
24 * with the following description:
25 * The GFDL uses many large files that could not be uploaded to our GForge site.
26 * At this time, such files are updated manually. This cronjob updates file sizes
27 * for all files that have the incorrect size. Note that this cronjob checks all files
28 * instead of recently updated ones. This could put a major damper on large systems.
29 * Updates are only performed for incorrect file sizes.
34 require_once $gfcommon.'include/pre.php';
38 $fms_filesize_res = db_query_params ('SELECT frs_file.filename,frs_file.file_id,
39 groups.unix_group_name,frs_file.file_size
40 FROM frs_package,frs_release,frs_file,groups
41 WHERE frs_release.release_id=frs_file.release_id
42 AND groups.group_id=frs_package.group_id
43 AND frs_release.package_id=frs_package.package_id
44 AND frs_file.post_date > $1',
45 array (time() - (7 * 24 * 60 * 60))) ;
48 while ( $fms_filesize_row = db_fetch_array( $fms_filesize_res ) ) {
50 $fms_file_path = forge_get_config('upload_dir') . '/' .
51 $fms_filesize_row['unix_group_name'] . '/' .
52 $fms_filesize_row['filename'];
54 $fms_curr_size = filesize( $fms_file_path );
56 if ( $fms_curr_size != $fms_filesize_row['file_size'] ) {
57 db_query_params ('UPDATE frs_file SET file_size=$1 WHERE file_id=$2',
58 array ($fms_curr_size,
59 $fms_filesize_row['file_id']));