Skip to content

Commit 60885f2

Browse files
committed
Add method from auth utils to initialize global admin tools
Signed-off-by: Kirtan Gajjar <kirtangajjar95@gmail.com>
1 parent 85906f9 commit 60885f2

2 files changed

Lines changed: 6 additions & 19 deletions

File tree

admin-tools-command.php

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,9 @@
1313
}
1414

1515
$autoload = dirname( __FILE__ ) . '/vendor/autoload.php';
16+
1617
if ( file_exists( $autoload ) ) {
1718
require_once $autoload;
1819
}
1920

2021
EE::add_command( 'admin-tools', 'Admin_Tools_Command' );
21-
22-
23-
EE::add_hook('before_invoke:admin-tools up', 'init_global_auth' );
24-
25-
/**
26-
* Initialize global auth if it's not present.
27-
*
28-
* @throws \EE\ExitException
29-
*/
30-
function init_global_auth() {
31-
if ( ! is_array( EE::get_runner()->find_command_to_run( [ 'auth' ] ) ) ) {
32-
EE::error( 'Auth command needs to be registered for mailhog' );
33-
}
34-
35-
EE::run_command( [ 'auth', 'init' ] );
36-
}

src/Admin_Tools_Command.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
* @package ee-cli
1212
*/
1313

14+
use Composer\Console\Application;
1415
use EE\Model\Site;
15-
use \Symfony\Component\Filesystem\Filesystem;
16-
use \Composer\Console\Application;
17-
use \Symfony\Component\Console\Input\ArrayInput;
16+
use Symfony\Component\Console\Input\ArrayInput;
17+
use Symfony\Component\Filesystem\Filesystem;
1818
use function EE\Site\Utils\auto_site_name;
1919

2020
class Admin_Tools_Command extends EE_Command {
@@ -100,6 +100,8 @@ public function install() {
100100
*/
101101
public function up( $args, $assoc_args ) {
102102

103+
\EE\Auth\Utils\init_global_admin_tools_auth();
104+
103105
EE\Utils\delem_log( 'admin-tools ' . __FUNCTION__ . ' start' );
104106
$args = auto_site_name( $args, $this->command, __FUNCTION__ );
105107
$force = EE\Utils\get_flag_value( $assoc_args, 'force' );

0 commit comments

Comments
 (0)