3 * Project Admin page to manage quotas disk and database
5 * Copyright 2005, Fabio Bertagnin
6 * Copyright 2011,2016, Franck Villaume - Capgemini
7 * Copyright 2019,2021, Franck Villaume - TrivialDev
8 * http://fusionforge.org
10 * This file is part of FusionForge.
12 * FusionForge is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
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 this program; if not, write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 global $quotamanagement;
30 if ( !forge_check_global_perm('forge_admin')) {
31 $warning_msg = _('Quota Management Action Denied.');
32 session_redirect('/plugins/'.$quotamanagement->name.'/?group_id='.$group_id, false);
35 require_once $gfcommon.'include/SysTasksQ.class.php';
37 $_quota_block_size = trim(shell_exec('echo $BLOCK_SIZE')) + 0;
38 if ($_quota_block_size == 0) {
39 $_quota_block_size = 1024;
42 $type = getStringFromRequest('type');
44 $qs = $_POST["qs"] * $_quota_block_size;
45 $qh = $_POST["qh"] * $_quota_block_size;
46 $qds = $_POST["qds"] * 1024;
47 $qdh = $_POST["qdh"] * 1024;
49 if ($qs > $qh || $qds > $qdh) {
50 $error_msg = _('Input error: Hard quota must be greater than soft quota');
52 db_query_params('UPDATE plugin_quotamanagement SET quota_soft = $1, quota_hard = $2, quota_db_soft = $3, quota_db_hard = $4 WHERE group_id = $5',
53 array($qs, $qh, $qds, $qdh, $group_id));
54 $systasksq = new SystasksQ();
55 $systasksq->add($quotamanagement->getID(), 'QUOTAMANAGEMENT_SET_QUOTA', $group_id);
56 $feedback = _('Quota updated successfully');
59 $redirect_url = '/plugins/'.$quotamanagement->name.'/?type='.$type;
60 session_redirect($redirect_url, false);