The lead developer at Mosaic, Brighton with a passion for web application development and motorcycles.
External Link: Updated: Back up Tumblr Blog and/or Disqus Comments
A simple and somewhat dirty script for backing up Tumblr and/or Disqus via its API to an SQLite DB. It now handles backing up Disqus comments to SQLite as well.
External Link: Backing up Tumblr blogs with PHP and SQLite
I have knocked together a very simple and somewhat dirty PHP CLI script to download copies of an entire Tumblr blog through their API. I have imaginatively called it Tumblr Backup PHP. I will be adding extra features as and when I can. The first new feature on the list will be ability backup the associated Disqus comments at the same time.
This script was developed on Windows so you will need to update the PHP binary location in the top of the run.php file. More installation information is available in the readme file on GitHub.
Essentially the script uses php-rest-api by Jason Tan to download all your blog posts in 50 post chunks from the Tumblr API and Idiorm by Jamie Matthews to then save all the posts into an SQLite database.
All you need to do is update the configuration file with your blogs details and then execute run.php in your console/command prompt. You will need SQLite, cURL and PHP5 to run the script. You do not need a web server you can just install PHP on your machine and run the script from the command line just like you would with a Python or Ruby script.
There is currently no allowances for time outs when accessing the API and there is also no restore script at the moment.
Recently I produced a website for hosting on a Linux box running with PHP5 and MySQL5. Well it now needs to move over to a Windows 2003 server with MS SQL as the DB and IIS as opposed to Apache.
Execute the above
Don’t forget to change all the references above to your correct database server settings.
Please note I have had some trouble with SQL Server not accepting 0000-00-00 00:00:00 in datetime fields set to not null in MySQL – set your datetime fields to accept null before exporting.
Also primary keys and auto_increment column attributes are not brought across either. So you will need to go into Server Management and manually re-add your auto_increment (Identity in SQL Server speak) and the primary key. It can also be done programmatically like this:
Because SQL Server doesn’t allow you to alter a pre-existing column to be an Identity (auto_increment) column you have to:
Wow! What a pain.