aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorgit-marijus <mario@mariovavti.com>2017-07-18 13:56:09 +0200
committergit-marijus <mario@mariovavti.com>2017-07-18 13:56:09 +0200
commit08c0d78296d4518a5ece4d6a2c05b9be83580aa8 (patch)
tree88cd4dbce6e8111cc9a924dabb67957f51a4f361 /include
parent4728e72d182f78dc2f5768fdb55d1e142fc92129 (diff)
downloadvolse-hubzilla-08c0d78296d4518a5ece4d6a2c05b9be83580aa8.tar.gz
volse-hubzilla-08c0d78296d4518a5ece4d6a2c05b9be83580aa8.tar.bz2
volse-hubzilla-08c0d78296d4518a5ece4d6a2c05b9be83580aa8.zip
issue #827 provide backward compatibility for album links generated in earlier times before the ambiguity of photo album names was solved. This may provide incorrect results if two or more photo albums with the same basename exist in different directories of the file tree; but there is no easy way to solve that ambiguity - which is why the link format changed.
Diffstat (limited to 'include')
-rw-r--r--include/photos.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/photos.php b/include/photos.php
index 6ea444e2e..f5d5fdb48 100644
--- a/include/photos.php
+++ b/include/photos.php
@@ -593,6 +593,15 @@ function photos_album_exists($channel_id, $observer_hash, $album) {
intval($channel_id)
);
+ // partial backward compatibility with Hubzilla < 2.4 when we used the filename only
+ // (ambiguous which would get chosen if you had two albums of the same name in different directories)
+ if(!$r) {
+ $r = q("SELECT folder, hash, is_dir, filename, os_path, display_path FROM attach WHERE filename = '%s' AND is_dir = 1 AND uid = %d $sql_extra limit 1",
+ dbesc(hex2bin($album)),
+ intval($channel_id)
+ );
+ }
+
return (($r) ? $r[0] : false);
}