diff --git a/docs/upgrades/upgrade_6.8.5-6.9.0.pl b/docs/upgrades/upgrade_6.8.5-6.9.0.pl index 1954ce5d7..4b0882985 100644 --- a/docs/upgrades/upgrade_6.8.5-6.9.0.pl +++ b/docs/upgrades/upgrade_6.8.5-6.9.0.pl @@ -27,9 +27,55 @@ addEMSTemplates(); addEMSTables(); updateTemplates(); updateDatabaseLinksAndSQLReport(); +addWorkflow(); finish($session); # this line required +#------------------------------------------------- +sub addWorkflow { + print "\tAdding workflow.\n"; + $session->db->write("create table WorkflowSchedule ( + taskId varchar(22) binary not null primary key, + enabled int not null default 1, + minuteofHour varchar(25) not null default '0', + hourOfDay varchar(25) not null default '*', + dayOfMonth varchar(25) not null default '*', + monthOfYear varchar(25) not null default '*', + dayOfWeek varchar(25) not null default '*', + workflowId varchar(22) binary not null + )"); + $session->db->write("create table WorkflowInstance ( + instanceId varchar(22) binary not null primary key, + workflowId varchar(22) binary not null, + currentActivityId varchar(22) binary not null, + priority int not null default 2, + className varchar(255), + methodName varchar(255), + parameters text, + runningSince bigint + )"); + $session->db->write("create table Workflow ( + workflowId varchar(22) binary not null primary key, + title varchar(255) not null default 'Untitled', + description text + )"); + $session->db->write("create table WorkflowActivity ( + activityId varchar(22) binary not null primary key, + workflowId varchar(22) binary not null, + title varchar(255) not null default 'Untitled', + description text, + previousActivityId varchar(22) binary not null, + dateCreated bigint, + className varchar(255) + )"); + $session->db->write("create table WorkflowActivityProperty ( + propertyId varchar(22) binary not null primary key, + activityId varchar(22) binary not null, + name varchar(255), + value text + )"); +} + #------------------------------------------------- sub updateDatabaseLinksAndSQLReport { print "\tUpdating the Database link and SQLReport Tables.\n"; diff --git a/lib/Spectre/Workflow.pm b/lib/Spectre/Workflow.pm index d783591b0..79ba94a30 100644 --- a/lib/Spectre/Workflow.pm +++ b/lib/Spectre/Workflow.pm @@ -115,7 +115,8 @@ Returns an integer representing the number of running jobs. sub countRunningJobs { my $self = shift; - return scalar(@{$self->{_runningJobs}}); + my $runningJobs = $self->{_runningJobs} || []; + return scalar(@{$runningJobs}); } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Config.pm b/lib/WebGUI/Config.pm index 0d00ed7c2..0cf6d72d8 100644 --- a/lib/WebGUI/Config.pm +++ b/lib/WebGUI/Config.pm @@ -186,16 +186,20 @@ sub new { return $config{$filename}; } else { my $json = ""; - open(FILE,"<".$webguiPath.'/etc/'.$filename); - while (my $line = ) { - $json .= $line unless ($line =~ /^\s*#/); + if (open(FILE,"<".$webguiPath.'/etc/'.$filename)) { + while (my $line = ) { + $json .= $line unless ($line =~ /^\s*#/); + } + close(FILE); + my $conf = jsonToObj($json); + my $self = {_webguiRoot=>$webguiPath, _configFile=>$filename, _config=>$conf}; + bless $self, $class; + $config{$filename} = $self unless $noCache; + return $self; + } else { + warn "Cannot open config file: ".$filename; + return undef; } - close(FILE); - my $conf = jsonToObj($json); - my $self = {_webguiRoot=>$webguiPath, _configFile=>$filename, _config=>$conf}; - bless $self, $class; - $config{$filename} = $self unless $noCache; - return $self; } } diff --git a/sbin/spectre.pl b/sbin/spectre.pl index c13055f8e..cd8bda8e7 100644 --- a/sbin/spectre.pl +++ b/sbin/spectre.pl @@ -48,6 +48,17 @@ STOP } my $config = WebGUI::Config->new("..","spectre.conf",1); +unless (defined $config) { + print <