Include the package autoloader in the main wc file
This commit is contained in:
parent
5b105d0c7f
commit
06bdfa67fd
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
<!-- Configs -->
|
<!-- Configs -->
|
||||||
<config name="minimum_supported_wp_version" value="4.7" />
|
<config name="minimum_supported_wp_version" value="4.7" />
|
||||||
<config name="testVersion" value="5.2-" />
|
<config name="testVersion" value="5.6-" />
|
||||||
|
|
||||||
<!-- Rules -->
|
<!-- Rules -->
|
||||||
<rule ref="WooCommerce-Core" />
|
<rule ref="WooCommerce-Core" />
|
||||||
|
|
|
@ -14,11 +14,50 @@
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
// Define WC_PLUGIN_FILE.
|
|
||||||
if ( ! defined( 'WC_PLUGIN_FILE' ) ) {
|
if ( ! defined( 'WC_PLUGIN_FILE' ) ) {
|
||||||
define( 'WC_PLUGIN_FILE', __FILE__ );
|
define( 'WC_PLUGIN_FILE', __FILE__ );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load all the packages.
|
||||||
|
*
|
||||||
|
* We want to fail gracefully if `composer install` has not been executed yet, so we are checking for the autoloader.
|
||||||
|
* If the autoloader is not present, let's log the failure and display a nice admin notice.
|
||||||
|
*/
|
||||||
|
$autoloader = dirname( __FILE__ ) . '/vendor/autoload_packages.php';
|
||||||
|
if ( is_readable( $autoloader ) ) {
|
||||||
|
require $autoloader;
|
||||||
|
} else {
|
||||||
|
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
|
||||||
|
error_log( // phpcs:ignore
|
||||||
|
esc_html__( 'Your installation of WooCommerce is incomplete. If you installed WooCommerce from GitHub, please refer to this document to set up your development environment: https://github.com/woocommerce/woocommerce/wiki/How-to-set-up-WooCommerce-development-environment', 'woocommerce' )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Outputs an admin notice for folks running WooCommerce without having run composer install.
|
||||||
|
*/
|
||||||
|
add_action(
|
||||||
|
'admin_notices',
|
||||||
|
function() {
|
||||||
|
?>
|
||||||
|
<div class="notice notice-error">
|
||||||
|
<p>
|
||||||
|
<?php
|
||||||
|
printf(
|
||||||
|
/* translators: 1: is a link to a support document. 2: closing link */
|
||||||
|
esc_html__( 'Your installation of WooCommerce is incomplete. If you installed WooCommerce from GitHub, %1$splease refer to this document%2$s to set up your development environment.', 'woocommerce' ),
|
||||||
|
'<a href="' . esc_url( 'https://github.com/woocommerce/woocommerce/wiki/How-to-set-up-WooCommerce-development-environment' ) . '" target="_blank" rel="noopener noreferrer">',
|
||||||
|
'</a>'
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Include the main WooCommerce class.
|
// Include the main WooCommerce class.
|
||||||
if ( ! class_exists( 'WooCommerce' ) ) {
|
if ( ! class_exists( 'WooCommerce' ) ) {
|
||||||
include_once dirname( __FILE__ ) . '/includes/class-woocommerce.php';
|
include_once dirname( __FILE__ ) . '/includes/class-woocommerce.php';
|
||||||
|
|
Loading…
Reference in New Issue