From 0c109c9d377e10757c208c1d87aa6d4bf8d9af44 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Wed, 14 May 2014 19:56:19 +0200 Subject: [ticket/11224] SQL cache destroy does not destroy queries to tables joined https://tracker.phpbb.com/browse/PHPBB3-11224 PHPBB3-11224 --- phpBB/includes/acm/acm_memory.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/acm') diff --git a/phpBB/includes/acm/acm_memory.php b/phpBB/includes/acm/acm_memory.php index 2936ea0bae..d975e4b348 100644 --- a/phpBB/includes/acm/acm_memory.php +++ b/phpBB/includes/acm/acm_memory.php @@ -292,12 +292,24 @@ class acm_memory // determine which tables this query belongs to // Some queries use backticks, namely the get_database_size() query // don't check for conformity, the SQL would error and not reach here. - if (!preg_match('/FROM \\(?(`?\\w+`?(?: \\w+)?(?:, ?`?\\w+`?(?: \\w+)?)*)\\)?/', $query, $regs)) + if (!preg_match_all('/(?:FROM \\(?(`?\\w+`?(?: \\w+)?(?:, ?`?\\w+`?(?: \\w+)?)*)\\)?)|(?:JOIN (`?\\w+`?(?: \\w+)?))/', $query, $regs, PREG_SET_ORDER)) { // Bail out if the match fails. - return; + return $query_result; + } + + $tables = array(); + foreach($regs as $match) + { + if ($match[0][0] == 'F') + { + $tables = array_merge($tables, array_map('trim', explode(',', $match[1]))); + } + else + { + $tables[] = $match[2]; + } } - $tables = array_map('trim', explode(',', $regs[1])); foreach ($tables as $table_name) { -- cgit v1.2.1 From 0c4b53e2f1ea14dcdc82d2e2abac1ba96e4669ee Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Wed, 14 May 2014 20:22:36 +0200 Subject: [ticket/11224] Fix returned data PHPBB3-11224 --- phpBB/includes/acm/acm_memory.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acm') diff --git a/phpBB/includes/acm/acm_memory.php b/phpBB/includes/acm/acm_memory.php index d975e4b348..83b0e61182 100644 --- a/phpBB/includes/acm/acm_memory.php +++ b/phpBB/includes/acm/acm_memory.php @@ -295,7 +295,7 @@ class acm_memory if (!preg_match_all('/(?:FROM \\(?(`?\\w+`?(?: \\w+)?(?:, ?`?\\w+`?(?: \\w+)?)*)\\)?)|(?:JOIN (`?\\w+`?(?: \\w+)?))/', $query, $regs, PREG_SET_ORDER)) { // Bail out if the match fails. - return $query_result; + return; } $tables = array(); @@ -448,4 +448,4 @@ class acm_memory } } -?> \ No newline at end of file +?> -- cgit v1.2.1 From 9dd71fa32e13120c324a4cfb40a9c5c5534207e8 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Wed, 14 May 2014 20:23:27 +0200 Subject: [ticket/11224] Fix the blank line after ?> PHPBB3-11224 --- phpBB/includes/acm/acm_memory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acm') diff --git a/phpBB/includes/acm/acm_memory.php b/phpBB/includes/acm/acm_memory.php index 83b0e61182..3182c5a942 100644 --- a/phpBB/includes/acm/acm_memory.php +++ b/phpBB/includes/acm/acm_memory.php @@ -448,4 +448,4 @@ class acm_memory } } -?> +?> \ No newline at end of file -- cgit v1.2.1 From 7c99e309204d5647ae2eb246d5dc939e9e90c307 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Thu, 15 May 2014 01:17:02 +0200 Subject: [ticket/11224] Fix coding style PHPBB3-11224 --- phpBB/includes/acm/acm_memory.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acm') diff --git a/phpBB/includes/acm/acm_memory.php b/phpBB/includes/acm/acm_memory.php index 3182c5a942..2ed5e9902d 100644 --- a/phpBB/includes/acm/acm_memory.php +++ b/phpBB/includes/acm/acm_memory.php @@ -299,7 +299,7 @@ class acm_memory } $tables = array(); - foreach($regs as $match) + foreach ($regs as $match) { if ($match[0][0] == 'F') { @@ -448,4 +448,4 @@ class acm_memory } } -?> \ No newline at end of file +?> -- cgit v1.2.1 From d53336af061e4c7b892c3acf4ce8fe0fa0205a72 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Thu, 15 May 2014 12:36:22 +0200 Subject: [ticket/11224] Remove new line in acm_memory.php PHPBB3-11224 --- phpBB/includes/acm/acm_memory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acm') diff --git a/phpBB/includes/acm/acm_memory.php b/phpBB/includes/acm/acm_memory.php index 2ed5e9902d..9b68585d24 100644 --- a/phpBB/includes/acm/acm_memory.php +++ b/phpBB/includes/acm/acm_memory.php @@ -448,4 +448,4 @@ class acm_memory } } -?> +?> \ No newline at end of file -- cgit v1.2.1