Skip to content

Commit a4e6950

Browse files
committed
more mariadb checks
1 parent f847213 commit a4e6950

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

templates/install-wp-tests.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,11 @@ recreate_db() {
153153
shopt -s nocasematch
154154
if [[ $1 =~ ^(y|yes)$ ]]
155155
then
156-
mysqladmin drop $DB_NAME -f --user="$DB_USER" --password="$DB_PASS"$EXTRA
156+
if [ `which mariadb-admin` ]; then
157+
mariadb-admin drop $DB_NAME -f --user="$DB_USER" --password="$DB_PASS"$EXTRA
158+
else
159+
mysqladmin drop $DB_NAME -f --user="$DB_USER" --password="$DB_PASS"$EXTRA
160+
fi
157161
create_db
158162
echo "Recreated the database ($DB_NAME)."
159163
else
@@ -193,7 +197,12 @@ install_db() {
193197
fi
194198

195199
# create database
196-
if [ $(mysql --user="$DB_USER" --password="$DB_PASS"$EXTRA --execute='show databases;' | grep ^$DB_NAME$) ]
200+
if [ `which mariadb` ]; then
201+
local DB_CLIENT='mariadb'
202+
else
203+
local DB_CLIENT='mysql'
204+
fi
205+
if [ $($DB_CLIENT --user="$DB_USER" --password="$DB_PASS"$EXTRA --execute='show databases;' | grep ^$DB_NAME$) ]
197206
then
198207
echo "Reinstalling will delete the existing test database ($DB_NAME)"
199208
read -p 'Are you sure you want to proceed? [y/N]: ' DELETE_EXISTING_DB

0 commit comments

Comments
 (0)