Skip to content

Commit

Permalink
the counting mechanism is error prone, so the indicator if scans are …
Browse files Browse the repository at this point in the history
…already running should be the actual scheduled crons
  • Loading branch information
ata-no-one committed Oct 18, 2024
1 parent 2f7b95a commit 504922a
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion PluginPage/FullScan/FullScanMenuPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ public function full_scan(): void {
$batch_size = get_option('gdatacyberdefenseag_antivirus_options_full_scan_batch_size', 100);
$it = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(ABSPATH, \FilesystemIterator::SKIP_DOTS));
$files = array();
$this->scans->reset();
foreach ($it as $file_path) {
if (! ( $file_path instanceof \SplFileInfo )) {
continue;
Expand Down Expand Up @@ -302,7 +303,17 @@ public function full_scan_menu(): void {
<?php
$scheduled_scans = $this->scans->scheduled_count();
$finished_scans = $this->scans->finished_count();
if ($scheduled_scans <= $finished_scans) {
$cron_jobs = wp_get_ready_cron_jobs();
$still_running=false;
foreach($cron_jobs as $key => $cron) {
foreach($cron as $name =>$job) {
if ($name=='gdatacyberdefenseag_antivirus_scan_batch') {
$still_running=true;
break;
}
}
}
if ($still_running === false) {
?>
<form action="admin-post.php" method="post">
<input type="hidden" name="action" value="full_scan">
Expand Down

0 comments on commit 504922a

Please sign in to comment.