Exclude information_schema from all-DB backups
authorJamie Cameron <jcameron@webmin.com>
Wed, 7 Oct 2009 19:04:44 +0000 (12:04 -0700)
committerJamie Cameron <jcameron@webmin.com>
Wed, 7 Oct 2009 19:04:44 +0000 (12:04 -0700)
mysql/CHANGELOG
mysql/backup.pl
mysql/backup_db.cgi
mysql/mysql-lib.pl

index 78e3084..693f397 100644 (file)
@@ -86,3 +86,5 @@ Added code to detect a password in /root/.my.cnf which overrides the MYSQL_PWD v
 MySQL stored procedures are now included in backups, where supported.
 ---- Changes since 1.480 ----
 Restores and imports from local files are now run as the Unix user configured for backups, rather than root.
+---- Changes since 1.490 ----
+The information_schema database is no longer included when backing up all databases, as it really just contains metadata.
index 6314f1d..3503bb7 100755 (executable)
@@ -7,7 +7,7 @@ require './mysql-lib.pl';
 
 if ($ARGV[0] eq "--all") {
        $all = 1;
-       @dbs = &list_databases();
+       @dbs = grep { &supports_backup_db($_) } &list_databases();
        $cmode = $config{'backup_cmode_'};
        }
 else {
index 7e4d8dc..7290836 100755 (executable)
@@ -5,7 +5,7 @@
 require './mysql-lib.pl';
 &ReadParse();
 if ($in{'all'}) {
-       @alldbs = &list_databases();
+       @alldbs = grep { &supports_backup_db($_) } &list_databases();
        @dbs = grep { &can_edit_db($_) } @alldbs;
        @alldbs == @dbs || &error($text{'dbase_ecannot'});
        }
index cd8c68b..b441fe2 100755 (executable)
@@ -468,6 +468,13 @@ else {
        }
 }
 
+# supports_backup_db(name)
+# Returns 1 if some database can be backed up
+sub supports_backup_db
+{
+return $_[0] ne "information_schema";
+}
+
 # list_accessible_databases()
 # Returns a list of databases that the current user may access to. Returns
 # an empty list if he has all of them.