fix(bootstrap): 舊外掛互斥偵測改查 active_plugins
WPDO_VERSION 由 class-tmdo-back-compat.php 自行 define 為 TMDO_VERSION, 兩者永遠相等,admin notice 從未觸發;PHPStan L6 認出 notIdentical.alwaysFalse 並卡掉 main run #8 與 v1.0.0 tag 的 Test Gate。改查 active_plugins basename, 與 HP AddOn detector 的偵測方式一致。
This commit is contained in:
@@ -88,7 +88,11 @@ if ( version_compare( PHP_VERSION, TMDO_MIN_PHP, '<' ) ) {
|
|||||||
add_action(
|
add_action(
|
||||||
'admin_notices',
|
'admin_notices',
|
||||||
static function () {
|
static function () {
|
||||||
if ( defined( 'WPDO_VERSION' ) && WPDO_VERSION !== TMDO_VERSION ) {
|
// Deliberately not a WPDO_VERSION comparison: this plugin defines that
|
||||||
|
// constant itself (includes/class-tmdo-back-compat.php), so the two
|
||||||
|
// would always match and the notice could never fire.
|
||||||
|
$tmdo_legacy = 'wp-data-optimizer/wp-data-optimizer.php';
|
||||||
|
if ( in_array( $tmdo_legacy, (array) get_option( 'active_plugins', array() ), true ) ) {
|
||||||
echo '<div class="notice notice-error"><p>';
|
echo '<div class="notice notice-error"><p>';
|
||||||
esc_html_e( '⚠ 偵測到舊版 wp-data-optimizer 已啟用。請停用舊外掛以避免 hook 雙觸發。', '2meet-data-optimizer' );
|
esc_html_e( '⚠ 偵測到舊版 wp-data-optimizer 已啟用。請停用舊外掛以避免 hook 雙觸發。', '2meet-data-optimizer' );
|
||||||
echo '</p></div>';
|
echo '</p></div>';
|
||||||
|
|||||||
Reference in New Issue
Block a user