diff --git a/.devcontainer/configureWordPress.sh b/.devcontainer/configureWordPress.sh index d59f091..edde6f2 100644 --- a/.devcontainer/configureWordPress.sh +++ b/.devcontainer/configureWordPress.sh @@ -9,7 +9,6 @@ do echo "waiting for WordPress to be installed" sleep 2 done -composer install docker exec -it --user www-data gdata-antivirus-app-1 bash -c "wp plugin uninstall hello" docker exec -it --user www-data gdata-antivirus-app-1 bash -c "wp plugin uninstall akismet" diff --git a/Readme.txt b/Readme.txt index 2861fa7..74b54f0 100644 --- a/Readme.txt +++ b/Readme.txt @@ -56,6 +56,15 @@ While the released code is hosted on the WordPress svn, we develop the plugin on == Changelog == += 2.0.8 = +* bugfix: posts could not be saved + += 2.0.7 = +* enable upload scan by removing the nonce check temporary + += 2.0.6 = +* changed the full scan indicator. the counting method was error prone + = 2.0.5 = * don't connect to the backend for every page load diff --git a/Vaas/ScanClient.php b/Vaas/ScanClient.php index 1cc1de2..dbfe49c 100644 --- a/Vaas/ScanClient.php +++ b/Vaas/ScanClient.php @@ -50,7 +50,7 @@ public function __construct( $post_scan_enabled = (bool) get_option('gdatacyberdefenseag_antivirus_options_on_demand_scan_post_scan_enabled', true); if ($post_scan_enabled === true) { - add_filter('wp_insert_post_data', array( $this, 'scan_post' ), 10, 3); + add_filter('wp_insert_post_data', array( $this, 'scan_post' ), 10, 1); } } @@ -87,8 +87,7 @@ public function connect() { $this->connected = true; } - public function scan_post( $data, $postdata, $unsanitized_postarr ) { - $data = wp_unslash($unsanitized_postarr); + public function scan_post( $data ) { if (empty($data['post_content'])) { return $data; } @@ -98,11 +97,7 @@ public function scan_post( $data, $postdata, $unsanitized_postarr ) { return $data; } - if (empty($postdata['post_content'])) { - return $data; - } - - $post_content = wp_unslash($postdata['post_content']); + $post_content = wp_unslash($data['post_content']); $stream = $this->file_system->get_resource_stream_from_string($post_content); $this->connect(); @@ -128,7 +123,7 @@ public function scan_post( $data, $postdata, $unsanitized_postarr ) { $this->logger->debug('gdata-antivirus: virus found in post'); wp_die(esc_html__('virus found', 'gdata-antivirus')); } - return $postdata; + return $data; } public function scan_comment( $commentdata ) { diff --git a/scoper.sh b/scoper.sh index 26f5ccf..fe1b5b8 100644 --- a/scoper.sh +++ b/scoper.sh @@ -1,9 +1,11 @@ #!/bin/bash set -e -composer install --no-dev rm -rf scoped-code/ -php-scoper add-prefix +composer install --no-dev +php-scoper add-prefix --force +composer install --no-dev + mv scoped-code/vendor/netresearch/jsonmapper/src/JsonMapper/Exception.php scoped-code/vendor/netresearch/jsonmapper/src/JsonMapper/JsonMapper_Exception.php mv scoped-code/vendor/netresearch/jsonmapper/src/JsonMapper.php scoped-code/vendor/netresearch/jsonmapper/src/JsonMapper/JsonMapper.php composer dump-autoload --working-dir scoped-code/ --classmap-authoritative