Added the display of the repository size in the source subtab of a project.

This commit is contained in:
Loic d'Anterroches
2009-06-19 17:31:45 +02:00
parent e235242ea6
commit 25e296fbb6
7 changed files with 62 additions and 1 deletions

View File

@@ -349,6 +349,24 @@ class IDF_Project extends Pluf_Model
return new Pluf_Template_ContextVars($tags);
}
/**
* Get the repository size.
*
* @param bool Force to skip the cache (false)
* @return int Size in byte or -1 if not available
*/
public function getRepositorySize($force=false)
{
$last_eval = $this->getConf()->getVal('repository_size_check_date', 0);
if (!$force and $last_eval > time()-86400) {
return $this->getConf()->getVal('repository_size', -1);
}
$scm = IDF_Scm::get($this);
$this->getConf()->setVal('repository_size', $scm->getRepositorySize());
$this->getConf()->setVal('repository_size_check_date', time());
return $this->getConf()->getVal('repository_size', -1);
}
/**
* Get the access url to the repository.
*