diff options
author | Max Kostikov <max@kostikov.co> | 2019-04-24 11:18:17 +0200 |
---|---|---|
committer | Max Kostikov <max@kostikov.co> | 2019-04-24 11:18:17 +0200 |
commit | fe84dae313a21598882d52f3f36923b99180470c (patch) | |
tree | 10b296738232e6c2d5e8215841ee893d3212cb24 | |
parent | 9104933b181a22799a799afed2c1db9467b8f586 (diff) | |
download | volse-hubzilla-fe84dae313a21598882d52f3f36923b99180470c.tar.gz volse-hubzilla-fe84dae313a21598882d52f3f36923b99180470c.tar.bz2 volse-hubzilla-fe84dae313a21598882d52f3f36923b99180470c.zip |
Optimize cached photos processing
-rw-r--r-- | Zotlabs/Module/Photo.php | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/Zotlabs/Module/Photo.php b/Zotlabs/Module/Photo.php index 74b2ef45d..30670c329 100644 --- a/Zotlabs/Module/Photo.php +++ b/Zotlabs/Module/Photo.php @@ -162,18 +162,20 @@ class Photo extends \Zotlabs\Web\Controller { $allowed = (-1); if($u === PHOTO_CACHE) { // Validate cache - $cache = array( - 'resid' => $photo, - 'status' => false - ); - if($cache_mode['on']) + if($cache_mode['on']) { + $cache = array( + 'resid' => $photo, + 'status' => false + ); call_hooks('cache_url_hook', $cache); - if(! $cache['status']) { - $url = htmlspecialchars_decode($r[0]['display_path']); - if(strpos(z_root(),'https:') !== false && strpos($url,'https:') === false) - $url = z_root() . '/sslify/' . $filename . '?f=&url=' . urlencode($url); - header("Location: " . $url); - killme(); + if(! $cache['status']) { + $url = htmlspecialchars_decode($r[0]['display_path']); + // SSLify if needed + if(strpos(z_root(),'https:') !== false && strpos($url,'https:') === false) + $url = z_root() . '/sslify/' . $filename . '?f=&url=' . urlencode($url); + header("Location: " . $url); + killme(); + } } } } |