JezK
Edit File: AccelerateWpMaxCache.php
<?php /** * Copyright (с) Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2023 All Rights Reserved */ namespace WP_Rocket\Cli; use Exception; use WP_CLI; /** * AccelerateWp MaxCache */ class AccelerateWpMaxCache { /** * Run. * * @param array $args args. * @param array $assoc_args args. * * @return void * @throws Exception Something went wrong. */ public function run( $args = [], $assoc_args = [] ) { $subcommand = ''; if ( array_key_exists( 0, $args ) ) { $subcommand = $args[0]; } if ( ! empty( $subcommand ) && 0 !== strcasecmp( $subcommand, __FUNCTION__ ) && method_exists( $this, $subcommand ) ) { $this->$subcommand( $args, $assoc_args ); } else { WP_CLI::error( 'Subcommand not found' ); } } /** * Enable. * * @param array $args args. Unused. * @param array $assoc_args args. Unused. * * @return void * @throws Exception Something went wrong. */ private function enable( $args = [], $assoc_args = [] ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed try { do_action( 'accelerate_wp_maxcache_enable' ); WP_CLI::success( 'Enabled.' ); } catch ( Exception $e ) { $code = $e->getCode() > 0 ? $e->getCode() : 1; WP_CLI::error( $e->getMessage(), $code ); } } /** * Disable. * * @param array $args args. Unused. * @param array $assoc_args args. Unused. * * @return void * @throws Exception Something went wrong. */ private function disable( $args = [], $assoc_args = [] ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed try { do_action( 'accelerate_wp_maxcache_disable' ); WP_CLI::success( 'Disabled.' ); } catch ( Exception $e ) { $code = $e->getCode() > 0 ? $e->getCode() : 1; WP_CLI::error( $e->getMessage(), $code ); } } }