#!/bin/bash #################################################################################################### #### author: SlickStack ############################################################################ #### link: https://slickstack.io ################################################################### #### mirror: https://mirrors.slickstack.io/bash/ss-install-wordpress-mu-plugins.txt ################ #### path: /var/www/ss-install-wordpress-mu-plugins ################################################ #### destination: n/a (not a boilerplate) ########################################################## #### purpose: Reinstalls all the WordPress MU plugins for SlickStack servers (idempotent) ########## #### module version: WordPress 5.9.x ############################################################### #### sourced by: ss-install ######################################################################## #### bash aliases: ss install wordpress|wp mu plugins, ss install mu plugins ####################### #################################################################################################### ## SS-CONFIG MUST BE PROPERLY CONFIGURED AND ON CURRENT BUILD BEFORE RUNNING SS-INSTALL ## ## ENSURE YOUR SS-CONFIG BUILD REMAINS CURRENT BY RUNNING SS-UPDATE OCCASIONALLY ## ## source ss-config ## source /var/www/ss-config ## source ss-functions ## source /var/www/ss-functions ## BELOW THIS RELIES ON SS-CONFIG AND SS-FUNCTIONS #################################################################################################### #### TABLE OF CONTENTS (SS-Install-WordPress-MU-Plugins) ########################################### #################################################################################################### ## this is a brief summary of the different code snippets you will find in this script ## ## each section should be commented so you understand what is being accomplished ## #################################################################################################### #### SS-Install-WordPress-MU-Plugins: Touch Timestamp File ######################################### #################################################################################################### ## this is a dummy timestamp file that will remember the last time this script was run ## ## it can be useful for developer reference and is sometimes used by SlickStack ## ## script timestamp ## ss_touch "${TIMESTAMP_SS_INSTALL_WORDPRESS_MU_PLUGINS}" #################################################################################################### #### SS-Install-WordPress-MU-Plugins: Message (Begin Script) ####################################### #################################################################################################### ## this is a simple message that announces to the shell the purpose of this bash script ## ## it will only be noticed by sudo users who manually call ss core bash scripts ## ## echo message ## echo -e "${COLOR_INFO}Running ss-install-wordpress-mu-plugins: Reinstalls all the WordPress MU plugins for SlickStack servers (idempotent)... ${NOCOLOR}" sleep "$SLEEP_MESSAGE_BEGIN" #################################################################################################### #### SS-Install-WordPress-MU-Plugins: Cleanup Temporary Files ###################################### #################################################################################################### ## delete tmp files ## ss_rm /tmp/autoloader* ss_rm /tmp/custom-functions* ss_rm /tmp/functions* ss_rm /tmp/xxx-* ss_rm /tmp/object-cache* ss_rm /tmp/redis-cache* ss_rm /tmp/clear-caches* ss_rm /tmp/cloudflare* ss_rm /tmp/dashboard-cleanup* ss_rm /tmp/delete-expired-transients* ss_rm /tmp/disable-attachment-pages* ss_rm /tmp/disable-default-runner* ss_rm /tmp/disable-emails* ss_rm /tmp/disable-embeds* ss_rm /tmp/disable-emojis* ss_rm /tmp/disable-empty-trash* ss_rm /tmp/disable-gutenberg* ss_rm /tmp/disable-image-compression* ss_rm /tmp/disable-post-via-email* ss_rm /tmp/disable-xml-rpc* ss_rm /tmp/error-log-monitor* ss_rm /tmp/force-https* ss_rm /tmp/force-strong-hashing* ss_rm /tmp/header-cleanup* ss_rm /tmp/limit-heartbeat* ss_rm /tmp/minify-html* ss_rm /tmp/plugin-blacklist* ss_rm /tmp/remove-query-strings* ss_rm /tmp/virtual-robotstxt* ## delete (custom) MU plugins temporary files ## # (coming soon) #################################################################################################### #### SS-Muplugs: Ensure MU (Must-Use) Directory Exists + Delete Current MU Plugins ################# #################################################################################################### ## install Linux utilities (Zip, Unzip) in case missing ## apt install zip unzip > /dev/null 2>&1 ## ensure MU (Must-Use) plugins directory exists ## mkdir /var/www/html/wp-content/mu-plugins ss_rm /var/www/html/wp-content/mu-plugins/* if [[ "${DEV_SITE}" == "true" ]]; then mkdir /var/www/html/dev/wp-content/mu-plugins ss_rm /var/www/html/dev/wp-content/mu-plugins/* fi if [[ "${STAGING_SITE}" == "true" ]]; then mkdir /var/www/html/staging/wp-content/mu-plugins ss_rm /var/www/html/staging/wp-content/mu-plugins/* fi #################################################################################################### #### SS-Muplugs: Install Required MU (Must-Use) Plugins + Object Cache ############################# #################################################################################################### ## download Autoloader (required script) files ## wget -O /tmp/autoloader.php "$MIRROR_AUTOLOADER_PHP" ## download XXX Notices (required MU plugins) files ## wget -O /tmp/xxx-common.php "$MIRROR_XXX_COMMON_PHP" ## staging site ## wget -O /tmp/disable-emails.zip "$MIRROR_DISABLE_EMAILS_ZIP" wget -O /tmp/disable-default-runner.zip "$MIRROR_DISABLE_DEFAULT_RUNNER_ZIP" ## dev site ?? ## ## download Object Cache (required drop-in plugin) files ## wget -O /tmp/object-cache.php "$MIRROR_OBJECT_CACHE_PHP_TILL" # wget -O /tmp/redis-cache.zip "$MIRROR_REDIS_CACHE_ZIP" # unzip /tmp/redis-cache.zip -d /tmp ## unzip various files ## unzip /tmp/disable-emails.zip -d /tmp unzip /tmp/disable-default-runner.zip -d /tmp ## delete potentially conflicting normal plugins (with required MU plugins) ## ss_rm /var/www/html/wp-content/plugins/xxx-common* ss_rm /var/www/html/wp-content/plugins/xxx-notices* ss_rm /var/www/html/wp-content/plugins/xxx-staging* ss_rm /var/www/html/wp-content/plugins/xxx-dev* ## and from staging ## ss_rm /var/www/html/staging/wp-content/plugins/xxx-common* ss_rm /var/www/html/staging/wp-content/plugins/xxx-notices* ss_rm /var/www/html/staging/wp-content/plugins/xxx-staging* ss_rm /var/www/html/staging/wp-content/plugins/xxx-dev* ss_rm /var/www/html/staging/wp-content/plugins/disable-emails* ss_rm /var/www/html/staging/wp-content/plugins/disable-default-runner* ## delete potentially conflicting object caches (drop-in plugins + normal plugins) ## ss_rm /var/www/html/wp-content/object-cache* ss_rm /var/www/html/wp-content/plugins/memcache* ss_rm /var/www/html/wp-content/plugins/memcached* ss_rm /var/www/html/wp-content/plugins/object-cache* ss_rm /var/www/html/wp-content/plugins/redis* ss_rm /var/www/html/staging/wp-content/object-cache* ss_rm /var/www/html/staging/wp-content/plugins/memcache* ss_rm /var/www/html/staging/wp-content/plugins/memcached* ss_rm /var/www/html/staging/wp-content/plugins/object-cache* ss_rm /var/www/html/staging/wp-content/plugins/redis* ss_rm /var/www/html/dev/wp-content/object-cache* ss_rm /var/www/html/dev/wp-content/plugins/memcache* ss_rm /var/www/html/dev/wp-content/plugins/memcached* ss_rm /var/www/html/dev/wp-content/plugins/object-cache* ss_rm /var/www/html/dev/wp-content/plugins/redis* ## copy Autoloader files to destination ## cp /tmp/autoloader.php /var/www/html/wp-content/mu-plugins/autoloader.php if [[ "${STAGING_SITE}" == "true" ]]; then cp /tmp/autoloader.php /var/www/html/staging/wp-content/mu-plugins/autoloader.php fi if [[ "${DEV_SITE}" == "true" ]]; then cp /tmp/autoloader.php /var/www/html/dev/wp-content/mu-plugins/autoloader.php fi ## copy required MU plugins files to destinations ## if [[ -z "$WHITELABEL_BRAND" ]]; then sed -i "s/@WHITELABEL_BRAND/SlickStack/g" /tmp/xxx-common.php else sed -i "s/@WHITELABEL_BRAND/${WHITELABEL_BRAND}/g" /tmp/xxx-common.php fi cp /tmp/xxx-common.php /var/www/html/wp-content/mu-plugins/xxx-common.php ## and staging ## if [[ "${STAGING_SITE}" == "true" ]]; then cp /tmp/xxx-common.php /var/www/html/staging/wp-content/mu-plugins/xxx-common.php cp /tmp/disable-emails /var/www/html/staging/wp-content/mu-plugins/disable-emails cp /tmp/disable-default-runner /var/www/html/staging/wp-content/mu-plugins/disable-default-runner fi ## and dev ## if [[ "${DEV_SITE}" == "true" ]]; then cp /tmp/xxx-common.php /var/www/html/dev/wp-content/mu-plugins/xxx-common.php cp /tmp/disable-emails /var/www/html/dev/wp-content/mu-plugins/disable-emails cp /tmp/disable-default-runner /var/www/html/dev/wp-content/mu-plugins/disable-default-runner fi ## copy Object Cache files to destination ## if [[ "${SS_OBJECT_CACHE}" != "false" ]]; then cp /tmp/object-cache.php /var/www/html/wp-content/object-cache.php fi # cp /tmp/redis-cache /var/www/html/wp-content/mu-plugins/redis-cache # if [[ "${SS_OBJECT_CACHE}" != "false" ]] && [[ "${STAGING_SITE}" == "true" ]]; then #### cp /tmp/object-cache.php /var/www/html/staging/wp-content/object-cache.php ### causes conflicts just use on prod better # fi # cp /tmp/redis-cache /var/www/html/staging/wp-content/mu-plugins/redis-cache #################################################################################################### #### SS-Muplugs: Install Specified MU (Must-Use) Plugins (Optional) ################################ #################################################################################################### ## below MU plugins are distinct from the required MU plugins that are always included ## ## in the case these are missing the default LittleBizzy plugins are installed ## if [[ "$SS_WORDPRESS_MU_PLUGINS" == "custom" || "$SS_MU_PLUGINS" == "custom" ]] && [[ -n "${MU_PLUGIN_01_SOURCE}" ]] && [[ -n "${MU_PLUGIN_01_DIR}" ]]; then ## download specified (custom) MU plugins ## wget -O /tmp/${MU_PLUGIN_01_DIR}.zip ${MU_PLUGIN_01_SOURCE} wget -O /tmp/${MU_PLUGIN_02_DIR}.zip ${MU_PLUGIN_02_SOURCE} wget -O /tmp/${MU_PLUGIN_03_DIR}.zip ${MU_PLUGIN_03_SOURCE} wget -O /tmp/${MU_PLUGIN_04_DIR}.zip ${MU_PLUGIN_04_SOURCE} wget -O /tmp/${MU_PLUGIN_05_DIR}.zip ${MU_PLUGIN_05_SOURCE} wget -O /tmp/${MU_PLUGIN_06_DIR}.zip ${MU_PLUGIN_06_SOURCE} wget -O /tmp/${MU_PLUGIN_07_DIR}.zip ${MU_PLUGIN_07_SOURCE} wget -O /tmp/${MU_PLUGIN_08_DIR}.zip ${MU_PLUGIN_08_SOURCE} wget -O /tmp/${MU_PLUGIN_09_DIR}.zip ${MU_PLUGIN_09_SOURCE} wget -O /tmp/${MU_PLUGIN_10_DIR}.zip ${MU_PLUGIN_10_SOURCE} wget -O /tmp/${MU_PLUGIN_11_DIR}.zip ${MU_PLUGIN_11_SOURCE} wget -O /tmp/${MU_PLUGIN_12_DIR}.zip ${MU_PLUGIN_12_SOURCE} wget -O /tmp/${MU_PLUGIN_13_DIR}.zip ${MU_PLUGIN_13_SOURCE} wget -O /tmp/${MU_PLUGIN_14_DIR}.zip ${MU_PLUGIN_14_SOURCE} wget -O /tmp/${MU_PLUGIN_15_DIR}.zip ${MU_PLUGIN_15_SOURCE} wget -O /tmp/${MU_PLUGIN_16_DIR}.zip ${MU_PLUGIN_16_SOURCE} wget -O /tmp/${MU_PLUGIN_17_DIR}.zip ${MU_PLUGIN_17_SOURCE} wget -O /tmp/${MU_PLUGIN_18_DIR}.zip ${MU_PLUGIN_18_SOURCE} wget -O /tmp/${MU_PLUGIN_19_DIR}.zip ${MU_PLUGIN_19_SOURCE} wget -O /tmp/${MU_PLUGIN_20_DIR}.zip ${MU_PLUGIN_20_SOURCE} wget -O /tmp/${MU_PLUGIN_21_DIR}.zip ${MU_PLUGIN_21_SOURCE} wget -O /tmp/${MU_PLUGIN_22_DIR}.zip ${MU_PLUGIN_22_SOURCE} wget -O /tmp/${MU_PLUGIN_23_DIR}.zip ${MU_PLUGIN_23_SOURCE} wget -O /tmp/${MU_PLUGIN_24_DIR}.zip ${MU_PLUGIN_24_SOURCE} wget -O /tmp/${MU_PLUGIN_25_DIR}.zip ${MU_PLUGIN_25_SOURCE} ## unzip them all ## unzip /tmp/${MU_PLUGIN_01_DIR}.zip -d /tmp unzip /tmp/${MU_PLUGIN_02_DIR}.zip -d /tmp unzip /tmp/${MU_PLUGIN_03_DIR}.zip -d /tmp unzip /tmp/${MU_PLUGIN_04_DIR}.zip -d /tmp unzip /tmp/${MU_PLUGIN_05_DIR}.zip -d /tmp unzip /tmp/${MU_PLUGIN_06_DIR}.zip -d /tmp unzip /tmp/${MU_PLUGIN_07_DIR}.zip -d /tmp unzip /tmp/${MU_PLUGIN_08_DIR}.zip -d /tmp unzip /tmp/${MU_PLUGIN_09_DIR}.zip -d /tmp unzip /tmp/${MU_PLUGIN_10_DIR}.zip -d /tmp unzip /tmp/${MU_PLUGIN_11_DIR}.zip -d /tmp unzip /tmp/${MU_PLUGIN_12_DIR}.zip -d /tmp unzip /tmp/${MU_PLUGIN_13_DIR}.zip -d /tmp unzip /tmp/${MU_PLUGIN_14_DIR}.zip -d /tmp unzip /tmp/${MU_PLUGIN_15_DIR}.zip -d /tmp unzip /tmp/${MU_PLUGIN_16_DIR}.zip -d /tmp unzip /tmp/${MU_PLUGIN_17_DIR}.zip -d /tmp unzip /tmp/${MU_PLUGIN_18_DIR}.zip -d /tmp unzip /tmp/${MU_PLUGIN_19_DIR}.zip -d /tmp unzip /tmp/${MU_PLUGIN_20_DIR}.zip -d /tmp unzip /tmp/${MU_PLUGIN_21_DIR}.zip -d /tmp unzip /tmp/${MU_PLUGIN_22_DIR}.zip -d /tmp unzip /tmp/${MU_PLUGIN_23_DIR}.zip -d /tmp unzip /tmp/${MU_PLUGIN_24_DIR}.zip -d /tmp unzip /tmp/${MU_PLUGIN_25_DIR}.zip -d /tmp ## copy to destinations ## cp /tmp/${MU_PLUGIN_01_DIR} /var/www/html/wp-content/mu-plugins/${MU_PLUGIN_01_DIR} cp /tmp/${MU_PLUGIN_02_DIR} /var/www/html/wp-content/mu-plugins/${MU_PLUGIN_02_DIR} cp /tmp/${MU_PLUGIN_03_DIR} /var/www/html/wp-content/mu-plugins/${MU_PLUGIN_03_DIR} cp /tmp/${MU_PLUGIN_04_DIR} /var/www/html/wp-content/mu-plugins/${MU_PLUGIN_04_DIR} cp /tmp/${MU_PLUGIN_05_DIR} /var/www/html/wp-content/mu-plugins/${MU_PLUGIN_05_DIR} cp /tmp/${MU_PLUGIN_06_DIR} /var/www/html/wp-content/mu-plugins/${MU_PLUGIN_06_DIR} cp /tmp/${MU_PLUGIN_07_DIR} /var/www/html/wp-content/mu-plugins/${MU_PLUGIN_07_DIR} cp /tmp/${MU_PLUGIN_08_DIR} /var/www/html/wp-content/mu-plugins/${MU_PLUGIN_08_DIR} cp /tmp/${MU_PLUGIN_09_DIR} /var/www/html/wp-content/mu-plugins/${MU_PLUGIN_09_DIR} cp /tmp/${MU_PLUGIN_10_DIR} /var/www/html/wp-content/mu-plugins/${MU_PLUGIN_10_DIR} cp /tmp/${MU_PLUGIN_11_DIR} /var/www/html/wp-content/mu-plugins/${MU_PLUGIN_11_DIR} cp /tmp/${MU_PLUGIN_12_DIR} /var/www/html/wp-content/mu-plugins/${MU_PLUGIN_12_DIR} cp /tmp/${MU_PLUGIN_13_DIR} /var/www/html/wp-content/mu-plugins/${MU_PLUGIN_13_DIR} cp /tmp/${MU_PLUGIN_14_DIR} /var/www/html/wp-content/mu-plugins/${MU_PLUGIN_14_DIR} cp /tmp/${MU_PLUGIN_15_DIR} /var/www/html/wp-content/mu-plugins/${MU_PLUGIN_15_DIR} cp /tmp/${MU_PLUGIN_16_DIR} /var/www/html/wp-content/mu-plugins/${MU_PLUGIN_16_DIR} cp /tmp/${MU_PLUGIN_17_DIR} /var/www/html/wp-content/mu-plugins/${MU_PLUGIN_17_DIR} cp /tmp/${MU_PLUGIN_18_DIR} /var/www/html/wp-content/mu-plugins/${MU_PLUGIN_18_DIR} cp /tmp/${MU_PLUGIN_19_DIR} /var/www/html/wp-content/mu-plugins/${MU_PLUGIN_19_DIR} cp /tmp/${MU_PLUGIN_20_DIR} /var/www/html/wp-content/mu-plugins/${MU_PLUGIN_20_DIR} cp /tmp/${MU_PLUGIN_21_DIR} /var/www/html/wp-content/mu-plugins/${MU_PLUGIN_21_DIR} cp /tmp/${MU_PLUGIN_22_DIR} /var/www/html/wp-content/mu-plugins/${MU_PLUGIN_22_DIR} cp /tmp/${MU_PLUGIN_23_DIR} /var/www/html/wp-content/mu-plugins/${MU_PLUGIN_23_DIR} cp /tmp/${MU_PLUGIN_24_DIR} /var/www/html/wp-content/mu-plugins/${MU_PLUGIN_24_DIR} cp /tmp/${MU_PLUGIN_25_DIR} /var/www/html/wp-content/mu-plugins/${MU_PLUGIN_25_DIR} ## copy to destinations (staging subdirectory) ## cp /tmp/${MU_PLUGIN_01_DIR} /var/www/html/staging/wp-content/mu-plugins/${MU_PLUGIN_01_DIR} cp /tmp/${MU_PLUGIN_02_DIR} /var/www/html/staging/wp-content/mu-plugins/${MU_PLUGIN_02_DIR} cp /tmp/${MU_PLUGIN_03_DIR} /var/www/html/staging/wp-content/mu-plugins/${MU_PLUGIN_03_DIR} cp /tmp/${MU_PLUGIN_04_DIR} /var/www/html/staging/wp-content/mu-plugins/${MU_PLUGIN_04_DIR} cp /tmp/${MU_PLUGIN_05_DIR} /var/www/html/staging/wp-content/mu-plugins/${MU_PLUGIN_05_DIR} cp /tmp/${MU_PLUGIN_06_DIR} /var/www/html/staging/wp-content/mu-plugins/${MU_PLUGIN_06_DIR} cp /tmp/${MU_PLUGIN_07_DIR} /var/www/html/staging/wp-content/mu-plugins/${MU_PLUGIN_07_DIR} cp /tmp/${MU_PLUGIN_08_DIR} /var/www/html/staging/wp-content/mu-plugins/${MU_PLUGIN_08_DIR} cp /tmp/${MU_PLUGIN_09_DIR} /var/www/html/staging/wp-content/mu-plugins/${MU_PLUGIN_09_DIR} cp /tmp/${MU_PLUGIN_10_DIR} /var/www/html/staging/wp-content/mu-plugins/${MU_PLUGIN_10_DIR} cp /tmp/${MU_PLUGIN_11_DIR} /var/www/html/staging/wp-content/mu-plugins/${MU_PLUGIN_11_DIR} cp /tmp/${MU_PLUGIN_12_DIR} /var/www/html/staging/wp-content/mu-plugins/${MU_PLUGIN_12_DIR} cp /tmp/${MU_PLUGIN_13_DIR} /var/www/html/staging/wp-content/mu-plugins/${MU_PLUGIN_13_DIR} cp /tmp/${MU_PLUGIN_14_DIR} /var/www/html/staging/wp-content/mu-plugins/${MU_PLUGIN_14_DIR} cp /tmp/${MU_PLUGIN_15_DIR} /var/www/html/staging/wp-content/mu-plugins/${MU_PLUGIN_15_DIR} cp /tmp/${MU_PLUGIN_16_DIR} /var/www/html/staging/wp-content/mu-plugins/${MU_PLUGIN_16_DIR} cp /tmp/${MU_PLUGIN_17_DIR} /var/www/html/staging/wp-content/mu-plugins/${MU_PLUGIN_17_DIR} cp /tmp/${MU_PLUGIN_18_DIR} /var/www/html/staging/wp-content/mu-plugins/${MU_PLUGIN_18_DIR} cp /tmp/${MU_PLUGIN_19_DIR} /var/www/html/staging/wp-content/mu-plugins/${MU_PLUGIN_19_DIR} cp /tmp/${MU_PLUGIN_20_DIR} /var/www/html/staging/wp-content/mu-plugins/${MU_PLUGIN_20_DIR} cp /tmp/${MU_PLUGIN_21_DIR} /var/www/html/staging/wp-content/mu-plugins/${MU_PLUGIN_21_DIR} cp /tmp/${MU_PLUGIN_22_DIR} /var/www/html/staging/wp-content/mu-plugins/${MU_PLUGIN_22_DIR} cp /tmp/${MU_PLUGIN_23_DIR} /var/www/html/staging/wp-content/mu-plugins/${MU_PLUGIN_23_DIR} cp /tmp/${MU_PLUGIN_24_DIR} /var/www/html/staging/wp-content/mu-plugins/${MU_PLUGIN_24_DIR} cp /tmp/${MU_PLUGIN_25_DIR} /var/www/html/staging/wp-content/mu-plugins/${MU_PLUGIN_25_DIR} ## copy to destinations (dev subdirectory) ## # cp /tmp/${MU_PLUGIN_01_DIR} /var/www/html/dev/wp-content/mu-plugins/${MU_PLUGIN_01_DIR} # cp /tmp/${MU_PLUGIN_02_DIR} /var/www/html/dev/wp-content/mu-plugins/${MU_PLUGIN_02_DIR} # cp /tmp/${MU_PLUGIN_03_DIR} /var/www/html/dev/wp-content/mu-plugins/${MU_PLUGIN_03_DIR} # cp /tmp/${MU_PLUGIN_04_DIR} /var/www/html/dev/wp-content/mu-plugins/${MU_PLUGIN_04_DIR} # cp /tmp/${MU_PLUGIN_05_DIR} /var/www/html/dev/wp-content/mu-plugins/${MU_PLUGIN_05_DIR} # cp /tmp/${MU_PLUGIN_06_DIR} /var/www/html/dev/wp-content/mu-plugins/${MU_PLUGIN_06_DIR} # cp /tmp/${MU_PLUGIN_07_DIR} /var/www/html/dev/wp-content/mu-plugins/${MU_PLUGIN_07_DIR} # cp /tmp/${MU_PLUGIN_08_DIR} /var/www/html/dev/wp-content/mu-plugins/${MU_PLUGIN_08_DIR} # cp /tmp/${MU_PLUGIN_09_DIR} /var/www/html/dev/wp-content/mu-plugins/${MU_PLUGIN_09_DIR} # cp /tmp/${MU_PLUGIN_10_DIR} /var/www/html/dev/wp-content/mu-plugins/${MU_PLUGIN_10_DIR} # cp /tmp/${MU_PLUGIN_11_DIR} /var/www/html/dev/wp-content/mu-plugins/${MU_PLUGIN_11_DIR} # cp /tmp/${MU_PLUGIN_12_DIR} /var/www/html/dev/wp-content/mu-plugins/${MU_PLUGIN_12_DIR} # cp /tmp/${MU_PLUGIN_13_DIR} /var/www/html/dev/wp-content/mu-plugins/${MU_PLUGIN_13_DIR} # cp /tmp/${MU_PLUGIN_14_DIR} /var/www/html/dev/wp-content/mu-plugins/${MU_PLUGIN_14_DIR} # cp /tmp/${MU_PLUGIN_15_DIR} /var/www/html/dev/wp-content/mu-plugins/${MU_PLUGIN_15_DIR} # cp /tmp/${MU_PLUGIN_16_DIR} /var/www/html/dev/wp-content/mu-plugins/${MU_PLUGIN_16_DIR} # cp /tmp/${MU_PLUGIN_17_DIR} /var/www/html/dev/wp-content/mu-plugins/${MU_PLUGIN_17_DIR} # cp /tmp/${MU_PLUGIN_18_DIR} /var/www/html/dev/wp-content/mu-plugins/${MU_PLUGIN_18_DIR} # cp /tmp/${MU_PLUGIN_19_DIR} /var/www/html/dev/wp-content/mu-plugins/${MU_PLUGIN_19_DIR} # cp /tmp/${MU_PLUGIN_20_DIR} /var/www/html/dev/wp-content/mu-plugins/${MU_PLUGIN_20_DIR} # cp /tmp/${MU_PLUGIN_21_DIR} /var/www/html/dev/wp-content/mu-plugins/${MU_PLUGIN_21_DIR} # cp /tmp/${MU_PLUGIN_22_DIR} /var/www/html/dev/wp-content/mu-plugins/${MU_PLUGIN_22_DIR} # cp /tmp/${MU_PLUGIN_23_DIR} /var/www/html/dev/wp-content/mu-plugins/${MU_PLUGIN_23_DIR} # cp /tmp/${MU_PLUGIN_24_DIR} /var/www/html/dev/wp-content/mu-plugins/${MU_PLUGIN_24_DIR} # cp /tmp/${MU_PLUGIN_25_DIR} /var/www/html/dev/wp-content/mu-plugins/${MU_PLUGIN_25_DIR} else ## otherwise download default LittleBizzy MU plugins ## wget -O /tmp/clear-caches.zip "$MIRROR_CLEAR_CACHES_ZIP" wget -O /tmp/cloudflare.zip "$MIRROR_CLOUDFLARE_ZIP" wget -O /tmp/delete-expired-transients.zip "$MIRROR_DELETE_EXPIRED_TRANSIENTS_ZIP" wget -O /tmp/disable-attachment-pages.zip "$MIRROR_DISABLE_ATTACHMENT_PAGES_ZIP" wget -O /tmp/disable-emojis.zip "$MIRROR_DISABLE_EMOJIS_ZIP" wget -O /tmp/disable-empty-trash.zip "$MIRROR_DISABLE_EMPTY_TRASH_ZIP" wget -O /tmp/disable-image-compression.zip "$MIRROR_DISABLE_IMAGE_COMPRESSION_ZIP" wget -O /tmp/disable-post-via-email.zip "$MIRROR_DISABLE_POST_VIA_EMAIL_ZIP" wget -O /tmp/disable-xml-rpc.zip "$MIRROR_DISABLE_XML_RPC_ZIP" wget -O /tmp/force-https.zip "$MIRROR_FORCE_HTTPS_ZIP" wget -O /tmp/force-strong-hashing.zip "$MIRROR_FORCE_STRONG_HASHING_ZIP" wget -O /tmp/header-cleanup.zip "$MIRROR_HEADER_CLEANUP_ZIP" wget -O /tmp/plugin-blacklist.zip "$MIRROR_PLUGIN_BLACKLIST_ZIP" ## unzip them all ## unzip /tmp/clear-caches.zip -d /tmp unzip /tmp/cloudflare.zip -d /tmp unzip /tmp/delete-expired-transients.zip -d /tmp unzip /tmp/disable-attachment-pages.zip -d /tmp unzip /tmp/disable-emojis.zip -d /tmp unzip /tmp/disable-empty-trash.zip -d /tmp unzip /tmp/disable-image-compression.zip -d /tmp unzip /tmp/disable-post-via-email.zip -d /tmp unzip /tmp/disable-xml-rpc.zip -d /tmp unzip /tmp/force-https.zip -d /tmp unzip /tmp/force-strong-hashing.zip -d /tmp unzip /tmp/header-cleanup.zip -d /tmp unzip /tmp/plugin-blacklist.zip -d /tmp ## delete plugins instances (conflicting namespaces or previous namespaces) ## ss_rm /var/www/html/wp-content/plugins/clear-caches* ss_rm /var/www/html/staging/wp-content/plugins/clear-caches* ss_rm /var/www/html/dev/wp-content/plugins/clear-caches* ss_rm /var/www/html/wp-content/plugins/cloudflare* ss_rm /var/www/html/staging/wp-content/plugins/cloudflare* ss_rm /var/www/html/dev/wp-content/plugins/cloudflare* ss_rm /var/www/html/wp-content/plugins/delete-expired-transients* ss_rm /var/www/html/staging/wp-content/plugins/delete-expired-transients* ss_rm /var/www/html/dev/wp-content/plugins/delete-expired-transients* ss_rm /var/www/html/wp-content/plugins/disable-attachment-pages* ss_rm /var/www/html/staging/wp-content/plugins/disable-attachment-pages* ss_rm /var/www/html/dev/wp-content/plugins/disable-attachment-pages* ss_rm /var/www/html/wp-content/plugins/disable-emojis* ss_rm /var/www/html/staging/wp-content/plugins/disable-emojis* ss_rm /var/www/html/dev/wp-content/plugins/disable-emojis* ss_rm /var/www/html/wp-content/plugins/disable-empty-trash* ss_rm /var/www/html/staging/wp-content/plugins/disable-empty-trash* ss_rm /var/www/html/dev/wp-content/plugins/disable-empty-trash* ss_rm /var/www/html/wp-content/plugins/disable-image-compression* ss_rm /var/www/html/staging/wp-content/plugins/disable-image-compression* ss_rm /var/www/html/dev/wp-content/plugins/disable-image-compression* ss_rm /var/www/html/wp-content/plugins/disable-post-via-email* ss_rm /var/www/html/staging/wp-content/plugins/disable-post-via-email* ss_rm /var/www/html/dev/wp-content/plugins/disable-post-via-email* ss_rm /var/www/html/wp-content/plugins/disable-xml-rpc* ss_rm /var/www/html/staging/wp-content/plugins/disable-xml-rpc* ss_rm /var/www/html/dev/wp-content/plugins/disable-xml-rpc* ss_rm /var/www/html/wp-content/plugins/force-https* ss_rm /var/www/html/staging/wp-content/plugins/force-https* ss_rm /var/www/html/dev/wp-content/plugins/force-https* ss_rm /var/www/html/wp-content/plugins/force-strong-hashing* ss_rm /var/www/html/staging/wp-content/plugins/force-strong-hashing* ss_rm /var/www/html/dev/wp-content/plugins/force-strong-hashing* ss_rm /var/www/html/wp-content/plugins/header-cleanup* ss_rm /var/www/html/staging/wp-content/plugins/header-cleanup* ss_rm /var/www/html/dev/wp-content/plugins/header-cleanup* ss_rm /var/www/html/wp-content/plugins/plugin-blacklist* ss_rm /var/www/html/staging/wp-content/plugins/plugin-blacklist* ss_rm /var/www/html/dev/wp-content/plugins/plugin-blacklist* ## copy to destination ## cp /tmp/clear-caches /var/www/html/wp-content/mu-plugins/clear-caches cp /tmp/cloudflare /var/www/html/wp-content/mu-plugins/cloudflare cp /tmp/delete-expired-transients /var/www/html/wp-content/mu-plugins/delete-expired-transients cp /tmp/disable-attachment-pages /var/www/html/wp-content/mu-plugins/disable-attachment-pages cp /tmp/disable-emojis /var/www/html/wp-content/mu-plugins/disable-emojis cp /tmp/disable-empty-trash /var/www/html/wp-content/mu-plugins/disable-empty-trash cp /tmp/disable-image-compression /var/www/html/wp-content/mu-plugins/disable-image-compression cp /tmp/disable-post-via-email /var/www/html/wp-content/mu-plugins/disable-post-via-email cp /tmp/disable-xml-rpc /var/www/html/wp-content/mu-plugins/disable-xml-rpc cp /tmp/force-https /var/www/html/wp-content/mu-plugins/force-https cp /tmp/force-strong-hashing /var/www/html/wp-content/mu-plugins/force-strong-hashing cp /tmp/header-cleanup /var/www/html/wp-content/mu-plugins/header-cleanup cp /tmp/plugin-blacklist /var/www/html/wp-content/mu-plugins/plugin-blacklist if [[ "${STAGING_SITE}" == "true" ]]; then cp /tmp/clear-caches /var/www/html/staging/wp-content/mu-plugins/clear-caches cp /tmp/cloudflare /var/www/html/staging/wp-content/mu-plugins/cloudflare cp /tmp/delete-expired-transients /var/www/html/staging/wp-content/mu-plugins/delete-expired-transients cp /tmp/disable-attachment-pages /var/www/html/staging/wp-content/mu-plugins/disable-attachment-pages cp /tmp/disable-emojis /var/www/html/staging/wp-content/mu-plugins/disable-emojis cp /tmp/disable-empty-trash /var/www/html/staging/wp-content/mu-plugins/disable-empty-trash cp /tmp/disable-image-compression /var/www/html/staging/wp-content/mu-plugins/disable-image-compression cp /tmp/disable-post-via-email /var/www/html/staging/wp-content/mu-plugins/disable-post-via-email cp /tmp/disable-xml-rpc /var/www/html/staging/wp-content/mu-plugins/disable-xml-rpc cp /tmp/force-https /var/www/html/staging/wp-content/mu-plugins/force-https cp /tmp/force-strong-hashing /var/www/html/staging/wp-content/mu-plugins/force-strong-hashing cp /tmp/header-cleanup /var/www/html/staging/wp-content/mu-plugins/header-cleanup cp /tmp/plugin-blacklist /var/www/html/staging/wp-content/mu-plugins/plugin-blacklist fi if [[ "${DEV_SITE}" == "true" ]]; then cp /tmp/clear-caches /var/www/html/dev/wp-content/mu-plugins/clear-caches cp /tmp/cloudflare /var/www/html/dev/wp-content/mu-plugins/cloudflare cp /tmp/delete-expired-transients /var/www/html/dev/wp-content/mu-plugins/delete-expired-transients cp /tmp/disable-attachment-pages /var/www/html/dev/wp-content/mu-plugins/disable-attachment-pages cp /tmp/disable-emojis /var/www/html/dev/wp-content/mu-plugins/disable-emojis cp /tmp/disable-empty-trash /var/www/html/dev/wp-content/mu-plugins/disable-empty-trash cp /tmp/disable-image-compression /var/www/html/dev/wp-content/mu-plugins/disable-image-compression cp /tmp/disable-post-via-email /var/www/html/dev/wp-content/mu-plugins/disable-post-via-email cp /tmp/disable-xml-rpc /var/www/html/dev/wp-content/mu-plugins/disable-xml-rpc cp /tmp/force-https /var/www/html/dev/wp-content/mu-plugins/force-https cp /tmp/force-strong-hashing /var/www/html/dev/wp-content/mu-plugins/force-strong-hashing cp /tmp/header-cleanup /var/www/html/dev/wp-content/mu-plugins/header-cleanup cp /tmp/plugin-blacklist /var/www/html/dev/wp-content/mu-plugins/plugin-blacklist fi ## end if ## fi #################################################################################################### #### SS-Install-WordPress-MU-Plugins: Reset Permissions (WordPress MU Plugins) ##################### #################################################################################################### ## run ss-perms-wordpress-mu-plugins ## source "$PATH_SS_PERMS_WORDPRESS_MU_PLUGINS" #################################################################################################### #### SS-Install-WordPress-MU-Plugins: Modify WP Admin Toolbar Shortcuts ############################ #################################################################################################### ## CURRENT NOT USED BUT COMING BACK SOON ## ## enable WP Admin toolbar switcher shortcut ## # if [[ "$STAGING_SITE" != "false" ]]; then # sed -i "s#//@STAGING_SITE_TRUE//##g" /var/www/html/wp-content/mu-plugins/xxx-common.php # fi #################################################################################################### #### SS-Install-WordPress-MU-Plugins: Purge Cache (PHP OPcache) #################################### #################################################################################################### ## run ss-purge-opcache ## source "$PATH_SS_PURGE_OPCACHE" #################################################################################################### #### SS-Install-WordPress-MU-Plugins: Cleanup Temporary Files ###################################### #################################################################################################### ## delete tmp files ## ss_rm /tmp/autoloader* ss_rm /tmp/custom-functions* ss_rm /tmp/functions* ss_rm /tmp/xxx-* ss_rm /tmp/object-cache* ss_rm /tmp/redis-cache* ss_rm /tmp/clear-caches* ss_rm /tmp/cloudflare* ss_rm /tmp/dashboard-cleanup* ss_rm /tmp/delete-expired-transients* ss_rm /tmp/disable-attachment-pages* ss_rm /tmp/disable-default-runner* ss_rm /tmp/disable-emails* ss_rm /tmp/disable-embeds* ss_rm /tmp/disable-emojis* ss_rm /tmp/disable-empty-trash* ss_rm /tmp/disable-gutenberg* ss_rm /tmp/disable-image-compression* ss_rm /tmp/disable-post-via-email* ss_rm /tmp/disable-xml-rpc* ss_rm /tmp/error-log-monitor* ss_rm /tmp/force-https* ss_rm /tmp/force-strong-hashing* ss_rm /tmp/header-cleanup* ss_rm /tmp/index-autoload* ss_rm /tmp/limit-heartbeat* ss_rm /tmp/maintenance-mode* ss_rm /tmp/minify-html* ss_rm /tmp/plugin-blacklist* ss_rm /tmp/remove-query-strings* ss_rm /tmp/server-status* ss_rm /tmp/sftp-details* ss_rm /tmp/virtual-robotstxt* #################################################################################################### ## delete (custom) MU plugins temporary files ## # (coming soon) ## fix bug ss_rm /var/www/html/wp-content/mu-plugins/tmp/ ss_rm /var/www/html/staging/wp-content/mu-plugins/tmp/ ss_rm /var/www/html/dev/wp-content/mu-plugins/tmp/ #################################################################################################### #### SlickStack: External References Used To Improve This Script (Thanks, Interwebz) ############### #################################################################################################### ## Ref: https://unix.stackexchange.com/questions/368246/cant-use-alias-in-script-even-if-i-define-it-just-above ## SS_EOF