Changed scheduler to use WebGUI session object.

This commit is contained in:
JT Smith 2002-08-14 04:27:00 +00:00
parent 985b45212a
commit d55f4f1c3c
5 changed files with 29 additions and 24 deletions

View file

@ -7,6 +7,17 @@ upgrading from one version to the next, or even between multiple
versions. Be sure to heed the warnings contained herein as they will versions. Be sure to heed the warnings contained herein as they will
save you many hours of grief. save you many hours of grief.
4.6.0
--------------------------------------------------------------------
* The runHourly scheduler has been updated to allow for more
types of automation. This update has caused an
incompatibility in old scheduler plug-ins. If you have not
installed any third-party scheduler plug-ins, then you have
nothing to worry about. However, if you do have some
scheduler plug-ins that didn't come with WebGUI, then please
contact the person or company that made it to get an
upgrade.
4.3.0 4.3.0
-------------------------------------------------------------------- --------------------------------------------------------------------
* The settings "extras", "uploadsURL", and "uploadsPath" have all * The settings "extras", "uploadsURL", and "uploadsPath" have all

View file

@ -165,6 +165,7 @@ sub page {
$debug .='</table>'; $debug .='</table>';
} }
if ($session{header}{redirect} ne "") { if ($session{header}{redirect} ne "") {
WebGUI::Session::close();
return $session{header}{redirect}; return $session{header}{redirect};
} else { } else {
$httpHeader = WebGUI::Session::httpHeader(); $httpHeader = WebGUI::Session::httpHeader();

View file

@ -11,11 +11,12 @@ package Hourly::DeleteExpiredSessions;
#------------------------------------------------------------------- #-------------------------------------------------------------------
use strict; use strict;
use WebGUI::Session;
use WebGUI::SQL; use WebGUI::SQL;
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub process { sub process {
WebGUI::SQL->write("delete from userSession where expires<".time(),$_[0]); WebGUI::SQL->write("delete from userSession where expires<".time());
} }
1; 1;

View file

@ -13,6 +13,7 @@ package Hourly::SyndicatedContent;
use HTTP::Request; use HTTP::Request;
use LWP::UserAgent; use LWP::UserAgent;
use strict; use strict;
use WebGUI::Session;
use WebGUI::SQL; use WebGUI::SQL;
use XML::RSSLite; use XML::RSSLite;
@ -52,18 +53,17 @@ sub generateHTML {
sub process { sub process {
my ($sth, @data, %rss, $html); my ($sth, @data, %rss, $html);
$sth = WebGUI::SQL->read("select wobject.wobjectId, SyndicatedContent.rssURL, SyndicatedContent.content $sth = WebGUI::SQL->read("select wobject.wobjectId, SyndicatedContent.rssURL, SyndicatedContent.content
from wobject,SyndicatedContent where wobject.wobjectId=SyndicatedContent.wobjectId and wobject.pageId<>3",$_[0]); from wobject,SyndicatedContent where wobject.wobjectId=SyndicatedContent.wobjectId and wobject.pageId<>3");
while (@data = $sth->array) { while (@data = $sth->array) {
%rss = getRSS($data[1]); %rss = getRSS($data[1]);
$html = generateHTML(%rss); $html = generateHTML(%rss);
if ($html ne "") { if ($html ne "") {
WebGUI::SQL->write("update SyndicatedContent set content=".$_[0]->quote($html).", lastFetched=".time()." WebGUI::SQL->write("update SyndicatedContent set content=".quote($html).", lastFetched=".time()." where wobjectId=$data[0]");
where wobjectId=$data[0]",$_[0]);
} elsif (substr($data[2],6) ne "Unable" && substr($data[2],7) ne "Not yet") { } elsif (substr($data[2],6) ne "Unable" && substr($data[2],7) ne "Not yet") {
# then just leave the existing content in place # then just leave the existing content in place
} else { } else {
WebGUI::SQL->write("update SyndicatedContent set content='Unable to fetch content. Perhaps the RSS is improperly formated.', WebGUI::SQL->write("update SyndicatedContent set content='Unable to fetch content. Perhaps the RSS is improperly formated.',
lastFetched=".time()." where wobjectId=$data[0]",$_[0]); lastFetched=".time()." where wobjectId=$data[0]");
} }
} }
$sth->finish; $sth->finish;

View file

@ -19,6 +19,7 @@ BEGIN {
use DBI; use DBI;
use strict qw(subs vars); use strict qw(subs vars);
use Data::Config; use Data::Config;
use WebGUI::Session;
use WebGUI::Utility; use WebGUI::Utility;
@ -47,26 +48,17 @@ if (opendir (CONFDIR,$confdir)) {
@files = readdir(CONFDIR); @files = readdir(CONFDIR);
foreach $file (@files) { foreach $file (@files) {
if ($file =~ /(.*?)\.conf$/ && $file ne "some_other_site.conf") { if ($file =~ /(.*?)\.conf$/ && $file ne "some_other_site.conf") {
my ($config); WebGUI::Session::open($webguiRoot,$file);
$config = new Data::Config $confdir.$file; WebGUI::Session::refreshUserInfo(3,$session{dbh});
unless ($config->param('dsn') eq "") { foreach $namespace (keys %plugins) {
my $dbh; $exclude = $session{config}{excludeHourly};
unless (eval {$dbh = DBI->connect($config->param('dsn'),$config->param('dbuser'),$config->param('dbpass'))}) { $exclude =~ s/ //g;
print "Can't connect to ".$config->param('dsn')." with info provided. Skipping.\n"; unless (isIn($namespace, split(/,/,$exclude))) {
} else { $cmd = $plugins{$namespace};
foreach $namespace (keys %plugins) { &$cmd();
$exclude = $config->param('excludeHourly'); }
$exclude =~ s/ //g;
unless (isIn($namespace, split(/,/,$exclude))) {
$cmd = $plugins{$namespace};
&$cmd($dbh);
}
}
$dbh->disconnect();
}
} else {
print "$file has some problems. Skipping\n";
} }
WebGUI::Session::close();
} }
} }
closedir(CONFDIR); closedir(CONFDIR);