define('APPTYPEID', 1);
define('CURSCRIPT', 'cronrun');
if
(
$argv
['1'] != 'start'){
header(
"HTTP/1.1 301 Moved Permanently"
);
header(
"location: index.php"
);
exit
();
}
@ignore_user_abort(TRUE);
@set_time_limit(0);
require
'./source/
class
/class_core.php';
$discuz
= & discuz_core::instance();
$discuz
->init();
$timestamp
= time();
$t
=
$timestamp
+ 600;
if
(
$timestamp
<= @
filemtime
('data/run.lock')){
runlog(
"runlog.log"
,'limit-run');
exit
();
}
@touch('data/run.lock',
$t
);
$query
= DB::query(
"SELECT * FROM "
.DB::table('common_cron').
" WHERE `available`>'0' AND `nextrun`<='$timestamp' ORDER BY nextrun"
);
while
(
$cron
= DB::fetch(
$query
)) {
$cron
['filename'] =
str_replace
(
array
('..', '/', '\\'), '',
$cron
['filename']);
$cronfile
= DISCUZ_ROOT.'./source/
include
/cron/'.
$cron
['filename'];
$cron
['minute'] =
explode
(
"\t"
,
$cron
['minute']);
discuz_cron::setnextime(
$cron
);
if
(!@
include_once
$cronfile
) {
runlog(
"runlog.log"
,'Not find cronfile:'.
$cronfile
);
continue
;
}
runlog(
"runlog.log"
,
$cronfile
);
}
@touch('data/run.lock',
$timestamp
);