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.

This commit is contained in:
git-marijus
2017-07-18 13:56:09 +02:00
parent b7d92d3a09
commit 9bd11afc62
2 changed files with 10 additions and 1 deletions

View File

@@ -592,6 +592,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);
}