- Added a --skipDelete option to upgrade.pl

- rfe: Approvers don't need to approve own changes
fixed a rare bug that could occur in archiving old threads
This commit is contained in:
JT Smith 2006-08-03 19:20:55 +00:00
parent 8ec18c957f
commit 61b70325f2
4 changed files with 37 additions and 18 deletions

View file

@ -1,5 +1,6 @@
7.0.5
- Added a --skipDelete option to upgrade.pl
- rfe: Approvers don't need to approve own changes
7.0.4

View file

@ -73,6 +73,7 @@ sub execute {
my $a = $self->session->db->read("select assetId from asset where className='WebGUI::Asset::Wobject::Collaboration'");
while (my ($assetId) = $a->array) {
my $cs = WebGUI::Asset->new($self->session, $assetId, "WebGUI::Asset::Wobject::Collaboration");
next unless defined $cs;
my $archiveDate = $epoch - $cs->get("archiveAfter");
my $sql = "select asset.assetId, assetData.revisionDate from Post left join asset on asset.assetId=Post.assetId
left join assetData on Post.assetId=assetData.assetId and Post.revisionDate=assetData.revisionDate

View file

@ -20,6 +20,7 @@ use base 'WebGUI::Workflow::Activity';
use WebGUI::VersionTag;
use WebGUI::Inbox;
use WebGUI::International;
use WebGUI::User;
=head1 NAME
@ -94,17 +95,22 @@ sub execute {
my $i18n = WebGUI::International->new($self->session, "VersionTag");
my $inbox = WebGUI::Inbox->new($self->session);
if ($instance->getScratch("status") eq "") {
my $message = $inbox->addMessage({
subject=>$i18n->get("approve/deny").": ".$versionTag->get("name"),
message=>join("\n\n",$self->get("message"),
$self->session->url->getSiteURL().$self->session->url->page("op=manageRevisionsInTag;workflowInstanceId=".$instance->getId.";tagId=".$versionTag->getId),
$versionTag->get("comments")),
groupId=>$self->get("groupToApprove"),
status=>'pending'
});
$instance->setScratch("messageId",$message->getId);
$instance->setScratch("status","notified");
return $self->WAITING;
my $u = WebGUI::User->new($self->session, $versionTag->get("committedBy"));
if ($u->isInGroup($self->get("groupToApprove"))) {
return $self->COMPLETE;
} else {
my $message = $inbox->addMessage({
subject=>$i18n->get("approve/deny").": ".$versionTag->get("name"),
message=>join("\n\n",$self->get("message"),
$self->session->url->getSiteURL().$self->session->url->page("op=manageRevisionsInTag;workflowInstanceId=".$instance->getId.";tagId=".$versionTag->getId),
$versionTag->get("comments")),
groupId=>$self->get("groupToApprove"),
status=>'pending'
});
$instance->setScratch("status","notified");
$instance->setScratch("messageId",$message->getId);
return $self->WAITING;
}
} elsif ($instance->getScratch("status") eq "denied") {
my $message = $inbox->getMessage($instance->getScratch("messageId"));
$message->setCompleted;

View file

@ -33,6 +33,7 @@ my $mysql = "mysql";
my $mysqldump = "mysqldump";
my $backupDir = "/tmp/backups";
my $skipBackup;
my $skipDelete;
my $doit;
GetOptions(
@ -42,6 +43,7 @@ GetOptions(
'quiet'=>\$quiet,
'mysql=s'=>\$mysql,
'doit'=>\$doit,
'skipDelete' =>\$skipDelete,
'mysqldump=s'=>\$mysqldump,
'backupDir=s'=>\$backupDir,
'skipbackup'=>\$skipBackup
@ -87,6 +89,13 @@ Options:
--skipBackup Backups will not be performed during the
upgrade.
--skipDelete The upgrade normally deletes WebGUI's cache
and temporary files as part of the upgrade.
This is mainly important during big upgrades,
but can make the upgrade go very slowly.
Using this option skips the deletion of these
files.
STOP
exit;
}
@ -183,12 +192,14 @@ foreach my $filename (keys %{$configs}) {
print "\tPreparing site for upgrade.\n" unless ($quiet);
$session->setting->remove('specialState');
$session->setting->add('specialState','upgrading');
print "\tDeleting temp files.\n" unless ($quiet);
my $path = $configs->{$filename}->get("uploadsPath").$slash."temp";
rmtree($path) unless ($path eq "" || $path eq "/" || $path eq "/data");
print "\tDeleting file cache.\n" unless ($quiet);
$path = $configs->{$filename}->get("fileCacheRoot")||"/tmp/WebGUICache";
rmtree($path) unless ($path eq "" || $path eq "/" || $path eq "/data");
unless ($skipDelete) {
print "\tDeleting temp files.\n" unless ($quiet);
my $path = $configs->{$filename}->get("uploadsPath").$slash."temp";
rmtree($path) unless ($path eq "" || $path eq "/" || $path eq "/data");
print "\tDeleting file cache.\n" unless ($quiet);
$path = $configs->{$filename}->get("fileCacheRoot")||"/tmp/WebGUICache";
rmtree($path) unless ($path eq "" || $path eq "/" || $path eq "/data");
}
}
$session->close();
} else {