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)); }
<?php if (!WsdUtil::canLoad()) { return; } if (!WsdUtil::isAdministrator()) { return; } $progress = WsdWPScanSettings::getSetting('SCAN_PROGRESS'); if ($progress == WsdWPScanSettings::SCAN_PROGRESS_NONE) { $currentlyScanning = 'nothing'; } elseif ($progress == WsdWPScanSettings::SCAN_PROGRESS_ROOT) { $currentlyScanning = '<strong>root</strong> directory'; } elseif ($progress == WsdWPScanSettings::SCAN_PROGRESS_ADMIN) { $currentlyScanning = '<strong>wp-admin</strong> directory'; } elseif ($progress == WsdWPScanSettings::SCAN_PROGRESS_CONTENT) { $currentlyScanning = '<strong>wp-content</strong> directory'; } elseif ($progress == WsdWPScanSettings::SCAN_PROGRESS_INCLUDES) { $currentlyScanning = '<strong>wp-includes</strong> directory'; } ?> <style type="text/css"> #progressBar { width: 400px; padding: 0 0; line-height: normal; } #step { display:block; background: #e0e0e0; border: solid 1px #bebebe;padding: 3px 0; margin: 0 0; line-height: normal; text-align: center;} #step span { font-weight: 800; color: #000; font-size: 12px; } </style> <h3 style="margin-bottom: 2px;">Scan State: In Progress</h3> <hr style="height:1px; color: #eee; margin-top: 0; width: 75%;"/> <div id="progressBar"><p id="step"><span></span></p></div>
} elseif (2 == $result) { $eInfo['error'] = "Internal Error: could not retrieve the ID for the last added scan."; } elseif (3 === $result) { $eInfo['message'] = "Scan successfully registered. It should start in approximately 1 minute. You can come back later on to check on its status."; $scanSettings = WsdWPScanSettings::getSettings(); $scanProgress = $scanSettings['SCAN_PROGRESS']; $scanState = $scanSettings['SCAN_STATE']; $scanType = $scanSettings['SCAN_TYPE']; $enableSubmit = false; } } else { $eInfo['error'] = "Invalid form."; } } } else { $scanSettings = WsdWPScanSettings::getSettings(); $scanProgress = $scanSettings['SCAN_PROGRESS']; $scanState = $scanSettings['SCAN_STATE']; $scanType = $scanSettings['SCAN_TYPE']; $enableSubmit = in_array($scanState, array(WsdWPScanSettings::SCAN_STATE_DONE, WsdWPScanSettings::SCAN_STATE_NONE)) ? true : false; } //#! Whether or not to show the scan form $showScanForm = !(isset($_GET) && !empty($_GET['scan'])); ?> <style type="text/css"> .wsdplugin_alert_section_title{ float: none; clear: both; padding: 0 0 !important; } .wsdplugin_alert_section_title p { font-size: 14px; margin: 10px 7px; line-height: normal; } #wpCoreScanWrapper, #wpCoreScanReportWrapper { margin: 0 0; display: block; clear: both; } #wpScanForm { margin-top: 25px;} #scanStateWrapper {margin-top: 35px;} [class^="icon-"], [class*=" icon-"] { margin-top: 0 !important;}