lots of bug fixes

This commit is contained in:
JT Smith 2004-09-06 21:28:55 +00:00
parent fd0413c746
commit b4498138fb
12 changed files with 67 additions and 45 deletions

View file

@ -22,14 +22,13 @@ sub process {
my $a = WebGUI::SQL->read("select forumId,archiveAfter,masterForumId from forum");
while (my $forum = $a->hashRef) {
if ($forum->{masterForumId}) {
($forum->{archiveAfter}) = WebGUI::SQL->quickArray("select archiveAfter from forum where masterForumId=$forum->{masterForumId}");
($forum->{archiveAfter}) = WebGUI::SQL->quickArray("select archiveAfter from forum where masterForumId=".quote($forum->{masterForumId}));
}
my $archiveDate = $epoch - $forum->{archiveAfter};
my $b = WebGUI::SQL->read("select forumThreadId from forumThread where forumId=".$forum->{forumId}
." and lastPostDate<$archiveDate");
my $b = WebGUI::SQL->read("select forumThreadId from forumThread where forumId=".quote($forum->{forumId})." and lastPostDate<$archiveDate");
while (my ($threadId) = $b->array) {
WebGUI::SQL->write("update forumPost set status='archived' where status='approved' and forumThreadId=$threadId");
WebGUI::SQL->write("update forumThread set status='archived' where status='approved' and forumThreadId=$threadId");
WebGUI::SQL->write("update forumPost set status='archived' where status='approved' and forumThreadId=".quote($threadId));
WebGUI::SQL->write("update forumThread set status='archived' where status='approved' and forumThreadId=".quote($threadId));
}
$b->finish;
}

View file

@ -23,10 +23,10 @@ sub process {
WebGUI::ErrorHandler::audit("moving expired clipboard items to trash");
WebGUI::SQL->write("update page set parentId=3, bufferPrevId=2, bufferDate=" .time()
WebGUI::SQL->write("update page set parentId=3, bufferPrevId=2, bufferDate=" .WebGUI::DateTime::time()
." where parentId=2 and bufferDate < ". $expireDate );
WebGUI::SQL->write("update wobject set pageId=3, bufferPrevId=2, bufferDate=" .time()
WebGUI::SQL->write("update wobject set pageId=3, bufferPrevId=2, bufferDate=" .WebGUI::DateTime::time()
." where pageId=2 and bufferDate < ". $expireDate );
}
}

View file

@ -23,10 +23,10 @@ sub process {
while (my $data = $sth->hashRef) {
if ($data->{dbCacheTimeout} > 0) {
# there is no need to wait deleteOffset days for expired external group cache data
WebGUI::SQL->write("delete from groupings where groupId=$data->{groupId} and expireDate < ".time());
WebGUI::SQL->write("delete from groupings where groupId=".quote($data->{groupId})." and expireDate < ".WebGUI::DateTime::time());
} else {
WebGUI::SQL->write("delete from groupings where groupId=$data->{groupId} and expireDate < "
.(time()-(86400*$data->{deleteOffset})));
WebGUI::SQL->write("delete from groupings where groupId=".quote($data->{groupId})." and expireDate < "
.(WebGUI::DateTime::time()-(86400*$data->{deleteOffset})));
}
}
$sth->finish;

View file

@ -17,7 +17,7 @@ use WebGUI::SQL;
#-------------------------------------------------------------------
sub process {
my $epoch = time();
my $epoch = WebGUI::DateTime::time();
my $sth = WebGUI::SQL->read("select sessionId from userSession where expires<".$epoch);
while (my ($sessionId) = $sth->array) {
WebGUI::Session::end($sessionId);

View file

@ -22,13 +22,13 @@ sub process {
my (%properties, $base, $extended, $b, $w, $cmd, $purgeDate, $a, $pageId);
tie %properties, 'Tie::CPHash';
$purgeDate = (time()-(86400*$session{config}{DeleteExpiredTrash_offset}));
$purgeDate = (WebGUI::DateTime::time()-(86400*$session{config}{DeleteExpiredTrash_offset}));
# Delete wobjects
$b = WebGUI::SQL->read("select * from wobject where pageId=3 and bufferDate<" . $purgeDate);
while ($base = $b->hashRef) {
$extended = WebGUI::SQL->quickHashRef("select * from ".$base->{namespace}."
where wobjectId=".$base->{wobjectId});
where wobjectId=".quote($base->{wobjectId}));
%properties = (%{$base}, %{$extended});
$cmd = "WebGUI::Wobject::".$properties{namespace};
$w = $cmd->new(\%properties);
@ -44,7 +44,7 @@ sub process {
WebGUI::ErrorHandler::audit("purging expired page ". $pageId ." from trash");
WebGUI::Operation::Trash::_recursePageTree($pageId);
WebGUI::Operation::Trash::_purgeWobjects($pageId);
WebGUI::SQL->write("delete from page where pageId=$pageId");
WebGUI::SQL->write("delete from page where pageId=".quote($pageId));
}
$a->finish;
}

View file

@ -27,7 +27,7 @@ sub process {
while (my $group = $a->hashRef) {
my $start = $now + (86400 * $group->{expireNotifyOffset});
my $end = $start + 86400;
my $b = WebGUI::SQL->read("select userId from groupings where groupId=".$group->{groupId}." and
my $b = WebGUI::SQL->read("select userId from groupings where groupId=".quote($group->{groupId})." and
expireDate>=".$start." and expireDate<=".$end);
while (my ($userId) = $b->array) {
WebGUI::MessageLog::addEntry($userId,"",WebGUI::International::get(867),$group->{expireNotifyMessage});