Update the dependency check logic and the message

We actually need WP 6.7 and above, no matter what Gutenberg version
is installed. This commit updates the check logic and the warning
message to match this requirement.
[MAILPOET-6367]
This commit is contained in:
Rostislav Wolny
2025-01-09 15:22:13 +01:00
committed by Oluwaseun Olorunsola
parent 3f48d088f3
commit 0cb66ecc40
2 changed files with 11 additions and 6 deletions

View File

@@ -28,7 +28,13 @@ class Dependency_Check {
* Checks if all dependencies are met.
*/
public function are_dependencies_met(): bool {
return $this->is_gutenberg_version_compatible() || $this->is_wp_version_compatible();
if ( ! $this->is_wp_version_compatible() ) {
return false;
}
if ( is_plugin_active( 'gutenberg/gutenberg.php' ) ) {
return $this->is_gutenberg_version_compatible();
}
return true;
}
/**
@@ -42,9 +48,8 @@ class Dependency_Check {
* Checks if the WordPress version is supported.
*/
private function is_gutenberg_version_compatible(): bool {
if ( defined( 'GUTENBERG_VERSION' ) ) {
return version_compare( GUTENBERG_VERSION, self::MIN_GUTENBERG_VERSION, '>=' );
}
return false;
$plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/gutenberg/gutenberg.php', false, false );
$version = $plugin_data['Version'] ?? '0.0.0';
return version_compare( $version, self::MIN_GUTENBERG_VERSION, '>=' );
}
}