From ad6148cae7a288aa5ac64accc832a0722eed0358 Mon Sep 17 00:00:00 2001 From: Loic d'Anterroches Date: Wed, 19 May 2010 10:55:50 +0200 Subject: [PATCH] Fixed issue 403, make the calcul of project's disk used space optionnal. --- src/IDF/Project.php | 3 ++- src/IDF/Views/Admin.php | 9 ++++++--- src/IDF/conf/idf.php-dist | 5 +++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/IDF/Project.php b/src/IDF/Project.php index 28d3d48..05931c2 100644 --- a/src/IDF/Project.php +++ b/src/IDF/Project.php @@ -366,7 +366,8 @@ class IDF_Project extends Pluf_Model public function getRepositorySize($force=false) { $last_eval = $this->getConf()->getVal('repository_size_check_date', 0); - if (!$force and $last_eval > time()-172800) { + if (Pluf::f('idf_no_size_check', false) or + (!$force and $last_eval > time()-172800)) { return $this->getConf()->getVal('repository_size', -1); } $this->getConf()->setVal('repository_size_check_date', time()); diff --git a/src/IDF/Views/Admin.php b/src/IDF/Views/Admin.php index 49a1685..f7525a8 100644 --- a/src/IDF/Views/Admin.php +++ b/src/IDF/Views/Admin.php @@ -357,7 +357,8 @@ function IDF_Views_Admin_getForgeSize($force=false) } } $last_eval = $conf->getVal('downloads_size_check_date', 0); - if (!$force and $last_eval > time()-172800) { + if (Pluf::f('idf_no_size_check', false) or + (!$force and $last_eval > time()-172800)) { $res['downloads'] = $conf->getVal('downloads_size', 0); } else { $conf->setVal('downloads_size_check_date', time()); @@ -368,7 +369,8 @@ function IDF_Views_Admin_getForgeSize($force=false) $conf->setVal('downloads_size', $res['downloads']); } $last_eval = $conf->getVal('attachments_size_check_date', 0); - if (!$force and $last_eval > time()-172800) { + if (Pluf::f('idf_no_size_check', false) or + (!$force and $last_eval > time()-172800)) { $res['attachments'] = $conf->getVal('attachments_size', 0); } else { $conf->setVal('attachments_size_check_date', time()); @@ -379,7 +381,8 @@ function IDF_Views_Admin_getForgeSize($force=false) $conf->setVal('attachments_size', $res['attachments']); } $last_eval = $conf->getVal('database_size_check_date', 0); - if (!$force and $last_eval > time()-172800) { + if (Pluf::f('idf_no_size_check', false) or + (!$force and $last_eval > time()-172800)) { $res['database'] = $conf->getVal('database_size', 0); } else { $conf->setVal('database_size_check_date', time()); diff --git a/src/IDF/conf/idf.php-dist b/src/IDF/conf/idf.php-dist index 36d69b2..e927fce 100644 --- a/src/IDF/conf/idf.php-dist +++ b/src/IDF/conf/idf.php-dist @@ -235,4 +235,9 @@ $cfg['allowed_scm'] = array('git' => 'IDF_Scm_Git', # $cfg['hg_path'] = 'hg'; # $cfg['git_path'] = 'git'; +# If you do not want to have calculations of the repositories, attachments +# and downloads size, set it to true. You can set to false some +# times to times to check the size. +# $cfg['idf_no_size_check'] = false; + return $cfg;