From 3121d967c561d25ecaff40478233fc974b309e90 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 29 Jun 2019 08:30:48 +0000 Subject: [PATCH] Item delivery data must only be stored when there is data --- config/dbstructure.config.php | 2 +- src/Model/Item.php | 4 +++- update.php | 5 +++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/config/dbstructure.config.php b/config/dbstructure.config.php index 5c6948a62f..5cf9d85972 100755 --- a/config/dbstructure.config.php +++ b/config/dbstructure.config.php @@ -34,7 +34,7 @@ use Friendica\Database\DBA; if (!defined('DB_UPDATE_VERSION')) { - define('DB_UPDATE_VERSION', 1314); + define('DB_UPDATE_VERSION', 1315); } return [ diff --git a/src/Model/Item.php b/src/Model/Item.php index 3c503dd670..3244053ba0 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -1883,7 +1883,9 @@ class Item extends BaseObject self::updateThread($parent_id); } - ItemDeliveryData::insert($current_post, $delivery_data); + if (!empty($item['origin']) || !empty($item['wall']) || !empty($delivery_data['postopts']) || !empty($delivery_data['inform'])) { + ItemDeliveryData::insert($current_post, $delivery_data); + } DBA::commit(); diff --git a/update.php b/update.php index 077a56e66e..aead1b93de 100644 --- a/update.php +++ b/update.php @@ -369,3 +369,8 @@ function update_1309() } return Update::SUCCESS; } + +function update_1315() +{ + DBA::delete('item-delivery-data', ['postopts' => '', 'inform' => '', 'queue_count' => 0, 'queue_done' => 0]); +}