[TikiWiki-commits] [Git][tikiwiki/tiki][29.x] [BP][FIX] list_pages(): properly handle 'langOrphan' filter using 'NOT IN'

"Olivier Kango \(@olivierkango\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <69b92e82da9c6_3b18c8107318a@gitlab-sidekiq-low-urgency-cpu-bound-v2-7fb98cc9d4-n5hwn.mail>

Olivier Kango pushed to branch 29.x at Tiki Wiki CMS Groupware / Tiki


Commits:
23723db3 by Olivier Kango at 2026-03-17T12:27:57+02:00
[BP][FIX] list_pages(): properly handle 'langOrphan' filter using 'NOT IN'
---
* [FIX] list_pages(): properly handle 'langOrphan' filter using 'NOT IN'
---
* [FIX] Correctly filter langOrphan pages by checking untranslated traId groups

* [FIX] list_pages(): properly handle 'langOrphan' filter using 'NOT IN'

See merge request tikiwiki/tiki!7992

(cherry picked from commit 7d0c91e1a694e765ddbbe26ce0665681e385d853)

See merge request tikiwiki/tiki!9770

- - - - -


1 changed file:

- lib/tikilib.php


Changes:

=====================================
lib/tikilib.php
=====================================
@@ -3867,10 +3867,13 @@ class TikiLib extends TikiDb_Bridge
                     $join_tables .= " inner join `tiki_structures` as ts on (ts.`page_id` = tp.`page_id` and ts.`parent_id` = 0) ";
                     $select .= ',ts.`page_alias`';
                 } elseif ($type == 'langOrphan') {
-                    $join_tables .= " left join `tiki_translated_objects` tro on (tro.`type` = 'wiki page' AND tro.`objId` = tp.`page_id`) ";
-                    $tmp_mid[] = "( (tro.`traId` IS NULL AND tp.`lang` != ?) OR tro.`traId` NOT IN(SELECT `traId` FROM `tiki_translated_objects` WHERE `lang` = ?))";
-                    $bindvars[] = $val;
-                    $bindvars[] = $val;
+                    $langs = is_array($val) ? $val : [$val];
+                    $placeholders = implode(',', array_fill(0, count($langs), '?'));
+
+                    $join_tables .= " left join `tiki_translated_objects` tro on (tro.`type` = 'wiki page' and tro.`objId` = tp.`page_id`) ";
+                    $tmp_mid[] = "((tro.`traId` IS NULL AND tp.`lang` NOT IN ($placeholders)) OR tro.`traId` NOT IN (SELECT `traId` FROM `tiki_translated_objects` WHERE `lang` IN ($placeholders)))";
+
+                    $bindvars = array_merge($bindvars, $langs, $langs);
                 } elseif ($type == 'structure_orphans') {
                     $join_tables .= " left join `tiki_structures` as tss on (tss.`page_id` = tp.`page_id`) ";
                     $tmp_mid[] = "(tss.`page_ref_id` is null)";



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/23723db3b90fb9f6aaf4701990d1bdc7a36c99e4

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/23723db3b90fb9f6aaf4701990d1bdc7a36c99e4
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.