redis plugin installed

Now Redis Object Cache Plugin is automatically installed when WP Cache is enabled.
This commit is contained in:
Cristhian Martínez Ochoa 2018-03-19 14:32:37 -07:00
parent 404e42cd13
commit cef1fed914
2 changed files with 37 additions and 18 deletions

View file

@ -6,19 +6,38 @@
source /opt/webinoly/lib/general
nginx_helper_plugin() {
# Download WP (latest version)
sudo wget --timeout=15 -qrO /var/www/$domain/htdocs/nginx-helper-plugin.zip https://downloads.wordpress.org/plugin/nginx-helper.latest-stable.zip
sudo unzip -qq /var/www/$domain/htdocs/nginx-helper-plugin.zip -d /var/www/$domain/htdocs/wp-content/plugins/
sudo rm /var/www/$domain/htdocs/nginx-helper-plugin.zip
echo ""
echo "${gre} Nginx Helper Plugin has been installed!"
echo " Please, activate this plugin for a better experience with FastCgi Cache."
echo "${blu} ** IMPORTANT - Plugin Settings **"
echo "- The “Caching Method” should be set to “Nginx FastCgi Cache”."
echo "- Support for purge/url method has been disabled because it is considered a security risk."
echo "- The Purge Method should be set to “Delete local server cache file” "
echo "${end}"
wp_cache_plugins() {
if [[ ! -d /var/www/$domain/htdocs/wp-content/plugins/nginx-helper ]]; then
# Download Nginx Helper Plugin
sudo wget --timeout=15 -qrO /var/www/$domain/htdocs/nginx-helper-plugin.zip https://downloads.wordpress.org/plugin/nginx-helper.latest-stable.zip
sudo unzip -qq /var/www/$domain/htdocs/nginx-helper-plugin.zip -d /var/www/$domain/htdocs/wp-content/plugins/
sudo rm /var/www/$domain/htdocs/nginx-helper-plugin.zip
echo ""
echo "${gre} Nginx Helper Plugin has been installed!"
echo " Please, activate this plugin for a better experience with FastCgi Cache."
echo "${blu} ** IMPORTANT - Plugin Settings **"
echo "- The “Caching Method” should be set to “Nginx FastCgi Cache”."
echo "- Support for purge/url method has been disabled because it is considered a security risk."
echo "- The Purge Method should be set to “Delete local server cache file” "
echo "${end}"
else
echo "${red}Nginx Helper Plugin is already installed!${end}"
fi
if [[ ! -d /var/www/$domain/htdocs/wp-content/plugins/redis-cache ]]; then
# Download Redis Object Cache Plugin
sudo wget --timeout=15 -qrO /var/www/$domain/htdocs/redis-cache-plugin.zip https://downloads.wordpress.org/plugin/redis-cache.latest-stable.zip
sudo unzip -qq /var/www/$domain/htdocs/redis-cache-plugin.zip -d /var/www/$domain/htdocs/wp-content/plugins/
sudo rm /var/www/$domain/htdocs/redis-cache-plugin.zip
echo ""
echo "${gre} Redis Object Cache Plugin has been installed!"
echo " Please, activate this plugin for a better experience with WordPress Object Cache."
echo "${blu} ** IMPORTANT - Plugin Settings **"
echo "- Go to “Menu > Settings > Redis” and be sure that Object Cache is enabled. "
echo "${end}"
else
echo "${red}Redis Object Cache Plugin is already installed!${end}"
fi
}
@ -457,7 +476,7 @@ createsite() {
# Activate FastCgi cache
if [[ "$cache" == "-cache" && "$wp" == [123] ]]; then
sudo sed -i '/php.conf/c \ include common/wpfc.conf;' /etc/nginx/sites-available/$domain
nginx_helper_plugin
wp_cache_plugins
fi
echo "${gre}Site $domain has been successfully created!${end}"

View file

@ -299,14 +299,14 @@ elif [[ "$type" == "-cache" && -a /etc/nginx/sites-available/$domain ]]; then
iswp=$( grep -F "wpcommon.conf" /etc/nginx/sites-available/$domain )
if [[ -n $isphp && -n $iswp ]]; then
sudo sed -i '/php.conf/c \ include common/wpfc.conf;' /etc/nginx/sites-available/$domain
if [[ ! -d /var/www/$domain/htdocs/wp-content/plugins/nginx-helper ]]; then
if [[ ! -d /var/www/$domain/htdocs/wp-content/plugins/nginx-helper || ! -d /var/www/$domain/htdocs/wp-content/plugins/redis-cache ]]; then
echo "${gre}"
echo "We recommend Nginx Helper Plugin as an easy way to manage FastCGI Cache on your site."
echo "${blu} Do you want to install it now [Y/n]? "
echo "We recommend Nginx Helper Plugin and Redis Object Cache Plugin as an easy way to manage FastCGI and Redis Cache on your WordPress site."
echo "${blu}Do you want to install it now [Y/n]? ${end}"
while read -r -n 1 -s answer; do
answer=${answer:-y}
if [[ $answer = [YyNn] ]]; then
[[ $answer = [Yy] ]] && nginx_helper_plugin
[[ $answer = [Yy] ]] && wp_cache_plugins
break
fi
done