Skip to content

Commit

Permalink
fixed import of maintained GC waypoints; updates #341
Browse files Browse the repository at this point in the history
and enabled manually running single cronjobs
  • Loading branch information
following5 committed Jun 16, 2015
1 parent 33302e7 commit 95805da
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
16 changes: 16 additions & 0 deletions htdocs/util2/cron/modules/gcwp_update.class.php
Expand Up @@ -20,20 +20,36 @@ function run()
{
global $opt;

$ocwp_imported = array();
$errors = false;

foreach ($opt['cron']['gcwp']['sources'] as $source)
{
$wpdata = @file($source);
if ($wpdata === FALSE)
{
echo "gcwp_update: error reading " . $source . "\n";
$errors = true;
}
else
foreach ($wpdata as $line)
{
$waypoints = explode(",",trim($line));
if (count($waypoints) == 2)
{
sql("UPDATE `caches` SET `wp_gc_maintained`='&2' WHERE `wp_oc`='&1'",
$waypoints[0], $waypoints[1]);
$ocwp_imported[] = sql_escape($waypoints[0]);
}
}
}

if (!$errors)
sql("
UPDATE caches
SET wp_gc_maintained = UCASE(TRIM(wp_gc))
WHERE wp_oc NOT IN ('" . implode("','",$ocwp_imported) . "')"
);
}
}

Expand Down
16 changes: 12 additions & 4 deletions htdocs/util2/cron/runcron.php
Expand Up @@ -32,10 +32,18 @@

$modules_dir = $opt['rootpath'] . 'util2/cron/modules/';

$hDir = opendir($modules_dir);
while (false !== ($file = readdir($hDir)))
if (substr($file, -10) == '.class.php')
require($modules_dir . $file);
if (count($argv) == 2 && !strstr("/", $argv[1]))
{
// run one job manually for debugging purpose
require($modules_dir . $argv[1] . ".class.php");
}
else
{
$hDir = opendir($modules_dir);
while (false !== ($file = readdir($hDir)))
if (substr($file, -10) == '.class.php')
require($modules_dir . $file);
}

$process_sync->Leave();
}
Expand Down

0 comments on commit 95805da

Please sign in to comment.