- fix create.sql / style3

- fix Spectre memory consumption
 - fix password vidible in debug mode
 - fix No way to add an advertisment to an adspace.
This commit is contained in:
JT Smith 2006-05-25 04:56:12 +00:00
parent 58331a5834
commit 741b523ad3
6 changed files with 48 additions and 18 deletions

View file

@ -3,6 +3,10 @@
- Data Forms now send email as HTML. - Data Forms now send email as HTML.
- The back to site link generated after a CS post now leads back to the - The back to site link generated after a CS post now leads back to the
thread if the new post is a reply to a thread as discussed in Community IRC. thread if the new post is a reply to a thread as discussed in Community IRC.
- fix create.sql / style3
- fix Spectre memory consumption
- fix password vidible in debug mode
- fix No way to add an advertisment to an adspace.
- Added full drag bar to the top of each asset as discussed in Community IRC. - Added full drag bar to the top of each asset as discussed in Community IRC.
- fixed a bug in the project management app that was causing a no privilege error when trying to display the view. - fixed a bug in the project management app that was causing a no privilege error when trying to display the view.
- fixed various bugs in the project management app. - fixed various bugs in the project management app.

View file

@ -99,7 +99,7 @@ Prints out error information.
sub error { sub error {
my $self = shift; my $self = shift;
my $output = shift; my $output = shift;
print "ADMIN: ".$output."\n"; print "ADMIN: [Error] ".$output."\n";
$self->getLogger->error("ADMIN: ".$output); $self->getLogger->error("ADMIN: ".$output);
} }
@ -183,6 +183,7 @@ sub runTests {
$self->debug("Running connectivity tests."); $self->debug("Running connectivity tests.");
my $configs = WebGUI::Config->readAllConfigs($self->config->getWebguiRoot); my $configs = WebGUI::Config->readAllConfigs($self->config->getWebguiRoot);
foreach my $config (keys %{$configs}) { foreach my $config (keys %{$configs}) {
next if $config =~ m/^demo/;
$self->debug("Testing $config"); $self->debug("Testing $config");
my $userAgent = new LWP::UserAgent; my $userAgent = new LWP::UserAgent;
$userAgent->agent("Spectre"); $userAgent->agent("Spectre");

View file

@ -40,6 +40,7 @@ sub _start {
$self->debug("Loading the schedules from all the sites."); $self->debug("Loading the schedules from all the sites.");
my $configs = WebGUI::Config->readAllConfigs($self->config->getWebguiRoot); my $configs = WebGUI::Config->readAllConfigs($self->config->getWebguiRoot);
foreach my $config (keys %{$configs}) { foreach my $config (keys %{$configs}) {
next if $config =~ m/^demo/;
$kernel->yield("loadSchedule", $config); $kernel->yield("loadSchedule", $config);
} }
$kernel->yield("checkSchedules"); $kernel->yield("checkSchedules");
@ -273,7 +274,7 @@ sub error {
my $self = shift; my $self = shift;
my $output = shift; my $output = shift;
if ($self->{_debug}) { if ($self->{_debug}) {
print "CRON: ".$output."\n"; print "CRON: [Error] ".$output."\n";
} }
$self->getLogger->error("CRON: ".$output); $self->getLogger->error("CRON: ".$output);
} }
@ -372,8 +373,11 @@ sub runJob {
$self->debug("Preparing to run a scheduled job ".$job->{taskId}."."); $self->debug("Preparing to run a scheduled job ".$job->{taskId}.".");
POE::Component::Client::UserAgent->new; POE::Component::Client::UserAgent->new;
if ($job->{sitename} eq "" || $job->{config} eq "" || $job->{taskId} eq "") { if ($job->{sitename} eq "" || $job->{config} eq "" || $job->{taskId} eq "") {
$self->error("Warning: A scheduled task has corrupt information and is not able to be run. Skipping execution."); $self->error("A scheduled task has corrupt information and is not able to be run. Skipping execution.");
$kernel->yield("deleteJob",{config=>$job->{config}, taskId=>$job->{taskId}}) if ($job->{config} ne "" && $job->{taskId} ne ""); $kernel->yield("deleteJob",{config=>$job->{config}, taskId=>$job->{taskId}}) if ($job->{config} ne "" && $job->{taskId} ne "");
} elsif ($self->{_errorCount}{$job->{config}}{$job->{taskId}} >= 5) {
$self->error("Scheduled task ".$job->{config}." / ".$job->{taskId}." has failed ".$self->{_errorCount}{$job->{config}}{$job->{taskId}}." times in a row and will no longer attempt to execute.");
$kernel->yield("deleteJob",{config=>$job->{config}, taskId=>$job->{taskId}});
} else { } else {
my $url = "http://".$job->{sitename}.':'.$self->config->get("webguiPort").$job->{gateway}; my $url = "http://".$job->{sitename}.':'.$self->config->get("webguiPort").$job->{gateway};
my $request = POST $url, [op=>"runCronJob", taskId=>$job->{taskId}]; my $request = POST $url, [op=>"runCronJob", taskId=>$job->{taskId}];
@ -414,23 +418,26 @@ sub runJobResponse {
} }
my $state = $response->content; my $state = $response->content;
if ($state eq "done") { if ($state eq "done") {
$self->{_errorCount}{$config}{$taskId} = 0;
$self->debug("Scheduled task $config / $taskId is now complete."); $self->debug("Scheduled task $config / $taskId is now complete.");
if ($job->{runOnce}) { if ($job->{runOnce}) {
$kernel->yield("deleteJob",{config=>$job->{config}, taskId=>$job->{taskId}}); $kernel->yield("deleteJob",{config=>$job->{config}, taskId=>$job->{taskId}});
} }
} elsif ($state eq "error") { } elsif ($state eq "error") {
$self->{_errorCount}{$config}{$taskId}++;
$self->debug("Got an error response for scheduled task $config / $taskId, will try again in ".$self->config->get("suspensionDelay")." seconds."); $self->debug("Got an error response for scheduled task $config / $taskId, will try again in ".$self->config->get("suspensionDelay")." seconds.");
$kernel->delay_set("runJob",$self->config->get("suspensionDelay"),$job); $kernel->delay_set("runJob",$self->config->get("suspensionDelay"),$job);
} else { } else {
$self->{_errorCount}{$config}{$taskId}++;
$self->error("Something bad happened on the return of scheduled task $config / $taskId, will try again in ".$self->config->get("suspensionDelay")." seconds. ".$response->error_as_HTML); $self->error("Something bad happened on the return of scheduled task $config / $taskId, will try again in ".$self->config->get("suspensionDelay")." seconds. ".$response->error_as_HTML);
$kernel->delay_set("runJob",$self->config->get("suspensionDelay"),$job); $kernel->delay_set("runJob",$self->config->get("suspensionDelay"),$job);
} }
} elsif ($response->is_redirect) { } elsif ($response->is_redirect) {
$self->debug("Response for $config / $taskId was redirected."); $self->error("Response for $config / $taskId was redirected. This should never happen if configured properly!!!");
} elsif ($response->is_error) { } elsif ($response->is_error) {
$self->error("Response for scheduled task $config / $taskId had a communications error. ".$response->error_as_HTML); $self->error("Response for scheduled task $config / $taskId had a communications error. ".$response->error_as_HTML);
$self->{_errorCount}{$config}{$taskId}++;
$kernel->delay_set("runJob",$self->config->get("suspensionDelay"),$job); $kernel->delay_set("runJob",$self->config->get("suspensionDelay"),$job);
# we should probably log something
} }
} }

View file

@ -36,6 +36,7 @@ sub _start {
$self->debug("Reading workflow configs."); $self->debug("Reading workflow configs.");
my $configs = WebGUI::Config->readAllConfigs($self->config->getWebguiRoot); my $configs = WebGUI::Config->readAllConfigs($self->config->getWebguiRoot);
foreach my $config (keys %{$configs}) { foreach my $config (keys %{$configs}) {
next if $config =~ m/^demo/;
$kernel->yield("loadWorkflows", $configs->{$config}); $kernel->yield("loadWorkflows", $configs->{$config});
} }
$kernel->yield("checkInstances"); $kernel->yield("checkInstances");
@ -211,7 +212,7 @@ sub error {
my $self = shift; my $self = shift;
my $output = shift; my $output = shift;
if ($self->{_debug}) { if ($self->{_debug}) {
print "WORKFLOW: ".$output."\n"; print "WORKFLOW: [Error] ".$output."\n";
} }
$self->getLogger->error("WORKFLOW: ".$output); $self->getLogger->error("WORKFLOW: ".$output);
} }
@ -355,17 +356,22 @@ Suspends a workflow instance for a number of seconds defined in the config file,
sub suspendInstance { sub suspendInstance {
my ($self, $instanceId, $kernel) = @_[OBJECT, ARG0, KERNEL]; my ($self, $instanceId, $kernel) = @_[OBJECT, ARG0, KERNEL];
$self->debug("Suspending workflow instance ".$instanceId." for ".$self->config->get("suspensionDelay")." seconds."); if ($self->{_errorCount}{$instanceId} >= 5) {
# normally this is taken care of by the returnInstanceToQueue method, but we want to free up the running count $self->error("Workflow instance $instanceId has failed to execute ".$self->{_errorCount}{$instanceId}." times in a row and will no longer attempt to execute.");
# so that other things can be run while this thing is suspended $kernel->yield("deleteInstance",$instanceId);
if ($self->{_instances}{$instanceId}) { } else {
for (my $i=0; $i < scalar(@{$self->{_runningInstances}}); $i++) { $self->debug("Suspending workflow instance ".$instanceId." for ".$self->config->get("suspensionDelay")." seconds.");
if ($self->{_runningInstances}[$i] eq $instanceId) { # normally this is taken care of by the returnInstanceToQueue method, but we want to free up the running count
splice(@{$self->{_runningInstances}}, $i, 1); # so that other things can be run while this thing is suspended
if ($self->{_instances}{$instanceId}) {
for (my $i=0; $i < scalar(@{$self->{_runningInstances}}); $i++) {
if ($self->{_runningInstances}[$i] eq $instanceId) {
splice(@{$self->{_runningInstances}}, $i, 1);
}
} }
} }
$kernel->delay_set("returnInstanceToQueue",$self->config->get("suspensionDelay"), $instanceId);
} }
$kernel->delay_set("returnInstanceToQueue",$self->config->get("suspensionDelay"), $instanceId);
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -392,30 +398,36 @@ sub workerResponse {
} }
my $state = $response->content; my $state = $response->content;
if ($state eq "waiting") { if ($state eq "waiting") {
$self->{_errorCount}{$instanceId}=0;
$self->debug("Was told to wait on $instanceId because we're still waiting on some external event."); $self->debug("Was told to wait on $instanceId because we're still waiting on some external event.");
$kernel->yield("suspendInstance",$instanceId); $kernel->yield("suspendInstance",$instanceId);
} elsif ($state eq "complete") { } elsif ($state eq "complete") {
$self->{_errorCount}{$instanceId}=0;
$self->debug("Workflow instance $instanceId ran one of it's activities successfully."); $self->debug("Workflow instance $instanceId ran one of it's activities successfully.");
$kernel->yield("returnInstanceToQueue",$instanceId); $kernel->yield("returnInstanceToQueue",$instanceId);
} elsif ($state eq "disabled") { } elsif ($state eq "disabled") {
$self->{_errorCount}{$instanceId}=0;
$self->debug("Workflow instance $instanceId is disabled."); $self->debug("Workflow instance $instanceId is disabled.");
$kernel->yield("suspendInstance",$instanceId); $kernel->yield("suspendInstance",$instanceId);
} elsif ($state eq "done") { } elsif ($state eq "done") {
$self->{_errorCount}{$instanceId}=0;
$self->debug("Workflow instance $instanceId is now complete."); $self->debug("Workflow instance $instanceId is now complete.");
$kernel->yield("deleteInstance",$instanceId); $kernel->yield("deleteInstance",$instanceId);
} elsif ($state eq "error") { } elsif ($state eq "error") {
$self->{_errorCount}{$instanceId}++;
$self->debug("Got an error response for $instanceId."); $self->debug("Got an error response for $instanceId.");
$kernel->yield("suspendInstance",$instanceId); $kernel->yield("suspendInstance",$instanceId);
} else { } else {
$self->{_errorCount}{$instanceId}++;
$self->error("Something bad happened on the return of $instanceId. ".$response->error_as_HTML); $self->error("Something bad happened on the return of $instanceId. ".$response->error_as_HTML);
$kernel->yield("suspendInstance",$instanceId); $kernel->yield("suspendInstance",$instanceId);
} }
} elsif ($response->is_redirect) { } elsif ($response->is_redirect) {
$self->debug("Response for $instanceId was redirected."); $self->error("Response for $instanceId was redirected. This should never happen if configured properly!!!");
} elsif ($response->is_error) { } elsif ($response->is_error) {
$self->{_errorCount}{$instanceId}++;
$self->error("Response for $instanceId had a communications error. ".$response->error_as_HTML); $self->error("Response for $instanceId had a communications error. ".$response->error_as_HTML);
$kernel->yield("suspendInstance",$instanceId) $kernel->yield("suspendInstance",$instanceId)
# we should probably log something
} }
} }

View file

@ -272,11 +272,11 @@ sub www_editAdSpace {
my $ac = WebGUI::AdminConsole->new($session,"adSpace"); my $ac = WebGUI::AdminConsole->new($session,"adSpace");
if (defined $adSpace) { if (defined $adSpace) {
$id = $adSpace->getId; $id = $adSpace->getId;
$ac->addSubmenuItem($session->url->page("op=editAd;adSpaceId=".$id), $i18n->get("add an ad")) if defined $adSpace;
} else { } else {
$id = $session->form->param("adSpaceId") || "new"; $id = $session->form->param("adSpaceId") || "new";
$adSpace = WebGUI::AdSpace->new($session, $id); $adSpace = WebGUI::AdSpace->new($session, $id);
} }
$ac->addSubmenuItem($session->url->page("op=editAd;adSpaceId=".$id), $i18n->get("add an ad")) if defined $adSpace;
$ac->addSubmenuItem($session->url->page("op=manageAdSpaces"), $i18n->get("manage ad spaces")); $ac->addSubmenuItem($session->url->page("op=manageAdSpaces"), $i18n->get("manage ad spaces"));
my $f = WebGUI::HTMLForm->new($session); my $f = WebGUI::HTMLForm->new($session);
$f->submit; $f->submit;

View file

@ -403,7 +403,13 @@ sub showDebug {
$text = $self->session->stow->get('debug_info'); $text = $self->session->stow->get('debug_info');
$text =~ s/\n/\<br \/\>\n/g; $text =~ s/\n/\<br \/\>\n/g;
$output .= '<div style="text-align: left;background-color: #ffffdd;color: #000000;">'.$text."</div>\n"; $output .= '<div style="text-align: left;background-color: #ffffdd;color: #000000;">'.$text."</div>\n";
$text = JSON::objToJson($self->session->form->paramsHashRef(), {pretty => 1, indent => 4, autoconv=>0, skipinvalid=>1}); my $form = $self->session->form->paramsHashRef();
foreach my $key (keys %{$form}) {
if ($key eq "password" || $key eq "identifier") {
$form->{$key} = "********";
}
}
$text = JSON::objToJson($form, {pretty => 1, indent => 4, autoconv=>0, skipinvalid=>1});
$text =~ s/&/&amp;/xsg; $text =~ s/&/&amp;/xsg;
$text =~ s/>/&gt;/xsg; $text =~ s/>/&gt;/xsg;
$text =~ s/</&lt;/xsg; $text =~ s/</&lt;/xsg;