Skip to content

Commit c727661

Browse files
committed
Fix installer
1 parent 7b9fa53 commit c727661

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

includes/class-wc-product-tables-install.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,6 @@
1111
*/
1212
class WC_Product_Tables_Install {
1313

14-
/**
15-
* Constructor
16-
*
17-
* @return void
18-
*/
19-
public function __construct() {
20-
register_activation_hook( WC_PRODUCT_TABLES_FILE, array( __CLASS__, 'activate' ) );
21-
}
22-
2314
/**
2415
* Activate function, runs on plugin activation
2516
*
@@ -129,5 +120,3 @@ public static function activate() {
129120
dbDelta( $tables );
130121
}
131122
}
132-
133-
new WC_Product_Tables_Install();

woocommerce-product-tables-feature-plugin.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
exit;
2121
}
2222

23+
define( 'WC_PRODUCT_TABLES_FILE', __FILE__ );
24+
2325
/**
2426
* Admin notice for when WooCommerce not installed
2527
*
@@ -31,8 +33,6 @@ function wc_custom_product_tables_need_wc() {
3133

3234
/**
3335
* Bootstrap function, loads everything up.
34-
*
35-
* @return void
3636
*/
3737
function wc_custom_product_tables_bootstrap() {
3838
if ( ! class_exists( 'WooCommerce' ) ) {
@@ -47,10 +47,18 @@ function wc_custom_product_tables_bootstrap() {
4747
return;
4848
}
4949

50-
define( 'WC_PRODUCT_TABLES_FILE', __FILE__ );
51-
5250
// Include the main bootstrap class.
5351
require_once dirname( __FILE__ ) . '/includes/class-wc-product-tables-bootstrap.php';
5452
}
5553

5654
add_action( 'plugins_loaded', 'wc_custom_product_tables_bootstrap' );
55+
56+
/**
57+
* Runs on activation.
58+
*/
59+
function wc_custom_product_tables_activate() {
60+
include_once dirname( __FILE__ ) . '/includes/class-wc-product-tables-install.php';
61+
WC_Product_Tables_Install::activate();
62+
}
63+
64+
register_activation_hook( WC_PRODUCT_TABLES_FILE, 'wc_custom_product_tables_activate' );

0 commit comments

Comments
 (0)