Permalink
Browse files

close discussions on "approved" submissions

  • Loading branch information...
1 parent 74a38f5 commit 4bffe775bd8f2f19f3a585fd6725a0a2a89471c8 @pudge pudge committed Jun 21, 2007
Showing with 17 additions and 2 deletions.
  1. +17 −2 Slash/DB/Static/MySQL/MySQL.pm
View
19 Slash/DB/Static/MySQL/MySQL.pm
@@ -184,15 +184,30 @@ sub updateArchivedDiscussions {
my $days_to_archive = getCurrentStatic('archive_delay');
return 0 if !$days_to_archive;
- # Close discussions.
- return $self->sqlUpdate(
+ # Close old discussions
+ my $count = $self->sqlUpdate(
"discussions",
{ type => 'archived' },
"TO_DAYS(NOW()) - TO_DAYS(ts) > $days_to_archive
AND type = 'open'
AND flags != 'delete'
AND archivable = 'yes'"
);
+
+ # Close expired submission discussions
+ $count += $self->sqlUpdate(
+ "firehose, discussions",
+ { 'firehose.type' => 'archived' },
+ "firehose.type = 'submission'
+ AND firehose.accepted = 'yes'
+ AND firehose.discussion IS NOT NULL
+ AND discussions.id = firehose.discussion
+ AND discussions.type = 'open'
+ AND discussions.flags != 'delete'
+ AND discussions.archivable = 'yes'"
+ );
+
+ return $count;
}

0 comments on commit 4bffe77

Please sign in to comment.