Skip to content

Commit

Permalink
MDL-13766, add default vaule for cache expired time.
Browse files Browse the repository at this point in the history
  • Loading branch information
dongsheng committed Aug 13, 2008
1 parent 3fd2552 commit d7e122d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/filelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1726,13 +1726,17 @@ function __construct(){
if(is_dir($CFG->dataroot.'/repository/cache')) {
$this->dir = $CFG->dataroot.'/repository/cache/';
}
if (empty($CFG->repository_cache_expire)) {
$CFG->repository_cache_expire = 120;
}
}
public function get($param){
global $CFG;
$filename = md5(serialize($param));
if(file_exists($this->dir.$filename)) {
$lasttime = filemtime($this->dir.$filename);
if(time()-$lasttime > $CFG->repository_cache_expire) {
if(time()-$lasttime > $CFG->repository_cache_expire)
{
return false;
} else {
$fp = fopen($this->dir.$filename, 'r');
Expand Down

0 comments on commit d7e122d

Please sign in to comment.