|
@@ -4,8 +4,9 @@ set -eu
|
|
|
|
|
|
readonly WP="/app/code/wp --allow-root"
|
|
|
|
|
|
-# Detect the wordpress prefix from existing database
|
|
|
-table_prefix=$(mysql --user=${MYSQL_USERNAME} --password=${MYSQL_PASSWORD} --host=${MYSQL_HOST} ${MYSQL_DATABASE} -e 'SHOW TABLES' --batch 2>/dev/null | sed -n 's/\(.*_\)usermeta/\1/p')
|
|
|
+# Detect the wordpress prefix from existing database. This is a bit of a hack because some wordpress plugins
|
|
|
+# seem to leave the old wp_ tables behind.
|
|
|
+table_prefix=$(mysql --user=${MYSQL_USERNAME} --password=${MYSQL_PASSWORD} --host=${MYSQL_HOST} ${MYSQL_DATABASE} -e 'SHOW TABLES' --batch 2>/dev/null | sed -n 's/\(.*_\)usermeta/\1/p' | grep -v ^wp_ | head -n1)
|
|
|
[[ -n "${table_prefix}" ]] || table_prefix="wp_"
|
|
|
echo "Using table prefix ${table_prefix}"
|
|
|
|