'disabled' ) ); \WP_CLI::log( __( 'The WSAL daily notification is removed', 'wp-security-audit-log' ) ); } /** * Sets the pruning date * * ## OPTIONS * * [--enabled=] * : The boolean (true|false). Default is true. * * [--pruning-value=] * : The time value. Integer numbers only. Default is 6. * * [--pruning-unit=] * : The time unit. Could be either of the following: days, months, years. Default is months. * * @param array $args - The arguments passed. * @param array $assoc_args - The associative array of the arguments passed. * * @return void * * @since 4.6.0 * * @subcommand set_retention */ public function set_retention( $args, $assoc_args ) { $units = array( 'days', 'months', 'years' ); $pruning_enabled = \WP_CLI\Utils\get_flag_value( $assoc_args, 'enabled', 'true' ); $pruning_enabled = trim( $pruning_enabled ); if ( 'false' === $pruning_enabled ) { $pruning_enabled = false; } else { $pruning_enabled = true; } $pruning_date = absint( \WP_CLI\Utils\get_flag_value( $assoc_args, 'pruning-value', 6 ) ); $pruning_unit = \WP_CLI\Utils\get_flag_value( $assoc_args, 'pruning-unit', 'months' ); if ( ! \in_array( $pruning_unit, $units, true ) ) { $pruning_unit = 'months'; } $pruning_date .= ' ' . $pruning_unit; Settings_Helper::set_pruning_date_settings( $pruning_enabled, $pruning_date, $pruning_unit ); \WP_CLI::log( __( 'The WSAL pruning date is set', 'wp-security-audit-log' ) ); } } } }