mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-14 10:37:30 -07:00
Перенос файлов движка в корень
This commit is contained in:
parent
584f692288
commit
f94c0dd2ee
585 changed files with 14 additions and 14 deletions
67
library/includes/cron/cron_init.php
Normal file
67
library/includes/cron/cron_init.php
Normal file
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
|
||||
if (!defined('BB_ROOT')) die(basename(__FILE__));
|
||||
|
||||
//
|
||||
// Functions
|
||||
//
|
||||
function cron_get_file_lock ()
|
||||
{
|
||||
$lock_obtained = false;
|
||||
|
||||
if (file_exists(CRON_ALLOWED))
|
||||
{
|
||||
# bb_log(date('H:i:s - ') . getmypid() .' -x-- FILE-LOCK try'. LOG_LF, CRON_LOG_DIR .'cron_check');
|
||||
|
||||
$lock_obtained = @rename(CRON_ALLOWED, CRON_RUNNING);
|
||||
}
|
||||
elseif (file_exists(CRON_RUNNING))
|
||||
{
|
||||
cron_release_deadlock();
|
||||
}
|
||||
elseif (!file_exists(CRON_ALLOWED) && !file_exists(CRON_RUNNING))
|
||||
{
|
||||
file_write('', CRON_ALLOWED);
|
||||
$lock_obtained = @rename(CRON_ALLOWED, CRON_RUNNING);
|
||||
}
|
||||
|
||||
return $lock_obtained;
|
||||
}
|
||||
|
||||
function cron_track_running ($mode)
|
||||
{
|
||||
@define('CRON_STARTMARK', TRIGGERS_DIR .'cron_started_at_'. date('Y-m-d_H-i-s') .'_by_pid_'. getmypid());
|
||||
|
||||
if ($mode == 'start')
|
||||
{
|
||||
cron_touch_lock_file(CRON_RUNNING);
|
||||
file_write('', CRON_STARTMARK);
|
||||
}
|
||||
elseif ($mode == 'end')
|
||||
{
|
||||
@unlink(CRON_STARTMARK);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Run cron
|
||||
//
|
||||
if (cron_get_file_lock())
|
||||
{
|
||||
ignore_user_abort(true);
|
||||
register_shutdown_function('cron_release_file_lock');
|
||||
register_shutdown_function('cron_enable_board');
|
||||
|
||||
# bb_log(date('H:i:s - ') . getmypid() .' --x- FILE-LOCK OBTAINED ###############'. LOG_LF, CRON_LOG_DIR .'cron_check');
|
||||
|
||||
cron_track_running('start');
|
||||
|
||||
require(CRON_DIR .'cron_check.php');
|
||||
|
||||
cron_track_running('end');
|
||||
}
|
||||
|
||||
if (defined('IN_CRON'))
|
||||
{
|
||||
bb_log(date('H:i:s - ') . getmypid() .' --x- ALL jobs FINISHED *************************************************'. LOG_LF, CRON_LOG_DIR .'cron_check');
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue