Skip to content

Commit 9942e79

Browse files
committed
refactor
1 parent e100f5d commit 9942e79

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

hooks/pluginable.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ function str_starts_with($haystack, $needle) {
814814
case 'yes':
815815
if ( file_exists( "/usr/local/hestia/plugins/$plugin.disabled") ) {
816816
rename( "/usr/local/hestia/plugins/$plugin.disabled", "/usr/local/hestia/plugins/$plugin" );
817-
$hcpp->do_action( 'hcpp_plugin_enabled', $plugin );
817+
$hcpp->run( 'invoke-plugin hcpp_plugin_enabled ' . escapeshellarg( $plugin ) );
818818
}
819819
$hcpp->run_install_scripts();
820820
break;
@@ -848,6 +848,16 @@ function str_starts_with($haystack, $needle) {
848848
return $args;
849849
});
850850

851+
// Invoke plugin enabled after plugin is renamed and loaded
852+
$hcpp->add_action( 'hcpp_invoke_plugin', function( $args ) ) {
853+
if ( $args[0] == 'hcpp_plugin_enabled' ) {
854+
$plugin = $args[1];
855+
global $hcpp;
856+
$hcpp->do_action( 'hcpp_plugin_enabled', $plugin );
857+
}
858+
return $args;
859+
}
860+
851861
// List plugins in HestiaCP's Configure Server UI
852862
$hcpp->add_action( 'hcpp_render_page', function( $args ) {
853863
global $hcpp;

0 commit comments

Comments
 (0)