You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
489 B

  1. #!/bin/bash
  2. SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
  3. WP_CONTENT_DIRS=(
  4. plugins
  5. upgrade
  6. uploads
  7. mcloud-reports
  8. mcloud-view-cache
  9. )
  10. export WEB_GID=33
  11. perms() {
  12. sudo chown -R $UID:$WEB_GID "$1"
  13. sudo chmod -R g+rwx "$1"
  14. }
  15. permsFile() {
  16. sudo chown $UID:$WEB_GID "$1"
  17. sudo chmod g+rw "$1"
  18. }
  19. for DIR in "${WP_CONTENT_DIRS[@]}"; do
  20. DIR="$SCRIPT_DIR/../wp-content/$DIR"
  21. if [[ -f $DIR ]]; then
  22. permsFile "$DIR"
  23. else
  24. perms "$DIR"
  25. fi
  26. done