Skip to content

Commit a27f64f

Browse files
committed
* 1.5.1 Added: filter plugin version numbers for typos
1 parent 9566e08 commit a27f64f

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
**MainWP check vulnerability extension**
22

33
**Changelog:**
4+
* 1.5.1 Added: filter plugin version numbers for typos
45
* 1.5.0 Added feed selection option and feed data in transient
56
* Change: adapted scanner feed from file storage to transient
67
* Fix: max execution time error

class/class-dashboard.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,12 @@ public static function hhdev_mwpcpv_render_page() {
274274
$plugin_slug = explode('/', $plugin['slug']);
275275
$slug = $plugin_slug[0];
276276

277+
//print_r($slug);
278+
277279
foreach ( $file as $key => $plugin_data) {
278280

281+
//print_r($slug);
282+
279283
if($plugin_data['slug'] == $slug) {
280284

281285
// is patched?
@@ -292,7 +296,17 @@ public static function hhdev_mwpcpv_render_page() {
292296
$compare = '<';
293297
if($to_inclusive) $compare = '<=';
294298

295-
// if ($slug == 'wp-mail-logging') echo '<p>vuln version: '.$vuln_version.' -> plugin: '.$plugin['version'].'-> '.$plugin_data['title'].'</p>';
299+
// if ($slug == 'wp-mail-logging') echo '<p>vuln version: '.$vuln_version.' -> plugin: '.$plugin['version'].'-> '.$plugin_data['title'].'</p>';
300+
//print_r('vuln: ' . $vuln_version);
301+
//print_r('plugin: ' . $plugin['version']);
302+
303+
// fix for typo's in WF database on version numbers
304+
if(str_ends_with($vuln_version, '.')) $vuln_version = rtrim($vuln_version, '.');
305+
//print_r($vuln_version.'<br>');
306+
307+
// also check the plugin version
308+
if(str_ends_with($plugin['version'], '.')) $plugin['version'] = rtrim($plugin['version'], '.');
309+
296310

297311
if($MainWPCheckPluginVulnerabilityActivator->hhdev_plugin_needs_update($plugin['version'],$vuln_version,$compare)) {
298312

hhdev-mwpcpv.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: MainWP Check Plugins Vulnerability Extension
44
* Plugin URI: https://haha.nl
55
* Description: MainWP Extension: Use this extension to check the installed child site plugins for vulnerabilities using data from the wordfence vulnerability data feed api.
6-
* Version: 1.5.0
6+
* Version: 1.5.1
77
* Author: herbert hoekstra - haha!
88
* Author URI: https://haha.nl
99
* Documentation URI: https://haha.nl/voorbeelden/mainwp-check-plugins-vulnerability-extension/
@@ -43,7 +43,7 @@ class MainWPCheckPluginVulnerabilityActivator
4343
protected $childFile;
4444
protected $plugin_handle = 'mainwp-check-plugins-vulnerability';
4545
protected $product_id = 'MainWP Check Plugins Vulnerability Extension';
46-
protected $software_version = '1.5.0'; // used for mwp update notice
46+
protected $software_version = '1.5.1'; // used for mwp update notice
4747

4848
// set custom plugin vars
4949
// -------------------
@@ -444,7 +444,8 @@ private function mwpcpv_transient_set_data($data,$feed='prod') {
444444
if ( !empty( $data ) ) {
445445

446446
$data = json_decode($data); // get feed data
447-
set_transient( $transient_name, $data, 1 * HOUR_IN_SECONDS ); // 24 hour expire transient
447+
set_transient( $transient_name, $data, WEEK_IN_SECONDS ); // 1 week expire transient
448+
// this forces to not autoload the transient.
448449
return true;
449450
}
450451

0 commit comments

Comments
 (0)