+ deactivate plugins helper wp script
+ ignore helper wp script for create .gitignore files in some wp-content dirs + nerest quick script example & readmes * update quick scripts with use SCRIPT_DIR logic (where quick scripts placed in subfolder of root project dir) * legacy create mysql example moved to root dir
This commit is contained in:
@ -15,8 +15,6 @@
|
||||
/wp-content/cache
|
||||
/wp-content/logs
|
||||
/wp-content/updraft
|
||||
/wp-content/upgrade
|
||||
/wp-content/uploads
|
||||
/wp-content/wp-cache-config.php
|
||||
/wp-content/webp-express
|
||||
/wp-content/wp-rocket-config
|
||||
@ -35,7 +33,7 @@
|
||||
# IDE ignores
|
||||
/.idea
|
||||
|
||||
# Bash script helpers in root dir
|
||||
/*.sh
|
||||
# composer root vendor dir ignore
|
||||
/vendor
|
||||
|
||||
# Custom ignores
|
||||
|
23
wp/README.md
Normal file
23
wp/README.md
Normal file
@ -0,0 +1,23 @@
|
||||
# Quick scripts
|
||||
|
||||
Create `quick` dir in your root project folder.
|
||||
|
||||
Place `.gitignore` file in that dir with these content:
|
||||
|
||||
```
|
||||
*.sh
|
||||
```
|
||||
|
||||
Copy needed helper scripts in that `quick/` dir and create copies with `.example` extension for adding example-scripts to your project GIT.
|
||||
|
||||
You might need add worked execute script for create executable copies from examples.
|
||||
|
||||
Add `nerest-quick.sh` to you root project dir:
|
||||
|
||||
```shell
|
||||
#!/bin/bash
|
||||
QUICK_DIR=quick
|
||||
|
||||
cd $QUICK_DIR &&
|
||||
find ./ -name "*.sh.example" -exec sh -c 'F={}; cp -u $F ${F%.example} && chmod +x ${F%.example}' \;
|
||||
```
|
5
wp/nerest-quick.sh
Executable file
5
wp/nerest-quick.sh
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
QUICK_DIR=quick
|
||||
|
||||
cd $QUICK_DIR &&
|
||||
find ./ -name "*.sh.example" -exec sh -c 'F={}; cp -u $F ${F%.example} && chmod +x ${F%.example}' \;
|
1
wp/quick/.gitignore-example
Normal file
1
wp/quick/.gitignore-example
Normal file
@ -0,0 +1 @@
|
||||
*.sh
|
@ -1,10 +1,14 @@
|
||||
#!/bin/bash
|
||||
NAME=invatur
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
cd "$SCRIPT_DIR/.."
|
||||
|
||||
NAME=wpstudio
|
||||
wp core config --dbname=$NAME --dbuser=$NAME --dbpass=$NAME --dbhost=db
|
||||
|
||||
sed -i 's/<?php//' wp-config.php
|
||||
sed -i 's/<?php//' "$SCRIPT_DIR/../wp-config.php"
|
||||
|
||||
cat << \EOF | cat - wp-config.php > /tmp/out && mv /tmp/out wp-config.php
|
||||
cat << \EOF | cat - "$SCRIPT_DIR/../wp-config.php" > /tmp/out && mv /tmp/out "$SCRIPT_DIR/../wp-config.php"
|
||||
<?php
|
||||
if (@$_SERVER['HTTP_HOST']) {
|
||||
define('WP_SITEURL', 'http://'.$_SERVER['HTTP_HOST']);
|
||||
@ -19,4 +23,4 @@ if (@$_SERVER['HTTP_HOST']) {
|
||||
define('FS_METHOD', 'direct');
|
||||
EOF
|
||||
|
||||
#wp plugin deactivate wp-force-https
|
||||
$SCRIPT_DIR/deactivate-plugins-from-prod.sh
|
5
wp/quick/deactivate-plugins-from-prod.sh
Executable file
5
wp/quick/deactivate-plugins-from-prod.sh
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
cd "$SCRIPT_DIR/.."
|
||||
#wp plugin deactivate really-simple-ssl
|
59
wp/quick/ignore.sh
Normal file
59
wp/quick/ignore.sh
Normal file
@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
POSITIONAL_ARGS=()
|
||||
|
||||
MCLOUD=0
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--mcloud)
|
||||
MCLOUD=1
|
||||
shift # past argument
|
||||
;;
|
||||
-*|--*)
|
||||
echo "Unknown option $1"
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
echo "No support positional arguments"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
export SCRIPT_DIR
|
||||
|
||||
ignore() {
|
||||
DIR="${SCRIPT_DIR}/../wp-content/${1}"
|
||||
FILE="${DIR}/.gitignore"
|
||||
|
||||
if [[ ! -d $DIR ]]; then
|
||||
mkdir $DIR
|
||||
fi
|
||||
|
||||
if [[ ! -f $DIR ]]; then
|
||||
echo "*" > $FILE
|
||||
echo "!.gitignore" >> $FILE
|
||||
fi
|
||||
|
||||
git add -f $FILE
|
||||
}
|
||||
|
||||
ignore uploads
|
||||
ignore upgrade
|
||||
|
||||
if [[ $MCLOUD -eq 1 ]]; then
|
||||
ignore mcloud-reports
|
||||
ignore mcloud-view-cache
|
||||
fi
|
||||
|
||||
# Create git ignore in quick script dir
|
||||
|
||||
QUICK_DIR_GIT_IGNORE="${SCRIPT_DIR}/.gitignore"
|
||||
|
||||
if [[ ! -f $QUICK_DIR_GIT_IGNORE ]]; then
|
||||
echo "/*.sh" > $QUICK_DIR_GIT_IGNORE
|
||||
fi
|
||||
|
||||
git add -f $QUICK_DIR_GIT_IGNORE
|
32
wp/quick/restore-perms.sh
Normal file
32
wp/quick/restore-perms.sh
Normal file
@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
WP_CONTENT_DIRS=(
|
||||
plugins
|
||||
upgrade
|
||||
uploads
|
||||
mcloud-reports
|
||||
mcloud-view-cache
|
||||
)
|
||||
|
||||
export WEB_GID=33
|
||||
|
||||
perms() {
|
||||
sudo chown -R $UID:$WEB_GID "$1"
|
||||
sudo chmod -R g+rwx "$1"
|
||||
}
|
||||
|
||||
permsFile() {
|
||||
sudo chown $UID:$WEB_GID "$1"
|
||||
sudo chmod g+rw "$1"
|
||||
}
|
||||
|
||||
for DIR in "${WP_CONTENT_DIRS[@]}"; do
|
||||
DIR="$SCRIPT_DIR/../wp-content/$DIR"
|
||||
|
||||
if [[ -f $DIR ]]; then
|
||||
permsFile "$DIR"
|
||||
else
|
||||
perms "$DIR"
|
||||
fi
|
||||
done
|
@ -1,10 +0,0 @@
|
||||
#!/bin/bash
|
||||
DIRS=( wp-content/plugins )
|
||||
export WEB_GID=33
|
||||
perms() {
|
||||
sudo chown -R $UID:$WEB_GID "$1"
|
||||
sudo chmod -R g+rwx "$1"
|
||||
}
|
||||
for DIR in "${DIRS[@]}"; do
|
||||
perms "$DIR"
|
||||
done
|
Reference in New Issue
Block a user