Commit graph

7 commits

Author SHA1 Message Date
Eloy Lafuente (stronk7)
c9840c0144 MDL-62619 privacy: Prevent action when boolean queries are involved
Before the patch, queries like:

SELECT 1 FROM dual UNION SELECT 2 FROM dual

were failing badly, with everything but the first numeric element
being ignored by the optimization.

So, being conservative, now we reduce the query being analysed,
ignoring any subquery, inline view (anything within parenthesis
in general) and, in the remaining query, if a boolean query (UNION,
MINUS, INTERSECT...) is found, we don't apply any optimization.
2018-08-09 16:05:55 +02:00
David Mudrák
cea03cbd43 MDL-62619 privacy: Fix some bits of performance improvements
* We need to use is_numeric() in this case as is_int() would never
  return true.
* Extend the supported cases, add support for SQL consisting just of
  numerical value or selectinga numerical constant.
* Do not rely on any particulat letter case in provided SQL.
* Add unit tests for the new method. Even when it is a protected one, it
  is an essential unit to be tested on its own.
2018-07-27 10:14:43 +02:00
Andrew Nicols
7d05f5813d Merge branch 'MDL-62140_master' of git://github.com/markn86/moodle 2018-04-24 11:16:07 +08:00
Mark Nelson
6d82a42353 MDL-62140 core_privacy: only reset tests when necessary 2018-04-24 10:54:21 +08:00
Andrew Nicols
3bdcd4d8c3 MDL-62140 core_privacy: Improve unit test 2018-04-24 10:18:31 +08:00
Mark Nelson
aa725516d3 MDL-62140 core_privacy: add helper functions to add system/user context 2018-04-23 20:06:02 +08:00
Andrew Nicols
81f1e31a51 MDL-61307 core_privacy: Define and test providers 2018-03-09 10:01:18 +08:00