[PATCH] Remove PackageNotifications when User is suspended

Kevin Morris kevr.gtalk at gmail.com
Fri Jul 3 19:02:11 UTC 2020


This path will only trigger when suspending a user through an
account page; if the database is managed manually or through
another script, PackageNotifications will also need manual
modifications if intended.

This change was written as a solution to
https://bugs.archlinux.org/task/65554.

Signed-off-by: Kevin Morris <kevr.gtalk at gmail.com>
---
 web/lib/acctfuncs.inc.php | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php
index d238c0e0..fb7cca8c 100644
--- a/web/lib/acctfuncs.inc.php
+++ b/web/lib/acctfuncs.inc.php
@@ -403,6 +403,10 @@ function process_account_form($TYPE,$A,$U="",$T="",$S="",$E="",$BE="",$H="",$P="
 		$q.= " WHERE ID = ".intval($UID);
 		$result = $dbh->exec($q);
 
+		// Clean up PackageNotifications for $UID as well.
+		$q = "DELETE FROM PackageNotifications WHERE UserID = ".intval($UID);
+		$result = $dbh->exec($q);
+
 		if (isset($ssh_keys) && count($ssh_keys) > 0) {
 			$ssh_key_result = account_set_ssh_keys($UID, $ssh_keys, $ssh_fingerprints);
 		} else {
-- 
2.20.1


More information about the aur-dev mailing list