summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-01-17 15:27:18 -0500
committerFrederic Guillot <fred@kanboard.net>2016-01-17 15:27:18 -0500
commite7a614781985a5686092d62a48021066dc559e35 (patch)
treed0d5b9b514f2078e8a334bf13ac6dd3a0f80b635 /app
parente94c4cab7f79657f8b514b4af6c4e459e9b42961 (diff)
Fix regression: make sql query compatible with Mysql
Diffstat (limited to 'app')
-rw-r--r--app/Model/ProjectActivity.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/Model/ProjectActivity.php b/app/Model/ProjectActivity.php
index d3aeefe5..74df26a1 100644
--- a/app/Model/ProjectActivity.php
+++ b/app/Model/ProjectActivity.php
@@ -168,9 +168,11 @@ class ProjectActivity extends Base
*/
public function cleanup($max)
{
- if ($this->db->table(self::TABLE)->count() > $max) {
- $subquery = $this->db->table(self::TABLE)->desc('id')->limit($max)->columns('id');
- $this->db->table(self::TABLE)->notInSubquery('id', $subquery)->remove();
+ $total = $this->db->table(self::TABLE)->count();
+
+ if ($total > $max) {
+ $ids = $this->db->table(self::TABLE)->asc('id')->limit($total - $max)->findAllByColumn('id');
+ $this->db->table(self::TABLE)->in('id', $ids)->remove();
}
}