PhpBB
From Rabbi Blog
phpBB, proof that I am a masochist.
Updating versions
Prepping
- Download the full package and read the update directions
- tl\dr: unzip the zip and clear out folder\files to NOT overwrite in the destination later
del config.php
rmdir /s /q "files/"
rmdir /s /q "images/"
rmdir /s /q "store/"
- Double check the listing below and create cleanup.sh executable in the phpbb dir on the webserver
- Run the script from that dir (else it fails) using "Usage: ./cleanup.sh /var/www/html/target_directory"
#!/bin/bash
# Check if target directory is provided as an argument
if [ -z "$1" ]; then
echo "Error: Target directory not provided."
echo "Usage: ./cleanup.sh /path/to/target_directory"
exit 1
fi
# Resolve absolute paths for reliable comparison
TARGET_DIR=$(realpath "$1" 2>/dev/null)
CURRENT_DIR=$(pwd)
# Verify the target directory actually exists before comparing
if [ -z "$TARGET_DIR" ]; then
echo "Error: The specified target directory does not exist."
exit 1
fi
# SAFETY CHECK 1: Ensure script is run from inside the target directory
if [ "$CURRENT_DIR" != "$TARGET_DIR" ]; then
echo "Safety Check Failed: You must run this script from inside the target directory."
echo "Please 'cd' into $TARGET_DIR and run the script from there."
exit 1
fi
# SAFETY CHECK 2: Confirm config.php exists
if [ ! -f "config.php" ]; then
echo "Safety Check Failed: 'config.php' was not found in $CURRENT_DIR."
exit 1
fi
# SAFETY CHECK 3: Confirm config.php contains the word 'phpBB'
if ! grep -q 'phpBB' config.php; then
echo "Safety Check Failed: 'config.php' does not contain the word 'phpBB'."
echo "Aborting to prevent accidental deletion in a non-phpBB directory."
exit 1
fi
echo "Safety checks passed. Starting cleanup in $TARGET_DIR..."
# Execute cleanup
# -mindepth 1 and -maxdepth 1 ensure we only look at the immediate contents of the directory
find . -mindepth 1 -maxdepth 1 \
-not -name 'cleanup.sh' \
-not -name 'config.php' \
-not -name 'ext' \
-not -name 'files' \
-not -name 'images' \
-not -name 'store' \
-not -name 'styles' \
-exec rm -rf {} +
echo "Cleanup complete! Unnecessary files and directories have been removed."
- You should have a clean area now.
- Follow the rest of the directions