change ErrorHandler to Log
This commit is contained in:
parent
d11cd6f4f7
commit
199c4e4960
90 changed files with 311 additions and 311 deletions
|
|
@ -293,7 +293,7 @@ sub new {
|
|||
$class = $main->{className};
|
||||
eval { WebGUI::Pluggable::load($class) };
|
||||
if ($@) {
|
||||
$session->errorHandler->error($@);
|
||||
$session->log->error($@);
|
||||
return undef;
|
||||
}
|
||||
my $sub = $session->db->buildHashRef("select name,value from WorkflowActivityData where activityId=?",[$activityId]);
|
||||
|
|
@ -333,7 +333,7 @@ sub newByPropertyHashRef {
|
|||
my $className = $properties->{className};
|
||||
eval { WebGUI::Pluggable::load($className) };
|
||||
if ($@) {
|
||||
$session->errorHandler->error($@);
|
||||
$session->log->error($@);
|
||||
return undef;
|
||||
}
|
||||
bless {_session=>$session, _id=>$properties->{activityId}, _data => $properties}, $className;
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ sub execute {
|
|||
} else {
|
||||
# If something strange happened and we ended up with > 1 matching rows, cut our losses and remove offending userLoginLog rows (otherwise we
|
||||
# could end up with ridiculously long user recorded times)
|
||||
$self->session->errorHandler->warn("More than 1 old userLoginLog rows found, removing offending rows");
|
||||
$self->session->log->warn("More than 1 old userLoginLog rows found, removing offending rows");
|
||||
$self->session->db->write("delete from userLoginLog where lastPageViewed = timeStamp and sessionId = ? ", [$sessionId] );
|
||||
}
|
||||
my $session = WebGUI::Session->open($self->session->config, undef, $sessionId, 1);
|
||||
|
|
|
|||
|
|
@ -102,14 +102,14 @@ sub execute {
|
|||
my $instance = shift;
|
||||
|
||||
unless ($self->session->config->get('exportPath')) {
|
||||
$self->session->errorHandler->warn("DeleteExportedFiles: no export path, so not doing anything");
|
||||
$self->session->log->warn("DeleteExportedFiles: no export path, so not doing anything");
|
||||
return $self->COMPLETE;
|
||||
}
|
||||
|
||||
my $time = time;
|
||||
my $filesRef = Storable::thaw($instance->getScratch(DELETE_FILES_SCRATCH));
|
||||
unless ($filesRef) {
|
||||
$self->session->errorHandler->error("DeleteExportedFiles: can't find list of files to delete");
|
||||
$self->session->log->error("DeleteExportedFiles: can't find list of files to delete");
|
||||
return $self->ERROR;
|
||||
}
|
||||
|
||||
|
|
@ -119,14 +119,14 @@ sub execute {
|
|||
my $ttl = $self->getTTL;
|
||||
while (defined(my $filename = shift @files)) {
|
||||
my $cfilename = $self->_canonExportPath($filename);
|
||||
unlink $cfilename or $self->session->errorHandler->warn("DeleteExportedFiles: Couldn't unlink $filename: $!"), next;
|
||||
unlink $cfilename or $self->session->log->warn("DeleteExportedFiles: Couldn't unlink $filename: $!"), next;
|
||||
push @dirs, $self->_pruneOfFile($filename);
|
||||
goto pause if (time - $time > $ttl);
|
||||
}
|
||||
|
||||
while (defined(my $dirname = shift @dirs)) {
|
||||
my $cdirname = $self->_canonExportPath($dirname);
|
||||
rmdir $cdirname or $self->session->errorHandler->warn("DeleteExportedFiles: couldn't rmdir $dirname: $!"), next;
|
||||
rmdir $cdirname or $self->session->log->warn("DeleteExportedFiles: couldn't rmdir $dirname: $!"), next;
|
||||
push @dirs, $self->_pruneOfFile($dirname);
|
||||
goto pause if (time - $time > $ttl);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ sub execute {
|
|||
my $object = shift;
|
||||
my $instance = shift;
|
||||
my $start = time();
|
||||
my $log = $self->session->errorHandler;
|
||||
my $log = $self->session->log;
|
||||
$log->info('Searching for EMS items that have been in the cart too long.');
|
||||
my $ttl = $self->getTTL;
|
||||
my $items = $self->session->db->read("select itemId, cartId, assetId from cartItem where
|
||||
|
|
|
|||
|
|
@ -181,10 +181,10 @@ sub execute {
|
|||
unless (defined $user) { #if no user
|
||||
unless ($postGroup eq 1 || $postGroup eq 7) { #reject mail if no registered email, unless post group is Visitors (1) or Everyone (7)
|
||||
if ($message->{from} eq "") {
|
||||
$self->session->errorHandler->error("For some reason the message ".$message->{subject}." (".$message->{messageId}.") has no from address.");
|
||||
$self->session->log->error("For some reason the message ".$message->{subject}." (".$message->{messageId}.") has no from address.");
|
||||
}
|
||||
elsif ($message->{from} eq $cs->get("mailAddress")) {
|
||||
$self->session->errorHandler->error("For some reason the message ".$message->{subject}." (".$message->{messageId}.") has the same from address as the collaboration system's mail address.");
|
||||
$self->session->log->error("For some reason the message ".$message->{subject}." (".$message->{messageId}.") has the same from address as the collaboration system's mail address.");
|
||||
}
|
||||
else {
|
||||
my $send = WebGUI::Mail::Send->create($self->session, {
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ sub execute {
|
|||
my $object = shift;
|
||||
my $instance = shift;
|
||||
unless (defined $instance) {
|
||||
$self->session->errorHandler->error("Could not instanciate Workflow Instance in GetSyndicatedContent Activity");
|
||||
$self->session->log->error("Could not instanciate Workflow Instance in GetSyndicatedContent Activity");
|
||||
return $self->ERROR;
|
||||
}
|
||||
my $log = $self->session->log;
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ See WebGUI::Workflow::Activity::execute() for details.
|
|||
sub execute {
|
||||
my ($self, $nothing, $instance) = @_;
|
||||
my $session = $self->session;
|
||||
my $log = $session->errorHandler;
|
||||
my $log = $session->log;
|
||||
|
||||
# keep track of how much time it's taking
|
||||
my $start = time();
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ sub execute {
|
|||
$self->session->user({user=>$user});
|
||||
WebGUI::Macro::process($self->session, \$cmd);
|
||||
if (system($cmd)) {
|
||||
$self->session->errorHandler->error("Workflow: RunCommandAsUser failed because: $!");
|
||||
$self->session->log->error("Workflow: RunCommandAsUser failed because: $!");
|
||||
$self->session->user({user=>$previousUser});
|
||||
return $self->ERROR;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ See WebGUI::Workflow::Activity::execute() for details.
|
|||
|
||||
sub execute {
|
||||
my $self = shift;
|
||||
my ($db,$eh) = $self->session->quick(qw(db errorHandler));
|
||||
my ($db,$eh) = $self->session->quick(qw(db log));
|
||||
|
||||
my $time = time();
|
||||
my $newsletter = undef;
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ sub execute {
|
|||
my $request = POST 'https://www.webgui.org/stats', [ func => 'receiveStats', stats => $statsAsJson ];
|
||||
my $response = $userAgent->request($request);
|
||||
if ($response->is_error) {
|
||||
$self->session->errorHandler->error("WebGUI Stats could not be sent.");
|
||||
$self->session->log->error("WebGUI Stats could not be sent.");
|
||||
}
|
||||
return $self->COMPLETE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,11 +132,11 @@ sub execute {
|
|||
filter =>$ldapLink->getValue("ldapIdentity").'='.$userObject->username
|
||||
);
|
||||
if($search->code) {
|
||||
$self->session->errorHandler->warn("Couldn't search LDAP ".$uri->host." to find user ".$userObject->username." (".$userId.").\nError Message from LDAP: ".$ldapStatusCode{$search->code});
|
||||
$self->session->log->warn("Couldn't search LDAP ".$uri->host." to find user ".$userObject->username." (".$userId.").\nError Message from LDAP: ".$ldapStatusCode{$search->code});
|
||||
return $self->COMPLETE;
|
||||
}
|
||||
elsif ($search->count == 0) {
|
||||
$self->session->errorHandler->warn("No results returned for user with dn ".$userData->{connectDN});
|
||||
$self->session->log->warn("No results returned for user with dn ".$userData->{connectDN});
|
||||
return $self->COMPLETE;
|
||||
}
|
||||
else {
|
||||
|
|
@ -149,7 +149,7 @@ sub execute {
|
|||
}
|
||||
$ldap->unbind;
|
||||
} else {
|
||||
$self->session->errorHandler->warn("Error connecting to LDAP: ".$ldapLink->getErrorMessage);
|
||||
$self->session->log->warn("Error connecting to LDAP: ".$ldapLink->getErrorMessage);
|
||||
return $self->ERROR;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ sub _alias {
|
|||
}
|
||||
#Print an error message if no aliases are found
|
||||
unless (scalar(keys %{$alias}) > 0) {
|
||||
$session->errorHandler->warn("SynchProfilesToLdap: ldapAlias is not configured properly in your WebGUI config file. Please check to make sure that this setting is enabled and contains alias mappings");
|
||||
$session->log->warn("SynchProfilesToLdap: ldapAlias is not configured properly in your WebGUI config file. Please check to make sure that this setting is enabled and contains alias mappings");
|
||||
}
|
||||
#Return the value of the key passed in
|
||||
return $alias->{$key} || $key;
|
||||
|
|
@ -137,7 +137,7 @@ sub execute {
|
|||
if ($rowLinkId ne $currentLinkId) {
|
||||
$link->unbind if defined $link;
|
||||
$skippingLink = 0;
|
||||
# $self->session->errorHandler->warn("DEBUG: SyncProfilesToLdap: Switching to link $rowLinkId");
|
||||
# $self->session->log->warn("DEBUG: SyncProfilesToLdap: Switching to link $rowLinkId");
|
||||
|
||||
$currentLinkId = $rowLinkId;
|
||||
$link = WebGUI::LDAPLink->new($self->session, $rowLinkId);
|
||||
|
|
@ -146,14 +146,14 @@ sub execute {
|
|||
$ldap = $link->bind;
|
||||
|
||||
if (my $error = $link->getErrorMessage) {
|
||||
$self->session->errorHandler->error("SyncProfilesToLdap: Couldn't bind to LDAP link $ldapUrl ($currentLinkId), skipping: $error");
|
||||
$self->session->log->error("SyncProfilesToLdap: Couldn't bind to LDAP link $ldapUrl ($currentLinkId), skipping: $error");
|
||||
$skippingLink = 1;
|
||||
next;
|
||||
}
|
||||
} elsif ($skippingLink) {
|
||||
next;
|
||||
}
|
||||
# $self->session->errorHandler->warn("DEBUG: SyncProfilesToLdap: Syncing profile for user $userId");
|
||||
# $self->session->log->warn("DEBUG: SyncProfilesToLdap: Syncing profile for user $userId");
|
||||
|
||||
my $user = WebGUI::User->new($self->session, $userId);
|
||||
my $username = $user->username;
|
||||
|
|
@ -163,16 +163,16 @@ sub execute {
|
|||
filter => "&(objectClass=*)");
|
||||
|
||||
if ($result->code && ! $result->code ~~ @noResultsCodes) {
|
||||
$self->session->errorHandler->error("SyncProfilesToLdap: Couldn't search LDAP link $ldapUrl ($currentLinkId) to find user $username ($userId) with DN ".$userData->{connectDN}.": LDAP returned: ".$ldapStatusCode{$result->code});
|
||||
$self->session->log->error("SyncProfilesToLdap: Couldn't search LDAP link $ldapUrl ($currentLinkId) to find user $username ($userId) with DN ".$userData->{connectDN}.": LDAP returned: ".$ldapStatusCode{$result->code});
|
||||
} elsif ($result->code ~~ @noResultsCodes || $result->count == 0) {
|
||||
$self->session->errorHandler->warn("SyncProfilesToLdap: No results returned by LDAP server for user with dn ".$userData->{connectDN});
|
||||
$self->session->log->warn("SyncProfilesToLdap: No results returned by LDAP server for user with dn ".$userData->{connectDN});
|
||||
} else {
|
||||
my $entry = $result->entry(0);
|
||||
|
||||
foreach my $fieldName (@fieldNames) {
|
||||
my $value = $entry->get_value($self->_alias($fieldName));
|
||||
next unless length $value;
|
||||
# $self->session->errorHandler->warn("DEBUG: SyncProfilesToLdap: Got data for profile field '$fieldName'");
|
||||
# $self->session->log->warn("DEBUG: SyncProfilesToLdap: Got data for profile field '$fieldName'");
|
||||
$user->profileField($fieldName, $value);
|
||||
}
|
||||
}
|
||||
|
|
@ -180,7 +180,7 @@ sub execute {
|
|||
$index++;
|
||||
|
||||
if (time - $startTime >= $ttl) {
|
||||
# $self->session->errorHandler->warn("DEBUG: SyncProfilesToLdap: next round");
|
||||
# $self->session->log->warn("DEBUG: SyncProfilesToLdap: next round");
|
||||
$link->unbind if defined $link;
|
||||
$instance->setScratch('ldapSelectIndex', $index);
|
||||
$sth->finish;
|
||||
|
|
@ -188,7 +188,7 @@ sub execute {
|
|||
}
|
||||
}
|
||||
|
||||
# $self->session->errorHandler->warn("DEBUG: SyncProfilesToLdap: done");
|
||||
# $self->session->log->warn("DEBUG: SyncProfilesToLdap: done");
|
||||
$link->unbind if defined $link;
|
||||
$instance->deleteScratch('ldapSelectIndex');
|
||||
return $self->COMPLETE;
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ sub getAllInstances {
|
|||
push(@instances, $instance);
|
||||
}
|
||||
else {
|
||||
$session->errorHandler->warn('Tried to instance instanceId '.$instanceId.' but it returned undef');
|
||||
$session->log->warn('Tried to instance instanceId '.$instanceId.' but it returned undef');
|
||||
}
|
||||
}
|
||||
return \@instances;
|
||||
|
|
@ -361,7 +361,7 @@ sub run {
|
|||
}
|
||||
my $activity = $self->getNextActivity;
|
||||
unless (defined $activity) {
|
||||
$session->errorHandler->error(
|
||||
$session->log->error(
|
||||
sprintf q{Unable to load Workflow Activity for activity after id %s in workflow %s},
|
||||
$self->get('currentActivityId'),
|
||||
$workflow->getId
|
||||
|
|
@ -369,7 +369,7 @@ sub run {
|
|||
$self->set({lastStatus=>"error"}, 1);
|
||||
return "error";
|
||||
}
|
||||
$session->errorHandler->info("Running workflow activity ".$activity->getId.", which is a ".(ref $activity).", for instance ".$self->getId.".");
|
||||
$session->log->info("Running workflow activity ".$activity->getId.", which is a ".(ref $activity).", for instance ".$self->getId.".");
|
||||
my $object = eval { $self->getObject };
|
||||
if ( my $e = WebGUI::Error::ObjectNotFound->caught ) {
|
||||
$session->log->warn(
|
||||
|
|
@ -379,7 +379,7 @@ sub run {
|
|||
return "done";
|
||||
}
|
||||
elsif ($@) {
|
||||
$session->errorHandler->error(
|
||||
$session->log->error(
|
||||
q{Error on workflow instance '} . $self->getId . q{': }. $@
|
||||
);
|
||||
$self->set({lastStatus=>"error"}, 1);
|
||||
|
|
@ -388,7 +388,7 @@ sub run {
|
|||
|
||||
my $status = eval { $activity->execute($object, $self) };
|
||||
if ($@) {
|
||||
$session->errorHandler->error("Caught exception executing workflow activity ".$activity->getId." for instance ".$self->getId." which reported ".$@);
|
||||
$session->log->error("Caught exception executing workflow activity ".$activity->getId." for instance ".$self->getId." which reported ".$@);
|
||||
$self->set({lastStatus=>"error"}, 1);
|
||||
return "error";
|
||||
}
|
||||
|
|
@ -639,7 +639,7 @@ When a workflow instance is started WebGUI tries to run it immediately to see if
|
|||
|
||||
sub start {
|
||||
my ($self, $skipRealtime) = @_;
|
||||
my $log = $self->session->errorHandler;
|
||||
my $log = $self->session->log;
|
||||
$self->{_started} = 1;
|
||||
|
||||
# run the workflow in realtime to start.
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ sub notify {
|
|||
my $self = shift;
|
||||
my $module = shift;
|
||||
my $params = shift;
|
||||
my ($config, $error) = $self->session->quick("config", "errorHandler");
|
||||
my ($config, $error) = $self->session->quick("config", "log");
|
||||
my $remote = create_ikc_client(
|
||||
port=>$config->get("spectrePort"),
|
||||
ip=>$config->get("spectreIp"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue