Index: /main/trunk/greenstone2/perllib/gsmysql.pm
===================================================================
--- /main/trunk/greenstone2/perllib/gsmysql.pm	(revision 32593)
+++ /main/trunk/greenstone2/perllib/gsmysql.pm	(revision 32594)
@@ -32,4 +32,6 @@
 
 use DBI; # the central package for this module used by GreenstoneSQL Plugout and Plugin
+use FileUtils;
+use gsprintf;
 
 #################
@@ -110,4 +112,8 @@
 	    print STDERR "   User cancelled: rolling back SQL database transaction.\n";
 	    $_dbh_instance->rollback(); # will warn on failure, nothing more we can/want to do,
+
+	    print STDERR "****************************\n";
+	    &gsprintf::gsprintf(STDERR, "{gsmysql.restore_backups_on_build_cancel_msg}\n");
+	    print STDERR "****************************\n";
 	}
     }
@@ -219,5 +225,5 @@
 {
     my $self= shift (@_);
-    my ($params_map) = @_;
+    my ($params_map) = @_; # map instead of named vars with an eye on gssql inheritance
     
     $params_map->{'db_encoding'} = $self->{'db_encoding'};
@@ -237,20 +243,21 @@
 {
     #my $self= shift (@_); # singleton method doesn't use self, but callers don't need to know that
-    my ($params_map) = @_;
-    
-    if($params_map->{'verbosity'}) {
-	if(!defined $params_map->{'autocommit'}) {
-	    print STDERR "  Autocommit parameter not defined\n";
-	}
-	if($params_map->{'autocommit'}) {
-	    print STDERR "   SQL DB CANCEL SUPPORT OFF.\n" if($params_map->{'verbosity'} > 2);
-	} else {
-	    print STDERR "   SQL DB CANCEL SUPPORT ON.\n";
-	}
-    }
+    my ($params_map) = @_;    
+   
     
     return $_dbh_instance if($_dbh_instance);
-
     # or make the connection
+
+
+    # some useful user messages first
+    if(!defined $params_map->{'autocommit'} && $params_map->{'verbosity'}) {
+	print STDERR "  Autocommit parameter not defined\n";
+    }
+    if($params_map->{'autocommit'}) {
+	print STDERR "   SQL DB CANCEL SUPPORT OFF.\n" if($params_map->{'verbosity'} > 2);
+    } else { # rollback on cancel support on    
+	&issue_backup_on_build_message();
+    }    
+
     
     # For proper utf8 support in MySQL, encoding should be 'utf8mb4' as 'utf8' is insufficient
@@ -779,3 +786,38 @@
 }
 
+# regular function, not method
+# Called when rollback_on_cancel is on.
+# Warns they user to make backups of their archives and index dir
+# and sleeps for 5 seconds so they can do that
+sub issue_backup_on_build_message
+{    	
+    # warn the user they'll need to backup their archives (and index?) folders
+    # plugout stores archivedir in $self->{'output_dir'}, but not available in plugin
+    # But we're only making an example copy command anyway:
+    my $archivesdir = &FileUtils::filenameConcatenate($ENV{'GSDLCOLLECTDIR'}, "archives");
+    my $archives_rollbackdir = $archivesdir.".rollback";
+    
+    # Assume user knows what they're doing if a rollback directory already exists
+    # instead of wasting time waiting for sleep to terminate
+    return if FileUtils::directoryExists("$archives_rollbackdir");
+    
+    my $indexdir = &FileUtils::filenameConcatenate($ENV{'GSDLCOLLECTDIR'}, "index");
+    
+    
+    # use rsync command on unix
+    my $example_copy_cmds = "rsync -pavH $archivesdir $archivesdir.rollback\n";
+    $example_copy_cmds .= "rsync -pavH $indexdir $indexdir.rollback\n";
+    
+    if (($ENV{'GSDLOS'} =~ /^windows$/i) && ($^O ne "cygwin")) {
+	# https://stackoverflow.com/questions/4601161/copying-all-contents-of-folder-to-another-folder-using-batch-file
+	$example_copy_cmds = "xcopy /EVI $archivesdir $archivesdir.rollback\n";
+	$example_copy_cmds .= "xcopy /EVI $indexdir $indexdir.rollback\n";
+	
+	}
+    print STDERR "****************************\n";
+    &gsprintf::gsprintf(STDERR, "{gsmysql.backup_on_build_msg}\n", $example_copy_cmds);
+    print STDERR "****************************\n";	    
+    sleep 5; # 5s	
+}
+
 1;
Index: /main/trunk/greenstone2/perllib/strings.properties
===================================================================
--- /main/trunk/greenstone2/perllib/strings.properties	(revision 32593)
+++ /main/trunk/greenstone2/perllib/strings.properties	(revision 32594)
@@ -1463,4 +1463,7 @@
 GreenstoneSQLPlug.rollback_on_cancel:Support for undo on cancel. Set to true to support rollbacks on cancel. Transactions are then only committed to the database at the end of import and buildcol. Set to false if you do not want undo support, in which case SQL statements are autocommitted to the database.
 
+gsmysql.backup_on_build_msg:   SQL DB CANCEL SUPPORT ON.\n   To have the filesystem mimic the Rollback On Cancel behaviour of the GreenstonePlugs\n   you first need to manually backup your collection's 'archives' and 'index' subfolders\n   so you can manually restore them on cancel when the SQL database is automatically rolled back.\n \n   Example backup commands:\n%s\n   If you don't want to continue, press Ctrl-C to cancel now.
+gsmysql.restore_backups_on_build_cancel_msg:   SQL database rolled back.\n   If you backed up your collection's 'archives' and 'index' subfolders,\n   then restore the backups now.
+
 #
 # Perl module strings
