Skip to content

Commit

Permalink
fix namespaceing in scoped code
Browse files Browse the repository at this point in the history
  • Loading branch information
ata-no-one committed Oct 16, 2024
1 parent 1a0b3a5 commit bc4aa38
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/configureWordPress.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ docker exec -it --user www-data gdata-antivirus-app-1 bash -c "wp plugin install
docker exec -it --user www-data gdata-antivirus-app-1 bash -c "wp plugin activate plugin-check"
docker exec -it --user www-data gdata-antivirus-app-1 bash -c "wp plugin activate gdata-antivirus"

svn co https://plugins.svn.wordpress.org/gdata-antivirus/
svn co https://plugins.svn.wordpress.org/gdata-antivirus/ svn
2 changes: 1 addition & 1 deletion PluginPage/FullScan/FullScanMenuPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public function full_scan(): void {
$this->admin_notices->add_notice(__('Full Scan started', 'gdata-antivirus'));

$batch_size = get_option('gdatacyberdefenseag_antivirus_options_full_scan_batch_size', 100);
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(ABSPATH, \FilesystemIterator::SKIP_DOTS));
$it = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(ABSPATH, \FilesystemIterator::SKIP_DOTS));
$files = array();
foreach ($it as $file_path) {
if (! ( $file_path instanceof \SplFileInfo )) {
Expand Down
24 changes: 18 additions & 6 deletions Vaas/ScanClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use VaasSdk\Vaas;
use VaasSdk\Authentication\ClientCredentialsGrantAuthenticator;
use VaasSdk\Authentication\ResourceOwnerPasswordGrantAuthenticator;
use VaasSdk\Exceptions\VaasInvalidStateException;
use VaasSdk\Message\Verdict;
use VaasSdk\VaasOptions as VaasParameters;

Expand Down Expand Up @@ -103,9 +104,15 @@ public function scan_post( $data, $postdata, $unsanitized_postarr ) {

try {
$verdict = $this->vaas->ForStream($stream);
} catch (\VaasSdk\Exceptions\VaasInvalidStateException $e) {
$this->connect();
$verdict = $this->vaas->ForStream($stream);
} catch (VaasInvalidStateException $e) {
try {
$this->connect();
$verdict = $this->vaas->ForStream($stream);
} catch (\Exception $e) {
$this->admin_notices->add_notice(esc_html__('virus scan failed', 'gdata-antivirus'));
$this->logger->debug($e->getMessage());
return $data;
}
} catch (\Exception $e) {
$this->admin_notices->add_notice(esc_html__('virus scan failed', 'gdata-antivirus'));
$this->logger->debug($e->getMessage());
Expand Down Expand Up @@ -149,9 +156,14 @@ public function scan_comment( $commentdata ) {
$stream = $this->file_system->get_resource_stream_from_string($commend_content);
try {
$verdict = $this->vaas->ForStream($stream);
} catch (\VaasSdk\Exceptions\VaasInvalidStateException $e) {
$this->connect();
$verdict = $this->vaas->ForStream($stream);
} catch (VaasInvalidStateException $e) {
try {
$this->connect();
$verdict = $this->vaas->ForStream($stream);
} catch (\Exception $e) {
$this->admin_notices->add_notice(esc_html__('virus scan failed', 'gdata-antivirus'));
$this->logger->debug($e->getMessage());
}
} catch (\Exception $e) {
$this->admin_notices->add_notice(esc_html__('virus scan failed', 'gdata-antivirus'));
$this->logger->debug($e->getMessage());
Expand Down

0 comments on commit bc4aa38

Please sign in to comment.