diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2016-01-04 22:05:48 +0100 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2016-01-04 22:05:48 +0100 |
commit | 2509229184a991707420a339d9747c61c0a54654 (patch) | |
tree | 2134b1b6fba4fcabdd2c87ed1c528fc89013516a /db/itemmapper.php | |
parent | 46956395e90f013926aa079329284bf309c1ec8c (diff) |
skip not existing entities when updating indices
Diffstat (limited to 'db/itemmapper.php')
-rw-r--r-- | db/itemmapper.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/db/itemmapper.php b/db/itemmapper.php index 738368f25..ee0ed1775 100644 --- a/db/itemmapper.php +++ b/db/itemmapper.php @@ -13,6 +13,7 @@ namespace OCA\News\Db; +use OCP\AppFramework\Db\DoesNotExistException; use OCP\IDBConnection; @@ -369,7 +370,13 @@ class ItemMapper extends NewsMapper { private function updateSearchIndex(array $items=[]) { foreach ($items as $row) { - $item = $this->find($row['id'], $row['user_id']); + // ignore items of deleted rows + try { + $item = $this->find($row['id'], $row['user_id']); + } catch(\Exception $e) { + continue; + } + $item->generateSearchIndex(); $this->update($item); } |