=' ) ) { /* translators: 1: PHP version. 2: Link opening tag, 3: Link closing tag. */ $this->requirements_errors[] = sprintf( esc_html__( 'PHP is outdated. Update to PHP version %1$s. %2$sShow me how%3$s', 'image-optimization' ), '7.4', '', '' ); $can_start = false; } if ( count( $this->get_missing_extensions_list() ) ) { $missed_extensions = $this->get_missing_extensions_list(); $this->requirements_errors[] = sprintf( esc_html__( 'The following required PHP extensions are missing: %s', 'image-optimization' ), implode( ', ', $missed_extensions ) ); $can_start = false; } if ( ! $this->is_db_json_supported() ) { $this->requirements_errors[] = sprintf( /* translators: 1: MySQL minimum version. 2: MariaDB minimum version. */ esc_html__( 'The database server version is outdated. Update to MySQL version %1$s or MariaDB version %2$s', 'image-optimization' ), '5.7', '10.2' ); $can_start = false; } $upload_dir = wp_upload_dir(); if ( ! wp_is_writable( $upload_dir['basedir'] ) ) { $this->requirements_errors[] = esc_html__( 'Your site doesn’t have the necessary read/write permissions for your file system to use this plugin. Please contact your hosting provider to resolve this matter.', 'image-optimization', ); $can_start = false; } return $can_start; } /** * Returns an array of non-loaded extensions mentioned in self::REQUIRED_EXTENSIONS. * * @return array Missed extensions. */ private function get_missing_extensions_list(): array { $output = []; foreach ( self::REQUIRED_EXTENSIONS as $extension ) { if ( ! extension_loaded( $extension ) ) { $output[] = $extension; } } return $output; } public function is_db_json_supported(): bool { global $wpdb; $result = $wpdb->query(" SELECT JSON_EXTRACT('[1, 2]', '$[1]'); "); return false !== $result; } /** * Renders an admin notice if the setup did not meet requirements. * * @return void */ public function add_requirements_error() { $message = sprintf( /* translators: 1: `