Changeset 3182942
- Timestamp:
- 11/06/2024 08:21:08 AM (17 months ago)
- Location:
- gdata-antivirus
- Files:
-
- 12 edited
- 1 copied
-
tags/2.1.0 (copied) (copied from gdata-antivirus/trunk)
-
tags/2.1.0/Infrastructure/Database/FindingsQuery.php (modified) (3 diffs)
-
tags/2.1.0/PluginPage/Findings/FindingsMenuPage.php (modified) (2 diffs)
-
tags/2.1.0/PluginPage/FullScan/FullScanMenuPage.php (modified) (3 diffs)
-
tags/2.1.0/Readme.txt (modified) (2 diffs)
-
tags/2.1.0/composer.json (modified) (1 diff)
-
tags/2.1.0/gdata-antivirus.php (modified) (1 diff)
-
trunk/Infrastructure/Database/FindingsQuery.php (modified) (3 diffs)
-
trunk/PluginPage/Findings/FindingsMenuPage.php (modified) (2 diffs)
-
trunk/PluginPage/FullScan/FullScanMenuPage.php (modified) (3 diffs)
-
trunk/Readme.txt (modified) (2 diffs)
-
trunk/composer.json (modified) (1 diff)
-
trunk/gdata-antivirus.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
gdata-antivirus/tags/2.1.0/Infrastructure/Database/FindingsQuery.php
r3181695 r3182942 26 26 sha256 VARCHAR(64) NOT NULL, 27 27 request_id VARCHAR(256) NOT NULL, 28 created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, 29 updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, 28 30 UNIQUE KEY file_path (file_path) 29 31 )' . $charset_collate . ';'; … … 57 59 return \false; 58 60 } 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 } 59 69 public function add(\Gdatacyberdefenseag\GdataAntivirus\Infrastructure\Database\DetectedFile $detected_file): void 60 70 { 61 71 global $wpdb; 72 assert($wpdb instanceof wpdb); 62 73 if (!$this->table_exists()) { 63 74 return; 64 75 } 65 76 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 } 66 81 $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)); 67 82 } catch (\Exception $e) { … … 92 107 return array(); 93 108 } 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); 95 110 } 96 111 public function count(): int -
gdata-antivirus/tags/2.1.0/PluginPage/Findings/FindingsMenuPage.php
r3181695 r3182942 94 94 File 95 95 </th> 96 <th scope="col" id="title_file" class="manage-column column-title column-primary"> 97 Last seen 98 </th> 96 99 <th scope="col" id="title_detection" class="manage-column column-title column-primary"> 97 100 Detection … … 127 130 <?php 128 131 echo esc_html($finding['file_path']); 132 ?> 133 </td> 134 <td> 135 <?php 136 echo esc_html($finding['updated_at']); 129 137 ?> 130 138 </td> -
gdata-antivirus/tags/2.1.0/PluginPage/FullScan/FullScanMenuPage.php
r3181695 r3182942 43 43 $schedule_start = get_option('gdatacyberdefenseag_antivirus_options_full_scan_schedule_start', '01:00'); 44 44 $next = wp_next_scheduled('gdatacyberdefenseag_antivirus_scheduled_full_scan'); 45 if ( !$full_scan_enabled&& $next) {45 if ($full_scan_enabled !== \true && $next) { 46 46 wp_unschedule_event($next, 'gdatacyberdefenseag_antivirus_scheduled_full_scan'); 47 47 return; 48 48 } 49 if ($full_scan_enabled && !$next) {49 if ($full_scan_enabled === \true && !$next) { 50 50 $timestamp = strtotime($schedule_start); 51 51 $this->logger->debug('schedule start timestamp: ' . $timestamp); … … 54 54 } 55 55 $nextschedule_start = gmdate('H:i', $next); 56 if ($ nextschedule_start !== $schedule_start) {56 if ($full_scan_enabled === \true && $nextschedule_start !== $schedule_start) { 57 57 wp_unschedule_event($next, 'gdatacyberdefenseag_antivirus_scheduled_full_scan'); 58 58 $timestamp = strtotime($schedule_start); … … 146 146 continue; 147 147 } 148 // For testing purposes, we only scan files with eicar in the name148 // // For testing purposes, we only scan files with eicar in the name 149 149 // if (str_contains($file_path->getPathname(), "eicar") === false) { 150 150 // continue; -
gdata-antivirus/tags/2.1.0/Readme.txt
r3181695 r3182942 5 5 Tested up to: 6.6 6 6 Requires PHP: 8.1 7 Stable tag: 2. 0.97 Stable tag: 2.1.0 8 8 License: GNU General Public License v3.0 9 9 License URI: https://github.com/GDATASoftwareAG/vaas/blob/main/LICENSE … … 57 57 == Changelog == 58 58 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 59 63 = 2.0.9 = 60 64 * bugfix: reconnect on long running scans -
gdata-antivirus/tags/2.1.0/composer.json
r3181695 r3182942 1 1 { 2 2 "name": "gdatacyberdefenseag\/gdata-antivirus", 3 "version": "2. 0.9",3 "version": "2.1.0", 4 4 "autoload": { 5 5 "psr-4": { -
gdata-antivirus/tags/2.1.0/gdata-antivirus.php
r3181695 r3182942 12 12 * @wordpress-plugin 13 13 * Plugin Name: G DATA Antivirus 14 * Version: 2. 0.914 * Version: 2.1.0 15 15 * Requires at least: 6.2 16 16 * Tested up to: 6.6 -
gdata-antivirus/trunk/Infrastructure/Database/FindingsQuery.php
r3181695 r3182942 26 26 sha256 VARCHAR(64) NOT NULL, 27 27 request_id VARCHAR(256) NOT NULL, 28 created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, 29 updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, 28 30 UNIQUE KEY file_path (file_path) 29 31 )' . $charset_collate . ';'; … … 57 59 return \false; 58 60 } 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 } 59 69 public function add(\Gdatacyberdefenseag\GdataAntivirus\Infrastructure\Database\DetectedFile $detected_file): void 60 70 { 61 71 global $wpdb; 72 assert($wpdb instanceof wpdb); 62 73 if (!$this->table_exists()) { 63 74 return; 64 75 } 65 76 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 } 66 81 $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)); 67 82 } catch (\Exception $e) { … … 92 107 return array(); 93 108 } 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); 95 110 } 96 111 public function count(): int -
gdata-antivirus/trunk/PluginPage/Findings/FindingsMenuPage.php
r3181695 r3182942 94 94 File 95 95 </th> 96 <th scope="col" id="title_file" class="manage-column column-title column-primary"> 97 Last seen 98 </th> 96 99 <th scope="col" id="title_detection" class="manage-column column-title column-primary"> 97 100 Detection … … 127 130 <?php 128 131 echo esc_html($finding['file_path']); 132 ?> 133 </td> 134 <td> 135 <?php 136 echo esc_html($finding['updated_at']); 129 137 ?> 130 138 </td> -
gdata-antivirus/trunk/PluginPage/FullScan/FullScanMenuPage.php
r3181695 r3182942 43 43 $schedule_start = get_option('gdatacyberdefenseag_antivirus_options_full_scan_schedule_start', '01:00'); 44 44 $next = wp_next_scheduled('gdatacyberdefenseag_antivirus_scheduled_full_scan'); 45 if ( !$full_scan_enabled&& $next) {45 if ($full_scan_enabled !== \true && $next) { 46 46 wp_unschedule_event($next, 'gdatacyberdefenseag_antivirus_scheduled_full_scan'); 47 47 return; 48 48 } 49 if ($full_scan_enabled && !$next) {49 if ($full_scan_enabled === \true && !$next) { 50 50 $timestamp = strtotime($schedule_start); 51 51 $this->logger->debug('schedule start timestamp: ' . $timestamp); … … 54 54 } 55 55 $nextschedule_start = gmdate('H:i', $next); 56 if ($ nextschedule_start !== $schedule_start) {56 if ($full_scan_enabled === \true && $nextschedule_start !== $schedule_start) { 57 57 wp_unschedule_event($next, 'gdatacyberdefenseag_antivirus_scheduled_full_scan'); 58 58 $timestamp = strtotime($schedule_start); … … 146 146 continue; 147 147 } 148 // For testing purposes, we only scan files with eicar in the name148 // // For testing purposes, we only scan files with eicar in the name 149 149 // if (str_contains($file_path->getPathname(), "eicar") === false) { 150 150 // continue; -
gdata-antivirus/trunk/Readme.txt
r3181695 r3182942 5 5 Tested up to: 6.6 6 6 Requires PHP: 8.1 7 Stable tag: 2. 0.97 Stable tag: 2.1.0 8 8 License: GNU General Public License v3.0 9 9 License URI: https://github.com/GDATASoftwareAG/vaas/blob/main/LICENSE … … 57 57 == Changelog == 58 58 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 59 63 = 2.0.9 = 60 64 * bugfix: reconnect on long running scans -
gdata-antivirus/trunk/composer.json
r3181695 r3182942 1 1 { 2 2 "name": "gdatacyberdefenseag\/gdata-antivirus", 3 "version": "2. 0.9",3 "version": "2.1.0", 4 4 "autoload": { 5 5 "psr-4": { -
gdata-antivirus/trunk/gdata-antivirus.php
r3181695 r3182942 12 12 * @wordpress-plugin 13 13 * Plugin Name: G DATA Antivirus 14 * Version: 2. 0.914 * Version: 2.1.0 15 15 * Requires at least: 6.2 16 16 * Tested up to: 6.6
Note: See TracChangeset
for help on using the changeset viewer.