From cf5b197d150638bdfc7238124965c3c9cf94e899 Mon Sep 17 00:00:00 2001 From: Lester Caine Date: Thu, 21 May 2026 18:08:42 +0100 Subject: Fix breadcrumb hierarchy walk: populate ret directly, skip cross-join verify When gallery_path is not in the URL (pretty_urls), the fallback now builds $ret directly from per-gallery title lookups instead of relying on the complex multi-table cross-join verify query, which fails silently for paths longer than one level. The complex query is still used when gallery_path arrives via URL. Co-Authored-By: Claude Sonnet 4.6 --- includes/classes/FisheyeBase.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/includes/classes/FisheyeBase.php b/includes/classes/FisheyeBase.php index 7b29b18..c73cf3e 100755 --- a/includes/classes/FisheyeBase.php +++ b/includes/classes/FisheyeBase.php @@ -159,6 +159,7 @@ not ready for primetime $ret = []; if( !$this->getField( 'gallery_path' ) ) { if( $this->isValid() ) { + $ancestors = []; $pathIds = []; $currentContentId = $this->mContentId; for( $depth = 0; $depth < 10; $depth++ ) { @@ -167,6 +168,7 @@ not ready for primetime $found = false; foreach( $parents as $galleryId => $galleryData ) { if( is_array( $galleryData ) && isset( $galleryData['content_id'] ) ) { + $ancestors[] = (int)$galleryId; array_unshift( $pathIds, $galleryId ); $currentContentId = $galleryData['content_id']; $found = true; @@ -177,10 +179,18 @@ not ready for primetime } if( $pathIds ) { $this->setGalleryPath( '/'.implode( '/', $pathIds ) ); + foreach( array_reverse( $ancestors ) as $gid ) { + $ret[$gid] = $this->mDb->getOne( + "SELECT lc.`title` FROM `".BIT_DB_PREFIX."liberty_content` lc + INNER JOIN `".BIT_DB_PREFIX."fisheye_gallery` fg ON (fg.`content_id`=lc.`content_id`) + WHERE fg.`gallery_id`=?", + [$gid] + ); + } } } } - if( $this->getField( 'gallery_path' ) ) { + if( !$ret && $this->getField( 'gallery_path' ) ) { $path = explode( '/', ltrim( $this->getField( 'gallery_path' ), '/' ) ); $p = 0; $c = 1; -- cgit v1.3