本文整理汇总了PHP中wordfence::scheduleScans方法的典型用法代码示例。如果您正苦于以下问题:PHP wordfence::scheduleScans方法的具体用法?PHP wordfence::scheduleScans怎么用?PHP wordfence::scheduleScans使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wordfence
的用法示例。
在下文中一共展示了wordfence::scheduleScans方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wordfenceStartScheduledScan
public static function wordfenceStartScheduledScan()
{
//If scheduled scans are not enabled in the global config option, then don't run a scheduled scan.
if (wfConfig::get('scheduledScansEnabled') != '1') {
return;
}
//This prevents scheduled scans from piling up on low traffic blogs and all being run at once.
//Only one scheduled scan runs within a given 60 min window. Won't run if another scan has run within 30 mins.
$lastScanStart = wfConfig::get('lastScheduledScanStart', 0);
if ($lastScanStart && time() - $lastScanStart < 1800) {
//A scheduled scan was started in the last 30 mins, so skip this one.
return;
}
wfConfig::set('lastScheduledScanStart', time());
wordfence::status(1, 'info', "Scheduled Wordfence scan starting at " . date('l jS \\of F Y h:i:s A', current_time('timestamp')));
//We call this before the scan actually starts to advance the schedule for the next week.
//This ensures that if the scan crashes for some reason, the schedule will hold.
wordfence::scheduleScans();
wfScanEngine::startScan();
}