remove plugin uninstall

This commit is contained in:
Ray Elliott 2020-09-08 20:33:56 +01:00
parent bbc106c018
commit 8a3c354254
1 changed files with 43 additions and 43 deletions

View File

@ -4,18 +4,22 @@ echo "Installing WordPress .."
[ -z "$ssh_user" ] || [ -z "$ssh_root" ] && echo "Error: user and root ssh configuration must be specified" && exit 5 [ -z "$ssh_user" ] || [ -z "$ssh_root" ] && echo "Error: user and root ssh configuration must be specified" && exit 5
ssh -T $ssh_root << EOSSH ssh -T $ssh_root << EOSSH
# install wp-cli first
# install wp-cli first if [ ! -f /usr/local/bin/wp ] ; then
if [ ! -f /usr/local/bin/wp ] ; then wget -nv -O /usr/local/bin/wp https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \
wget -nv -O /usr/local/bin/wp https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \ && chmod +x /usr/local/bin/wp
&& chmod +x /usr/local/bin/wp fi
fi
EOSSH EOSSH
ssh -T $ssh_user << EOSSH ssh -T $ssh_user << EOSSH
if wp core is-installed --quiet --path="$wp_path" ; then if wp core is-installed --quiet --path="$wp_path" ; then
echo "WordPress already installed" echo "WordPress already installed"
else else
echo "wp core download \
--version=$wp_version \
--path=$wp_path \
--skip-content \
--locale=$wp_locale"
wp core download \ wp core download \
--version="$wp_version" \ --version="$wp_version" \
--path="$wp_path" \ --path="$wp_path" \
@ -73,42 +77,38 @@ EOSSH
done done
fi fi
if [ -n "$wp_plugins_active" ] ; then if [ -n "$_apache2_version" ] ; then
printf "\nUninstalling plugins ..." ssh -T $ssh_root << EOSSH
for plugin in $wp_plugins_uninstall ; do if [ -n "$apache2_version" ] ; then
echo " installing $plugin ..." mkdir -p /var/log/wordpress/
ssh -T $ssh_user << EOSSH cat << EOF > /etc/apache2/sites-available/wordpress.conf
wp plugin deactivate $plugin --path="$wp_path" <VirtualHost *:80>
wp plugin uninstall $plugin --path="$wp_path" ServerName $domain
EOSSH DocumentRoot $wp_path
done ErrorLog /var/log/wordpress/error.log
fi CustomLog /var/log/wordpress/access.log combined
<Directory $wp_path/>
config_path='/etc/apache2/sites-available/wordpress.conf' AllowOverride All
ssh -T $ssh_root << EOSSH <IfModule mod_rewrite.c>
if [ -n "$apache2_version" ] ; then RewriteEngine On
mkdir -p /var/log/wordpress/ RewriteBase /
cat << EOF > $config_path RewriteCond %{REQUEST_FILENAME} !-f
<VirtualHost *:80> RewriteCond %{REQUEST_FILENAME} !-d
ServerName $domain RewriteRule . /index.php [L]
DocumentRoot $wp_path </IfModule>
ErrorLog /var/log/wordpress/error.log </Directory>
CustomLog /var/log/wordpress/access.log combined </VirtualHost>
<Directory $wp_path/>
AllowOverride All
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
</Directory>
</VirtualHost>
EOF EOF
a2enmod rewrite a2enmod rewrite
a2ensite wordpress a2ensite wordpress
a2dissite 000-default a2dissite 000-default
systemctl reload apache2 systemctl reload apache2
fi elif [ -n "nginx_version" ] ; then
echo "TODO - nginx wordpress config"
elif [ -n "litespeed_version" ] ; then
echo "TODO - litespeed wordpress config"
else
echo "Warning: no webserver configuration found"
fi
EOSSH EOSSH
fi