本文整理汇总了PHP中Cron::cronTasksList方法的典型用法代码示例。如果您正苦于以下问题:PHP Cron::cronTasksList方法的具体用法?PHP Cron::cronTasksList怎么用?PHP Cron::cronTasksList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cron
的用法示例。
在下文中一共展示了Cron::cronTasksList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exit
* returns as soon as a download is finished
* or wait 10 seconds if no download is queued.
*/
if (!function_exists("curl_init")) {
error_log("php-curl not installed or not enabled, exit.\n");
exit(1);
}
require_once __DIR__ . '/../../../common.php';
require_once __DIR__ . '/../libs/cron.php';
require_once __DIR__ . '/../libs/api.php';
$cron = new Cron();
$api = new Api();
$api->log_caller = "cron-calling-daemon";
while (true) {
// We search for the list of crontasks to launch (date/time selector is done there)
$list = $cron->cronTasksList();
$urllist = array();
foreach ($list as $onecron) {
if (substr($onecron["url"], 0, 7) == "http://" || substr($onecron["url"], 0, 8) == "https://") {
if (strpos($onecron["url"], "?") !== false) {
$onecron["url"] .= "&action=transcoder_cron&app_key=" . $onecron['clientkey'];
} else {
$onecron["url"] .= "?action=transcoder_cron&app_key=" . $onecron['clientkey'];
}
$urllist[] = array("url" => $onecron["url"], "uid" => $onecron["uid"]);
}
}
if (empty($urllist)) {
// nothing to do :
sleep(60);
// Let's try again in a minute