@@ -47,6 +47,14 @@ classic-editor
47
47
redirection
48
48
tablepress
49
49
wordpress-importer
50
+ wordpress-seo
51
+ '
52
+ # NOTE: wordfence does not play nice with Docker. Enabling it results in WP-CLI
53
+ # commands taking approximately 13 times longer (ex. 10.8 seconds
54
+ # instead of 0.8 seconds)
55
+ PLUGINS_DEACTIVATE='
56
+ google-analytics-for-wordpress
57
+ wordfence
50
58
'
51
59
THEMES_ACTIVATE='
52
60
vocabulary-theme
@@ -86,9 +94,6 @@ activate_plugins() {
86
94
wpcli plugin activate " ${_plugin} "
87
95
fi
88
96
done
89
- wpcli plugin list --format=csv \
90
- | column -s' ,' -t \
91
- | format_list
92
97
echo
93
98
}
94
99
@@ -112,6 +117,24 @@ activate_themes() {
112
117
}
113
118
114
119
120
+ check_requirements () {
121
+ # Ensure docker daemon is running
122
+ if [[ ! -S /var/run/docker.sock ]]
123
+ then
124
+ error_exit ' docker daemon is not running'
125
+ fi
126
+
127
+ # Ensure docker containers are running:
128
+ for _container in index-web index-wpcli index-wpdb
129
+ do
130
+ if ! docker compose exec " ${_container} " true & > /dev/null
131
+ then
132
+ error_exit " docker container unavailable: ${_container} "
133
+ fi
134
+ done
135
+ }
136
+
137
+
115
138
composer_install () {
116
139
header ' Composer install'
117
140
docker compose run --rm index-composer install --ansi 2>&1 \
@@ -150,6 +173,22 @@ database_update() {
150
173
}
151
174
152
175
176
+ deactivate_plugins () {
177
+ local _bold _plugin _reset
178
+ header ' Deactivate plugins'
179
+ for _plugin in ${PLUGINS_DEACTIVATE}
180
+ do
181
+ if wpcli --no-color --quiet plugin is-active " ${_plugin} " & > /dev/null
182
+ then
183
+ wpcli plugin deactivate " ${_plugin} "
184
+ else
185
+ no_op " ${_plugin} is already inactive"
186
+ fi
187
+ done
188
+ echo
189
+ }
190
+
191
+
153
192
environment_info () {
154
193
local _key _val IFS
155
194
header ' Container information'
@@ -234,6 +273,13 @@ install_wordpress() {
234
273
echo
235
274
}
236
275
276
+ list_plugins () {
277
+ header ' List plugins'
278
+ wpcli plugin list --format=csv \
279
+ | column -s' ,' -t \
280
+ | format_list
281
+ echo
282
+ }
237
283
238
284
no_op () {
239
285
# Print no-op message"
@@ -337,12 +383,15 @@ wpcli() {
337
383
338
384
# ### MAIN #####################################################################
339
385
386
+ check_requirements
340
387
environment_info
341
388
composer_install
342
389
install_wordpress
343
390
update_options
344
391
remove_themes
345
392
activate_plugins
393
+ deactivate_plugins
394
+ list_plugins
346
395
activate_themes
347
396
database_update
348
397
database_optimize
0 commit comments