Skip to content

Commit 9ed842b

Browse files
authored
add openemr-cmd ms for maria shell for easy-dev (#374)
* add openemr-cmd ms for maria shell * review changes
1 parent 7973bcb commit 9ed842b

File tree

1 file changed

+27
-14
lines changed

1 file changed

+27
-14
lines changed

utilities/openemr-cmd/openemr-cmd

+27-14
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,24 @@
1010
#################################################################################################
1111

1212
# Increment the version when modify script
13-
VERSION="1.0.15"
13+
VERSION="1.0.16"
1414

1515
# If the docker is snap or non-snap docker
1616
# Setting the container names accordingly
1717
get_container_names() {
18-
snap_docker=$(which docker)
19-
if [ $snap_docker == '/snap/bin/docker' ]
20-
then
21-
INSANE_DEV_DOCKER="openemr-8-2-1"
22-
EASY_DEV_DOCKER="openemr-1"
23-
COUCHDB_DOCKER="couchdb-1"
24-
else
25-
INSANE_DEV_DOCKER="_openemr-8-2_1"
26-
EASY_DEV_DOCKER="_openemr_1"
27-
COUCHDB_DOCKER="_couchdb_1"
28-
fi
18+
snap_docker=$(which docker)
19+
if [ $snap_docker == '/snap/bin/docker' ]
20+
then
21+
INSANE_DEV_DOCKER="openemr-8-2-1"
22+
EASY_DEV_DOCKER="openemr-1"
23+
COUCHDB_DOCKER="couchdb-1"
24+
MARIADB_DOCKER="mysql-1"
25+
else
26+
INSANE_DEV_DOCKER="_openemr-8-2_1"
27+
EASY_DEV_DOCKER="_openemr_1"
28+
COUCHDB_DOCKER="_couchdb_1"
29+
MARIADB_DOCKER="_mysql_1"
30+
fi
2931
}
3032

3133
# Set the container names
@@ -47,6 +49,10 @@ quick_open_a_docker_shell(){
4749
docker exec -w /var/www/localhost/htdocs/openemr -it $CONTAINER_ID sh
4850
}
4951

52+
quick_open_a_maria_docker_shell(){
53+
docker exec -it $MARIADB_CONTAINER_ID /bin/bash
54+
}
55+
5056
execute_command_flexible(){
5157
if [ $# -lt 1 ]
5258
then
@@ -86,7 +92,7 @@ check_docker_names() {
8692
}
8793

8894
restart_couchdb_docker(){
89-
if [ -z $COUCHDB_CONTAINER ]
95+
if [ -z "$COUCHDB_CONTAINER" ]
9096
then
9197
echo "Unable to find the couchdb docker, so could not restart it"
9298
else
@@ -317,6 +323,7 @@ then
317323
echo " start Execute: docker-compose start"
318324
echo " stop Execute: docker-compose stop"
319325
echo " s, shell Open a docker shell quickly"
326+
echo " ms, maria-shell Open a maria docker shell quickly (only works in the easy dev environment)"
320327
echo " e, exec Execute commands outside docker"
321328
echo " dl, docker-log To check docker log"
322329
echo " dn, docker-names To check docker the running docker names"
@@ -404,7 +411,7 @@ then
404411
exit $USAGE_EXIT_CODE
405412
elif [ "$FIRST_ARG" == '--version' ] || [ "$FIRST_ARG" == '-v' ]
406413
then
407-
echo "openemer-cmd $VERSION"
414+
echo "openemr-cmd $VERSION"
408415
exit $VERSION_EXIT_CODE
409416
fi
410417

@@ -436,6 +443,9 @@ fi
436443
#collect the couchdb docker name
437444
COUCHDB_CONTAINER=$(docker ps | grep $COUCHDB_DOCKER | cut -f 1 -d " ")
438445

446+
# Collect the mariadb container id
447+
MARIADB_CONTAINER_ID=$(docker ps | grep $MARIADB_DOCKER | cut -f 1 -d " ")
448+
439449
# See how we were called.
440450
# For the shift usage, it used to cover the insane env.
441451
case "$FIRST_ARG" in
@@ -513,6 +523,9 @@ case "$FIRST_ARG" in
513523
cwo|change-webroot-openemr)
514524
set-webroot openemr
515525
;;
526+
ms|maria-shell)
527+
quick_open_a_maria_docker_shell
528+
;;
516529
bt)
517530
$DOCKER_EXEC_CMD $CONTAINER_ID $SHELL_TYPE "$DEV_TOOLS build-themes"
518531
;;

0 commit comments

Comments
 (0)