本文整理汇总了PHP中wfUtils::isScanRunning方法的典型用法代码示例。如果您正苦于以下问题:PHP wfUtils::isScanRunning方法的具体用法?PHP wfUtils::isScanRunning怎么用?PHP wfUtils::isScanRunning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wfUtils
的用法示例。
在下文中一共展示了wfUtils::isScanRunning方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
function load()
{
if ($this->_checkWordFence()) {
if (wfUtils::isScanRunning()) {
return array('scan' => 'yes');
} else {
return wordfence::ajax_loadIssues_callback();
}
} else {
return array('warning' => "Word Fence plugin is not activated");
}
}
示例2: start_scan
private function start_scan()
{
$information = array();
if (!class_exists('wordfence') || !class_exists('wfScanEngine')) {
$information['error'] = 'NO_WORDFENCE';
return $information;
}
if (wfUtils::isScanRunning()) {
$information['error'] = 'SCAN_RUNNING';
return $information;
}
$err = wfScanEngine::startScan();
if ($err) {
$information['error'] = htmlentities($err);
} else {
$information['result'] = 'SUCCESS';
}
return $information;
}
示例3: startScan
public static function startScan($isFork = false)
{
if (!$isFork) {
//beginning of scan
wfConfig::inc('totalScansRun');
wfConfig::set('wfKillRequested', 0);
wordfence::status(4, 'info', "Entering start scan routine");
if (wfUtils::isScanRunning()) {
return "A scan is already running. Use the kill link if you would like to terminate the current scan.";
}
}
$timeout = self::getMaxExecutionTime() - 2;
//2 seconds shorter than max execution time which ensures that only 2 HTTP processes are ever occupied
$testURL = admin_url('admin-ajax.php?action=wordfence_testAjax');
if (!wfConfig::get('startScansRemotely', false)) {
$testResult = wp_remote_post($testURL, array('timeout' => $timeout, 'blocking' => true, 'sslverify' => false, 'headers' => array()));
wordfence::status(4, 'info', "Test result of scan start URL fetch: " . var_export($testResult, true));
}
$cronKey = wfUtils::bigRandomHex();
wfConfig::set('currentCronKey', time() . ',' . $cronKey);
if (!wfConfig::get('startScansRemotely', false) && !is_wp_error($testResult) && is_array($testResult) && strstr($testResult['body'], 'WFSCANTESTOK') !== false) {
//ajax requests can be sent by the server to itself
$cronURL = 'admin-ajax.php?action=wordfence_doScan&isFork=' . ($isFork ? '1' : '0') . '&cronKey=' . $cronKey;
$cronURL = admin_url($cronURL);
$headers = array();
wordfence::status(4, 'info', "Starting cron with normal ajax at URL {$cronURL}");
wp_remote_get($cronURL, array('timeout' => $timeout, 'blocking' => true, 'sslverify' => false, 'headers' => $headers));
wordfence::status(4, 'info', "Scan process ended after forking.");
} else {
$cronURL = admin_url('admin-ajax.php');
$cronURL = preg_replace('/^(https?:\\/\\/)/i', '$1noc1.wordfence.com/scanp/', $cronURL);
$cronURL .= '?action=wordfence_doScan&isFork=' . ($isFork ? '1' : '0') . '&cronKey=' . $cronKey;
$headers = array();
wordfence::status(4, 'info', "Starting cron via proxy at URL {$cronURL}");
wp_remote_get($cronURL, array('timeout' => $timeout, 'blocking' => true, 'sslverify' => false, 'headers' => $headers));
wordfence::status(4, 'info', "Scan process ended after forking.");
}
return false;
//No error
}
示例4: getSummaryItems
public function getSummaryItems()
{
if (!$this->updateCalled) {
$this->updateCalled = true;
$this->updateSummaryItems();
}
$arr = wfConfig::get_ser('wf_summaryItems', array());
//$arr['scanTimeAgo'] = wfUtils::makeTimeAgo(sprintf('%.0f', time() - $arr['scanTime']));
$arr['scanRunning'] = wfUtils::isScanRunning() ? '1' : '0';
$arr['scheduledScansEnabled'] = wfConfig::get('scheduledScansEnabled');
$secsToGo = wp_next_scheduled('wordfence_scheduled_scan') - time();
if ($secsToGo < 1) {
$nextRun = 'now';
} else {
$nextRun = wfUtils::makeTimeAgo($secsToGo) . ' from now';
}
$arr['nextRun'] = $nextRun;
$arr['totalCritical'] = $this->getDB()->querySingle("select count(*) as cnt from " . $this->issuesTable . " where status='new' and severity=1");
$arr['totalWarning'] = $this->getDB()->querySingle("select count(*) as cnt from " . $this->issuesTable . " where status='new' and severity=2");
return $arr;
}