Skip to content

Commit

Permalink
A2CP-422 added wpcli method to expose is_active
Browse files Browse the repository at this point in the history
  • Loading branch information
jrtaylor-com committed Oct 23, 2023
1 parent 9cd76ec commit 7179b7b
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions core/A2_Optimized_CLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,34 @@ public function site_health($args, $assoc_args) {
}
}

/**
* Returns status of specified security options
*/
public function is_active($args, $assoc_args) {
$optimizations = new A2_Optimized_Optimizations;
$return = array();

$specialMapping = array(
'lock_plugins' => 'lock_editing',
'bcrypt' => 'a2_bcrypt_passwords',
);

if (count($args) > 0) {
$slugs = explode(',', $args[0]);

foreach ($slugs as $slug) {
$name = $slug;
if (array_key_exists($slug, $specialMapping)) {
$name = $specialMapping[$slug];
}
$stat = $optimizations->is_active($name, TRUE);
$return[$slug] = $stat;
}
}

return WP_CLI::line(json_encode($return));
}

/**
* Returns a site health report for the current site
*/
Expand Down

0 comments on commit 7179b7b

Please sign in to comment.