aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kostikov <max@kostikov.co>2019-10-26 12:30:41 +0200
committerMax Kostikov <max@kostikov.co>2019-10-26 12:30:41 +0200
commitb00db39739dfb9b47ee669b9d9567dcc032904b6 (patch)
tree2ee98aff3f4aa69a75a445837c1095fb47149c67
parente27b19c75629e510daaab8403d30db77a0af1e15 (diff)
parent6f2a5842795c94a16bad089cb6ad5c9e2a74f480 (diff)
downloadvolse-hubzilla-b00db39739dfb9b47ee669b9d9567dcc032904b6.tar.gz
volse-hubzilla-b00db39739dfb9b47ee669b9d9567dcc032904b6.tar.bz2
volse-hubzilla-b00db39739dfb9b47ee669b9d9567dcc032904b6.zip
Merge branch 'dev' into 'dev'
Better cached photos processing See merge request hubzilla/core!1759
-rw-r--r--Zotlabs/Module/Photo.php16
1 files changed, 4 insertions, 12 deletions
diff --git a/Zotlabs/Module/Photo.php b/Zotlabs/Module/Photo.php
index 98b47a4a6..fe8c47544 100644
--- a/Zotlabs/Module/Photo.php
+++ b/Zotlabs/Module/Photo.php
@@ -31,12 +31,7 @@ class Photo extends \Zotlabs\Web\Controller {
// NOTREACHED
}
- $cache_mode = array(
- 'on' => false,
- 'age' => 86400,
- 'exp' => true,
- 'leak' => false
- );
+ $cache_mode = [ 'on' => false, 'age' => 86400, 'exp' => true, 'leak' => false ];
call_hooks('cache_mode_hook', $cache_mode);
$observer_xchan = get_observer_hash();
@@ -144,7 +139,7 @@ class Photo extends \Zotlabs\Web\Controller {
$resolution = 1;
}
- $r = q("SELECT uid, photo_usage, display_path FROM photo WHERE resource_id = '%s' AND imgscale = %d LIMIT 1",
+ $r = q("SELECT * FROM photo WHERE resource_id = '%s' AND imgscale = %d LIMIT 1",
dbesc($photo),
intval($resolution)
);
@@ -163,13 +158,10 @@ class Photo extends \Zotlabs\Web\Controller {
if($u === PHOTO_CACHE) {
// Validate cache
if($cache_mode['on']) {
- $cache = array(
- 'resid' => $photo,
- 'status' => false
- );
+ $cache = [ 'status' => false, 'item' => $r[0] ];
call_hooks('cache_url_hook', $cache);
if(! $cache['status']) {
- $url = html_entity_decode($r[0]['display_path'], ENT_QUOTES);
+ $url = html_entity_decode($cache['item']['display_path'], ENT_QUOTES);
// SSLify if needed
if(strpos(z_root(),'https:') !== false && strpos($url,'https:') === false)
$url = z_root() . '/sslify/' . $filename . '?f=&url=' . urlencode($url);