[Rt-commit] rt branch, 4.4/external-storage, updated. rt-4.2.11-19-gce9a822
Shawn Moore
shawn at bestpractical.com
Thu May 21 17:35:23 EDT 2015
The branch, 4.4/external-storage has been updated
via ce9a822ef34ef936b5c706889556119d017e6622 (commit)
via dd72a1d432d460beb2a5a8ebe616acb873cd65c4 (commit)
via 7caac89efb5ca3ef2217c412bd57785d061b845b (commit)
via c3dbdcee20a10e3321b4f7e777b19dc5d620d183 (commit)
via d4853359ffd7266a97f512a7446ceac1d6b10437 (commit)
via 111e4da9eecf504c71ea8fabc6b52efc175e607c (commit)
via 2817a0e0fb71076baa4facd374fd029ef13b8f5d (commit)
via 1e4a67b6deb104d1db3516a258121f40e254e7fc (commit)
via a7a2b74689a287eebb31cc0aee4c04c7740cea2a (commit)
via a12cd1ae463b198ae8304c3526633a8db54f1b15 (commit)
via 68e81bc859932007f574f12af7132bdb7954fa0e (commit)
via fe97b4395db8265897158405931045a3d2f36acf (commit)
via fb84a1fc6b7b7f5663ee01f2fec4222638b215fc (commit)
via d4b8dd6e6f3939b40ed6c368159caa48c52e982e (commit)
from 428c9c45c4c552c2c469a3d14acef766882742fb (commit)
Summary of changes:
.gitignore | 1 +
Makefile.in | 1 +
configure.ac | 1 +
lib/RT/{Extension => }/ExternalStorage.pm | 85 +++++-----------------
lib/RT/{Extension => }/ExternalStorage/AmazonS3.pm | 75 +------------------
lib/RT/{Extension => }/ExternalStorage/Backend.pm | 9 +--
lib/RT/{Extension => }/ExternalStorage/Disk.pm | 9 +--
lib/RT/{Extension => }/ExternalStorage/Dropbox.pm | 7 +-
lib/RT/{Extension => }/ExternalStorage/Test.pm.in | 10 +--
...ttachments.in => rt-externalize-attachments.in} | 31 ++++++--
t/externalstorage/basic.t | 10 +--
11 files changed, 68 insertions(+), 171 deletions(-)
rename lib/RT/{Extension => }/ExternalStorage.pm (72%)
rename lib/RT/{Extension => }/ExternalStorage/AmazonS3.pm (72%)
rename lib/RT/{Extension => }/ExternalStorage/Backend.pm (91%)
rename lib/RT/{Extension => }/ExternalStorage/Disk.pm (94%)
rename lib/RT/{Extension => }/ExternalStorage/Dropbox.pm (96%)
rename lib/RT/{Extension => }/ExternalStorage/Test.pm.in (91%)
rename sbin/{extract-attachments.in => rt-externalize-attachments.in} (87%)
- Log -----------------------------------------------------------------
commit d4b8dd6e6f3939b40ed6c368159caa48c52e982e
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Thu May 21 20:02:15 2015 +0000
RT::Extension::ExternalStorage -> RT::ExternalStorage
Simple namespace adjustment, no more.
diff --git a/lib/RT/Extension/ExternalStorage.pm b/lib/RT/ExternalStorage.pm
similarity index 92%
rename from lib/RT/Extension/ExternalStorage.pm
rename to lib/RT/ExternalStorage.pm
index cfac2d8..a8abc20 100644
--- a/lib/RT/Extension/ExternalStorage.pm
+++ b/lib/RT/ExternalStorage.pm
@@ -50,21 +50,21 @@ use 5.008003;
use warnings;
use strict;
-package RT::Extension::ExternalStorage;
+package RT::ExternalStorage;
our $VERSION = '0.61';
use Digest::SHA qw//;
-require RT::Extension::ExternalStorage::Backend;
+require RT::ExternalStorage::Backend;
=head1 NAME
-RT::Extension::ExternalStorage - Store attachments outside the database
+RT::ExternalStorage - Store attachments outside the database
=head1 SYNOPSIS
- Set( @Plugins, 'RT::Extension::ExternalStorage' );
+ Set( @Plugins, 'RT::ExternalStorage' );
Set(%ExternalStorage,
Type => 'Disk',
@@ -105,13 +105,13 @@ May need root permissions
If you are using RT 4.2 or greater, add this line:
- Plugin('RT::Extension::ExternalStorage');
+ Plugin('RT::ExternalStorage');
For RT 4.0, add this line:
- Set(@Plugins, qw(RT::Extension::ExternalStorage));
+ Set(@Plugins, qw(RT::ExternalStorage));
-or add C<RT::Extension::ExternalStorage> to your existing C<@Plugins> line.
+or add C<RT::ExternalStorage> to your existing C<@Plugins> line.
You will also need to configure the C<%ExternalStorage> option,
depending on how and where you want your data stored; see
@@ -147,11 +147,11 @@ documentation in each for necessary configuration details:
=over
-=item L<RT::Extension::ExternalStorage::Disk>
+=item L<RT::ExternalStorage::Disk>
-=item L<RT::Extension::ExternalStorage::Dropbox>
+=item L<RT::ExternalStorage::Dropbox>
-=item L<RT::Extension::ExternalStorage::AmazonS3>
+=item L<RT::ExternalStorage::AmazonS3>
=back
@@ -172,7 +172,7 @@ $RT::Config::META{ExternalStorage} = {
my %hash = $self->Get('ExternalStorage');
return unless keys %hash;
$hash{Write} = $WRITE;
- $BACKEND = RT::Extension::ExternalStorage::Backend->new( %hash );
+ $BACKEND = RT::ExternalStorage::Backend->new( %hash );
},
};
diff --git a/lib/RT/Extension/ExternalStorage/AmazonS3.pm b/lib/RT/ExternalStorage/AmazonS3.pm
similarity index 96%
rename from lib/RT/Extension/ExternalStorage/AmazonS3.pm
rename to lib/RT/ExternalStorage/AmazonS3.pm
index 773ab4d..c36c1d0 100644
--- a/lib/RT/Extension/ExternalStorage/AmazonS3.pm
+++ b/lib/RT/ExternalStorage/AmazonS3.pm
@@ -50,10 +50,10 @@ use 5.008003;
use warnings;
use strict;
-package RT::Extension::ExternalStorage::AmazonS3;
+package RT::ExternalStorage::AmazonS3;
use Role::Basic qw/with/;
-with 'RT::Extension::ExternalStorage::Backend';
+with 'RT::ExternalStorage::Backend';
our( $S3, $BUCKET);
sub Init {
@@ -126,7 +126,7 @@ sub Store {
=head1 NAME
-RT::Extension::ExternalStorage::Dropbox - Store files in the Dropbox cloud
+RT::ExternalStorage::Dropbox - Store files in the Dropbox cloud
=head1 SYNOPSIS
diff --git a/lib/RT/Extension/ExternalStorage/Backend.pm b/lib/RT/ExternalStorage/Backend.pm
similarity index 91%
rename from lib/RT/Extension/ExternalStorage/Backend.pm
rename to lib/RT/ExternalStorage/Backend.pm
index 03b0898..976f3b8 100644
--- a/lib/RT/Extension/ExternalStorage/Backend.pm
+++ b/lib/RT/ExternalStorage/Backend.pm
@@ -50,7 +50,7 @@ use 5.008003;
use warnings;
use strict;
-package RT::Extension::ExternalStorage::Backend;
+package RT::ExternalStorage::Backend;
use Role::Basic;
@@ -68,7 +68,7 @@ sub new {
return undef;
} elsif ($class->require) {
} else {
- my $long = "RT::Extension::ExternalStorage::$class";
+ my $long = "RT::ExternalStorage::$class";
if ($long->require) {
$class = $long;
} else {
@@ -77,8 +77,8 @@ sub new {
}
}
- unless ($class->DOES("RT::Extension::ExternalStorage::Backend")) {
- RT->Logger->error("External storage engine $class doesn't implement RT::Extension::ExternalStorage::Backend");
+ unless ($class->DOES("RT::ExternalStorage::Backend")) {
+ RT->Logger->error("External storage engine $class doesn't implement RT::ExternalStorage::Backend");
return undef;
}
diff --git a/lib/RT/Extension/ExternalStorage/Disk.pm b/lib/RT/ExternalStorage/Disk.pm
similarity index 96%
rename from lib/RT/Extension/ExternalStorage/Disk.pm
rename to lib/RT/ExternalStorage/Disk.pm
index e93fb84..d47c50d 100644
--- a/lib/RT/Extension/ExternalStorage/Disk.pm
+++ b/lib/RT/ExternalStorage/Disk.pm
@@ -50,12 +50,12 @@ use 5.008003;
use warnings;
use strict;
-package RT::Extension::ExternalStorage::Disk;
+package RT::ExternalStorage::Disk;
use File::Path qw//;
use Role::Basic qw/with/;
-with 'RT::Extension::ExternalStorage::Backend';
+with 'RT::ExternalStorage::Backend';
sub Init {
my $self = shift;
@@ -114,7 +114,7 @@ sub Store {
=head1 NAME
-RT::Extension::ExternalStorage::Disk - On-disk storage of attachments
+RT::ExternalStorage::Disk - On-disk storage of attachments
=head1 SYNOPSIS
diff --git a/lib/RT/Extension/ExternalStorage/Dropbox.pm b/lib/RT/ExternalStorage/Dropbox.pm
similarity index 96%
rename from lib/RT/Extension/ExternalStorage/Dropbox.pm
rename to lib/RT/ExternalStorage/Dropbox.pm
index d57bf6b..cf6b4ac 100644
--- a/lib/RT/Extension/ExternalStorage/Dropbox.pm
+++ b/lib/RT/ExternalStorage/Dropbox.pm
@@ -50,10 +50,10 @@ use 5.008003;
use warnings;
use strict;
-package RT::Extension::ExternalStorage::Dropbox;
+package RT::ExternalStorage::Dropbox;
use Role::Basic qw/with/;
-with 'RT::Extension::ExternalStorage::Backend';
+with 'RT::ExternalStorage::Backend';
our $DROPBOX;
sub Init {
@@ -111,7 +111,7 @@ sub Store {
=head1 NAME
-RT::Extension::ExternalStorage::Dropbox - Store files in the Dropbox cloud
+RT::ExternalStorage::Dropbox - Store files in the Dropbox cloud
=head1 SYNOPSIS
diff --git a/lib/RT/Extension/ExternalStorage/Test.pm.in b/lib/RT/ExternalStorage/Test.pm.in
similarity index 91%
rename from lib/RT/Extension/ExternalStorage/Test.pm.in
rename to lib/RT/ExternalStorage/Test.pm.in
index 9032217..7e5fbb3 100644
--- a/lib/RT/Extension/ExternalStorage/Test.pm.in
+++ b/lib/RT/ExternalStorage/Test.pm.in
@@ -52,9 +52,9 @@ use warnings;
### after: use lib qw(@RT_LIB_PATH@);
use lib qw(/opt/rt4/local/lib /opt/rt4/lib);
-package RT::Extension::ExternalStorage::Test;
+package RT::ExternalStorage::Test;
-=head2 RT::Extension::ExternalStorage::Test
+=head2 RT::ExternalStorage::Test
Initialization for testing.
@@ -70,15 +70,15 @@ sub import {
$args{'requires'} ||= [];
if ( $args{'testing'} ) {
- unshift @{ $args{'requires'} }, 'RT::Extension::ExternalStorage';
+ unshift @{ $args{'requires'} }, 'RT::ExternalStorage';
} else {
- $args{'testing'} = 'RT::Extension::ExternalStorage';
+ $args{'testing'} = 'RT::ExternalStorage';
}
$class->SUPER::import( %args );
$class->export_to_level(1);
- require RT::Extension::ExternalStorage;
+ require RT::ExternalStorage;
}
sub attachments_dir {
diff --git a/sbin/extract-attachments.in b/sbin/extract-attachments.in
index ce5dedb..9127700 100755
--- a/sbin/extract-attachments.in
+++ b/sbin/extract-attachments.in
@@ -54,7 +54,7 @@ use warnings;
### after: use lib qw(@RT_LIB_PATH@);
use lib qw(/opt/rt4/local/lib /opt/rt4/lib);
-BEGIN { $RT::Extension::ExternalStorage::WRITE = 1 };
+BEGIN { $RT::ExternalStorage::WRITE = 1 };
use RT -init;
# Ensure we only run one of these processes at once
@@ -64,7 +64,7 @@ exit unless flock main::DATA, LOCK_EX | LOCK_NB;
die "\%ExternalStorage is not configured\n"
unless RT->Config->Get("ExternalStorage");
-exit unless $RT::Extension::ExternalStorage::BACKEND;
+exit unless $RT::ExternalStorage::BACKEND;
my $last = RT->System->FirstAttribute("ExternalStorage");
$last = $last ? $last->Content : {};
@@ -133,7 +133,7 @@ for my $class (qw/RT::Attachments RT::ObjectCustomFieldValues/) {
);
# Attempt to write that out
- my ($key, $msg) = RT::Extension::ExternalStorage->Store( $content );
+ my ($key, $msg) = RT::ExternalStorage->Store( $content );
unless ($key) {
RT->Logger->error("Failed to store $class $id: $msg");
exit 1;
diff --git a/t/externalstorage/basic.t b/t/externalstorage/basic.t
index 281d2e7..4b41231 100644
--- a/t/externalstorage/basic.t
+++ b/t/externalstorage/basic.t
@@ -1,7 +1,7 @@
use strict;
use warnings;
-use RT::Extension::ExternalStorage::Test tests => undef;
+use RT::ExternalStorage::Test tests => undef;
my $queue = RT::Test->load_or_create_queue(Name => 'General');
ok $queue && $queue->id;
@@ -51,7 +51,7 @@ is $attachs[3]->Content, 'thing', "Can get the binary content";
is $attachs[3]->ContentEncoding, "none", "Content is not encoded";
ok $attachs[3]->StoreExternally, "Will store binary data on disk";
-my $dir = RT::Extension::ExternalStorage::Test->attachments_dir;
+my $dir = RT::ExternalStorage::Test->attachments_dir;
ok !<$dir/*>, "Attachments directory is empty";
commit fb84a1fc6b7b7f5663ee01f2fec4222638b215fc
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Thu May 21 20:05:32 2015 +0000
bin/extract-attachments -> sbin/rt-externalize-attachments
Some doc incorrectly described the script as being in sbin/.
diff --git a/lib/RT/ExternalStorage.pm b/lib/RT/ExternalStorage.pm
index a8abc20..66bd2fb 100644
--- a/lib/RT/ExternalStorage.pm
+++ b/lib/RT/ExternalStorage.pm
@@ -82,12 +82,12 @@ database, at the cost of adding additional locations which must be
configured or backed up. Attachment storage paths are calculated based
on file contents; this provides de-duplication.
-The files are initially stored in the database when RT receives them;
-this guarantees that the user does not need to wait for the file to be
-transferred to disk or to the cloud, and makes it durable to transient
-failures of cloud connectivity. The provided C<bin/extract-attachments>
-script, to be run regularly via cron, takes care of moving attachments
-out of the database at a later time.
+The files are initially stored in the database when RT receives
+them; this guarantees that the user does not need to wait for
+the file to be transferred to disk or to the cloud, and makes it
+durable to transient failures of cloud connectivity. The provided
+C<sbin/rt-externalize-attachments> script, to be run regularly via cron,
+takes care of moving attachments out of the database at a later time.
=head1 INSTALLATION
@@ -125,18 +125,18 @@ are extracted.
=item Extract existing attachments
-Run C<bin/extract-attachments>; this may take some time, depending on
-the existing size of the database. This task may be safely cancelled
+Run C<sbin/rt-externalize-attachments>; this may take some time, depending
+on the existing size of the database. This task may be safely cancelled
and re-run to resume.
=item Schedule attachments extraction
-Schedule C<bin/extract-attachments> to run at regular intervals via
+Schedule C<sbin/rt-externalize-attachments> to run at regular intervals via
cron. For instance, the following F</etc/cron.d/rt> entry will run it
daily, which may be good to concentrate network or disk usage to times
when RT is less in use:
- 0 0 * * * root /opt/rt4/local/plugins/RT-Extension-ExternalStorage/bin/extract-attachments
+ 0 0 * * * root /opt/rt4/sbin/rt-externalize-attachments
=back
diff --git a/lib/RT/ExternalStorage/Disk.pm b/lib/RT/ExternalStorage/Disk.pm
index d47c50d..4713a0b 100644
--- a/lib/RT/ExternalStorage/Disk.pm
+++ b/lib/RT/ExternalStorage/Disk.pm
@@ -131,7 +131,7 @@ if the same file appears in multiple transactions, only one copy will be
stored on disk.
The C<Path> must be readable by the webserver, and writable by the
-C<bin/extract-attachments> script. Because the majority of the
+C<sbin/rt-externalize-attachments> script. Because the majority of the
attachments are in the filesystem, a simple database backup is thus
incomplete. It is B<extremely important> that I<backups include the
on-disk attachments directory>.
diff --git a/sbin/extract-attachments.in b/sbin/rt-externalize-attachments.in
similarity index 100%
rename from sbin/extract-attachments.in
rename to sbin/rt-externalize-attachments.in
diff --git a/t/externalstorage/basic.t b/t/externalstorage/basic.t
index 4b41231..473151d 100644
--- a/t/externalstorage/basic.t
+++ b/t/externalstorage/basic.t
@@ -55,9 +55,9 @@ my $dir = RT::ExternalStorage::Test->attachments_dir;
ok !<$dir/*>, "Attachments directory is empty";
-ok -e 'sbin/extract-attachments', "Found extract-attachments script";
-ok -x 'sbin/extract-attachments', "extract-attachments is executable";
-ok !system('sbin/extract-attachments'), "extract-attachments ran successfully";
+ok -e 'sbin/rt-externalize-attachments', "Found rt-externalize-attachments script";
+ok -x 'sbin/rt-externalize-attachments', "rt-externalize-attachments is executable";
+ok !system('sbin/rt-externalize-attachments'), "rt-externalize-attachments ran successfully";
@attachs = @{ $ticket->Transactions->First->Attachments->ItemsArrayRef };
is $attachs[1]->Content, 'test', "Can still get the text part content";
commit fe97b4395db8265897158405931045a3d2f36acf
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Thu May 21 20:07:03 2015 +0000
Remove VERSION from RT::ExternalStorage
It's no longer shipped separately from RT, so no need for a VERSION.
diff --git a/lib/RT/ExternalStorage.pm b/lib/RT/ExternalStorage.pm
index 66bd2fb..1b7d27c 100644
--- a/lib/RT/ExternalStorage.pm
+++ b/lib/RT/ExternalStorage.pm
@@ -52,8 +52,6 @@ use strict;
package RT::ExternalStorage;
-our $VERSION = '0.61';
-
use Digest::SHA qw//;
require RT::ExternalStorage::Backend;
commit 68e81bc859932007f574f12af7132bdb7954fa0e
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Thu May 21 20:09:02 2015 +0000
Remove boilerplate CPAN doc from RT::ExternalStorage
RT's own packages don't typically include author, copyright, etc.
in POD; it's in the BPS TAGGED BLOCK
diff --git a/lib/RT/ExternalStorage.pm b/lib/RT/ExternalStorage.pm
index 1b7d27c..83f4921 100644
--- a/lib/RT/ExternalStorage.pm
+++ b/lib/RT/ExternalStorage.pm
@@ -254,28 +254,4 @@ sub StoreExternally {
}
}
-=head1 AUTHOR
-
-Best Practical Solutions, LLC E<lt>modules at bestpractical.comE<gt>
-
-=head1 BUGS
-
-All bugs should be reported via email to
-
- L<bug-RT-Extension-ExternalStorage at rt.cpan.org|mailto:bug-RT-Extension-ExternalStorage at rt.cpan.org>
-
-or via the web at
-
- L<rt.cpan.org|http://rt.cpan.org/Public/Dist/Display.html?Name=RT-Extension-ExternalStorage>.
-
-=head1 COPYRIGHT
-
-This extension is Copyright (C) 2009-2015 Best Practical Solutions, LLC.
-
-This is free software, licensed under:
-
- The GNU General Public License, Version 2, June 1991
-
-=cut
-
1;
commit a12cd1ae463b198ae8304c3526633a8db54f1b15
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Thu May 21 20:11:52 2015 +0000
Remove 5.8.3 requirement from RT::ExternalStorage modules
RT itself requires at least 5.10 at this point, so these are
spurious.
diff --git a/lib/RT/ExternalStorage.pm b/lib/RT/ExternalStorage.pm
index 83f4921..95915f8 100644
--- a/lib/RT/ExternalStorage.pm
+++ b/lib/RT/ExternalStorage.pm
@@ -46,7 +46,6 @@
#
# END BPS TAGGED BLOCK }}}
-use 5.008003;
use warnings;
use strict;
diff --git a/lib/RT/ExternalStorage/AmazonS3.pm b/lib/RT/ExternalStorage/AmazonS3.pm
index c36c1d0..5f07539 100644
--- a/lib/RT/ExternalStorage/AmazonS3.pm
+++ b/lib/RT/ExternalStorage/AmazonS3.pm
@@ -46,7 +46,6 @@
#
# END BPS TAGGED BLOCK }}}
-use 5.008003;
use warnings;
use strict;
diff --git a/lib/RT/ExternalStorage/Backend.pm b/lib/RT/ExternalStorage/Backend.pm
index 976f3b8..c3f987a 100644
--- a/lib/RT/ExternalStorage/Backend.pm
+++ b/lib/RT/ExternalStorage/Backend.pm
@@ -46,7 +46,6 @@
#
# END BPS TAGGED BLOCK }}}
-use 5.008003;
use warnings;
use strict;
diff --git a/lib/RT/ExternalStorage/Disk.pm b/lib/RT/ExternalStorage/Disk.pm
index 4713a0b..07d3acd 100644
--- a/lib/RT/ExternalStorage/Disk.pm
+++ b/lib/RT/ExternalStorage/Disk.pm
@@ -46,7 +46,6 @@
#
# END BPS TAGGED BLOCK }}}
-use 5.008003;
use warnings;
use strict;
diff --git a/lib/RT/ExternalStorage/Dropbox.pm b/lib/RT/ExternalStorage/Dropbox.pm
index cf6b4ac..ee1eaf6 100644
--- a/lib/RT/ExternalStorage/Dropbox.pm
+++ b/lib/RT/ExternalStorage/Dropbox.pm
@@ -46,7 +46,6 @@
#
# END BPS TAGGED BLOCK }}}
-use 5.008003;
use warnings;
use strict;
commit a7a2b74689a287eebb31cc0aee4c04c7740cea2a
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Thu May 21 21:15:50 2015 +0000
Install sbin/rt-externalize-attachments
diff --git a/Makefile.in b/Makefile.in
index b5ebfb9..3d997c8 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -144,6 +144,7 @@ SYSTEM_BINARIES = rt-attributes-viewer \
rt-email-dashboards \
rt-email-digest \
rt-email-group-admin \
+ rt-externalize-attachments \
rt-fulltext-indexer \
rt-importer \
rt-preferences-viewer \
diff --git a/configure.ac b/configure.ac
index 1bcf2ba..7df7b37 100755
--- a/configure.ac
+++ b/configure.ac
@@ -436,6 +436,7 @@ AC_CONFIG_FILES([
sbin/rt-test-dependencies
sbin/rt-email-digest
sbin/rt-email-dashboards
+ sbin/rt-externalize-attachments
sbin/rt-clean-sessions
sbin/rt-shredder
sbin/rt-validator
commit 1e4a67b6deb104d1db3516a258121f40e254e7fc
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Thu May 21 21:21:57 2015 +0000
Ignore generated sbin/rt-externalize-attachments
diff --git a/.gitignore b/.gitignore
index 855514b..7d7d823 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,6 +27,7 @@
/sbin/rt-email-dashboards
/sbin/rt-email-digest
/sbin/rt-email-group-admin
+/sbin/rt-externalize-attachments
/sbin/rt-fulltext-indexer
/sbin/rt-preferences-viewer
/sbin/rt-server
commit 2817a0e0fb71076baa4facd374fd029ef13b8f5d
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Thu May 21 21:22:08 2015 +0000
Use the standard script setup stanza in externalize-attachments
diff --git a/sbin/rt-externalize-attachments.in b/sbin/rt-externalize-attachments.in
index 9127700..8a18878 100755
--- a/sbin/rt-externalize-attachments.in
+++ b/sbin/rt-externalize-attachments.in
@@ -1,6 +1,4 @@
-#!/usr/bin/env perl
-### before: #!@PERL@
-
+#!@PERL@
# BEGIN BPS TAGGED BLOCK {{{
#
# COPYRIGHT:
@@ -51,8 +49,22 @@
use strict;
use warnings;
-### after: use lib qw(@RT_LIB_PATH@);
-use lib qw(/opt/rt4/local/lib /opt/rt4/lib);
+# fix lib paths, some may be relative
+BEGIN { # BEGIN RT CMD BOILERPLATE
+ require File::Spec;
+ require Cwd;
+ my @libs = ("@RT_LIB_PATH@", "@LOCAL_LIB_PATH@");
+ my $bin_path;
+
+ for my $lib (@libs) {
+ unless ( File::Spec->file_name_is_absolute($lib) ) {
+ $bin_path ||= ( File::Spec->splitpath(Cwd::abs_path(__FILE__)) )[1];
+ $lib = File::Spec->catfile( $bin_path, File::Spec->updir, $lib );
+ }
+ unshift @INC, $lib;
+ }
+
+}
BEGIN { $RT::ExternalStorage::WRITE = 1 };
use RT -init;
commit 111e4da9eecf504c71ea8fabc6b52efc175e607c
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Thu May 21 21:24:31 2015 +0000
Explain that ExternalStorage and $last is high-water mark
diff --git a/sbin/rt-externalize-attachments.in b/sbin/rt-externalize-attachments.in
index 8a18878..34699e7 100755
--- a/sbin/rt-externalize-attachments.in
+++ b/sbin/rt-externalize-attachments.in
@@ -78,6 +78,7 @@ die "\%ExternalStorage is not configured\n"
exit unless $RT::ExternalStorage::BACKEND;
+# pull out the previous high-water mark for each object type
my $last = RT->System->FirstAttribute("ExternalStorage");
$last = $last ? $last->Content : {};
@@ -174,6 +175,7 @@ for my $class (qw/RT::Attachments RT::ObjectCustomFieldValues/) {
$last->{$class} = $id;
}
+# update high-water mark for each object type
RT->System->SetAttribute( Name => "ExternalStorage", Content => $last );
__DATA__
commit d4853359ffd7266a97f512a7446ceac1d6b10437
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Thu May 21 21:23:28 2015 +0000
Explain seemingly-spurious __DATA__
diff --git a/sbin/rt-externalize-attachments.in b/sbin/rt-externalize-attachments.in
index 34699e7..f201437 100755
--- a/sbin/rt-externalize-attachments.in
+++ b/sbin/rt-externalize-attachments.in
@@ -178,4 +178,5 @@ for my $class (qw/RT::Attachments RT::ObjectCustomFieldValues/) {
# update high-water mark for each object type
RT->System->SetAttribute( Name => "ExternalStorage", Content => $last );
+# don't remove; for locking (see call to flock above)
__DATA__
commit c3dbdcee20a10e3321b4f7e777b19dc5d620d183
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Thu May 21 21:29:00 2015 +0000
compatibile -> compatible
diff --git a/lib/RT/ExternalStorage.pm b/lib/RT/ExternalStorage.pm
index 95915f8..91a965e 100644
--- a/lib/RT/ExternalStorage.pm
+++ b/lib/RT/ExternalStorage.pm
@@ -154,7 +154,7 @@ documentation in each for necessary configuration details:
=head1 CAVEATS
-This extension is not currently compatibile with RT's C<shredder> tool;
+This extension is not currently compatible with RT's C<shredder> tool;
attachments which are shredded will not be removed from external
storage.
commit 7caac89efb5ca3ef2217c412bd57785d061b845b
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Thu May 21 21:29:51 2015 +0000
Remove straggling references to ExternalStorage "extension"
diff --git a/lib/RT/ExternalStorage.pm b/lib/RT/ExternalStorage.pm
index 91a965e..9ac720a 100644
--- a/lib/RT/ExternalStorage.pm
+++ b/lib/RT/ExternalStorage.pm
@@ -70,7 +70,7 @@ RT::ExternalStorage - Store attachments outside the database
=head1 DESCRIPTION
-By default, RT stores attachments in the database. This extension moves
+By default, RT stores attachments in the database. ExternalStorage moves
all attachments that RT does not need efficient access to (which include
textual content and images) to outside of the database. This may either
be on local disk, or to a cloud storage solution. This decreases the
@@ -154,7 +154,7 @@ documentation in each for necessary configuration details:
=head1 CAVEATS
-This extension is not currently compatible with RT's C<shredder> tool;
+This feature is not currently compatible with RT's C<shredder> tool;
attachments which are shredded will not be removed from external
storage.
commit dd72a1d432d460beb2a5a8ebe616acb873cd65c4
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Thu May 21 21:31:50 2015 +0000
Remove now-unnecessary install and @Plugins instructions
diff --git a/lib/RT/ExternalStorage.pm b/lib/RT/ExternalStorage.pm
index 9ac720a..6c06ace 100644
--- a/lib/RT/ExternalStorage.pm
+++ b/lib/RT/ExternalStorage.pm
@@ -61,8 +61,6 @@ RT::ExternalStorage - Store attachments outside the database
=head1 SYNOPSIS
- Set( @Plugins, 'RT::ExternalStorage' );
-
Set(%ExternalStorage,
Type => 'Disk',
Path => '/opt/rt4/var/attachments',
@@ -90,26 +88,8 @@ takes care of moving attachments out of the database at a later time.
=over
-=item C<perl Makefile.PL>
-
-=item C<make>
-
-=item C<make install>
-
-May need root permissions
-
=item Edit your F</opt/rt4/etc/RT_SiteConfig.pm>
-If you are using RT 4.2 or greater, add this line:
-
- Plugin('RT::ExternalStorage');
-
-For RT 4.0, add this line:
-
- Set(@Plugins, qw(RT::ExternalStorage));
-
-or add C<RT::ExternalStorage> to your existing C<@Plugins> line.
-
You will also need to configure the C<%ExternalStorage> option,
depending on how and where you want your data stored; see
L</CONFIGURATION>.
commit ce9a822ef34ef936b5c706889556119d017e6622
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Thu May 21 21:34:56 2015 +0000
Remove AmazonS3.pm's copy of Dropbox.pm's documentation
Oops :-)
diff --git a/lib/RT/ExternalStorage/AmazonS3.pm b/lib/RT/ExternalStorage/AmazonS3.pm
index 5f07539..c43f647 100644
--- a/lib/RT/ExternalStorage/AmazonS3.pm
+++ b/lib/RT/ExternalStorage/AmazonS3.pm
@@ -123,74 +123,4 @@ sub Store {
return (1);
}
-=head1 NAME
-
-RT::ExternalStorage::Dropbox - Store files in the Dropbox cloud
-
-=head1 SYNOPSIS
-
- Set(%ExternalStorage,
- Type => 'Dropbox',
- AccessToken => '...',
- );
-
-=head1 DESCRIPTION
-
-This storage option places attachments in the Dropbox shared file
-service. The files are de-duplicated when they are saved; as such, if
-the same file appears in multiple transactions, only one copy will be
-stored on in Dropbox.
-
-Files in Dropbox C<must not be modified or removed>; doing so may cause
-internal inconsistency.
-
-=head1 SETUP
-
-In order to use this stoage type, a new application must be registered
-with Dropbox:
-
-=over
-
-=item 1.
-
-Log into Dropbox as the user you wish to store files as.
-
-=item 2.
-
-Click C<Create app> on L<https://www.dropbox.com/developers/apps>
-
-=item 3.
-
-Choose B<Dropbox API app> as the type of app.
-
-=item 4.
-
-Choose the B<Files and datastores> as the type of data to store.
-
-=item 5.
-
-Choose B<Yes>, your application only needs access to files it creates.
-
-=item 6.
-
-Enter a descriptive name -- C<Request Tracker files> is fine.
-
-=item 7.
-
-Under C<Generated access token>, click the C<Generate> button.
-
-=item 8.
-
-Copy the provided value into your F<RT_SiteConfig.pm> file as the
-C<AccessToken>:
-
- Set(%ExternalStorage,
- Type => 'Dropbox',
- AccessToken => '...', # Replace the value here, between the quotes
- );
-
-=back
-
-=cut
-
1;
-----------------------------------------------------------------------
More information about the rt-commit
mailing list