[Rt-commit] rt branch, 4.4/improve-rt-externalize-attachments, repushed

Craig Kaiser craig at bestpractical.com
Tue Jan 2 13:12:36 EST 2018


The branch 4.4/improve-rt-externalize-attachments was deleted and repushed:
       was 8d52a1a45989f21c149dcce2054c1b03b6ea053b
       now b8fcb2496297ed70361c8754f502f8d6f14a62fa

1:  8d52a1a ! 1:  b8fcb24 Improve rt-externalize-attachments
    @@ -315,3 +315,76 @@
     +
     +# don't remove; for locking (see call to flock above)
     +__DATA__
    +
    +diff --git a/sbin/rt-externalize-attachments.in b/sbin/rt-externalize-attachments.in
    +--- a/sbin/rt-externalize-attachments.in
    ++++ b/sbin/rt-externalize-attachments.in
    +@@
    +     "age=s",
    +     "batchsize=s",
    +     "dry-run",
    ++    "attachments=s",
    ++    "attachment_id=s",
    + );
    + 
    + if ($opts{'help'}) {
    +@@
    +     my $column = $class eq 'RT::Attachments' ? "Content" : "LargeContent";
    +     my $id = $last->{$class} || 0;
    +     my $batchsize = $opts{'batchsize'} || 1;
    ++    my $attachments = $opts{'attachments'} || 9999;
    ++    my $attachment_id = $opts{'attachment_id'};
    + 
    +     while (1) {
    +         my $attach = $class->new($RT::SystemUser);
    +@@
    +             VALUE           => 'external',
    +             ENTRYAGGREGATOR => 'AND',
    +         );
    +-
    ++        if ($opts{'attachment_id'}) {
    ++            $attach->Limit(
    ++                FIELD           => 'ID',
    ++                OPERATOR        => '>=',
    ++                VALUE           => $attachment_id,
    ++                ENTRYAGGREGATOR => 'AND',
    ++            );
    ++        }
    +         if ($opts{'age'}) {
    +             my $agelimit = strftime "%F", localtime(time()-$opts{'age'}*24*60*60);
    +             $attach->Limit(
    +@@
    +                 RT->Logger->info("Stored $class $id as $key");
    +             }
    +         }
    +-
    ++            if ( $attach->Count >= $attachments ) {
    ++                RT->Logger->info("Reached attachment limit.");
    ++                exit 2;
    ++            }
    ++        }
    +         last unless $attach->Count and $batchsize > 0;
    +     }
    +     $last->{$class} = $id;
    +@@
    + produced). C<dry-run> implies verbose output.
    + 
    + =back
    ++=item --attachments
    ++
    ++Provide the number of attachments you would like to process.
    ++
    ++=item --attachments
    ++
    ++Provide the number of attachments you would like to process.
    ++
    ++=item --attachment_id
    ++
    ++Provide a attachment ID to have as the starting point of the externalize.
    ++
    ++=item --attachment_id
    ++
    ++Provide a attachment ID to have as the starting point of the externalize.
    + 
    + =head1 SEE ALSO
    + 



More information about the rt-commit mailing list