Skip to content

Commit 6d35f3e

Browse files
committed
only update wp_blogs and wp_domain_mapping tables if they exist (they only exist for WordPress Multisite Networks)
1 parent 31a3fd4 commit 6d35f3e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

bin/wp-pull-remote.sh

+14
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ create_temp_dir() {
4141
db_update_domain_wp_blogs() {
4242
headerone 'DEST_HOST: Updating domain in wp_blogs table'
4343
pushd ${DEST_WP_DIR} >/dev/null
44+
if ! wp db query "SHOW CREATE TABLE wp_blogs" &>/dev/null
45+
then
46+
echo 'Table wp_blogs does not exist. Skipping.'
47+
echo
48+
popd >/dev/null
49+
return
50+
fi
4451
wp db query "
4552
SELECT domain AS 'domain__contains__DEST_DOMAIN'
4653
FROM wp_blogs
@@ -63,6 +70,13 @@ db_update_domain_wp_blogs() {
6370
db_update_domain_wp_domain_mapping() {
6471
headerone 'DEST_HOST: Updating domain in wp_domain_mapping table'
6572
pushd ${DEST_WP_DIR} >/dev/null
73+
if ! wp db query "SHOW CREATE TABLE wp_domain_mapping" &>/dev/null
74+
then
75+
echo 'Table wp_domain_mapping does not exist. Skipping.'
76+
echo
77+
popd >/dev/null
78+
return
79+
fi
6680
wp db query "
6781
SELECT domain AS 'domain__contains__SOURCE_DOMAIN'
6882
FROM wp_domain_mapping

0 commit comments

Comments
 (0)