Ejemplo n.º 1
0
<?php

if (!WsdUtil::canLoad()) {
    return;
}
if (!WsdUtil::isAdministrator()) {
    return;
}
// get last scan info
$scanID = WsdWpScanner::getLastScanID_table();
$scanInfo = WsdWpScanner::getScanInfo($scanID);
$scanId = $scanInfo->scanId;
$scanStartDate = $scanInfo->scanStartDate;
$scanEndDate = $scanInfo->scanEndDate;
$scanFailed = $scanInfo->scanResult == 0;
$scanType = $scanInfo->scanType;
$h24 = 24 * 60 * 60;
$since = 0;
if ($scanType == 0) {
    $since = strtotime($scanStartDate);
} elseif ($scanType == 1) {
    $since = strtotime($scanStartDate) - $h24;
} elseif ($scanType == 2) {
    $since = strtotime($scanStartDate) - 2 * $h24;
} elseif ($scanType == 3) {
    $since = strtotime($scanStartDate) - 3 * $h24;
} elseif ($scanType == 4) {
    $since = strtotime($scanStartDate) - 4 * $h24;
} elseif ($scanType == 5) {
    $since = strtotime($scanStartDate) - 5 * $h24;
} elseif ($scanType == 6) {
Ejemplo n.º 2
0
 public static function stopScan($completed = false, $failReason = '')
 {
     $scanID = self::$_scanID;
     if (empty($scanID)) {
         $optData = WpsOption::getOption(WpsSettings::WP_FILE_SCAN_OPTION_NAME);
         if (empty($optData)) {
             wssLog('Empty $optData. Checking db table for any incomplete scan.');
             $sid = WsdWpScanner::getLastScanID_table();
             if (empty($sid)) {
                 wssLog('No incomplete scans found either.');
                 return;
             } else {
                 wssLog("Incomplete scan found: {$sid}");
                 $scanID = $sid;
             }
         } else {
             $scanID = $optData['SCAN_ID'];
             if (empty($scanID)) {
                 return;
             }
         }
     }
     $m = __METHOD__ . '() ';
     wssLog($m . 'triggered.');
     if ($completed) {
         self::_markScanCompleted();
     } else {
         wssLog('Fail reason: ' . $failReason);
         self::_markScanFailed($scanID, $failReason);
     }
     WsdWPScanSettings::deleteSettings();
     wssLog('Scan (' . $scanID . ') marked as ' . ($completed ? 'completed' : 'failed') . ' and options deleted.' . PHP_EOL . str_repeat('=', 50));
 }