From ca42deb9654b1b2a5bdff2d2cd1064aa35af52a1 Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Thu, 9 Jan 2025 09:40:41 +0000 Subject: [PATCH 1/2] The plugin must have the bootstrap complete before running the activation hook --- php/class-plugin.php | 1 - php/class-utils.php | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/php/class-plugin.php b/php/class-plugin.php index 7aecee44..9e63ff55 100644 --- a/php/class-plugin.php +++ b/php/class-plugin.php @@ -421,7 +421,6 @@ private function is_notice_component( $component ) { * @return void */ public function init() { - require_once ABSPATH . 'wp-admin/includes/plugin.php'; $plugin = get_plugin_data( CLDN_CORE ); $location = $this->locate_plugin(); $this->slug = ! empty( $plugin['TextDomain'] ) ? $plugin['TextDomain'] : $location['dir_basename']; diff --git a/php/class-utils.php b/php/class-utils.php index cd573606..0f774118 100644 --- a/php/class-utils.php +++ b/php/class-utils.php @@ -331,6 +331,8 @@ protected static function table_installed() { * Install our custom table. */ public static function install() { + // Ensure that the plugin bootstrap is loaded. + get_plugin_instance()->init(); $sql = self::get_table_sql(); From 2cbcc5c620f12a0df732b52ea0129b84a36a19f4 Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Mon, 13 Jan 2025 14:34:47 +0000 Subject: [PATCH 2/2] Require the `plugin.php` as it is essencial on new installs --- php/class-plugin.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/php/class-plugin.php b/php/class-plugin.php index 9e63ff55..c2cc2683 100644 --- a/php/class-plugin.php +++ b/php/class-plugin.php @@ -421,6 +421,8 @@ private function is_notice_component( $component ) { * @return void */ public function init() { + require_once ABSPATH . 'wp-admin/includes/plugin.php'; + $plugin = get_plugin_data( CLDN_CORE ); $location = $this->locate_plugin(); $this->slug = ! empty( $plugin['TextDomain'] ) ? $plugin['TextDomain'] : $location['dir_basename'];