From dc560557dd9f4d5bbbe60367b99c72b1145ef0e7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Tue, 25 Apr 2023 15:28:50 +0300 Subject: [PATCH] Re-order LEFT JOIN pages before LEFT JOIN rpm --- dokuwiki-plugin-data.spec | 2 +- separate-rpmdb.patch | 26 ++++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/dokuwiki-plugin-data.spec b/dokuwiki-plugin-data.spec index d40b335..7c29b4c 100644 --- a/dokuwiki-plugin-data.spec +++ b/dokuwiki-plugin-data.spec @@ -5,7 +5,7 @@ Summary: DokuWiki Structured Data Plugin Name: dokuwiki-plugin-%{plugin} Version: %{ver} -Release: 1 +Release: 2 License: GPL v2 Group: Applications/WWW Source0: https://github.com/splitbrain/dokuwiki-plugin-%{plugin}/archive/%{subver}/%{plugin}-%{subver}.tar.gz diff --git a/separate-rpmdb.patch b/separate-rpmdb.patch index d16d484..7a4e71e 100644 --- a/separate-rpmdb.patch +++ b/separate-rpmdb.patch @@ -30,8 +30,8 @@ time... $lang['lastmod'] = 'Last Modified'; $lang['name'] = 'Type Alias'; ---- dokuwiki-plugin-data-20160311/syntax/table.php~ 2016-07-01 14:27:21.000000000 +0300 -+++ dokuwiki-plugin-data-20160311/syntax/table.php 2016-11-22 23:08:01.967907897 +0200 +--- dokuwiki-plugin-data-20160311/syntax/table.php 2016-11-22 23:08:01.967907897 +0200 ++++ dokuwiki-plugin-data-20220727/syntax/table.php 2023-04-25 15:27:50.645943694 +0300 @@ -584,6 +584,13 @@ $select[] = 'pages.lastmod'; } elseif($key == '%title%') { @@ -46,3 +46,25 @@ time... } else { if(!isset($tables[$key])) { $tables[$key] = 'T' . (++$cnt); +@@ -686,6 +693,21 @@ + GROUP BY W1.pid + $order"; + ++ // Re-order LEFT JOIN pages before LEFT JOIN rpm ++ $sql = preg_replace_callback('/ ++ (?P.+) ++ (?PLEFT\sJOIN\srpmdb\sAS\sT\d+\sON\sT\d+.pid\s=\spages.pid\s+) ++ (?PLEFT\sJOIN\spages\sON\sW\d+\.pid\s*=pages\.pid\s+) ++ (?P.+) ++ /xm', function ($m) { ++ return implode("", [ ++ $m['before'], ++ $m['pages'], ++ $m['rpmdb'], ++ $m['after'], ++ ]); ++ }, $sql); ++ + // offset and limit + if($data['limit']) { + $sql .= ' LIMIT ' . ($data['limit'] + 1); -- 2.44.0