Skip to content

Instantly share code, notes, and snippets.

@taddev taddev/lock_wp-content.sh
Last active Aug 29, 2015

Embed
What would you like to do?
A series of scripts to manage the permissions for various wordpress directories in bulk. The *lock* scripts will remove write access to the files while the *unlock* scripts will add it.
#!/bin/bash
LOCKFILE="/home/tad/scripts/.unlocked_wp-content"
WPDIR="/var/www/localhost/htdocs/blog/wp/wp-content"
if [ -f $LOCKFILE ]; then
echo "Locking WP-Content Directory"
find $WPDIR -type f -exec chmod 644 {} \;
find $WPDIR -type d -exec chmod 755 {} \;
rm -f $LOCKFILE
else
echo "WP-Content Directory Already Locked"
fi
#!/bin/bash
LOCKFILE="/home/tad/scripts/.unlocked_wp-content"
WPDIR="/var/www/localhost/htdocs/blog/wp/wp-content"
if [ ! -f $LOCKFILE ]; then
echo "Unlocking WP-Content Directory"
find $WPDIR -type f -exec chmod 664 {} \;
find $WPDIR -type d -exec chmod 775 {} \;
touch $LOCKFILE
else
echo "WP-Content Directory Already Unlocked"
fi
#!/bin/bash
LOCKFILE="/home/tad/scripts/.unlocked_wp-content"
WPDIR="/var/www/localhost/htdocs/blog/wp/wp-content"
if [ ! -f $LOCKFILE ]; then
echo "Unlocking WP-Content Directory"
find $WPDIR -type f -exec chmod 664 {} \;
find $WPDIR -type d -exec chmod 775 {} \;
touch $LOCKFILE
else
echo "WP-Content Directory Already Unlocked"
fi
!/bin/bash
LOCKFILE="/home/tad/scripts/.unlocked_wp"
LOCKCONTENT="/home/tad/scripts/.unlocked_wp-content"
WPDIR="/var/www/localhost/htdocs/blog/wp/"
if [ ! -f $LOCKFILE ]; then
echo "Unlocking WP Directory"
find $WPDIR -type f -exec chmod 664 {} \;
find $WPDIR -type d -exec chmod 775 {} \;
touch $LOCKFILE
if [ ! -f $LOCKCONTENT ]; then
touch $LOCKCONTENT
fi
else
echo "WP Directory Already Unlocked"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.