Plugin Directory

Changeset 3171281


Ignore:
Timestamp:
10/18/2024 08:07:21 AM (18 months ago)
Author:
gdatavaas
Message:

release 2.0.5

Location:
gdata-antivirus
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • gdata-antivirus/trunk/Readme.txt

    r3170097 r3171281  
    55Tested up to: 6.6
    66Requires PHP: 8.1
    7 Stable tag: 2.0.4
     7Stable tag: 2.0.5
    88License: GNU General Public License v3.0
    99License URI: https://github.com/GDATASoftwareAG/vaas/blob/main/LICENSE
     
    5757== Changelog ==
    5858
     59= 2.0.5 =
     60* don't connect to the backend for every page load
     61
    5962= 2.0.2 =
    6063* also fix the bug for another failure case
  • gdata-antivirus/trunk/Vaas/ScanClient.php

    r3170097 r3171281  
    2020        private IGdataAntivirusFileSystem $file_system;
    2121        private AdminNotices $admin_notices;
     22        private bool $connected = \false;
    2223        public function __construct(LoggerInterface $logger, \Gdatacyberdefenseag\GdataAntivirus\Vaas\VaasOptions $vaas_options, IGdataAntivirusFileSystem $file_system, AdminNotices $admin_notices)
    2324        {
     
    2728            $this->file_system = $file_system;
    2829            $this->admin_notices = $admin_notices;
    29             try {
    30                 $this->Connect();
    31             } catch (\Exception $e) {
    32                 $this->admin_notices->add_notice($e->getMessage());
    33                 $this->logger->error("VaaS connection failed. Please verify if the VaaS-Url is correct.");
    34                 return;
    35             }
    3630            $plugin_upload_scan_enabled = (bool) get_option('gdatacyberdefenseag_antivirus_options_on_demand_scan_plugin_upload_scan_enabled', \true);
    3731            $media_upload_scan_enabled = (bool) get_option('gdatacyberdefenseag_antivirus_options_on_demand_scan_media_upload_scan_enabled', \true);
     
    5246            }
    5347        }
     48        public function reconnect()
     49        {
     50            $this->connected = \false;
     51            $this->connect();
     52        }
    5453        public function connect()
    5554        {
     55            if ($this->connected === \true) {
     56                return;
     57            }
    5658            $options = $this->vaas_options->get_options();
    5759            $this->vaas = new Vaas($options['vaas_url'], $this->logger, new VaasParameters(\false, \false));
     
    6668                $this->vaas->connect($client_credentials_grant_authenticator->getToken());
    6769            }
     70            $this->connected = \true;
    6871        }
    6972        public function scan_post($data, $postdata, $unsanitized_postarr)
     
    8285            $post_content = wp_unslash($postdata['post_content']);
    8386            $stream = $this->file_system->get_resource_stream_from_string($post_content);
     87            $this->connect();
    8488            try {
    8589                $verdict = $this->vaas->ForStream($stream);
    8690            } catch (VaasInvalidStateException $e) {
    8791                try {
    88                     $this->connect();
     92                    $this->reconnect();
    8993                    $verdict = $this->vaas->ForStream($stream);
    9094                } catch (\Exception $e) {
     
    130134            $commend_content = wp_unslash($commentdata['comment_content']);
    131135            $stream = $this->file_system->get_resource_stream_from_string($commend_content);
     136            $this->connect();
    132137            try {
    133138                $verdict = $this->vaas->ForStream($stream);
    134139            } catch (VaasInvalidStateException $e) {
    135140                try {
    136                     $this->connect();
     141                    $this->reconnect();
    137142                    $verdict = $this->vaas->ForStream($stream);
    138143                } catch (\Exception $e) {
     
    191196        public function scan_file($file_path): Verdict
    192197        {
     198            $this->connect();
    193199            try {
    194200                $verdict = $this->vaas->ForFile($file_path)->Verdict;
     201            } catch (VaasInvalidStateException $e) {
     202                try {
     203                    $this->reconnect();
     204                    $verdict = $this->vaas->ForFile($file_path)->Verdict;
     205                } catch (\Exception $e) {
     206                    $this->logger->debug($e->getMessage());
     207                    return Verdict::UNKNOWN;
     208                }
    195209            } catch (\Exception $e) {
    196210                $this->logger->debug($e->getMessage());
  • gdata-antivirus/trunk/composer.json

    r3170097 r3171281  
    11{
    22    "name": "gdatacyberdefenseag\/gdata-antivirus",
    3     "version": "2.0.4",
     3    "version": "2.0.5",
    44    "autoload": {
    55        "psr-4": {
  • gdata-antivirus/trunk/gdata-antivirus.php

    r3170097 r3171281  
    1212 * @wordpress-plugin
    1313 * Plugin Name: G DATA Antivirus
    14  * Version: 2.0.4
     14 * Version: 2.0.5
    1515 * Requires at least: 6.2
    1616 * Tested up to: 6.6
Note: See TracChangeset for help on using the changeset viewer.