summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2015-11-13 10:32:45 +0100
committerJoas Schilling <nickvergessen@owncloud.com>2015-11-30 17:12:48 +0100
commit623d34972dca25003d3f4107ec2715ff42bca086 (patch)
treed5d9921e36081bca15f998815fe6ecbe8a9d4590 /apps
parentb9faba8857ffb7ecd51f2be4f6619f2a6201c6a9 (diff)
downloadnextcloud-server-623d34972dca25003d3f4107ec2715ff42bca086.tar.gz
nextcloud-server-623d34972dca25003d3f4107ec2715ff42bca086.zip
Oracle can not return statements but only values
So evaluate the condition directly and return 1 or 0
Diffstat (limited to 'apps')
-rw-r--r--apps/files/lib/activity.php9
-rw-r--r--apps/files/tests/activitytest.php8
2 files changed, 10 insertions, 7 deletions
diff --git a/apps/files/lib/activity.php b/apps/files/lib/activity.php
index f3bbff48640..d473120b31f 100644
--- a/apps/files/lib/activity.php
+++ b/apps/files/lib/activity.php
@@ -379,6 +379,7 @@ class Activity implements IExtension {
*/
$parameters = $fileQueryList = [];
$parameters[] = self::APP_FILES;
+ $parameters[] = self::APP_FILES;
$fileQueryList[] = '(`type` <> ? AND `type` <> ?)';
$parameters[] = self::TYPE_SHARE_CREATED;
@@ -393,10 +394,12 @@ class Activity implements IExtension {
$parameters[] = $favorite . '/%';
}
- $parameters[] = self::APP_FILES;
-
return [
- ' CASE WHEN `app` = ? THEN (' . implode(' OR ', $fileQueryList) . ') ELSE `app` <> ? END ',
+ ' CASE '
+ . 'WHEN `app` <> ? THEN 1 '
+ . 'WHEN `app` = ? AND (' . implode(' OR ', $fileQueryList) . ') THEN 1 '
+ . 'ELSE 0 '
+ . 'END = 1 ',
$parameters,
];
}
diff --git a/apps/files/tests/activitytest.php b/apps/files/tests/activitytest.php
index cdb1d21bcd8..485c559d488 100644
--- a/apps/files/tests/activitytest.php
+++ b/apps/files/tests/activitytest.php
@@ -290,16 +290,16 @@ class ActivityTest extends TestCase {
'items' => [],
'folders' => [],
],
- ' CASE WHEN `app` = ? THEN ((`type` <> ? AND `type` <> ?)) ELSE `app` <> ? END ',
- ['files', Activity::TYPE_SHARE_CREATED, Activity::TYPE_SHARE_CHANGED, 'files']
+ ' CASE WHEN `app` <> ? THEN 1 WHEN `app` = ? AND ((`type` <> ? AND `type` <> ?)) THEN 1 ELSE 0 END = 1 ',
+ ['files', 'files', Activity::TYPE_SHARE_CREATED, Activity::TYPE_SHARE_CHANGED]
],
[
[
'items' => ['file.txt', 'folder'],
'folders' => ['folder'],
],
- ' CASE WHEN `app` = ? THEN ((`type` <> ? AND `type` <> ?) OR `file` = ? OR `file` = ? OR `file` LIKE ?) ELSE `app` <> ? END ',
- ['files', Activity::TYPE_SHARE_CREATED, Activity::TYPE_SHARE_CHANGED, 'file.txt', 'folder', 'folder/%', 'files']
+ ' CASE WHEN `app` <> ? THEN 1 WHEN `app` = ? AND ((`type` <> ? AND `type` <> ?) OR `file` = ? OR `file` = ? OR `file` LIKE ?) THEN 1 ELSE 0 END = 1 ',
+ ['files', 'files', Activity::TYPE_SHARE_CREATED, Activity::TYPE_SHARE_CHANGED, 'file.txt', 'folder', 'folder/%']
],
];
}