summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2016-01-04 22:05:48 +0100
committerBernhard Posselt <dev@bernhard-posselt.com>2016-01-04 22:05:48 +0100
commit2509229184a991707420a339d9747c61c0a54654 (patch)
tree2134b1b6fba4fcabdd2c87ed1c528fc89013516a
parent46956395e90f013926aa079329284bf309c1ec8c (diff)
skip not existing entities when updating indices
-rw-r--r--db/itemmapper.php9
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);
}