Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 399b215e

Von Tamino Steinert vor mehr als 1 Jahr hinzugefügt

  • ID 399b215efe6c454e5b5a87715a1e0c320b1c3b4e
  • Vorgänger 6a73c38f
  • Nachfolger 11067e9a

BJ: CleanUpEmailSubfolders: nur Emaildateien speicher

Es werden keine ein Einträge in die Datenbank gemacht und Emails, die
nicht zugeordnet werden können, werden ohne zu sichern gelöscht.

Unterschiede anzeigen:

SL/BackgroundJob/CleanUpEmailSubfolders.pm
18 18
    ],
19 19
  );
20 20

  
21
  my $email_import = $imap_client->clean_up_subfolders($open_sales_orders);
22
  return unless $email_import;
23

  
24
  $self->{job_obj}->set_data(last_email_import_id => $email_import->id)->save;
21
  $imap_client->clean_up_subfolders($open_sales_orders);
25 22
}
26 23

  
27 24
sub run {
SL/IMAPClient.pm
253 253
    or die "Could not get folders via IMAP: $@\n";
254 254
  my @subfolder_strings = grep { $_ ne $base_folder_string } @$folder_strings;
255 255

  
256
  # Store all emails in journal
257
  my $email_import =
258
    $self->_update_emails_from_folder_strings($base_folder_path, \@subfolder_strings);
259

  
260 256
  # Store the emails to the records
261 257
  foreach my $subfolder_string (@subfolder_strings) {
262 258
    my $ilike_folder_path = $self->get_ilike_folder_path_from_string($subfolder_string);
......
286 282
    $self->update_email_files_for_record($record);
287 283
  }
288 284

  
289
  return ($email_import, \@subfolder_strings);
285
  return \@subfolder_strings;
290 286
}
291 287

  
292 288
sub create_folder {
......
327 323

  
328 324
sub clean_up_subfolders {
329 325
  my ($self, $active_records) = @_;
330
  my $record_folder_path = $self->{base_folder};
331 326

  
332
  my ($email_import, $synced_folders) =
327
  my $subfolder_strings =
333 328
    $self->update_email_subfolders_and_files_for_records();
334 329

  
335
  my @active_folders = map { $self->_get_folder_string_for_record($_) }
330
  my @active_folder_strings = map { $self->_get_folder_string_for_record($_) }
336 331
    @$active_records;
337 332

  
338
  my %keep_folder = map { $_ => 1 } @active_folders;
339
  my @folders_to_delete = grep { !$keep_folder{$_} } @$synced_folders;
333
  my %keep_folder = map { $_ => 1 } @active_folder_strings;
334
  my @folders_to_delete = grep { !$keep_folder{$_} } @$subfolder_strings;
340 335

  
341 336
  foreach my $folder (@folders_to_delete) {
342 337
    $self->{imap_client}->delete($folder)
343 338
      or die "Could not delete IMAP folder '$folder': $@\n";
344 339
  }
345

  
346
  return $email_import;
347 340
}
348 341

  
349 342
sub _get_folder_string_for_record {

Auch abrufbar als: Unified diff