Skip to content

Commit

Permalink
Send a warning in case Jetpack is pinned but the pinned version is no…
Browse files Browse the repository at this point in the history
…t available anymore (#5093)

* Send a warning in case Jetpack is pinned but the pinned version is not available anymore
  • Loading branch information
rinatkhaziev authored and rebeccahum committed Feb 1, 2024
1 parent 5755bc3 commit 642812d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion jetpack.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/**
* Plugin Name: Jetpack
* Plugin URI: https://jetpack.com
Expand Down Expand Up @@ -596,6 +595,13 @@ function vip_jetpack_load() {

// We should break even if we failed to load Jetpack, because some constants like JETPACK_VERSION were probably already set
break;

// Trigger a E_USER_WARNING in non-production environments if the pinned version could not be loaded.
} elseif ( ! file_exists( $path ) && defined( 'VIP_JETPACK_PINNED_VERSION' ) && wp_in( constant( 'VIP_JETPACK_PINNED_VERSION' ), $path ) ) {
if ( ! defined( 'VIP_GO_APP_ENVIRONMENT' ) || 'production' !== constant( 'VIP_GO_APP_ENVIRONMENT' ) ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
trigger_error( 'Jetpack loading error: ' . constant( 'VIP_JETPACK_PINNED_VERSION' ) . ' could not be loaded, loading ' . constant( 'VIP_JETPACK_DEFAULT_VERSION' ) . ' instead.', E_USER_WARNING );
}
}
}

Expand Down

0 comments on commit 642812d

Please sign in to comment.