Manually remove messages for deleted users. Fixes bug #11908.
This commit is contained in:
parent
3f17369ae8
commit
f90a3f7c58
3 changed files with 23 additions and 6 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
7.10.3
|
7.10.3
|
||||||
- fixed #11903: Unnecessary debug in Thingy
|
- fixed #11903: Unnecessary debug in Thingy
|
||||||
|
- fixed #11908: Inbox messages linger after deleting a user
|
||||||
|
|
||||||
7.10.2
|
7.10.2
|
||||||
- fixed #11884: Editing Templates impossible / Code editor not loaded
|
- fixed #11884: Editing Templates impossible / Code editor not loaded
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ use Getopt::Long;
|
||||||
use WebGUI::Session;
|
use WebGUI::Session;
|
||||||
use WebGUI::Storage;
|
use WebGUI::Storage;
|
||||||
use WebGUI::Asset;
|
use WebGUI::Asset;
|
||||||
|
use WebGUI::Inbox;
|
||||||
|
|
||||||
|
|
||||||
my $toVersion = '7.10.2';
|
my $toVersion = '7.10.2';
|
||||||
|
|
|
||||||
|
|
@ -31,18 +31,33 @@ my $quiet; # this line required
|
||||||
my $session = start(); # this line required
|
my $session = start(); # this line required
|
||||||
|
|
||||||
# upgrade functions go here
|
# upgrade functions go here
|
||||||
|
pruneInboxMessagesFromDeletedUsers($session);
|
||||||
|
|
||||||
finish($session); # this line required
|
finish($session); # this line required
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# Describe what our function does
|
# Describe what our function does
|
||||||
#sub exampleFunction {
|
sub pruneInboxMessagesFromDeletedUsers {
|
||||||
# my $session = shift;
|
my $session = shift;
|
||||||
# print "\tWe're doing some stuff here that you should know about... " unless $quiet;
|
print "\tPruning inbox messages from deleted users. This may take a while... " unless $quiet;
|
||||||
# # and here's our code
|
my $sth = $session->db->prepare(<<EOSQL);
|
||||||
# print "DONE!\n" unless $quiet;
|
select messageId, inbox.userId
|
||||||
#}
|
from inbox_messageState
|
||||||
|
join inbox using (messageId)
|
||||||
|
left outer join users on inbox.userId=users.userId
|
||||||
|
where users.userId IS NULL
|
||||||
|
EOSQL
|
||||||
|
$sth->execute([]);
|
||||||
|
my $inbox = WebGUI::Inbox->new($session);
|
||||||
|
while (my ($messageId, $userId) = $sth->array) {
|
||||||
|
my $message = $inbox->getMessage($messageId, $userId);
|
||||||
|
if ($message) {
|
||||||
|
$message->delete;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print "...DONE!\n" unless $quiet;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
|
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue