Merged in feature/MAW-855-import-code-into-aws (pull request #2)

code import from pantheon

* code import from pantheon
This commit is contained in:
Tony Volpe
2023-12-04 23:08:14 +00:00
parent 8c9b1312bc
commit 8f4b5efda6
4766 changed files with 185592 additions and 239967 deletions

View File

@@ -17,7 +17,7 @@ class Addon_Installer {
/**
* The minimum Yoast SEO version required.
*/
const MINIMUM_YOAST_SEO_VERSION = '16.4';
const MINIMUM_YOAST_SEO_VERSION = '21.5';
/**
* The base directory for the installer.
@@ -198,13 +198,22 @@ class Addon_Installer {
);
}
/**
* Checks if Yoast SEO is at a minimum required version.
*
* @return bool True if Yoast SEO is at a minimal required version
*/
public static function is_yoast_seo_up_to_date() {
return ( \defined( 'WPSEO_VERSION' ) && \version_compare( \WPSEO_VERSION, self::MINIMUM_YOAST_SEO_VERSION . '-RC0', '>=' ) );
}
/**
* Resets the installation status if Yoast SEO is not installed or outdated.
*
* @return void
*/
public function validate_installation_status() {
if ( ! \defined( 'WPSEO_VERSION' ) || \version_compare( \WPSEO_VERSION, self::MINIMUM_YOAST_SEO_VERSION . '-RC0', '<' ) ) {
if ( ! self::is_yoast_seo_up_to_date() ) {
\delete_option( self::OPTION_KEY );
if ( ! \defined( 'WPSEO_VERSION' ) ) {
$this->load_yoast_seo_from_vendor_directory();
@@ -361,8 +370,9 @@ class Addon_Installer {
* @throws Exception If the move failed.
*/
protected function move_vendor_directory() {
if ( ! \rename( $this->base_dir . '/vendor/yoast/wordpress-seo', $this->yoast_seo_dir ) ) {
throw new Exception( 'Could not automatically installed Yoast SEO' );
// phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged -- Prevent a potential PHP warning on Windows.
if ( ! @\rename( $this->base_dir . '/vendor/yoast/wordpress-seo', $this->yoast_seo_dir ) ) {
throw new Exception( 'Could not automatically install Yoast SEO' );
}
}