Created
August 9, 2023 14:01
-
-
Save paulgoodchild/47b805de8b1ed42dac6da3e2bdd37f25 to your computer and use it in GitHub Desktop.
Triggering on-demand scans on Shield Security Pro for WordPress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php declare( strict_types=1 ); | |
use FernleafSystems\Wordpress\Plugin\Shield\Modules\HackGuard\Scan\Controller; | |
/** | |
* Launching on-demand scans for Shield Security can be done using the function outlined below. | |
* It requires a single array parameter that contains the so-called "slugs" of the respective scans. | |
* | |
* Shield currently has 3 distinct scan types, namely: | |
* - AFS: file scanner, (WordPress, plugin, themes, malware scan) | |
* - APC: abandoned plugin scanner, | |
* - WPV: vulnerability scanner | |
* | |
* They are each uniquely identified throughout the system by their SCAN_SLUG property. These slugs are what | |
* is needed to be passed to the function. There is no need to pass them all, just pass the ones you need. | |
* | |
* Use of this function requires an active ShieldPRO Plus+ license or higher. | |
* | |
* You can call this function at any time after the 'plugins_loaded' hook has been triggered, to ensure that | |
* the Shield plugin has been initialised. If you know you might be calling it early, use `function_exists()` | |
* to determine whether it's available, to avoid errors. | |
* | |
* The example below triggers an on-demand scan for all 3 scan type. Again, supply only the scan types you need. | |
* | |
* @since 18.2.7 | |
*/ | |
// ... my custom code | |
if ( \function_exists( 'shield_start_scans' ) ) { | |
shield_start_scans( [ | |
Controller\Afs::SCAN_SLUG, // Shield's file scanner | |
Controller\Apc::SCAN_SLUG, // Shield's abandoned plugin scanner | |
Controller\Wpv::SCAN_SLUG, // Shield's vulnerability scanner | |
] ); | |
} | |
// ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment