Skip to content

Commit 0623453

Browse files
committed
Use Site model instead of db calls.
Use auto_site_name instead of set_site_arg Signed-off-by: Kirtan Gajjar <kirtangajjar95@gmail.com>
1 parent daae25b commit 0623453

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

src/Shell_Command.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,16 @@ class Shell_Command extends EE_Command {
2525
*/
2626
public function __invoke( $args ) {
2727
EE\Utils\delem_log( 'ee shell start' );
28-
$args = EE\Utils\set_site_arg( $args, 'shell' );
28+
$args = EE\SiteUtils\auto_site_name( $args, 'shell', '' );
2929
$site_name = EE\Utils\remove_trailing_slash( $args[0] );
30-
if ( EE::db()::site_in_db( $site_name ) ) {
31-
$db_select = EE::db()::select( ['site_path'], ['sitename' => $site_name]);
32-
$site_root = $db_select[0]['site_path'];
33-
} else {
30+
31+
$site = Site::find( $site_name );
32+
33+
if ( ! $site ) {
3434
EE::error( "Site $site_name does not exist." );
3535
}
36-
chdir($site_root);
36+
37+
chdir( $site->site_fs_path );
3738
$this->run( "docker-compose exec --user='www-data' php bash" );
3839
EE\Utils\delem_log( 'ee shell end' );
3940
}
@@ -43,7 +44,7 @@ private function run( $cmd, $descriptors = null ) {
4344
if ( ! $descriptors ) {
4445
$descriptors = array( STDIN, STDOUT, STDERR );
4546
}
46-
47+
4748
$final_cmd = EE\Utils\force_env_on_nix_systems( $cmd );
4849
$proc = EE\Utils\proc_open_compat( $final_cmd, $descriptors, $pipes );
4950
if ( ! $proc ) {

0 commit comments

Comments
 (0)