mirror of
https://github.com/nerzhul/ocsms.git
synced 2025-06-12 10:26:31 +00:00
Added optimization: don't to the single deletion if we have purged the DB before, it's useless
This commit is contained in:
parent
ad1353c63c
commit
5d1cababc6
@ -50,13 +50,16 @@ class SmsMapper extends Mapper {
|
|||||||
$sms["seen"] === "true" ? "1" : "0"
|
$sms["seen"] === "true" ? "1" : "0"
|
||||||
);
|
);
|
||||||
|
|
||||||
// Remove previous record
|
// Only delete if we haven't purged the DB
|
||||||
// @ TODO: only update the required fields, getAllIds can be useful
|
if ($purgeAllSmsBeforeInsert === false) {
|
||||||
$query = \OC_DB::prepare('DELETE FROM *PREFIX*ocsms_smsdatas ' .
|
// Remove previous record
|
||||||
'WHERE user_id = ? AND sms_id = ?');
|
// @ TODO: only update the required fields, getAllIds can be useful
|
||||||
$result = $query->execute(array(
|
$query = \OC_DB::prepare('DELETE FROM *PREFIX*ocsms_smsdatas ' .
|
||||||
$userId, (int) $sms["_id"]
|
'WHERE user_id = ? AND sms_id = ?');
|
||||||
));
|
$result = $query->execute(array(
|
||||||
|
$userId, (int) $sms["_id"]
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
$query = \OC_DB::prepare('INSERT INTO *PREFIX*ocsms_smsdatas ' .
|
$query = \OC_DB::prepare('INSERT INTO *PREFIX*ocsms_smsdatas ' .
|
||||||
'(user_id, added, lastmodified, sms_flags, sms_date, sms_id,' .
|
'(user_id, added, lastmodified, sms_flags, sms_date, sms_id,' .
|
||||||
|
Loading…
x
Reference in New Issue
Block a user