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 source /opt/webinoly/lib/general
nginx_helper_plugin() { wp_cache_plugins() {
# Download WP (latest version) if [[ ! -d /var/www/$domain/htdocs/wp-content/plugins/nginx-helper ]]; then
sudo wget --timeout=15 -qrO /var/www/$domain/htdocs/nginx-helper-plugin.zip https://downloads.wordpress.org/plugin/nginx-helper.latest-stable.zip # Download Nginx Helper Plugin
sudo unzip -qq /var/www/$domain/htdocs/nginx-helper-plugin.zip -d /var/www/$domain/htdocs/wp-content/plugins/ sudo wget --timeout=15 -qrO /var/www/$domain/htdocs/nginx-helper-plugin.zip https://downloads.wordpress.org/plugin/nginx-helper.latest-stable.zip
sudo rm /var/www/$domain/htdocs/nginx-helper-plugin.zip sudo unzip -qq /var/www/$domain/htdocs/nginx-helper-plugin.zip -d /var/www/$domain/htdocs/wp-content/plugins/
echo "" sudo rm /var/www/$domain/htdocs/nginx-helper-plugin.zip
echo "${gre} Nginx Helper Plugin has been installed!" echo ""
echo " Please, activate this plugin for a better experience with FastCgi Cache." echo "${gre} Nginx Helper Plugin has been installed!"
echo "${blu} ** IMPORTANT - Plugin Settings **" echo " Please, activate this plugin for a better experience with FastCgi Cache."
echo "- The “Caching Method” should be set to “Nginx FastCgi Cache”." echo "${blu} ** IMPORTANT - Plugin Settings **"
echo "- Support for purge/url method has been disabled because it is considered a security risk." echo "- The “Caching Method” should be set to “Nginx FastCgi Cache”."
echo "- The Purge Method should be set to “Delete local server cache file” " echo "- Support for purge/url method has been disabled because it is considered a security risk."
echo "${end}" 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 # Activate FastCgi cache
if [[ "$cache" == "-cache" && "$wp" == [123] ]]; then if [[ "$cache" == "-cache" && "$wp" == [123] ]]; then
sudo sed -i '/php.conf/c \ include common/wpfc.conf;' /etc/nginx/sites-available/$domain sudo sed -i '/php.conf/c \ include common/wpfc.conf;' /etc/nginx/sites-available/$domain
nginx_helper_plugin wp_cache_plugins
fi fi
echo "${gre}Site $domain has been successfully created!${end}" 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 ) iswp=$( grep -F "wpcommon.conf" /etc/nginx/sites-available/$domain )
if [[ -n $isphp && -n $iswp ]]; then if [[ -n $isphp && -n $iswp ]]; then
sudo sed -i '/php.conf/c \ include common/wpfc.conf;' /etc/nginx/sites-available/$domain 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 "${gre}"
echo "We recommend Nginx Helper Plugin as an easy way to manage FastCGI Cache on your site." 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]? " echo "${blu}Do you want to install it now [Y/n]? ${end}"
while read -r -n 1 -s answer; do while read -r -n 1 -s answer; do
answer=${answer:-y} answer=${answer:-y}
if [[ $answer = [YyNn] ]]; then if [[ $answer = [YyNn] ]]; then
[[ $answer = [Yy] ]] && nginx_helper_plugin [[ $answer = [Yy] ]] && wp_cache_plugins
break break
fi fi
done done