Advertisement
cloudtuts

一次更新主機上所有網站的外掛/主題(需安裝WP-CLI)

Nov 21st, 2018
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.72 KB | None | 0 0
  1. #一次更新主機上所有網站的某一個外掛或佈景主題(需安裝WP-CLI)
  2. #By Jack https://www.yogoeasy.com
  3. read -p "更新外掛請輸入1,更新主題請輸入2: " isPlugin
  4. read -p "輸入更新項目的資料夾名稱(例如:Yoast SEO要輸入wordpress-seo): " name
  5. #name=wordpress-seo
  6. #isPlugin=1
  7. echo 'Upgrading'
  8. echo $name
  9. if (( $isPlugin == 1 ))
  10. then
  11.     cd /var/www
  12.     for i in * ;
  13.     do
  14.         echo $i
  15.         ls /var/www/$i/htdocs/wp-content/plugins/$name && cd $_ && wp plugin update $name --allow-root
  16.     done
  17. else
  18.     cd /var/www
  19.     for i in * ;
  20.     do
  21.         echo $i
  22.         ls /var/www/$i/htdocs/wp-content/themes/$name && cd $_ && wp theme update $name --allow-root
  23.     done
  24. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement