]> source.dussan.org Git - redmine.git/commitdiff
Ensure Tranc and Mantis importers don't reset global notification settings (#13989).
authorJean-Baptiste Barth <jeanbaptiste.barth@gmail.com>
Mon, 6 May 2013 20:39:03 +0000 (20:39 +0000)
committerJean-Baptiste Barth <jeanbaptiste.barth@gmail.com>
Mon, 6 May 2013 20:39:03 +0000 (20:39 +0000)
Contributed by Brandon Valentine

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11795 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/tasks/migrate_from_mantis.rake
lib/tasks/migrate_from_trac.rake

index 465ca99585f8b38ddd3cf79959c186d4c8ab00ce..ae8d3bb66951ffee1811d4beb4a5555b088efe9d 100644 (file)
@@ -503,10 +503,17 @@ task :migrate_from_mantis => :environment do
   # Make sure bugs can refer bugs in other projects
   Setting.cross_project_issue_relations = 1 if Setting.respond_to? 'cross_project_issue_relations'
 
-  # Turn off email notifications
-  Setting.notified_events = []
+  old_notified_events = Setting.notified_events
+  begin
+    # Turn off email notifications temporarily
+    Setting.notified_events = []
+    # Run the migration
+    MantisMigrate.establish_connection db_params
+    MantisMigrate.migrate
+  ensure
+    # Restore previous notification settings even if the migration fails
+    Setting.notified_events = old_notified_events
+  end
 
-  MantisMigrate.establish_connection db_params
-  MantisMigrate.migrate
 end
 end
index 923b0c620e3d57d42f973aa32679282ae49989df..406a5b221a287637337401ed4ec1f22db0204c28 100644 (file)
@@ -762,10 +762,16 @@ namespace :redmine do
     prompt('Target project identifier') {|identifier| TracMigrate.target_project_identifier identifier}
     puts
 
-    # Turn off email notifications
-    Setting.notified_events = []
-
-    TracMigrate.migrate
+    old_notified_events = Setting.notified_events
+    begin
+      # Turn off email notifications temporarily
+      Setting.notified_events = []
+      # Run the migration
+      TracMigrate.migrate
+    ensure
+      # Restore previous notification settings even if the migration fails
+      Setting.notified_events = old_notified_events
+    end
   end
 end