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

Benoit Grégoire (@benoitg) via TikiWiki-cvs <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <68b2236e14f95_2cdc8e8-36e@gitlab-sidekiq-low-urgency-cpu-bound-v2-5677dfb55d-p4x86.mail>

Benoit Grégoire pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
7d0c91e1 by Olivier Kango at 2025-08-29T21:54:21+00:00
[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

- - - - -


1 changed file:

- lib/tikilib.php


Changes:

=====================================
lib/tikilib.php
=====================================
@@ -3825,10 +3825,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/7d0c91e1a694e765ddbbe26ce0665681e385d853

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/7d0c91e1a694e765ddbbe26ce0665681e385d853
You're receiving this email because of your account on gitlab.com.

_______________________________________________
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.