cron fixes.
This commit is contained in:
parent
1bd1e2d16a
commit
31ece58d00
1 changed files with 27 additions and 26 deletions
11
cron.php
11
cron.php
|
@ -1,10 +1,6 @@
|
|||
<?php
|
||||
namespace YTKNS;
|
||||
|
||||
// Prevent running cron script during maintenance
|
||||
if(YTKNS_MAINTENANCE)
|
||||
return;
|
||||
|
||||
if(!defined('YTKNS_SEM_NAME'))
|
||||
define('YTKNS_SEM_NAME', 'b');
|
||||
if(!defined('YTKNS_SFM_PATH'))
|
||||
|
@ -18,8 +14,11 @@ $semaphore = sem_get($ftok, 1);
|
|||
if(!sem_acquire($semaphore))
|
||||
die('Failed to acquire semaphore.' . PHP_EOL);
|
||||
|
||||
try {
|
||||
require_once __DIR__ . '/startup.php';
|
||||
|
||||
// Prevent running cron script during maintenance
|
||||
if(!YTKNS_MAINTENANCE) {
|
||||
// Destroy old sessions
|
||||
UserSession::purge();
|
||||
|
||||
|
@ -46,5 +45,7 @@ while($task = array_shift($taskQueue)) {
|
|||
|
||||
$task->delete();
|
||||
}
|
||||
|
||||
}
|
||||
} finally {
|
||||
sem_release($semaphore);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue