route( '/system', array( 'methods' => \WP_REST_Server::READABLE, 'callback' => array( $this, 'get_system' ), ) ); } /** * Handles GET /system. * * @return \WP_REST_Response */ public function get_system() { $queue = array( 'pending' => null, 'failed' => null, ); if ( function_exists( 'as_get_scheduled_actions' ) ) { $queue['pending'] = count( as_get_scheduled_actions( array( 'group' => Installer::GROUP, 'status' => 'pending', 'per_page' => 500, ), 'ids' ) ); $queue['failed'] = count( as_get_scheduled_actions( array( 'group' => Installer::GROUP, 'status' => 'failed', 'per_page' => 500, ), 'ids' ) ); } $info = array( 'plugin' => RECAST_VERSION, 'dbVersion' => (int) get_option( Installer::OPTION_DB_VERSION, 0 ), 'wordpress' => get_bloginfo( 'version' ), 'php' => PHP_VERSION, 'woocommerce' => defined( 'WC_VERSION' ) ? WC_VERSION : null, 'subscriptions' => class_exists( 'WC_Subscriptions' ) ? (string) \WC_Subscriptions::$version : null, 'hpos' => Hpos::is_enabled(), 'actionScheduler' => function_exists( 'as_enqueue_async_action' ), 'queue' => $queue, 'settings' => array_combine( array_map( static function ( $key ) { return substr( $key, strlen( 'recast_' ) ); }, array_keys( Settings::defaults() ) ), array_map( array( Settings::class, 'get' ), array_keys( Settings::defaults() ) ) ), ); /** * Filters the system information. * * @param array $info Information. */ return $this->respond( apply_filters( 'recast_system_info', $info ) ); } }