Merge pull request #25830 from woocommerce/fix/wc-admin-system-status-logic
Update system status info about WC Admin.
This commit is contained in:
commit
5ef13786e4
|
@ -127,26 +127,40 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, 'min
|
||||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'The WooCommerce Admin package running on your site.', 'woocommerce' ) ); ?></td>
|
<td class="help"><?php echo wc_help_tip( esc_html__( 'The WooCommerce Admin package running on your site.', 'woocommerce' ) ); ?></td>
|
||||||
<td>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
if ( class_exists( '\Automattic\WooCommerce\Admin\Composer\Package' ) ) {
|
$wc_admin_path = null;
|
||||||
$version = \Automattic\WooCommerce\Admin\Composer\Package::get_active_version();
|
if ( defined( 'WC_ADMIN_VERSION_NUMBER' ) ) {
|
||||||
$package_active = \Automattic\WooCommerce\Admin\Composer\Package::is_package_active();
|
// Plugin version of WC Admin.
|
||||||
$path = \Automattic\WooCommerce\Admin\Composer\Package::get_path(); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
|
|
||||||
} elseif ( defined( 'WC_ADMIN_VERSION_NUMBER' ) ) {
|
|
||||||
$version = WC_ADMIN_VERSION_NUMBER;
|
$version = WC_ADMIN_VERSION_NUMBER;
|
||||||
$package_active = false;
|
$package_active = false;
|
||||||
|
} elseif ( class_exists( '\Automattic\WooCommerce\Admin\Composer\Package' ) ) {
|
||||||
|
if ( WC()->is_wc_admin_active() ) {
|
||||||
|
// Fully active package version of WC Admin.
|
||||||
|
$version = \Automattic\WooCommerce\Admin\Composer\Package::get_active_version();
|
||||||
|
$package_active = \Automattic\WooCommerce\Admin\Composer\Package::is_package_active();
|
||||||
|
} else {
|
||||||
|
// with WP version < 5.3, package is present, but inactive.
|
||||||
|
$version = __( 'Inactive ', 'woocommerce' );
|
||||||
|
$version .= \Automattic\WooCommerce\Admin\Composer\Package::VERSION;
|
||||||
|
$package_active = false;
|
||||||
|
}
|
||||||
|
$wc_admin_path = \Automattic\WooCommerce\Admin\Composer\Package::get_path();
|
||||||
} else {
|
} else {
|
||||||
$version = null;
|
$version = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! is_null( $version ) ) {
|
if ( ! is_null( $version ) ) {
|
||||||
if ( ! isset( $path ) || ! $package_active ) {
|
if ( ! isset( $wc_admin_path ) ) {
|
||||||
if ( defined( 'WC_ADMIN_PLUGIN_FILE' ) ) {
|
if ( defined( 'WC_ADMIN_PLUGIN_FILE' ) ) {
|
||||||
$path = dirname( WC_ADMIN_PLUGIN_FILE ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
|
$wc_admin_path = dirname( WC_ADMIN_PLUGIN_FILE );
|
||||||
} else {
|
} else {
|
||||||
$path = __( 'Active Plugin', 'woocommerce' ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
|
$wc_admin_path = __( 'Active Plugin', 'woocommerce' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo '<mark class="yes"><span class="dashicons dashicons-yes"></span> ' . esc_html( $version ) . ' <code class="private">' . esc_html( $path ) . '</code></mark> ';
|
if ( WC()->is_wc_admin_active() ) {
|
||||||
|
echo '<mark class="yes"><span class="dashicons dashicons-yes"></span> ' . esc_html( $version ) . ' <code class="private">' . esc_html( $wc_admin_path ) . '</code></mark> ';
|
||||||
|
} else {
|
||||||
|
echo '<span class="dashicons dashicons-no-alt"></span> ' . esc_html( $version ) . ' <code class="private">' . esc_html( $wc_admin_path ) . '</code> ';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . esc_html__( 'Unable to detect the WC Admin package.', 'woocommerce' ) . '</mark>';
|
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . esc_html__( 'Unable to detect the WC Admin package.', 'woocommerce' ) . '</mark>';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue