From 9942e79e0e61883de3fd315f674f3fd523026404 Mon Sep 17 00:00:00 2001 From: Stephen J Carnam Date: Tue, 8 Aug 2023 19:27:46 -0700 Subject: [PATCH] refactor --- hooks/pluginable.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/hooks/pluginable.php b/hooks/pluginable.php index efbdfad..4a2ff45 100644 --- a/hooks/pluginable.php +++ b/hooks/pluginable.php @@ -814,7 +814,7 @@ function str_starts_with($haystack, $needle) { case 'yes': if ( file_exists( "/usr/local/hestia/plugins/$plugin.disabled") ) { rename( "/usr/local/hestia/plugins/$plugin.disabled", "/usr/local/hestia/plugins/$plugin" ); - $hcpp->do_action( 'hcpp_plugin_enabled', $plugin ); + $hcpp->run( 'invoke-plugin hcpp_plugin_enabled ' . escapeshellarg( $plugin ) ); } $hcpp->run_install_scripts(); break; @@ -848,6 +848,16 @@ function str_starts_with($haystack, $needle) { return $args; }); + // Invoke plugin enabled after plugin is renamed and loaded + $hcpp->add_action( 'hcpp_invoke_plugin', function( $args ) ) { + if ( $args[0] == 'hcpp_plugin_enabled' ) { + $plugin = $args[1]; + global $hcpp; + $hcpp->do_action( 'hcpp_plugin_enabled', $plugin ); + } + return $args; + } + // List plugins in HestiaCP's Configure Server UI $hcpp->add_action( 'hcpp_render_page', function( $args ) { global $hcpp;