[freeside-commits] freeside/FS/FS Upgrade.pm,1.1.2.20,1.1.2.21
Ivan,,,
ivan at wavetail.420.am
Sat Jan 31 20:13:37 PST 2009
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv29736
Modified Files:
Tag: FREESIDE_1_7_BRANCH
Upgrade.pm
Log Message:
commit after each table upgrade, helps with getting huge dbs upgraded, RT#4679
Index: Upgrade.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Upgrade.pm,v
retrieving revision 1.1.2.20
retrieving revision 1.1.2.21
diff -u -d -r1.1.2.20 -r1.1.2.21
--- Upgrade.pm 7 Oct 2008 00:10:44 -0000 1.1.2.20
+++ Upgrade.pm 1 Feb 2009 04:13:35 -0000 1.1.2.21
@@ -40,10 +40,6 @@
sub upgrade {
my %opt = @_;
- my $oldAutoCommit = $FS::UID::AutoCommit;
- local $FS::UID::AutoCommit = 0;
- $FS::UID::AutoCommit = 0;
-
my $data = upgrade_data(%opt);
foreach my $table ( keys %$data ) {
@@ -54,7 +50,17 @@
if ( $class->can('_upgrade_data') ) {
warn "Upgrading $table...\n";
+
+ my $oldAutoCommit = $FS::UID::AutoCommit;
+ local $FS::UID::AutoCommit = 0;
+ $FS::UID::AutoCommit = 0;
+
$class->_upgrade_data(%opt);
+
+ if ( $oldAutoCommit ) {
+ dbh->commit or die dbh->errstr;
+ }
+
} else {
warn "WARNING: asked for upgrade of $table,".
" but FS::$table has no _upgrade_data method\n";
@@ -72,10 +78,6 @@
}
- if ( $oldAutoCommit ) {
- dbh->commit or die dbh->errstr;
- }
-
}
More information about the freeside-commits
mailing list