From 529315d852bb9dcc2e0026afdef9a5033564dc5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Dzieko=C5=84ski?= Date: Wed, 15 Jun 2022 00:18:39 +0200 Subject: [PATCH] GH-224 Move ignore entries remover to an util --- modules/settings/_includes.php | 1 + .../queries/deleteUserIgnoreEntries.query.php | 29 +++++++++++++++++++ settings.php | 18 +++++------- 3 files changed, 37 insertions(+), 11 deletions(-) create mode 100644 modules/settings/utils/queries/deleteUserIgnoreEntries.query.php diff --git a/modules/settings/_includes.php b/modules/settings/_includes.php index c0ad8d83..8323efe3 100644 --- a/modules/settings/_includes.php +++ b/modules/settings/_includes.php @@ -18,6 +18,7 @@ include($includePath . './utils/queries/createEmailChangeProcessEntry.query.php'); include($includePath . './utils/queries/createUserIgnoreEntry.query.php'); + include($includePath . './utils/queries/deleteUserIgnoreEntries.query.php'); include($includePath . './utils/queries/getMovingFleetsCount.query.php'); include($includePath . './utils/queries/getUserWithEmailAddress.query.php'); diff --git a/modules/settings/utils/queries/deleteUserIgnoreEntries.query.php b/modules/settings/utils/queries/deleteUserIgnoreEntries.query.php new file mode 100644 index 00000000..a96a8ffa --- /dev/null +++ b/modules/settings/utils/queries/deleteUserIgnoreEntries.query.php @@ -0,0 +1,29 @@ + diff --git a/settings.php b/settings.php index b342b426..ce8fe985 100644 --- a/settings.php +++ b/settings.php @@ -828,20 +828,16 @@ } } - if(!empty($IgnoreSystem_Deleted)) - { - $IgnoreSystem_Deleted_Count = count($IgnoreSystem_Deleted); - $IgnoreSystem_Deleted = implode(',', $IgnoreSystem_Deleted); + if (!empty($IgnoreSystem_Deleted)) { + Settings\Utils\Queries\deleteUserIgnoreEntries([ + 'entryOwnerId' => $_User['id'], + 'entriesIds' => $IgnoreSystem_Deleted, + ]); - $Query_DeleteIgnores = ''; - $Query_DeleteIgnores .= "DELETE FROM {{table}} WHERE "; - $Query_DeleteIgnores .= "`OwnerID` = {$_User['id']} AND `IgnoredID` IN ({$IgnoreSystem_Deleted}) LIMIT {$IgnoreSystem_Deleted_Count};"; - doquery($Query_DeleteIgnores, 'ignoresystem'); + $IgnoreSystem_Deleted_Count = count($IgnoreSystem_Deleted); $InfoMsgs[] = sprintf($_Lang['Ignore_DeletedXUsers'], $IgnoreSystem_Deleted_Count); - } - else - { + } else { $WarningMsgs[] = $_Lang['Ignore_NothingDeleted']; } }