You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: empty-site-single.sh
+9-17Lines changed: 9 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,13 @@
1
-
#!/bin/bash
1
+
#!/bin/env bash
2
2
#
3
3
# A script for emptying an individual network site and leaving an empty site.
4
4
#
5
5
# NOTE: Some PHP scripts may not like to be loaded via the command line. In some cases you can
6
6
# check if 'cli' === php_sapi_name() and return out of a function. If you see any PHP errors while
7
7
# running this script, you may want to start there.
8
8
9
+
source'source/includes.sh';
10
+
9
11
# Script version
10
12
version='1.0.3';
11
13
@@ -30,21 +32,11 @@ if [[ $current_dir =~ "$production_dir" ]]; then
30
32
echo
31
33
fi
32
34
33
-
# Make sure that WP-CLI is installed.
34
-
if [[ "$(which wp 2>/dev/null)"=="" ]];then
35
-
echo
36
-
echo"The WP-CLI command line interface could not be found. It is required for this script to run."
37
-
echo
38
-
echo"Visit https://wp-cli.org/ to get WP-CLI."
39
-
echo
40
-
exit
41
-
fi
42
-
43
35
while [[ -z$site_id ]];do
44
36
read -p "Please provide the Site ID: " site_id;
45
37
done;
46
38
47
-
site_url="$(wp db query "SELECT option_value FROM wp_${site_id}_options WHERE option_name = 'siteurl'" --skip-themes --skip-plugins --allow-root --skip-column-names)";
39
+
site_url="$(wp_skip_all db query "SELECT option_value FROM wp_${site_id}_options WHERE option_name = 'siteurl'" --skip-column-names)";
48
40
site_url="${site_url}/";
49
41
50
42
if [[ -z$site_url ]];then
@@ -110,13 +102,13 @@ site_options_exclude_regex=${site_options_exclude_regex::-1} # remove the last p
0 commit comments