migrated a few of the run hourly scripts
fixed a cron bug
This commit is contained in:
parent
a50a190642
commit
e04a1b6fca
25 changed files with 766 additions and 256 deletions
|
|
@ -1,30 +0,0 @@
|
|||
package Hourly::CleanFileCache;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2006 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Cache::FileCache;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my $size = $session{config}{fileCacheSizeLimit} + 10;
|
||||
my $expiresModifier = 0;
|
||||
my $cache = WebGUI::Cache::FileCache->new;
|
||||
while ($size > $session{config}{fileCacheSizeLimit}) {
|
||||
$size = $cache->getNamespaceSize($expiresModifier);
|
||||
$expiresModifier += 600; # add 10 minutes each pass
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
package Hourly::CleanLoginHistory;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2006 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
||||
use strict;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
#-----------------------------------------
|
||||
sub process {
|
||||
if ($session{config}{CleanLoginHistory_ageToDelete}) {
|
||||
WebGUI::SQL->write("delete from userLoginLog
|
||||
where timeStamp < ".(time()-(86400*$session{config}{CleanLoginHistory_ageToDelete})));
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
package Hourly::CleanTemp;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2006 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use File::Path;
|
||||
use File::stat;
|
||||
use strict;
|
||||
use WebGUI::Session;
|
||||
|
||||
#-----------------------------------------
|
||||
# _checkFileAge(filenameWithPath,ageToCheck)
|
||||
# return: true/false
|
||||
# checks age of file against specified age and reports true/false
|
||||
sub _checkFileAge {
|
||||
my ($filestat, $flag);
|
||||
$filestat = stat($_[0]) or print "No $_[0]: $!";
|
||||
if ((time()-$filestat->mtime) > $_[1]) {
|
||||
$flag = 1;
|
||||
} else {
|
||||
$flag = 0;
|
||||
}
|
||||
return $flag;
|
||||
}
|
||||
|
||||
#-----------------------------------------
|
||||
# _recurseFileSystem(path, ageOfFilesToDelete)
|
||||
# recurses the filesystem looking for files to delete
|
||||
sub _recurseFileSystem {
|
||||
my (@filelist, $file);
|
||||
if (opendir(DIR,$_[0])) {
|
||||
@filelist = readdir(DIR);
|
||||
closedir(DIR);
|
||||
foreach $file (@filelist) {
|
||||
unless ($file eq "." || $file eq "..") {
|
||||
_recurseFileSystem($_[0].$session{os}{slash}.$file,$_[1]);
|
||||
if (_checkFileAge($_[0].$session{os}{slash}.$file,$_[1])) {
|
||||
rmtree($_[0].$session{os}{slash}.$file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------
|
||||
sub process {
|
||||
my $pathToClean = $session{config}{uploadsPath}.$session{os}{slash}."temp";
|
||||
my $timeToDie = 86400;
|
||||
_recurseFileSystem($pathToClean,$timeToDie);
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
package Hourly::DecayKarma;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2006 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
||||
use strict;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
#-----------------------------------------
|
||||
sub process {
|
||||
if ($session{config}{DecayKarma_minimumKarma} ne "" && $session{config}{DecayKarma_decayFactor}) {
|
||||
WebGUI::SQL->write("update users set karma=karma-".$session{config}{DecayKarma_decayFactor}
|
||||
." where karma > ".$session{config}{DecayKarma_minimumKarma});
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
package Hourly::DeleteExpiredClipboard;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2006 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
||||
use strict;
|
||||
use WebGUI::Asset;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
#-----------------------------------------
|
||||
sub process {
|
||||
if ($session{config}{DeleteExpiredClipboard_offset} ne "") {
|
||||
my $expireDate = (time()-(86400*$session{config}{DeleteExpiredClipboard_offset}));
|
||||
my $sth = WebGUI::SQL->read("select assetId,className from asset where state='clipboard' and stateChanged <".$expireDate);
|
||||
while (my ($id, $class) = $sth->array) {
|
||||
my $asset = WebGUI::Asset->new($id,$class);
|
||||
$asset->trash;
|
||||
}
|
||||
$sth->finish;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
package Hourly::NewHourlyScript;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2005 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
||||
use strict;
|
||||
use WebGUI::Asset;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
#-----------------------------------------
|
||||
sub process {
|
||||
# Perform some action that needs to be done on a periodic basis.
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue