Skip to content

Commit 5f96147

Browse files
authored
Create cleaner.sh
1 parent 8e54453 commit 5f96147

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

‎script/frameworks/phpbb/cleaner.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
fxHeader "🧹 phpBB cleaner"
2+
3+
MYSQL_CREDENTIALS_FILE=/etc/turbolab.it/mysql.conf
4+
if [ ! -e "${MYSQL_CREDENTIALS_FILE}" ]; then
5+
fxCatastrophicError "Credentials file ${MYSQL_CREDENTIALS_FILE} not found!"
6+
fi
7+
8+
source "${MYSQL_CREDENTIALS_FILE}"
9+
10+
if [ ! -z "$MYSQL_PASSWORD" ]; then
11+
MYSQL_PASSWORD_HIDDEN="${MYSQL_PASSWORD:0:2}**...**${MYSQL_PASSWORD: -2}"
12+
fi
13+
14+
if [ -z "${WEBROOT_DIR}" ] || [ -z "${PHPBB_DB_NAME}" ] \
15+
[ -z "${MYSQL_USER}" ] || [ -z "${MYSQL_HOST}" ] || [ -z "${MYSQL_PASSWORD}" ] || \
16+
; then
17+
18+
catastrophicError "phpBB cleaner can't run with these variables undefined:
19+
20+
WEBROOT_DIR: ##${WEBROOT_DIR}##
21+
MYSQL_USER: ##${MYSQL_USER}##
22+
MYSQL_HOST: ##${MYSQL_HOST}##
23+
MYSQL_PASSWORD: ##${MYSQL_PASSWORD_HIDDEN}##"
24+
PHPBB_DB_NAME: ##${PHPBB_DB_NAME}##
25+
exit
26+
fi
27+
28+
if [ ! -d "${WEBROOT_DIR}forum" ]; then
29+
catastrophicError "phpBB directory ##${WEBROOT_DIR}forum## not found!"
30+
fi
31+
32+
fxTitle "Deleting anonymous user sessions..."
33+
echo mysqll -u"${MYSQL_USER}" -p"${MYSQL_PASSWORD}" -h "${MYSQL_HOST}" -e "DELETE FROM ${PHPBB_DB_NAME}.phpbb_sessions WHERE session_user_id = 1"

0 commit comments

Comments
 (0)