Skip to content

Commit 2ef423b

Browse files
committed
Add hook for auth command
Signed-off-by: Kirtan Gajjar <kirtangajjar95@gmail.com>
1 parent e930bab commit 2ef423b

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

admin-tools-command.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,15 @@
1818
}
1919

2020
EE::add_command( 'admin-tools', 'Admin_Tools_Command' );
21+
22+
23+
EE::add_hook('before_invoke:admin-tools up', function ( $args, $assoc_args ) {
24+
$site = \EE\Site\Utils\auto_site_name( $args, 'admin-tools', 'up' );
25+
$fs = new \Symfony\Component\Filesystem\Filesystem();
26+
27+
if ( ! is_array( EE::get_runner()->find_command_to_run( [ 'auth' ] ) ) ) {
28+
EE::error( 'Auth command needs to be registered for admin_tools' );
29+
}
30+
31+
EE::launch_self( 'auth', [ 'create', 'global' ], [], false );
32+
});

0 commit comments

Comments
 (0)