protected function getPhotoDirectory(string $slug, string $cabin) : int
{
// Start with the cabin
$root = $this->db->cell('SELECT directoryid FROM airship_dirs WHERE cabin = ? AND name = ? AND parent IS NULL', $cabin, 'author');
if (empty($root)) {
return 0;
}
$myBaseDir = $this->db->cell('SELECT directoryid FROM airship_dirs WHERE name = ? AND parent = ?', $slug, $root);
if (empty($myBaseDir)) {
return 0;
}
$photoDir = $this->db->cell('SELECT directoryid FROM airship_dirs WHERE name = ? AND parent = ?', $this->photosDir, $myBaseDir);
if (empty($photoDir)) {
return 0;
}
return $photoDir;
}