Backup does not work if $db_url is an array

glong - June 28, 2007 - 11:46
Project:backup
Version:5.x-4.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

According to the documentation in settings.php, $db_url may be an array. Backup does not backup the database in this case. A simple fix would be to use code similar to that found in includes/install.inc or includes/database.inc.

#1

jshuster@drupal.org - April 6, 2008 - 06:48

I've attached a patch that fixes this. It modifies the backup_database function to iterate through each database in $GLOBALS["db_url"], and dump each database to its own backup file.

In doing this, this patch changes $db_file to be an array of filenames, and also changes backup_files to delete multiple temp files, for each database.

This patch also runs the db_url's through the php rawurldecode function to decode any special characters that might be in the database name or password: see http://drupal.org/node/155446#comment-796416 for an explanation.

I used WinMerge to generate this patch -- I can't quite tell if I did this correctly. Let me know if this doesn't work -- I can try redoing this, or simply post a revised functions.inc file.

(Please check this carefully if you use it -- I've only tested this on sites with one and two databases, both declared in arrays.)

AttachmentSize
functions.inc_.patch 2.78 KB

#2

jshuster@drupal.org - April 6, 2008 - 06:50
Status:active» needs review
 
 

Drupal is a registered trademark of Dries Buytaert.