? db_maintenance.patch
Index: db_maintenance.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/db_maintenance/db_maintenance.module,v
retrieving revision 1.11.2.2.2.3
diff -u -p -r1.11.2.2.2.3 db_maintenance.module
--- db_maintenance.module	1 Oct 2008 05:43:02 -0000	1.11.2.2.2.3
+++ db_maintenance.module	12 Mar 2009 10:09:41 -0000
@@ -470,18 +470,19 @@ function db_maintenance_do_db_backup() {
   $mysqldumpexec = $mysqldump.' '.$mysqloptions.' > '.$filename;
   if (is_dir($backupdir)) {
     exec($mysqldumpexec, $output, $return);
+    $output=implode('<br>',$output);
     //variable_set('db_maintenance_debug', variable_get('db_maintenance_debug', '') . 'MYSQLDUMP: '.$mysqldumpexec.' ('. var_export($return, TRUE) .') '. var_export($output, TRUE)."\n");
     if (!$return && !is_file($filename)) {
+      watchdog('db_maintenance', $output, null, WATCHDOG_ERROR);
       return FALSE;
-      watchdog('db_maintenance', $output, WATCHDOG_ERROR);
     }
     else {
       return $filename;
     }
   }
   else {
+    watchdog('db_maintenance', 'backup directory does not exist',array(), WATCHDOG_ERROR);
     return FALSE;
-    watchdog('db_maintenance', t('backup directory does not exist'), WATCHDOG_ERROR);
   }
 }
 
@@ -495,23 +496,25 @@ function db_maintanence_do_files_backup(
   $date = date($dateformat, $now);
   if (is_file($tarpath) && is_dir($filespath) && is_dir($backupdir)) {
     $backupname = $date.'_'.$dbname.'_files.tar.gz';
-    $command = 'tar -cvzf '.$backupdir.'/'.$backupname.' '.$filespath;
+    $command = "tar -cvzf $backupdir/$backupname --exclude=*".$dbname."_files.tar.gz --exclude=*".$dbname."_db.sql $filespath";
+    $output = array();
     exec($command, $output, $return);
+    $output = implode('<br>',$output);
     //variable_set('db_maintenance_debug', variable_get('db_maintenance_debug', '') . 'TAR: '.$command.' ('. var_export($return, TRUE) .') '. var_export($output, TRUE) ."\n");
     if (!$return) {
       return FALSE;
-      watchdog('db_maintenance', $output, WATCHDOG_ERROR);
+      watchdog('db_maintenance', $output, null, WATCHDOG_ERROR);
     }
     else {
       if (!is_file($backupdir.'/'.$backupname)) {
+        watchdog('db_maintenance', 'failed to create files backup file: !output',array('!output'=>$output), WATCHDOG_ERROR);
         return FALSE;
-        watchdog('db_maintenance', t('failed to create files backup file').': '.$output, WATCHDOG_ERROR);
       }
       return $backupdir.'/'.$backupname;
     }
   }
   else {
-    watchdog('db_maintenance', t('Files dir not present, backup dir not present or path to tar incorrect'), WATCHDOG_ERROR);
+    watchdog('db_maintenance', 'Files dir not present, backup dir not present or path to tar incorrect', array(),WATCHDOG_ERROR);
     return FALSE;
   }
 }
