Skip to content

Commit bd18640

Browse files
committed
Merge branch 'mrrobot47-fix/auto_detect_sitename' into develop-v4
2 parents 70247c6 + 98d01f1 commit bd18640

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

php/utils.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,18 +1575,22 @@ function get_site_name() {
15751575
* Function to set the site-name in the args when ee is running in a site folder and the site-name has not been passed in the args. If the site-name could not be found it will throw an error.
15761576
*
15771577
* @param array $args The passed arguments.
1578-
* @param String $command The command passing the arguments to aut=detect site-name.
1578+
* @param String $command The command passing the arguments to auto-detect site-name.
1579+
* @param bool $arg_zero Site-name will be present in the first argument. Default true.
15791580
*
15801581
* @return array Arguments with site-name set.
15811582
*/
1582-
function set_site_arg( $args, $command ) {
1583+
function set_site_arg( $args, $command, $arg_zero=true ) {
15831584
if ( isset( $args[0] ) ) {
15841585
if ( EE::db()::site_in_db( $args[0] ) ) {
15851586
return $args;
15861587
}
15871588
}
15881589
$site_name = get_site_name();
15891590
if ( $site_name ) {
1591+
if ( isset( $args[0] ) && $arg_zero ) {
1592+
EE::error( $args[0] . " is not a valid site-name. Did you mean `ee $command $site_name`?" );
1593+
}
15901594
array_unshift( $args, $site_name );
15911595
} else {
15921596
EE::error( "Could not find the site you wish to run $command command on.\nEither pass it as an argument: `ee $command <site-name>` \nor run `ee $command` from inside the site folder." );

0 commit comments

Comments
 (0)