summaryrefslogtreecommitdiff
blob: 6766cf54e97c304426887bbfaa5b7c82397fefd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
diff -aNru pfa/admin/backup.php postfixAdmin/admin/backup.php
--- pfa/admin/backup.php	2006-02-08 19:00:47.478454000 +0100
+++ postfixAdmin/admin/backup.php	2006-02-22 15:16:43.677891000 +0100
@@ -40,41 +40,11 @@
    } 
    else
    {
-      fwrite ($fh, $header);
-      
-      $tables = array('admin','alias','domain','domain_admins','log','mailbox','vacation');
-
-      for ($i = 0 ; $i < sizeof ($tables) ; ++$i)
-      {
-         $result = db_query ("SHOW CREATE TABLE $tables[$i]");
-         if ($result['rows'] > 0)
-         {
-            while ($row = db_array ($result['result']))
-            {
-               fwrite ($fh, "$row[1]\n\n");
-            }
-         }
-      }   
-
-      for ($i = 0 ; $i < sizeof ($tables) ; ++$i)
-      {
-         $result = db_query ("SELECT * FROM $tables[$i]");
-         if ($result['rows'] > 0)
-         {
-            while ($row = db_assoc ($result['result']))
-            {
-               foreach ($row as $key=>$val)
-               {
-                  $fields[] = $key;
-                  $values[] = $val;
-               }
-
-               fwrite ($fh, "INSERT INTO ". $tables[$i] . " (". implode (',',$fields) . ") VALUES ('" . implode ('\',\'',$values) . "')\n");
-               $fields = "";
-               $values = "";
-            }
-         }
+      exec('/usr/bin/pg_dump -U postgres postfix', $exec_dump);
+      foreach($exec_dump as $row) {
+         fwrite($fh, $row. "\r\n");
       }
+      fclose($fh);
    }
    header ("Content-Type: application/octet-stream");
    header ("Content-Disposition: attachment; filename=\"$filename\"");