This commit was generated by cvs2svn to compensate for changes in r11022,
[freeside.git] / FS / FS / Cron / vacuum.pm
1 package FS::Cron::vacuum;
2
3 use vars qw( @ISA @EXPORT_OK);
4 use Exporter;
5 use FS::UID qw(driver_name dbh);
6 use FS::Schema qw(dbdef);
7
8 @ISA = qw( Exporter );
9 @EXPORT_OK = qw( vacuum );
10
11 sub vacuum {
12
13   if ( driver_name eq 'Pg' ) {
14     dbh->{AutoCommit} = 1; #so we can vacuum
15     foreach my $table ( dbdef->tables ) {
16       my $sth = dbh->prepare("VACUUM ANALYZE $table") or die dbh->errstr;
17       $sth->execute or die $sth->errstr;
18     }
19   }
20
21 }
22
23 1;