WP_CLI
Runner::check_wp_version()
Method of the class: Runner{}
No Hooks.
Return
null
. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->check_wp_version();
Runner::check_wp_version() Runner::check wp version code WP-CLI 2.8.0-alpha
private function check_wp_version() { $wp_exists = $this->wp_exists(); $wp_is_readable = $this->wp_is_readable(); if ( ! $wp_exists || ! $wp_is_readable ) { $this->show_synopsis_if_composite_command(); // If the command doesn't exist use as error. $args = $this->cmd_starts_with( [ 'help' ] ) ? array_slice( $this->arguments, 1 ) : $this->arguments; $suggestion_or_disabled = $this->find_command_to_run( $args ); if ( is_string( $suggestion_or_disabled ) ) { if ( ! preg_match( '/disabled from the config file.$/', $suggestion_or_disabled ) ) { WP_CLI::warning( "No WordPress installation found. If the command '" . implode( ' ', $args ) . "' is in a plugin or theme, pass --path=`path/to/wordpress`." ); } WP_CLI::error( $suggestion_or_disabled ); } if ( $wp_exists && ! $wp_is_readable ) { WP_CLI::error( 'It seems, the WordPress core files do not have the proper file permissions.' ); } WP_CLI::error( "This does not seem to be a WordPress installation.\n" . 'The used path is: ' . ABSPATH . "\n" . 'Pass --path=`path/to/wordpress` or run `wp core download`.' ); } global $wp_version; include ABSPATH . 'wp-includes/version.php'; $minimum_version = '3.7'; if ( version_compare( $wp_version, $minimum_version, '<' ) ) { WP_CLI::error( "WP-CLI needs WordPress $minimum_version or later to work properly. " . "The version currently installed is $wp_version.\n" . 'Try running `wp core download --force`.' ); } }