diff options
author | Andreas Gohr <andi@splitbrain.org> | 2006-06-15 20:48:47 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2006-06-15 20:48:47 +0200 |
commit | 847b82981c3abfa3a352c66c3922c3c2cb89f023 (patch) | |
tree | 62c8fa4264dae86810a176a2932a22edaa413115 /lib/exe/fetch.php | |
parent | a6ef4796e22156364843a3b42bdd8f2dc78c0db5 (diff) | |
download | rpg-847b82981c3abfa3a352c66c3922c3c2cb89f023.tar.gz rpg-847b82981c3abfa3a352c66c3922c3c2cb89f023.tar.bz2 |
$conf['fetchsize'] added
This patch adds an option to configure the maximum size for files the fetch.php
will ever download. Setting this to 0 completely turns of the caching of external
media files.
Disadvantages of setting a low or zero fetchsize:
* fetch.php needs to download images to be able to resize them. When the used
fetchsize prevents the downloading the images can only be resized by the
browser which means the browser will need to download the fullsized image first.
* If the linked external media files vanishes it will no longer display in the
wiki because it is not cached.
Advantages of setting a low or zero fetchsize:
* fetch.php may be used for a possible denial of service attack by requesting
many big external files.
* The created cache files may take a lot of space on the server
I recommend to leave the setting at 2MB for internal and private wikis and lower
the setting to about 200 to 500 Kb for bigger public Wikis.
Note: the caching of files uploaded through the media manager is not affected by
this setting.
darcs-hash:20060615184847-7ad00-04fc39928f7d72e56f5c5e271013ef265436e6c9.gz
Diffstat (limited to 'lib/exe/fetch.php')
-rw-r--r-- | lib/exe/fetch.php | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/exe/fetch.php b/lib/exe/fetch.php index f1cf9c7b4..e45c27e67 100644 --- a/lib/exe/fetch.php +++ b/lib/exe/fetch.php @@ -224,8 +224,9 @@ function calc_cache($cache){ function get_from_URL($url,$ext,$cache){ global $conf; - // if 'nocache' just redirect - if ($cache==0) { return false; } + // if no cache or fetchsize just redirect + if ($cache==0) return false; + if (!$conf['fetchsize']) return false; $local = getCacheName(strtolower($url),".media.$ext"); $mtime = @filemtime($local); // 0 if not exists @@ -234,7 +235,7 @@ function get_from_URL($url,$ext,$cache){ if( ($mtime == 0) || // cache does not exist ($cache != -1 && $mtime < time()-$cache) // 'recache' and cache has expired ){ - if(io_download($url,$local)){ + if(io_download($url,$local,false,'',$conf['fetchsize'])){ return $local; }else{ return false; |