Beta Tester: Do not run code in tracks debug unless WC_ABSPATH is defined. (#39486)
* Do not run code in tracks debug unless WC_ABSPTAH is defined. * Add changefile(s) from automation for the following project(s): woocommerce-beta-tester * Also avoid registering scripts if Woo is not installed. --------- Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
parent
b14653ede0
commit
d64e1c24dd
|
@ -42,7 +42,7 @@ class Tracks_Debug_Log {
|
|||
*/
|
||||
public function __construct() {
|
||||
// WooCommerce might not be installed/activated between installs of WC versions.
|
||||
if ( class_exists( 'WooCommerce' ) ) {
|
||||
if ( defined( 'WC_ABSPATH' ) ) {
|
||||
include_once WC_ABSPATH . 'includes/tracks/class-wc-tracks-client.php';
|
||||
include_once WC_ABSPATH . 'includes/tracks/class-wc-tracks-footer-pixel.php';
|
||||
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Fix a bug where WC_ABSPATH is used when the WooCommerce instance might not have defined it yet.
|
|
@ -15,10 +15,23 @@ class WC_Beta_Tester_Live_Branches {
|
|||
* Constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
if ( ! $this->woocommerce_is_installed() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
add_action( 'admin_menu', array( $this, 'register_page' ) );
|
||||
add_action( 'admin_init', array( $this, 'register_scripts' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if WooCommerce is installed.
|
||||
*
|
||||
* @return bool - True if WooCommerce is installed, false otherwise.
|
||||
*/
|
||||
private function woocommerce_is_installed() {
|
||||
return class_exists( 'WooCommerce' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register live branches scripts.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue