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:
@@ -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.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user