Recently I had to upgrade a dozen PhpBB boards to the latest version. Previously I would do this by hand, which would take days. This time though, while reading through the update notes, I noticed that it is possible to update the database through the console (I assume this was only introduced in 3.1). That was the necessary prerequisity to be able to automate everything. I ended up with the following script:
echo "Upgrading PhpBB instal in '$1' to 3.1 with files from '$2'..."
echo "Deleting old files..."
shopt -s extglob
rm -r !(config.php|images|files|store)
shopt -u extglob
echo "Copying in 3.1 files..."
rsync -a --exclude='.git' $2/ $1/
echo "Migrating the database..."
php ./bin/phpbbcli.php db:migrate --safe-mode
echo "Removing the install dir..."
rm -r install
The usage is as follows (assuming you named the script
phpbb-update-to-3.1 /www/forum-to-update /tmp/phpbb-3.1-files-for-upgrade
The second parameter is the path to where you have prepared your 3.1 files, according to this guide. You should put your custom styles in this folder too.
If you have custom folders or files within your current install, make sure you add those to the
rm -r !(config.php|images|files|store) line in the update script. This
rm deletes everything except the files within the curly braces.
This saved me a lot of time and prevented mistakes. Enjoy!
I am just studying ACLs in CakePHP. This is one of the most brilliantly written pieces of documentation I’ve read in my web dev career. And I don’t mean it ironically. Whoever written this – thanks man!
…really enjoying it. I have been doing unit testing sparingly for a long time, but just now I am really starting to take it serious. Every new functionality I add to a project/application I am working on I seal with sufficient unit tests. Also it’s much faster to develop and test business logic using tests than testing it trough GUI. I’ve been missing a lot!
Recently I started using this wonderful PHP framework called CakePHP. It really moves the whole web development process to another level. It has got the MVC pattern, great community, good documentation, lots of people writing about it and there is the WebBaker. WebBaker is a PHP script that let’s you easily create all the files you need for your MVC pattern (model, controller, views). This saves you a lot of precious minutes.
The CakePHP and WebBaker combination is deadly. You can have a functional element in your site like in 1 minute. All you need to do is create a table in the database and use WebBaker to generate appropriate files. At this point when you have written exactly 0 lines of code you have a fully functional interface where you can list, view, edit, add and delete items from database. This is possible due to the excellent scaffold functionality build in Cake. Then you can start writing your own code and smoothly replace the scaffolds. Try it, you’ll never want to go back.