Initial commit

This commit is contained in:
2023-08-17 23:46:24 +03:00
commit cde7488084
10 changed files with 138 additions and 0 deletions

1
quick/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.sh

View File

@ -0,0 +1,25 @@
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. "${SCRIPT_DIR}/settings.sh" || {
echo "no settings" && exit 1
}
wp core config --dbname=$PROJECT_NAME --dbuser=$PROJECT_NAME --dbpass=$PROJECT_NAME --dbhost=db --dbprefix=$TABLE_PREFIX
sed -i 's/<?php//' "${PROJECT_WEB_ROOT}/wp-config.php"
cat << \EOF | cat - "${PROJECT_WEB_ROOT}/wp-config.php" > /tmp/out && mv /tmp/out "${PROJECT_WEB_ROOT}/wp-config.php"
<?php
if (@$_SERVER['HTTP_HOST']) {
define('WP_SITEURL', 'http://'.$_SERVER['HTTP_HOST']);
define('WP_HOME', 'http://'.$_SERVER['HTTP_HOST']);
}
//if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'){
// $_SERVER['HTTPS'] = 'on';
// $_SERVER['SERVER_PORT'] = 443;
//}
define('FS_METHOD', 'direct');
EOF

View File

@ -0,0 +1,2 @@
#!/bin/bash
wp plugin deactivate really-simple-ssl

View File

@ -0,0 +1,15 @@
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. "${SCRIPT_DIR}/../settings.sh" || {
echo "no settings" && exit 1
}
TABLE_WP_OPTIONS="${TABLE_PREFIX}options"
TABLE_WP_POSTS="${TABLE_PREFIX}posts"
TABLE_WP_POSTMETA="${TABLE_PREFIX}postmeta"
wp search-replace "https://${PROD_DOMAIN}" "http://${LOCAL_DOMAIN}" ${TABLE_WP_OPTIONS} ${TABLE_WP_POSTS} ${TABLE_WP_POSTMETA} --report-changed-only=true
wp search-replace "https:\/\/${PROD_DOMAIN}" "http:\/\/${LOCAL_DOMAIN}" ${TABLE_WP_OPTIONS} ${TABLE_WP_POSTS} ${TABLE_WP_POSTMETA} --report-changed-only=true
wp search-replace "${PROD_DOMAIN}" "${LOCAL_DOMAIN}" ${TABLE_WP_OPTIONS} ${TABLE_WP_POSTS} ${TABLE_WP_POSTMETA} --report-changed-only=true

View File

@ -0,0 +1,20 @@
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
WP_CONTENT_DIRS=(
plugins
upgrade
uploads
)
export WEB_GID=33
perms() {
sudo chown -R $UID:$WEB_GID "$1"
find "$1" -type d -exec chmod g+rwx '{}' \;
find "$1" -type f -exec chmod g+rw '{}' \;
}
for DIR in "${WP_CONTENT_DIRS[@]}"; do
perms "$SCRIPT_DIR/../wp-content/$DIR"
done

10
quick/settings.sh.example Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export PROJECT_NAME=wpstudio
export PROJECT_WEB_ROOT="${SCRIPT_DIR}/.."
export TABLE_PREFIX="wp_"
export PROD_DOMAIN=wpstudio.ru
export LOCAL_DOMAIN=wpstudio.local.wpstudio.ru