Plugin Directory

Changeset 3182942


Ignore:
Timestamp:
11/06/2024 08:21:08 AM (17 months ago)
Author:
gdatavaas
Message:

release 2.1.0

Location:
gdata-antivirus
Files:
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • gdata-antivirus/tags/2.1.0/Infrastructure/Database/FindingsQuery.php

    r3181695 r3182942  
    2626            sha256 VARCHAR(64) NOT NULL,
    2727            request_id VARCHAR(256) NOT NULL,
     28            created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
     29            updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    2830            UNIQUE KEY file_path (file_path)
    2931        )' . $charset_collate . ';';
     
    5759        return \false;
    5860    }
     61    private function exits(string $file_path): bool
     62    {
     63        global $wpdb;
     64        if (!$this->table_exists()) {
     65            return \false;
     66        }
     67        return $wpdb->get_var($wpdb->prepare('SELECT COUNT(*) FROM %i WHERE file_path = %s', $this->get_table_name(), $file_path)) > 0;
     68    }
    5969    public function add(\Gdatacyberdefenseag\GdataAntivirus\Infrastructure\Database\DetectedFile $detected_file): void
    6070    {
    6171        global $wpdb;
     72        assert($wpdb instanceof wpdb);
    6273        if (!$this->table_exists()) {
    6374            return;
    6475        }
    6576        try {
     77            if ($this->exits($detected_file->path)) {
     78                $wpdb->update($this->get_table_name(), array('detection' => $detected_file->detection, 'sha256' => $detected_file->sha256, 'request_id' => $detected_file->request_id), array('file_path' => $detected_file->path));
     79                return;
     80            }
    6681            $wpdb->insert($this->get_table_name(), array('file_path' => $detected_file->path, 'detection' => $detected_file->detection, 'sha256' => $detected_file->sha256, 'request_id' => $detected_file->request_id));
    6782        } catch (\Exception $e) {
     
    92107            return array();
    93108        }
    94         return $wpdb->get_results($wpdb->prepare('SELECT file_path, detection, sha256, request_id FROM %i', $this->get_table_name()), ARRAY_A);
     109        return $wpdb->get_results($wpdb->prepare('SELECT file_path, detection, sha256, request_id, updated_at FROM %i', $this->get_table_name()), ARRAY_A);
    95110    }
    96111    public function count(): int
  • gdata-antivirus/tags/2.1.0/PluginPage/Findings/FindingsMenuPage.php

    r3181695 r3182942  
    9494                                File
    9595                            </th>
     96                            <th scope="col" id="title_file" class="manage-column column-title column-primary">
     97                                Last seen
     98                            </th>
    9699                            <th scope="col" id="title_detection" class="manage-column column-title column-primary">
    97100                                Detection
     
    127130                                        <?php
    128131                    echo esc_html($finding['file_path']);
     132                    ?>
     133                                    </td>
     134                                    <td>
     135                                        <?php
     136                    echo esc_html($finding['updated_at']);
    129137                    ?>
    130138                                    </td>
  • gdata-antivirus/tags/2.1.0/PluginPage/FullScan/FullScanMenuPage.php

    r3181695 r3182942  
    4343            $schedule_start = get_option('gdatacyberdefenseag_antivirus_options_full_scan_schedule_start', '01:00');
    4444            $next = wp_next_scheduled('gdatacyberdefenseag_antivirus_scheduled_full_scan');
    45             if (!$full_scan_enabled && $next) {
     45            if ($full_scan_enabled !== \true && $next) {
    4646                wp_unschedule_event($next, 'gdatacyberdefenseag_antivirus_scheduled_full_scan');
    4747                return;
    4848            }
    49             if ($full_scan_enabled && !$next) {
     49            if ($full_scan_enabled === \true && !$next) {
    5050                $timestamp = strtotime($schedule_start);
    5151                $this->logger->debug('schedule start timestamp: ' . $timestamp);
     
    5454            }
    5555            $nextschedule_start = gmdate('H:i', $next);
    56             if ($nextschedule_start !== $schedule_start) {
     56            if ($full_scan_enabled === \true && $nextschedule_start !== $schedule_start) {
    5757                wp_unschedule_event($next, 'gdatacyberdefenseag_antivirus_scheduled_full_scan');
    5858                $timestamp = strtotime($schedule_start);
     
    146146                    continue;
    147147                }
    148                 // For testing purposes, we only scan files with eicar in the name
     148                // // For testing purposes, we only scan files with eicar in the name
    149149                // if (str_contains($file_path->getPathname(), "eicar") === false) {
    150150                //  continue;
  • gdata-antivirus/tags/2.1.0/Readme.txt

    r3181695 r3182942  
    55Tested up to: 6.6
    66Requires PHP: 8.1
    7 Stable tag: 2.0.9
     7Stable tag: 2.1.0
    88License: GNU General Public License v3.0
    99License URI: https://github.com/GDATASoftwareAG/vaas/blob/main/LICENSE
     
    5757== Changelog ==
    5858
     59= 2.1.0 =
     60* bugfix: [full scan runs in loop](https://github.com/GDATASoftwareAG/wordpress-gdata-antivirus/issues/37)
     61* bugifx: fails on duplicate key when detecting the same file twice
     62
    5963= 2.0.9 =
    6064* bugfix: reconnect on long running scans
  • gdata-antivirus/tags/2.1.0/composer.json

    r3181695 r3182942  
    11{
    22    "name": "gdatacyberdefenseag\/gdata-antivirus",
    3     "version": "2.0.9",
     3    "version": "2.1.0",
    44    "autoload": {
    55        "psr-4": {
  • gdata-antivirus/tags/2.1.0/gdata-antivirus.php

    r3181695 r3182942  
    1212 * @wordpress-plugin
    1313 * Plugin Name: G DATA Antivirus
    14  * Version: 2.0.9
     14 * Version: 2.1.0
    1515 * Requires at least: 6.2
    1616 * Tested up to: 6.6
  • gdata-antivirus/trunk/Infrastructure/Database/FindingsQuery.php

    r3181695 r3182942  
    2626            sha256 VARCHAR(64) NOT NULL,
    2727            request_id VARCHAR(256) NOT NULL,
     28            created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
     29            updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    2830            UNIQUE KEY file_path (file_path)
    2931        )' . $charset_collate . ';';
     
    5759        return \false;
    5860    }
     61    private function exits(string $file_path): bool
     62    {
     63        global $wpdb;
     64        if (!$this->table_exists()) {
     65            return \false;
     66        }
     67        return $wpdb->get_var($wpdb->prepare('SELECT COUNT(*) FROM %i WHERE file_path = %s', $this->get_table_name(), $file_path)) > 0;
     68    }
    5969    public function add(\Gdatacyberdefenseag\GdataAntivirus\Infrastructure\Database\DetectedFile $detected_file): void
    6070    {
    6171        global $wpdb;
     72        assert($wpdb instanceof wpdb);
    6273        if (!$this->table_exists()) {
    6374            return;
    6475        }
    6576        try {
     77            if ($this->exits($detected_file->path)) {
     78                $wpdb->update($this->get_table_name(), array('detection' => $detected_file->detection, 'sha256' => $detected_file->sha256, 'request_id' => $detected_file->request_id), array('file_path' => $detected_file->path));
     79                return;
     80            }
    6681            $wpdb->insert($this->get_table_name(), array('file_path' => $detected_file->path, 'detection' => $detected_file->detection, 'sha256' => $detected_file->sha256, 'request_id' => $detected_file->request_id));
    6782        } catch (\Exception $e) {
     
    92107            return array();
    93108        }
    94         return $wpdb->get_results($wpdb->prepare('SELECT file_path, detection, sha256, request_id FROM %i', $this->get_table_name()), ARRAY_A);
     109        return $wpdb->get_results($wpdb->prepare('SELECT file_path, detection, sha256, request_id, updated_at FROM %i', $this->get_table_name()), ARRAY_A);
    95110    }
    96111    public function count(): int
  • gdata-antivirus/trunk/PluginPage/Findings/FindingsMenuPage.php

    r3181695 r3182942  
    9494                                File
    9595                            </th>
     96                            <th scope="col" id="title_file" class="manage-column column-title column-primary">
     97                                Last seen
     98                            </th>
    9699                            <th scope="col" id="title_detection" class="manage-column column-title column-primary">
    97100                                Detection
     
    127130                                        <?php
    128131                    echo esc_html($finding['file_path']);
     132                    ?>
     133                                    </td>
     134                                    <td>
     135                                        <?php
     136                    echo esc_html($finding['updated_at']);
    129137                    ?>
    130138                                    </td>
  • gdata-antivirus/trunk/PluginPage/FullScan/FullScanMenuPage.php

    r3181695 r3182942  
    4343            $schedule_start = get_option('gdatacyberdefenseag_antivirus_options_full_scan_schedule_start', '01:00');
    4444            $next = wp_next_scheduled('gdatacyberdefenseag_antivirus_scheduled_full_scan');
    45             if (!$full_scan_enabled && $next) {
     45            if ($full_scan_enabled !== \true && $next) {
    4646                wp_unschedule_event($next, 'gdatacyberdefenseag_antivirus_scheduled_full_scan');
    4747                return;
    4848            }
    49             if ($full_scan_enabled && !$next) {
     49            if ($full_scan_enabled === \true && !$next) {
    5050                $timestamp = strtotime($schedule_start);
    5151                $this->logger->debug('schedule start timestamp: ' . $timestamp);
     
    5454            }
    5555            $nextschedule_start = gmdate('H:i', $next);
    56             if ($nextschedule_start !== $schedule_start) {
     56            if ($full_scan_enabled === \true && $nextschedule_start !== $schedule_start) {
    5757                wp_unschedule_event($next, 'gdatacyberdefenseag_antivirus_scheduled_full_scan');
    5858                $timestamp = strtotime($schedule_start);
     
    146146                    continue;
    147147                }
    148                 // For testing purposes, we only scan files with eicar in the name
     148                // // For testing purposes, we only scan files with eicar in the name
    149149                // if (str_contains($file_path->getPathname(), "eicar") === false) {
    150150                //  continue;
  • gdata-antivirus/trunk/Readme.txt

    r3181695 r3182942  
    55Tested up to: 6.6
    66Requires PHP: 8.1
    7 Stable tag: 2.0.9
     7Stable tag: 2.1.0
    88License: GNU General Public License v3.0
    99License URI: https://github.com/GDATASoftwareAG/vaas/blob/main/LICENSE
     
    5757== Changelog ==
    5858
     59= 2.1.0 =
     60* bugfix: [full scan runs in loop](https://github.com/GDATASoftwareAG/wordpress-gdata-antivirus/issues/37)
     61* bugifx: fails on duplicate key when detecting the same file twice
     62
    5963= 2.0.9 =
    6064* bugfix: reconnect on long running scans
  • gdata-antivirus/trunk/composer.json

    r3181695 r3182942  
    11{
    22    "name": "gdatacyberdefenseag\/gdata-antivirus",
    3     "version": "2.0.9",
     3    "version": "2.1.0",
    44    "autoload": {
    55        "psr-4": {
  • gdata-antivirus/trunk/gdata-antivirus.php

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