projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
4.x style employee edit
[freeside.git]
/
rt
/
sbin
/
rt-fulltext-indexer.in
diff --git
a/rt/sbin/rt-fulltext-indexer.in
b/rt/sbin/rt-fulltext-indexer.in
index
bd55adb
..
53dc3fd
100644
(file)
--- a/
rt/sbin/rt-fulltext-indexer.in
+++ b/
rt/sbin/rt-fulltext-indexer.in
@@
-3,7
+3,7
@@
#
# COPYRIGHT:
#
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-201
5
Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-201
7
Best Practical Solutions, LLC
# <sales@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
# <sales@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@
-99,6
+99,8
@@
if ( !flock main::DATA, LOCK_EX | LOCK_NB ) {
}
}
}
}
+my $max_size = RT->Config->Get('MaxFulltextAttachmentSize');
+
my $db_type = RT->Config->Get('DatabaseType');
my $fts_config = $ENV{RT_FTS_CONFIG} ? JSON::from_json($ENV{RT_FTS_CONFIG})
: RT->Config->Get('FullTextSearch') || {};
my $db_type = RT->Config->Get('DatabaseType');
my $fts_config = $ENV{RT_FTS_CONFIG} ? JSON::from_json($ENV{RT_FTS_CONFIG})
: RT->Config->Get('FullTextSearch') || {};
@@
-201,8
+203,16
@@
sub process_bulk_insert {
my ($attachments) = @_;
my @insert;
my $found = 0;
my ($attachments) = @_;
my @insert;
my $found = 0;
+
while ( my $a = $attachments->Next ) {
debug("Found attachment #". $a->id );
while ( my $a = $attachments->Next ) {
debug("Found attachment #". $a->id );
+ if ( $max_size and $a->ContentLength > $max_size ){
+ debug("Attachment #" . $a->id . " is " . $a->ContentLength .
+ " bytes which is larger than configured MaxFulltextAttachmentSize " .
+ " of " . $max_size . ", skipping");
+ next;
+ }
+
my $text = $a->Content // "";
HTML::Entities::decode_entities($text) if $a->ContentType eq "text/html";
push @insert, $text, $a->id;
my $text = $a->Content // "";
HTML::Entities::decode_entities($text) if $a->ContentType eq "text/html";
push @insert, $text, $a->id;
@@
-304,9
+314,17
@@
sub process_pg_update {
attachment_loop( sub {
my ($attachments) = @_;
my @insert;
attachment_loop( sub {
my ($attachments) = @_;
my @insert;
+
while ( my $a = $attachments->Next ) {
debug("Found attachment #". $a->id );
while ( my $a = $attachments->Next ) {
debug("Found attachment #". $a->id );
+ if ( $max_size and $a->ContentLength > $max_size ){
+ debug("Attachment #" . $a->id . " is " . $a->ContentLength .
+ " bytes which is larger than configured MaxFulltextAttachmentSize " .
+ " of " . $max_size . ", skipping");
+ next;
+ }
+
my $text = $a->Content // "";
HTML::Entities::decode_entities($text) if $a->ContentType eq "text/html";
my $text = $a->Content // "";
HTML::Entities::decode_entities($text) if $a->ContentType eq "text/html";