While this patch isn't anywhere nere done, here's a first stab at introducing a database dump mechanism into Drupal. I implemented it at the database level, because each database is going to have its own way of dumping (for example, for SQLLite, the whole file can be copied).
The dumping code itself, so far implemented for only MySQL, is taken nearly-verbatim from demo.module (the Demonstration Site module).
I also included an example of how this could be included into update.php. I haven't included any code for database restore, but I think it wouldn't be too difficult to present a restore screen if an error occurs (and also, it probably wouldn't be too difficult to implement the database-level restore).
I'm looking for general feedback on the patch, and if anyone wants to take this further, that'd be great too.
Comment | File | Size | Author |
---|---|---|---|
#6 | backup.patch | 3.14 KB | dmitrig01 |
#3 | database_backup.patch | 14.7 KB | dmitrig01 |
database_backup.patch | 0 bytes | dmitrig01 | |
Comments
Comment #1
droplet CreditAttribution: droplet commentedwrong patch ?
Comment #2
Damien Tournoud CreditAttribution: Damien Tournoud commentedSee http://drupal.org/sandbox/damz/1174672 for portable database dumps.
Comment #3
dmitrig01 CreditAttribution: dmitrig01 commentedUploading this just for reference. Damien, that could work too, though it's hard to re-import, since it's PHP code. How about exporting to JSON for easy re-importing? In that case, where would the code live? includes/backup.inc?
Comment #4
Damien Tournoud CreditAttribution: Damien Tournoud commentedHow is PHP hard to import? :)
Comment #5
dmitrig01 CreditAttribution: dmitrig01 commentedHard to export and then import from a server, of course it isn't hard to import if you're writing it into an executable place.
Comment #6
dmitrig01 CreditAttribution: dmitrig01 commentedHere's a solution that uses JSON, as I described. Does this seem like a more viable solution?
I didn't include the update.php part in this patch for sake of simplicity, though it should be quite easy.
Comment #7
jhedstromComment #8
googletorp CreditAttribution: googletorp at Reveal IT commented