Index: branches/release-33/plugins/WidgetManager/lib/WidgetManager/Plugin.pm
===================================================================
--- branches/release-33/plugins/WidgetManager/lib/WidgetManager/Plugin.pm (revision 1529)
+++ branches/release-33/plugins/WidgetManager/lib/WidgetManager/Plugin.pm (revision 1713)
@@ -118,3 +118,34 @@
 }
 
+sub restore_widgetmanagers {
+    my ($cb, $objects, $deferred, $errors, $callback) = @_;
+    my $plugin  = $cb->plugin;
+    my @keys = grep { $_ =~ /^MT::PluginData#/ } keys( %$objects );
+    foreach my $key ( @keys ) {
+        my $pd = $objects->{$key};
+        next unless $plugin->key eq $pd->plugin;
+        my $config = $pd->data;
+        next unless $config;
+        my $modulesets = $config->{modulesets};
+        next unless $modulesets;
+
+        foreach my $mod_key ( keys %$modulesets ) {
+            $callback->( $plugin->translate( 'Restoring widgetmanager [_1]... ', $mod_key ) );
+            my $tmpl_ids = $modulesets->{$mod_key};
+            my @tmpl_ids = split ',', $tmpl_ids;
+            my @new_ids;
+            foreach my $id ( @tmpl_ids ) {
+                my $tmpl = $objects->{"MT::Template#$id"};
+                next unless $tmpl;
+                push @new_ids, $tmpl->id;
+            }
+            $modulesets->{$mod_key} = join(',', @new_ids);
+            $callback->( $plugin->translate("Done.") . "\n" );
+        }
+        $pd->data({ modulesets => $modulesets });
+        $pd->save;
+    }
+    1;
+}
+
 1;
