1
0
mirror of https://github.com/mosbth/cimage.git synced 2025-08-26 01:03:41 +02:00

improved cache handling for remote, #130

This commit is contained in:
Mikael Roos
2015-12-07 15:12:20 +01:00
parent 3271d165ff
commit 79a7fd17d8
3 changed files with 21 additions and 24 deletions

View File

@@ -348,6 +348,16 @@ $img->setVerbose($verbose || $verboseFile);
/**
* Get the cachepath from config.
*/
$cachePath = getConfig('cache_path', __DIR__ . '/../cache/');
$cache = new CCache();
$cache->setDir($cachePath);
/**
* Allow or disallow remote download of images from other servers.
* Passwords apply if used.
@@ -356,8 +366,10 @@ $img->setVerbose($verbose || $verboseFile);
$allowRemote = getConfig('remote_allow', false);
if ($allowRemote && $passwordMatch !== false) {
$cacheRemote = $cache->getPathToSubdir("remote");
$pattern = getConfig('remote_pattern', null);
$img->setRemoteDownload($allowRemote, $pattern);
$img->setRemoteDownload($allowRemote, $pattern, $cacheRemote);
$whitelist = getConfig('remote_whitelist', null);
$img->setRemoteHostWhitelist($whitelist);
@@ -942,15 +954,6 @@ verbose("alias = $alias");
/**
* Get the cachepath from config.
*/
$cachePath = getConfig('cache_path', __DIR__ . '/../cache/');
$cache = new CCache();
$cache->setDir($cachePath);
/**
* Add cache control HTTP header.
*/