[Rt-commit] rt branch, 4.0-trunk, updated. rt-4.0.24-31-gf5886b4
Dustin Graves
dustin at bestpractical.com
Tue Feb 16 18:25:41 EST 2016
The branch, 4.0-trunk has been updated
via f5886b40a95914b67501e1306fb768aab86ddddb (commit)
from 736f2da209c0aade1a33a4c6f2f4a03c7c72ec4d (commit)
Summary of changes:
etc/upgrade/sanity-check-stylesheets | 88 --------
etc/upgrade/shrink-cgm-table | 124 ----------
etc/upgrade/shrink-transactions-table | 126 -----------
etc/upgrade/switch-templates-to | 145 ------------
etc/upgrade/time-worked-history | 111 ---------
etc/upgrade/upgrade-assets | 101 ---------
etc/upgrade/upgrade-sla | 142 ------------
sbin/rt-externalize-attachments | 231 -------------------
sbin/rt-importer | 283 -----------------------
sbin/rt-ldapimport | 136 -----------
sbin/rt-serializer | 399 ---------------------------------
t/data/configs/apache2.4+fastcgi.conf | 48 ----
t/data/configs/apache2.4+mod_perl.conf | 66 ------
13 files changed, 2000 deletions(-)
delete mode 100755 etc/upgrade/sanity-check-stylesheets
delete mode 100755 etc/upgrade/shrink-cgm-table
delete mode 100755 etc/upgrade/shrink-transactions-table
delete mode 100755 etc/upgrade/switch-templates-to
delete mode 100755 etc/upgrade/time-worked-history
delete mode 100755 etc/upgrade/upgrade-assets
delete mode 100755 etc/upgrade/upgrade-sla
delete mode 100755 sbin/rt-externalize-attachments
delete mode 100755 sbin/rt-importer
delete mode 100755 sbin/rt-ldapimport
delete mode 100755 sbin/rt-serializer
delete mode 100644 t/data/configs/apache2.4+fastcgi.conf
delete mode 100644 t/data/configs/apache2.4+mod_perl.conf
- Log -----------------------------------------------------------------
commit f5886b40a95914b67501e1306fb768aab86ddddb
Author: Dustin Graves <dustin at bestpractical.com>
Date: Tue Feb 16 23:20:35 2016 +0000
Remove 4.2+ files accidentally versioned
This was caused by using git add -A after the license tagger without
carefully inspecting the results.
diff --git a/etc/upgrade/sanity-check-stylesheets b/etc/upgrade/sanity-check-stylesheets
deleted file mode 100755
index 1e5ea60..0000000
--- a/etc/upgrade/sanity-check-stylesheets
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/usr/bin/perl
-# BEGIN BPS TAGGED BLOCK {{{
-#
-# COPYRIGHT:
-#
-# This software is Copyright (c) 1996-2016 Best Practical Solutions, LLC
-# <sales at bestpractical.com>
-#
-# (Except where explicitly superseded by other copyright notices)
-#
-#
-# LICENSE:
-#
-# This work is made available to you under the terms of Version 2 of
-# the GNU General Public License. A copy of that license should have
-# been provided with this software, but in any event can be snarfed
-# from www.gnu.org.
-#
-# This work is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-#
-#
-# CONTRIBUTION SUBMISSION POLICY:
-#
-# (The following paragraph is not intended to limit the rights granted
-# to you to modify and distribute this software under the terms of
-# the GNU General Public License and is only of importance to you if
-# you choose to contribute your changes and enhancements to the
-# community by submitting them to Best Practical Solutions, LLC.)
-#
-# By intentionally submitting any modifications, corrections or
-# derivatives to this work, or any other work intended for use with
-# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-# you are the copyright holder for those contributions and you grant
-# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-# royalty-free, perpetual, license to use, copy, create derivative
-# works based on those contributions, and sublicense and distribute
-# those contributions and any derivatives thereof.
-#
-# END BPS TAGGED BLOCK }}}
-use 5.10.1;
-use strict;
-use warnings;
-
-use lib "local/lib";
-use lib "lib";
-
-use RT::Interface::CLI qw(Init);
-Init();
-
-use RT::Users;
-my $users = RT::Users->new( $RT::SystemUser );
-$users->UnLimit();
-
-my @static_roots = RT::Interface::Web->StaticRoots;
-my %static_root_check_cache;
-sub stylesheet_exists {
- my $stylesheet = shift;
-
- return $static_root_check_cache{$stylesheet}
- if exists $static_root_check_cache{$stylesheet};
-
- for my $static_root (@static_roots) {
- return ++$static_root_check_cache{$stylesheet}
- if -d "$static_root/css/$stylesheet";
- }
-
- return $static_root_check_cache{$stylesheet} = 0;
-}
-
-my $system_stylesheet = RT->Config->Get('WebDefaultStylesheet');
-
-while (my $u = $users->Next) {
- my $stylesheet = RT->Config->Get('WebDefaultStylesheet', $u);
- unless (stylesheet_exists $stylesheet) {
- my $prefs = $u->Preferences($RT::System);
- $prefs->{WebDefaultStylesheet} = $system_stylesheet;
- $u->SetPreferences($RT::System, $prefs);
- }
-}
diff --git a/etc/upgrade/shrink-cgm-table b/etc/upgrade/shrink-cgm-table
deleted file mode 100755
index 50f07fc..0000000
--- a/etc/upgrade/shrink-cgm-table
+++ /dev/null
@@ -1,124 +0,0 @@
-#!/usr/bin/perl
-# BEGIN BPS TAGGED BLOCK {{{
-#
-# COPYRIGHT:
-#
-# This software is Copyright (c) 1996-2016 Best Practical Solutions, LLC
-# <sales at bestpractical.com>
-#
-# (Except where explicitly superseded by other copyright notices)
-#
-#
-# LICENSE:
-#
-# This work is made available to you under the terms of Version 2 of
-# the GNU General Public License. A copy of that license should have
-# been provided with this software, but in any event can be snarfed
-# from www.gnu.org.
-#
-# This work is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-#
-#
-# CONTRIBUTION SUBMISSION POLICY:
-#
-# (The following paragraph is not intended to limit the rights granted
-# to you to modify and distribute this software under the terms of
-# the GNU General Public License and is only of importance to you if
-# you choose to contribute your changes and enhancements to the
-# community by submitting them to Best Practical Solutions, LLC.)
-#
-# By intentionally submitting any modifications, corrections or
-# derivatives to this work, or any other work intended for use with
-# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-# you are the copyright holder for those contributions and you grant
-# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-# royalty-free, perpetual, license to use, copy, create derivative
-# works based on those contributions, and sublicense and distribute
-# those contributions and any derivatives thereof.
-#
-# END BPS TAGGED BLOCK }}}
-use 5.10.1;
-use strict;
-use warnings;
-
-use lib "local/lib";
-use lib "lib";
-
-use RT::Interface::CLI qw(Init);
-Init();
-
-use RT::CachedGroupMembers;
-my $cgms = RT::CachedGroupMembers->new( RT->SystemUser );
-$cgms->Limit(
- FIELD => 'id',
- OPERATOR => '!=',
- VALUE => 'main.Via',
- QUOTEVALUE => 0,
- ENTRYAGGREGATOR => 'AND',
-);
-$cgms->FindAllRows;
-
-my $alias = $cgms->Join(
- TYPE => 'LEFT',
- FIELD1 => 'Via',
- TABLE2 => 'CachedGroupMembers',
- FIELD2 => 'id',
-);
-$cgms->Limit(
- ALIAS => $alias,
- FIELD => 'MemberId',
- OPERATOR => '=',
- VALUE => $alias .'.GroupId',
- QUOTEVALUE => 0,
- ENTRYAGGREGATOR => 'AND',
-);
-$cgms->Limit(
- ALIAS => $alias,
- FIELD => 'id',
- OPERATOR => '=',
- VALUE => $alias .'.Via',
- QUOTEVALUE => 0,
- ENTRYAGGREGATOR => 'AND',
-);
-
-my $total = $cgms->Count;
-my $i = 0;
-
-FetchNext( $cgms, 'init' );
-while ( my $rec = FetchNext( $cgms ) ) {
- $i++;
- printf("\r%0.2f %%", 100 * $i / $total);
- $RT::Handle->BeginTransaction;
- my ($status) = $rec->Delete;
- unless ($status) {
- $RT::Logger->error( "Couldn't delete CGM #". $rec->id );
- exit 1;
- }
- $RT::Handle->Commit;
-}
-
-use constant PAGE_SIZE => 10000;
-sub FetchNext {
- my ($objs, $init) = @_;
- if ( $init ) {
- $objs->RowsPerPage( PAGE_SIZE );
- $objs->FirstPage;
- return;
- }
-
- my $obj = $objs->Next;
- return $obj if $obj;
- $objs->RedoSearch;
- $objs->FirstPage;
- return $objs->Next;
-}
-
diff --git a/etc/upgrade/shrink-transactions-table b/etc/upgrade/shrink-transactions-table
deleted file mode 100755
index e7ae4cc..0000000
--- a/etc/upgrade/shrink-transactions-table
+++ /dev/null
@@ -1,126 +0,0 @@
-#!/usr/bin/perl
-# BEGIN BPS TAGGED BLOCK {{{
-#
-# COPYRIGHT:
-#
-# This software is Copyright (c) 1996-2016 Best Practical Solutions, LLC
-# <sales at bestpractical.com>
-#
-# (Except where explicitly superseded by other copyright notices)
-#
-#
-# LICENSE:
-#
-# This work is made available to you under the terms of Version 2 of
-# the GNU General Public License. A copy of that license should have
-# been provided with this software, but in any event can be snarfed
-# from www.gnu.org.
-#
-# This work is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-#
-#
-# CONTRIBUTION SUBMISSION POLICY:
-#
-# (The following paragraph is not intended to limit the rights granted
-# to you to modify and distribute this software under the terms of
-# the GNU General Public License and is only of importance to you if
-# you choose to contribute your changes and enhancements to the
-# community by submitting them to Best Practical Solutions, LLC.)
-#
-# By intentionally submitting any modifications, corrections or
-# derivatives to this work, or any other work intended for use with
-# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-# you are the copyright holder for those contributions and you grant
-# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-# royalty-free, perpetual, license to use, copy, create derivative
-# works based on those contributions, and sublicense and distribute
-# those contributions and any derivatives thereof.
-#
-# END BPS TAGGED BLOCK }}}
-use 5.10.1;
-use strict;
-use warnings;
-
-use lib "local/lib";
-use lib "lib";
-
-use RT::Interface::CLI qw(Init);
-Init();
-
-use RT::Transactions;
-my $txns = RT::Transactions->new( RT->SystemUser );
-$txns->Limit(
- FIELD => 'ObjectType',
- OPERATOR => '=',
- VALUE => 'RT::Group',
- QUOTEVALUE => 1,
- ENTRYAGGREGATOR => 'AND',
-);
-
-my $alias = $txns->Join(
- TYPE => 'LEFT',
- FIELD1 => 'ObjectId',
- TABLE2 => 'Groups',
- FIELD2 => 'Id',
-);
-$txns->Limit(
- ALIAS => $alias,
- FIELD => 'Domain',
- OPERATOR => '=',
- VALUE => 'ACLEquivalence',
- CASESENSITIVE => 0,
- QUOTEVALUE => 1,
- ENTRYAGGREGATOR => 'AND',
-);
-
-$txns->Limit(
- ALIAS => $alias,
- FIELD => 'Name',
- OPERATOR => '=',
- VALUE => 'UserEquiv',
- QUOTEVALUE => 1,
- CASESENSITIVE => 0,
- ENTRYAGGREGATOR => 'AND',
-);
-
-my $total = $txns->Count;
-my $i = 0;
-
-FetchNext( $txns, 'init' );
-while ( my $rec = FetchNext( $txns ) ) {
- $i++;
- printf("\r%0.2f %%", 100 * $i / $total);
- $RT::Handle->BeginTransaction;
- my ($status) = $rec->Delete;
- unless ($status) {
- $RT::Logger->error( "Couldn't delete TXN #". $rec->id );
- exit 1;
- }
- $RT::Handle->Commit;
-}
-
-use constant PAGE_SIZE => 10000;
-sub FetchNext {
- my ($objs, $init) = @_;
- if ( $init ) {
- $objs->RowsPerPage( PAGE_SIZE );
- $objs->FirstPage;
- return;
- }
-
- my $obj = $objs->Next;
- return $obj if $obj;
- $objs->RedoSearch;
- $objs->FirstPage;
- return $objs->Next;
-}
-
diff --git a/etc/upgrade/switch-templates-to b/etc/upgrade/switch-templates-to
deleted file mode 100755
index 282ce71..0000000
--- a/etc/upgrade/switch-templates-to
+++ /dev/null
@@ -1,145 +0,0 @@
-#!/usr/bin/perl
-# BEGIN BPS TAGGED BLOCK {{{
-#
-# COPYRIGHT:
-#
-# This software is Copyright (c) 1996-2016 Best Practical Solutions, LLC
-# <sales at bestpractical.com>
-#
-# (Except where explicitly superseded by other copyright notices)
-#
-#
-# LICENSE:
-#
-# This work is made available to you under the terms of Version 2 of
-# the GNU General Public License. A copy of that license should have
-# been provided with this software, but in any event can be snarfed
-# from www.gnu.org.
-#
-# This work is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-#
-#
-# CONTRIBUTION SUBMISSION POLICY:
-#
-# (The following paragraph is not intended to limit the rights granted
-# to you to modify and distribute this software under the terms of
-# the GNU General Public License and is only of importance to you if
-# you choose to contribute your changes and enhancements to the
-# community by submitting them to Best Practical Solutions, LLC.)
-#
-# By intentionally submitting any modifications, corrections or
-# derivatives to this work, or any other work intended for use with
-# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-# you are the copyright holder for those contributions and you grant
-# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-# royalty-free, perpetual, license to use, copy, create derivative
-# works based on those contributions, and sublicense and distribute
-# those contributions and any derivatives thereof.
-#
-# END BPS TAGGED BLOCK }}}
-use 5.10.1;
-use strict;
-use warnings;
-
-use lib "local/lib";
-use lib "lib";
-
-use RT::Interface::CLI qw(Init);
-Init();
-
-my $to = shift || '';
-my $from;
-
-if ($to =~ /html|text/i) {
- $to = $to =~ /html/i ? 'html' : 'text';
- $from = $to eq 'html' ? 'text' : 'html';
-} else {
- print "Usage: $0 [html|text]\n";
- warn "Please specify if you'd like to switch to HTML or text templates.\n";
- exit 1;
-}
-
-
-my @templates = (
- "Autoreply",
- "Transaction",
- "Admin Correspondence",
- "Correspondence",
- "Admin Comment",
- "Status Change",
- "Resolved",
- "New Pending Approval",
- "Approval Passed",
- "All Approvals Passed",
- "Approval Rejected",
- "Approval Ready for Owner",
-);
-
-$RT::Handle->BeginTransaction();
-
-use RT::Scrips;
-my $scrips = RT::Scrips->new( RT->SystemUser );
-$scrips->UnLimit;
-
-for (@templates) {
- $scrips->Limit(
- FIELD => 'Template',
- VALUE => ($to eq 'html' ? $_ : "$_ in HTML"),
- ENTRYAGGREGATOR => 'OR'
- );
-}
-
-my $switched = 0;
-while ( my $s = $scrips->Next ) {
- my $new = $s->TemplateObj->Name;
-
- if ($to eq 'html') {
- $new .= ' in HTML';
- } else {
- $new =~ s/ in HTML$//;
- }
-
- print $s->id, ": ", $s->Description, "\n";
- print " ", $s->TemplateObj->Name, " -> $new\n\n";
-
- my ($ok, $msg) = $s->SetTemplate($new);
-
- if ($ok) {
- $switched++;
- } else {
- warn " Couldn't switch templates: $msg\n";
- }
-}
-
-$RT::Handle->Commit;
-
-if ($switched) {
- print <<" EOT";
-Switched $switched scrips to $to templates. You should now manually port any
-customizations from the old templates to the new templates.
- EOT
- exit 1 if $switched != $scrips->Count;
-}
-elsif ($scrips->Count) {
- print <<" EOT";
-@{[$scrips->Count]} scrips using $from templates were found, but none were
-successfully switched to $to. See the errors above.
- EOT
- exit 1;
-}
-else {
- print <<" EOT";
-No scrips were found using the $from templates, so none were switched to
-$to templates.
- EOT
-}
-
diff --git a/etc/upgrade/time-worked-history b/etc/upgrade/time-worked-history
deleted file mode 100755
index 475ebf0..0000000
--- a/etc/upgrade/time-worked-history
+++ /dev/null
@@ -1,111 +0,0 @@
-#!/usr/bin/perl
-# BEGIN BPS TAGGED BLOCK {{{
-#
-# COPYRIGHT:
-#
-# This software is Copyright (c) 1996-2016 Best Practical Solutions, LLC
-# <sales at bestpractical.com>
-#
-# (Except where explicitly superseded by other copyright notices)
-#
-#
-# LICENSE:
-#
-# This work is made available to you under the terms of Version 2 of
-# the GNU General Public License. A copy of that license should have
-# been provided with this software, but in any event can be snarfed
-# from www.gnu.org.
-#
-# This work is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-#
-#
-# CONTRIBUTION SUBMISSION POLICY:
-#
-# (The following paragraph is not intended to limit the rights granted
-# to you to modify and distribute this software under the terms of
-# the GNU General Public License and is only of importance to you if
-# you choose to contribute your changes and enhancements to the
-# community by submitting them to Best Practical Solutions, LLC.)
-#
-# By intentionally submitting any modifications, corrections or
-# derivatives to this work, or any other work intended for use with
-# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-# you are the copyright holder for those contributions and you grant
-# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-# royalty-free, perpetual, license to use, copy, create derivative
-# works based on those contributions, and sublicense and distribute
-# those contributions and any derivatives thereof.
-#
-# END BPS TAGGED BLOCK }}}
-use 5.10.1;
-use strict;
-use warnings;
-
-use lib "local/lib";
-use lib "lib";
-
-use RT::Interface::CLI qw(Init);
-Init();
-
-my $dbh = RT->DatabaseHandle->dbh;
-my $ids = $dbh->selectcol_arrayref(
- "SELECT t1.id FROM Tickets t1, Tickets t2 WHERE t1.id = t2.EffectiveId"
- ." AND t2.id != t2.EffectiveId AND t2.EffectiveId = t1.id"
-);
-foreach my $id ( @$ids ) {
- my $t = RT::Ticket->new( RT->SystemUser );
- $t->Load( $id );
- unless ( $t->id ) {
- $RT::Logger->error("Couldn't load ticket #$id");
- next;
- }
-
- fix_time_worked_history($t);
-}
-
-sub fix_time_worked_history {
- my ($t) = (@_);
-
- my $history = 0;
- my $candidate = undef;
- my @delete = ();
- my $delete_time = 0;
-
- my $txns = $t->Transactions;
- while ( my $txn = $txns->Next ) {
- if ( $txn->Type =~ /^(Create|Correspond|Comment)$/ ) {
- $history += $txn->TimeTaken || 0;
- } elsif ( $txn->Type eq 'Set' && $txn->Field eq 'TimeWorked' ) {
- $history += $txn->NewValue - $txn->OldValue;
- $candidate = $txn;
- } elsif ( $candidate && ($txn->Field||'') eq 'MergedInto' ) {
- if ($candidate->Creator eq $txn->Creator ) {
- push @delete, $candidate;
- $delete_time += $candidate->NewValue - $candidate->OldValue;
- }
-
- $candidate = undef;
- }
- }
-
- if ( $history == $t->TimeWorked ) {
- $RT::Logger->info("Ticket #". $t->id . " has TimeWorked matching history. Skipping");
- } elsif ( $history - $delete_time == $t->TimeWorked ) {
- $RT::Logger->warn( "Ticket #". $t->id ." has TimeWorked mismatch. Deleting transactions" );
- foreach my $dtxn ( @delete ) {
- my ($status, $msg) = $dtxn->Delete;
- $RT::Logger->error("Couldn't delete transaction: $msg") unless $status;
- }
- } else {
- $RT::Logger->error( "Ticket #". $t->id ." has TimeWorked mismatch, but we couldn't find correct transactions to delete. Skipping" );
- }
-}
diff --git a/etc/upgrade/upgrade-assets b/etc/upgrade/upgrade-assets
deleted file mode 100755
index 7140d59..0000000
--- a/etc/upgrade/upgrade-assets
+++ /dev/null
@@ -1,101 +0,0 @@
-#!/usr/bin/perl
-# BEGIN BPS TAGGED BLOCK {{{
-#
-# COPYRIGHT:
-#
-# This software is Copyright (c) 1996-2016 Best Practical Solutions, LLC
-# <sales at bestpractical.com>
-#
-# (Except where explicitly superseded by other copyright notices)
-#
-#
-# LICENSE:
-#
-# This work is made available to you under the terms of Version 2 of
-# the GNU General Public License. A copy of that license should have
-# been provided with this software, but in any event can be snarfed
-# from www.gnu.org.
-#
-# This work is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-#
-#
-# CONTRIBUTION SUBMISSION POLICY:
-#
-# (The following paragraph is not intended to limit the rights granted
-# to you to modify and distribute this software under the terms of
-# the GNU General Public License and is only of importance to you if
-# you choose to contribute your changes and enhancements to the
-# community by submitting them to Best Practical Solutions, LLC.)
-#
-# By intentionally submitting any modifications, corrections or
-# derivatives to this work, or any other work intended for use with
-# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-# you are the copyright holder for those contributions and you grant
-# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-# royalty-free, perpetual, license to use, copy, create derivative
-# works based on those contributions, and sublicense and distribute
-# those contributions and any derivatives thereof.
-#
-# END BPS TAGGED BLOCK }}}
-use 5.10.1;
-use strict;
-use warnings;
-
-use lib "local/lib";
-use lib "lib";
-
-use RT::Interface::CLI qw(Init);
-Init();
-
-my $db_name = RT->Config->Get('DatabaseName');
-my $db_type = RT->Config->Get('DatabaseType');
-
-my $dbh = $RT::Handle->dbh;
-
-my $found_assets_tables = {};
-foreach my $name ( $RT::Handle->_TableNames ) {
- next unless grep lc($name) eq $_, qw(rtxassets rtxcatalogs);
- $found_assets_tables->{lc $name}++;
-}
-
-unless ( $found_assets_tables->{rtxassets} && $found_assets_tables->{rtxcatalogs} ) {
- warn "Could not find RT::Extension::Assets data to migrate";
- exit;
-}
-
-{ # port over Catalogs
- my @columns = qw(id Name Lifecycle Description Disabled Creator Created LastUpdatedBy LastUpdated);
- copy_tables('RTxCatalogs','Catalogs',\@columns);
-
-}
-
-
-{ # port over Assets
- my @columns = qw(id Name Catalog Status Description Creator Created LastUpdatedBy LastUpdated);
- copy_tables('RTxAssets','Assets',\@columns);
-}
-
-sub copy_tables {
- my ($source, $dest, $columns) = @_;
- my $column_list = join(', ',@$columns);
- my $sql;
- # SQLite: http://www.sqlite.org/lang_insert.html
- if ( $db_type eq 'mysql' || $db_type eq 'SQLite' ) {
- $sql = "insert into $dest ($column_list) select $column_list from $source";
- }
- # Oracle: http://www.adp-gmbh.ch/ora/sql/insert/select_and_subquery.html
- elsif ( $db_type eq 'Pg' || $db_type eq 'Oracle' ) {
- $sql = "insert into $dest ($column_list) (select $column_list from $source)";
- }
- $RT::Logger->debug($sql);
- $dbh->do($sql);
-}
diff --git a/etc/upgrade/upgrade-sla b/etc/upgrade/upgrade-sla
deleted file mode 100755
index e18acea..0000000
--- a/etc/upgrade/upgrade-sla
+++ /dev/null
@@ -1,142 +0,0 @@
-#!/usr/bin/perl
-# BEGIN BPS TAGGED BLOCK {{{
-#
-# COPYRIGHT:
-#
-# This software is Copyright (c) 1996-2016 Best Practical Solutions, LLC
-# <sales at bestpractical.com>
-#
-# (Except where explicitly superseded by other copyright notices)
-#
-#
-# LICENSE:
-#
-# This work is made available to you under the terms of Version 2 of
-# the GNU General Public License. A copy of that license should have
-# been provided with this software, but in any event can be snarfed
-# from www.gnu.org.
-#
-# This work is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-#
-#
-# CONTRIBUTION SUBMISSION POLICY:
-#
-# (The following paragraph is not intended to limit the rights granted
-# to you to modify and distribute this software under the terms of
-# the GNU General Public License and is only of importance to you if
-# you choose to contribute your changes and enhancements to the
-# community by submitting them to Best Practical Solutions, LLC.)
-#
-# By intentionally submitting any modifications, corrections or
-# derivatives to this work, or any other work intended for use with
-# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-# you are the copyright holder for those contributions and you grant
-# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-# royalty-free, perpetual, license to use, copy, create derivative
-# works based on those contributions, and sublicense and distribute
-# those contributions and any derivatives thereof.
-#
-# END BPS TAGGED BLOCK }}}
-use 5.10.1;
-use strict;
-use warnings;
-
-use lib "local/lib";
-use lib "lib";
-
-use RT::Interface::CLI qw(Init);
-Init();
-
-my $tickets = RT::Tickets->new(RT->SystemUser);
-$tickets->FromSQL('CF.SLA IS NOT NULL AND SLA IS NULL');
-while ( my $ticket = $tickets->Next ) {
- my ($ret, $msg) = $ticket->SetSLA($ticket->FirstCustomFieldValue('SLA'));
- unless ( $ret ) {
- RT->Logger->error("Failed to upgrade SLA for ticket #" . $ticket->id . ": $msg");
- }
-}
-
-my $queues = RT::Queues->new(RT->SystemUser);
-$queues->UnLimit;
-
-my %cfs_to_disable;
-while ( my $queue = $queues->Next ) {
- my $cfs = $queue->TicketCustomFields;
- $cfs->Limit(FIELD => 'Name', VALUE => 'SLA', CASESENSITIVE => 0 );
- if ( my $cf = $cfs->First ) {
- $cfs_to_disable{$cf->id} ||= $cf;
- }
- elsif ( !$queue->SLADisabled ) {
- my ($ret, $msg) = $queue->SetSLADisabled(1);
- if ( $ret ) {
- RT->Logger->info("Disabled SLA for queue #" . $queue->id . " because it doesn't have custom field SLA applied");
- }
- else {
- RT->Logger->error("Failed to disable SLA for queue #" . $queue->id . ": $msg");
- }
- }
-}
-
-for my $cf ( values %cfs_to_disable ) {
- my ($ret, $msg) = $cf->SetDisabled(1);
- if ( $ret ) {
- RT->Logger->info("Disabled custom field SLA #" . $cf->id);
- }
- else {
- RT->Logger->error("Failed to disable custom field SLA #" . $cf->id . ": $msg");
- }
-}
-
-my @old_scrips = ( '[SLA] Set default service level if needed', '[SLA] Set starts date if needed', '[SLA] Set due date if needed' );
-for my $item ( @old_scrips ) {
- my $scrip = RT::Scrip->new(RT->SystemUser);
- $scrip->LoadByCols( Description => $item );
- if ( $scrip->id ) {
- my ($ret, $msg) = $scrip->RT::Record::Delete();
- if ( $ret ) {
- RT->Logger->info(qq{Deleted scrip "$item"});
- }
- else {
- RT->Logger->error(qq{Failed to delete scrip "$item": $msg});
- }
- }
-}
-
-my @old_conditions = ( '[SLA] Require default', '[SLA] Require Starts set', '[SLA] Require Due set' );
-for my $item ( @old_conditions ) {
- my $condition = RT::ScripCondition->new(RT->SystemUser);
- $condition->Load($item);
- if ( $condition->id ) {
- my ($ret, $msg) = $condition->RT::Record::Delete();
- if ( $ret ) {
- RT->Logger->info(qq{Deleted condition "$item"});
- }
- else {
- RT->Logger->error(qq{Failed to delete condition "$item": $msg});
- }
- }
-}
-
-my @old_actions = ('[SLA] Set default service level', '[SLA] Set starts date', '[SLA] Set due date' );
-for my $item ( @old_actions ) {
- my $action = RT::ScripAction->new(RT->SystemUser);
- $action->Load($item);
- if ( $action->id ) {
- my ($ret, $msg) = $action->RT::Record::Delete();
- if ( $ret ) {
- RT->Logger->info(qq{Deleted action "$item"});
- }
- else {
- RT->Logger->error(qq{Failed to delete action "$item": $msg});
- }
- }
-}
diff --git a/sbin/rt-externalize-attachments b/sbin/rt-externalize-attachments
deleted file mode 100755
index f73bad4..0000000
--- a/sbin/rt-externalize-attachments
+++ /dev/null
@@ -1,231 +0,0 @@
-#!/usr/bin/perl
-# BEGIN BPS TAGGED BLOCK {{{
-#
-# COPYRIGHT:
-#
-# This software is Copyright (c) 1996-2016 Best Practical Solutions, LLC
-# <sales at bestpractical.com>
-#
-# (Except where explicitly superseded by other copyright notices)
-#
-#
-# LICENSE:
-#
-# This work is made available to you under the terms of Version 2 of
-# the GNU General Public License. A copy of that license should have
-# been provided with this software, but in any event can be snarfed
-# from www.gnu.org.
-#
-# This work is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-#
-#
-# CONTRIBUTION SUBMISSION POLICY:
-#
-# (The following paragraph is not intended to limit the rights granted
-# to you to modify and distribute this software under the terms of
-# the GNU General Public License and is only of importance to you if
-# you choose to contribute your changes and enhancements to the
-# community by submitting them to Best Practical Solutions, LLC.)
-#
-# By intentionally submitting any modifications, corrections or
-# derivatives to this work, or any other work intended for use with
-# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-# you are the copyright holder for those contributions and you grant
-# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-# royalty-free, perpetual, license to use, copy, create derivative
-# works based on those contributions, and sublicense and distribute
-# those contributions and any derivatives thereof.
-#
-# END BPS TAGGED BLOCK }}}
-use strict;
-use warnings;
-
-# fix lib paths, some may be relative
-BEGIN { # BEGIN RT CMD BOILERPLATE
- require File::Spec;
- require Cwd;
- my @libs = ("lib", "local/lib");
- 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;
- }
-
-}
-
-# Read in the options
-my %opts;
-use Getopt::Long;
-GetOptions( \%opts,
- "help|h", "verbose|v",
-);
-
-if ($opts{'help'}) {
- require Pod::Usage;
- print Pod::Usage::pod2usage(-verbose => 2);
- exit;
-}
-
-use RT -init;
-
-# Ensure we only run one of these processes at once
-use Fcntl ':flock';
-exit unless flock main::DATA, LOCK_EX | LOCK_NB;
-
-use Digest::SHA qw//;
-
-my $ExternalStorage = RT->System->ExternalStorage;
-
-die "\%ExternalStorage is not configured\n"
- unless $ExternalStorage;
-
-if ($ExternalStorage->can('IsWriteable')) {
- my ($ok, $msg) = $ExternalStorage->IsWriteable;
- die $msg if !$ok;
-}
-
-# pull out the previous high-water mark for each object type
-my $last = RT->System->FirstAttribute("ExternalStorage");
-$last = $last ? $last->Content : {};
-
-for my $class (qw/RT::Attachments RT::ObjectCustomFieldValues/) {
- my $column = $class eq 'RT::Attachments' ? "Content" : "LargeContent";
- my $id = $last->{$class} || 0;
-
- while (1) {
- my $attach = $class->new($RT::SystemUser);
- $attach->Limit(
- FIELD => 'id',
- OPERATOR => '>',
- VALUE => $id,
- );
- $attach->Limit(
- FIELD => 'ContentEncoding',
- OPERATOR => '!=',
- VALUE => 'external',
- ENTRYAGGREGATOR => 'AND',
- );
-
- if ($class eq "RT::ObjectCustomFieldValues") {
- $attach->{'find_disabled_rows'} = 1;
- }
-
- $attach->RowsPerPage(100);
- while ( my $a = $attach->Next ) {
- $id = $a->id;
-
- my ($ok, $why) = $a->ShouldStoreExternally;
- if (!$ok) {
- if ($opts{verbose}) {
- RT->Logger->info("Skipping $class $id because: $why");
- }
- next;
- }
-
- # Explicitly get bytes (not characters, which ->$column would do)
- my $content = $a->_DecodeLOB(
- "application/octet-stream",
- $a->ContentEncoding,
- $a->_Value( $column, decode_utf8 => 0),
- );
-
- # Attempt to write that out
- if ($opts{verbose}) {
- RT->Logger->info("Storing $class $id");
- }
-
- my ($key, $msg) = Store( $content );
- unless ($key) {
- RT->Logger->error("Failed to store $class $id: $msg");
- exit 1;
- }
-
- $RT::Handle->dbh->begin_work;
-
- (my $status, $msg ) = $a->__Set(
- Field => $column, Value => $key
- );
- unless ($status) {
- RT->Logger->error("Failed to update $column of $class $id: $msg");
- exit 2;
- }
-
- ( $status, $msg ) = $a->__Set(
- Field => 'ContentEncoding', Value => 'external',
- );
- unless ($status) {
- RT->Logger->error("Failed to update ContentEncoding of $class $id: $msg");
- exit 2;
- }
-
- $RT::Handle->dbh->commit;
-
- if ($opts{verbose}) {
- RT->Logger->info("Stored $class $id as $key");
- }
- }
-
- last unless $attach->Count;
- }
- $last->{$class} = $id;
-}
-
-# update high-water mark for each object type
-RT->System->SetAttribute( Name => "ExternalStorage", Content => $last );
-
-sub Store {
- my $content = shift;
-
- my $key = Digest::SHA::sha256_hex( $content );
- my ($ok, $msg) = $ExternalStorage->Store( $key => $content );
- return ($ok, $msg) unless defined $ok;
-
- return ($key);
-}
-
-=head1 NAME
-
-rt-externalize-attachments - Move attachments from database to external storage
-
-=head1 SYNOPSIS
-
- rt-externalize-attachments [options]
-
-=head1 OPTIONS
-
-This tool supports a few options. Most are for debugging.
-
-=over 8
-
-=item -h
-
-=item --help
-
-Display this documentation
-
-=item -v
-
-=item --verbose
-
-Log a message (at level "info") for each attachment, both before its
-upload begins and after it completes.
-
-=back
-
-=cut
-
-# don't remove; for locking (see call to flock above)
-__DATA__
diff --git a/sbin/rt-importer b/sbin/rt-importer
deleted file mode 100755
index 2127280..0000000
--- a/sbin/rt-importer
+++ /dev/null
@@ -1,283 +0,0 @@
-#!/usr/bin/perl
-# BEGIN BPS TAGGED BLOCK {{{
-#
-# COPYRIGHT:
-#
-# This software is Copyright (c) 1996-2016 Best Practical Solutions, LLC
-# <sales at bestpractical.com>
-#
-# (Except where explicitly superseded by other copyright notices)
-#
-#
-# LICENSE:
-#
-# This work is made available to you under the terms of Version 2 of
-# the GNU General Public License. A copy of that license should have
-# been provided with this software, but in any event can be snarfed
-# from www.gnu.org.
-#
-# This work is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-#
-#
-# CONTRIBUTION SUBMISSION POLICY:
-#
-# (The following paragraph is not intended to limit the rights granted
-# to you to modify and distribute this software under the terms of
-# the GNU General Public License and is only of importance to you if
-# you choose to contribute your changes and enhancements to the
-# community by submitting them to Best Practical Solutions, LLC.)
-#
-# By intentionally submitting any modifications, corrections or
-# derivatives to this work, or any other work intended for use with
-# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-# you are the copyright holder for those contributions and you grant
-# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-# royalty-free, perpetual, license to use, copy, create derivative
-# works based on those contributions, and sublicense and distribute
-# those contributions and any derivatives thereof.
-#
-# END BPS TAGGED BLOCK }}}
-use strict;
-use warnings;
-
-# fix lib paths, some may be relative
-BEGIN {
- require File::Spec;
- my @libs = ("lib", "local/lib");
- my $bin_path;
-
- for my $lib (@libs) {
- unless ( File::Spec->file_name_is_absolute($lib) ) {
- unless ($bin_path) {
- if ( File::Spec->file_name_is_absolute(__FILE__) ) {
- $bin_path = ( File::Spec->splitpath(__FILE__) )[1];
- }
- else {
- require FindBin;
- no warnings "once";
- $bin_path = $FindBin::Bin;
- }
- }
- $lib = File::Spec->catfile( $bin_path, File::Spec->updir, $lib );
- }
- unshift @INC, $lib;
- }
-
-}
-
-use RT;
-RT::LoadConfig();
-RT::Init();
-
- at RT::Record::ISA = qw( DBIx::SearchBuilder::Record RT::Base );
-
-use RT::Migrate;
-use RT::Migrate::Importer::File;
-use Getopt::Long;
-use Pod::Usage qw//;
-use Time::HiRes qw//;
-
-my %OPT = (resume => 1);
-GetOptions(
- \%OPT,
- "help|?",
- "quiet|q!",
- "list|l!",
-
- "resume!",
- "originalid|i=s",
-
- "ask",
- "ignore-errors",
-
- "dump=s@",
-) or Pod::Usage::pod2usage();
-
-Pod::Usage::pod2usage(-verbose => 1) if $OPT{help};
-
-Pod::Usage::pod2usage() unless @ARGV == 1;
-my ($dir) = @ARGV;
-$dir =~ s|/$||;
-die "No such directory $dir\n" unless -d $dir;
-die "$dir doesn't appear to contain serialized data\n"
- unless -f "$dir/001.dat";
-
-if ($OPT{dump}) {
- die "Dumping objects only works in conjunction with --list\n"
- unless $OPT{list};
-
- $OPT{dump} = [ split /,/, join(',', @{$OPT{dump}}) ];
-}
-
-my $error_handler;
-if ($OPT{ask}) {
- die "Interactive mode (--ask) doesn't work when STDERR and STDIN aren't terminals.\n"
- unless -t STDERR and -t STDIN;
-
- $error_handler = sub {
- my $importer = shift;
- local $| = 1;
- print STDERR "\n", @_, "\n";
- print STDERR "Hit any key to abort import, or type 'ignore' to continue anyway.\n";
- print STDERR "Continuing may leave you with a corrupt database. > ";
- chomp( my $resp = <STDIN> );
- return lc($resp) eq 'ignore';
- };
-}
-elsif ($OPT{'ignore-errors'}) {
- $error_handler = sub {
- my $importer = shift;
- warn "Ignoring error: ", @_;
- return 1;
- };
-}
-
-my $import = RT::Migrate::Importer::File->new(
- Directory => $dir,
- OriginalId => $OPT{originalid},
- DumpObjects => $OPT{dump},
- Resume => $OPT{resume},
- HandleError => $error_handler,
-);
-
-if ($import->Metadata and -t STDOUT and not $OPT{quiet}) {
- $import->Progress(
- RT::Migrate::progress(
- counts => sub { $import->ObjectCount },
- max => $import->Metadata->{ObjectCount},
- )
- );
-}
-
-my $log = RT::Migrate::setup_logging( $dir => 'importer.log' );
-print "Logging warnings and errors to $log\n" if $log;
-
-my %counts;
-if ($OPT{list}) {
- %counts = $import->List;
-
- my $org = $import->Organization;
- print "=========== Dump of $org ===========\n\n";
-} else {
- %counts = $import->Import;
-
- my $org = $import->Organization;
- print "========== Import of $org ==========\n\n";
-}
-
-print "Total object counts:\n";
-for (sort {$counts{$b} <=> $counts{$a}} keys %counts) {
- printf "%8d %s\n", $counts{$_}, $_;
-}
-
-my @missing = $import->Missing;
-if (@missing) {
- warn "The following UIDs were expected but never observed:\n";
- warn " $_\n" for @missing;
-}
-
-my @invalid = $import->Invalid;
-if (@invalid) {
- warn "The following UIDs (serialized => imported) referred to objects missing from the original database:\n";
- for my $info (@invalid) {
- my $uid = delete $info->{uid};
- my $obj = $import->LookupObj($uid);
- warn sprintf " %s => %s (%s)\n",
- $uid,
- ($obj && $obj->Id ? $obj->UID : '(not imported)'),
- join(", ", map { "$_ => $info->{$_}" }
- grep { defined $info->{$_} }
- sort keys %$info);
- }
-}
-
-if ($log and -s $log) {
- print STDERR "\n! Some warnings or errors occurred during import."
- ."\n! Please see $log for details.\n\n";
-}
-
-exit @missing;
-
-=head1 NAME
-
-rt-importer - Import a serialized RT database on top of the current one
-
-=head1 SYNOPSIS
-
- rt-importer path/to/export/directory
-
-This script is used to import the contents of a dump created by
-C<rt-serializer>. It will create all of the objects in the dump in the
-current database; this may include users, queues, and tickets.
-
-It is possible to stop the import process with ^C; it can be later
-resumed by re-running the importer.
-
-=head2 OPTIONS
-
-=over
-
-=item B<--list>
-
-Print a summary of the data contained in the dump.
-
-=item B<--originalid> I<cfname>
-
-Places the original ticket organization and ID into a global custom
-field with the given name. If no global ticket custom field with that
-name is found in the current database, it will create one.
-
-=item B<--ask>
-
-Prompt for action when an error occurs inserting a record into the
-database. This can often happen when importing data from very old RTs
-where some attachments (usually spam) contain invalid UTF-8.
-
-The importer will pause and ask if you want to ignore the error and
-continue on or abort (potentially to restart later). Ignoring errors
-will result in missing records in the database, which may cause database
-integrity problems later. If you ignored any errors, you should run
-C<rt-validator> after import.
-
-=item B<--ignore-errors>
-
-Ignore all record creation errors and continue on when importing. This
-is equivalent to running with C<--ask> and manually typing "ignore" at
-every prompt. You should always run C<rt-validator> after importing
-with errors ignored.
-
-B<This option can be dangerous and leave you with a broken RT!>
-
-=item B<--dump> I<class>[,I<class>]
-
-Prints L<Data::Dumper> representations of the objects of type I<class> in the
-serialized data. This is mostly useful for debugging.
-
-Works only in conjunction with C<--list>.
-
-=back
-
-
-=head1 CLONED DATA
-
-Some dumps may have been taken as complete clones of the RT system,
-which are only suitable for inserting into a schema with no data in it.
-You can setup the required database state for the receiving RT instance
-by running:
-
- /opt/rt4/sbin/rt-setup-database --action create,schema,acl --prompt-for-dba-password
-
-The normal C<make initdb> step will B<not> work because it also inserts
-core system data.
-
-
-=cut
diff --git a/sbin/rt-ldapimport b/sbin/rt-ldapimport
deleted file mode 100755
index 8175879..0000000
--- a/sbin/rt-ldapimport
+++ /dev/null
@@ -1,136 +0,0 @@
-#!/usr/bin/perl
-# BEGIN BPS TAGGED BLOCK {{{
-#
-# COPYRIGHT:
-#
-# This software is Copyright (c) 1996-2016 Best Practical Solutions, LLC
-# <sales at bestpractical.com>
-#
-# (Except where explicitly superseded by other copyright notices)
-#
-#
-# LICENSE:
-#
-# This work is made available to you under the terms of Version 2 of
-# the GNU General Public License. A copy of that license should have
-# been provided with this software, but in any event can be snarfed
-# from www.gnu.org.
-#
-# This work is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-#
-#
-# CONTRIBUTION SUBMISSION POLICY:
-#
-# (The following paragraph is not intended to limit the rights granted
-# to you to modify and distribute this software under the terms of
-# the GNU General Public License and is only of importance to you if
-# you choose to contribute your changes and enhancements to the
-# community by submitting them to Best Practical Solutions, LLC.)
-#
-# By intentionally submitting any modifications, corrections or
-# derivatives to this work, or any other work intended for use with
-# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-# you are the copyright holder for those contributions and you grant
-# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-# royalty-free, perpetual, license to use, copy, create derivative
-# works based on those contributions, and sublicense and distribute
-# those contributions and any derivatives thereof.
-#
-# END BPS TAGGED BLOCK }}}
-use strict;
-use warnings;
-
-$|++;
-
-# fix lib paths, some may be relative
-BEGIN { # BEGIN RT CMD BOILERPLATE
- require File::Spec;
- require Cwd;
- my @libs = ("lib", "local/lib");
- 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 {
- use RT;
- RT::LoadConfig();
- RT::Init();
-};
-
-eval { require RT::LDAPImport; 1; } or do {
- print "Unable to run rt-ldapimport without dependencies.\n";
- print "Rerun configure with the --enable-externalauth option.";
- exit 0;
-};
-
-
-my %OPT = (
- users => 1,
- groups => 1,
-);
-use Getopt::Long;
-GetOptions(
- \%OPT,
- 'debug', 'help',
- 'import', 'users!', 'groups!',
-);
-if ($OPT{help}) {
- print <<USAGE;
-$0: [--debug] [--import] [--help]
- --help This usage statement.
- --debug Enable debugging.
- --import Do the import.
- --no-users Skip users.
- --no-groups Skip groups.
-USAGE
- exit 0;
-}
-
-my $importer = RT::LDAPImport->new;
-
-if( $OPT{debug} ) {
- RT->Config->Set( LogToSTDERR => 'debug' );
-} else {
- RT->Config->Set( LogToSTDERR => undef );
-}
-
-if ($OPT{import}) {
- if ($OPT{users}) {
- print "Starting import\n";
- $importer->import_users(import => 1);
- }
- if ($OPT{groups}) {
- print "Starting group import\n";
- $importer->import_groups(import => 1);
- }
- print "Finished import\n";
-} else {
- print <<TESTING;
-Running test import, no data will be changed
-Rerun command with --import to perform the import
-Rerun command with --debug for more information
-TESTING
- $importer->import_users if $OPT{users};
- if ($OPT{groups}) {
- print "Testing group import\n";
- $importer->import_groups();
- }
- print "Finished test\n";
-}
diff --git a/sbin/rt-serializer b/sbin/rt-serializer
deleted file mode 100755
index 486916e..0000000
--- a/sbin/rt-serializer
+++ /dev/null
@@ -1,399 +0,0 @@
-#!/usr/bin/perl
-# BEGIN BPS TAGGED BLOCK {{{
-#
-# COPYRIGHT:
-#
-# This software is Copyright (c) 1996-2016 Best Practical Solutions, LLC
-# <sales at bestpractical.com>
-#
-# (Except where explicitly superseded by other copyright notices)
-#
-#
-# LICENSE:
-#
-# This work is made available to you under the terms of Version 2 of
-# the GNU General Public License. A copy of that license should have
-# been provided with this software, but in any event can be snarfed
-# from www.gnu.org.
-#
-# This work is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-#
-#
-# CONTRIBUTION SUBMISSION POLICY:
-#
-# (The following paragraph is not intended to limit the rights granted
-# to you to modify and distribute this software under the terms of
-# the GNU General Public License and is only of importance to you if
-# you choose to contribute your changes and enhancements to the
-# community by submitting them to Best Practical Solutions, LLC.)
-#
-# By intentionally submitting any modifications, corrections or
-# derivatives to this work, or any other work intended for use with
-# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-# you are the copyright holder for those contributions and you grant
-# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-# royalty-free, perpetual, license to use, copy, create derivative
-# works based on those contributions, and sublicense and distribute
-# those contributions and any derivatives thereof.
-#
-# END BPS TAGGED BLOCK }}}
-use strict;
-use warnings;
-
-# fix lib paths, some may be relative
-BEGIN {
- require File::Spec;
- my @libs = ("lib", "local/lib");
- my $bin_path;
-
- for my $lib (@libs) {
- unless ( File::Spec->file_name_is_absolute($lib) ) {
- unless ($bin_path) {
- if ( File::Spec->file_name_is_absolute(__FILE__) ) {
- $bin_path = ( File::Spec->splitpath(__FILE__) )[1];
- }
- else {
- require FindBin;
- no warnings "once";
- $bin_path = $FindBin::Bin;
- }
- }
- $lib = File::Spec->catfile( $bin_path, File::Spec->updir, $lib );
- }
- unshift @INC, $lib;
- }
-
-}
-
-use RT;
-RT::LoadConfig();
-RT::Init();
-
- at RT::Record::ISA = qw( DBIx::SearchBuilder::Record RT::Base );
-
-use RT::Migrate;
-use RT::Migrate::Serializer::File;
-use Getopt::Long;
-use Pod::Usage qw//;
-use Time::HiRes qw//;
-
-my %OPT;
-GetOptions(
- \%OPT,
- "help|?",
- "verbose|v!",
- "quiet|q!",
-
- "directory|d=s",
- "force|f!",
- "size|s=i",
-
- "users!",
- "groups!",
- "deleted!",
-
- "scrips!",
- "tickets!",
- "acls!",
-
- "clone",
- "incremental",
-
- "gc=i",
- "page=i",
-) or Pod::Usage::pod2usage();
-
-Pod::Usage::pod2usage(-verbose => 1) if $OPT{help};
-
-my %args;
-$args{Directory} = $OPT{directory};
-$args{Force} = $OPT{force};
-$args{MaxFileSize} = $OPT{size} if $OPT{size};
-
-$args{AllUsers} = $OPT{users} if defined $OPT{users};
-$args{AllGroups} = $OPT{groups} if defined $OPT{groups};
-$args{FollowDeleted} = $OPT{deleted} if defined $OPT{deleted};
-
-$args{FollowScrips} = $OPT{scrips} if defined $OPT{scrips};
-$args{FollowTickets} = $OPT{tickets} if defined $OPT{tickets};
-$args{FollowACL} = $OPT{acls} if defined $OPT{acls};
-
-$args{Clone} = $OPT{clone} if $OPT{clone};
-$args{Incremental} = $OPT{incremental} if $OPT{incremental};
-
-$args{GC} = defined $OPT{gc} ? $OPT{gc} : 5000;
-$args{Page} = defined $OPT{page} ? $OPT{page} : 100;
-
-if (($OPT{clone} or $OPT{incremental})
- and grep { /^(users|groups|deleted|scrips|tickets|acls)$/ } keys %OPT) {
- die "You cannot specify object types when cloning.\n\nPlease see $0 --help.\n";
-}
-
-my $walker;
-
-my $gnuplot = `which gnuplot`;
-my $msg = "";
-if (-t STDOUT and not $OPT{verbose} and not $OPT{quiet}) {
- $args{Progress} = RT::Migrate::progress(
- top => \&gnuplot,
- bottom => sub { print "\n$msg"; $msg = ""; },
- counts => sub { $walker->ObjectCount },
- max => { estimate() },
- );
- $args{MessageHandler} = sub {
- print "\r", " "x60, "\r", $_[-1]; $msg = $_[-1];
- };
- $args{Verbose} = 0;
-}
-$args{Verbose} = 0 if $OPT{quiet};
-
-
-$walker = RT::Migrate::Serializer::File->new( %args );
-
-my $log = RT::Migrate::setup_logging( $walker->{Directory} => 'serializer.log' );
-print "Logging warnings and errors to $log\n" if $log;
-
-print "Beginning database serialization...";
-my %counts = $walker->Export;
-
-my @files = $walker->Files;
-print "Wrote @{[scalar @files]} files:\n";
-print " $_\n" for @files;
-print "\n";
-
-print "Total object counts:\n";
-for (sort {$counts{$b} <=> $counts{$a}} keys %counts) {
- printf "%8d %s\n", $counts{$_}, $_;
-}
-
-if ($log and -s $log) {
- print STDERR "\n! Some warnings or errors occurred during serialization."
- ."\n! Please see $log for details.\n\n";
-} else {
- unlink $log;
-}
-
-sub estimate {
- $| = 1;
- my %e;
-
- # Expected types we'll serialize
- my @types = map {"RT::$_"} qw/
- Queue Ticket Transaction Attachment Link
- User Group GroupMember Attribute
- CustomField CustomFieldValue
- ObjectCustomField ObjectCustomFieldValue
- /;
-
- for my $class (@types) {
- print "Estimating $class count...";
- my $collection = $class . "s";
- if ($collection->require) {
- my $objs = $collection->new( RT->SystemUser );
- $objs->FindAllRows;
- $objs->UnLimit;
- $objs->{allow_deleted_search} = 1 if $class eq "RT::Ticket";
- $e{$class} = $objs->DBIx::SearchBuilder::Count;
- }
- print "\r", " "x60, "\r";
- }
-
- return %e;
-}
-
-
-sub gnuplot {
- my ($elapsed, $rows, $cols) = @_;
- my $length = $walker->StackSize;
- my $file = $walker->Directory . "/progress.plot";
- open(my $dat, ">>", $file);
- printf $dat "%10.3f\t%8d\n", $elapsed, $length;
- close $dat;
-
- if ($rows <= 24 or not $gnuplot) {
- print "\n\n";
- } elsif ($elapsed) {
- my $gnuplot = qx|
- gnuplot -e '
- set term dumb $cols @{[$rows - 12]};
- set xlabel "Seconds";
- unset key;
- set xrange [0:*];
- set yrange [0:*];
- set title "Queue length";
- plot "$file" using 1:2 with lines
- '
- |;
- if ($? == 0 and $gnuplot) {
- $gnuplot =~ s/^(\s*\n)//;
- print $gnuplot;
- unlink $file;
- } else {
- warn "Couldn't run gnuplot (\$? == $?): $!\n";
- }
- } else {
- print "\n" for 1..($rows - 13);
- }
-}
-
-=head1 NAME
-
-rt-serializer - Serialize an RT database to disk
-
-=head1 SYNOPSIS
-
- rt-validator --check && rt-serializer
-
-This script is used to write out the entire RT database to disk, for
-later import into a different RT instance. It requires that the data in
-the database be self-consistent, in order to do so; please make sure
-that the database being exported passes validation by L<rt-validator>
-before attempting to use C<rt-serializer>.
-
-While running, it will attempt to estimate the number of remaining
-objects to be serialized; these estimates are pessimistic, and will be
-incorrect if C<--no-users>, C<--no-groups>, or C<--no-tickets> are used.
-
-If the controlling terminal is large enough (more than 25 columns high)
-and the C<gnuplot> program is installed, it will also show a textual
-graph of the queue size over time.
-
-=head2 OPTIONS
-
-=over
-
-=item B<--directory> I<name>
-
-The name of the output directory to write data files to, which should
-not exist yet; it is a fatal error if it does. Defaults to
-C<< ./I<$Organization>:I<Date>/ >>, where I<$Organization> is as set in
-F<RT_SiteConfig.pm>, and I<Date> is today's date.
-
-=item B<--force>
-
-Remove the output directory before starting.
-
-=item B<--size> I<megabytes>
-
-By default, C<rt-serializer> chunks its output into data files which are
-around 32Mb in size; this option is used to set a different threshold
-size, in megabytes. Note that this is the threshold after which it
-rotates to writing a new file, and is as such the I<lower bound> on the
-size of each output file.
-
-=item B<--no-users>
-
-By default, all privileged users are serialized; passing C<--no-users>
-limits it to only those users which are referenced by serialized tickets
-and history, and are thus necessary for internal consistency.
-
-=item B<--no-groups>
-
-By default, all groups are serialized; passing C<--no-groups> limits it
-to only system-internal groups, which are needed for internal
-consistency.
-
-=item B<--no-deleted>
-
-By default, all tickets, including deleted tickets, are serialized;
-passing C<--no-deleted> skips deleted tickets during serialization.
-
-=item B<--scrips>
-
-No scrips or templates are serialized by default; this option forces all
-scrips and templates to be serialized.
-
-=item B<--acls>
-
-No ACLs are serialized by default; this option forces all ACLs to be
-serialized.
-
-=item B<--no-tickets>
-
-Skip serialization of all ticket data.
-
-=item B<--clone>
-
-Serializes your entire database, creating a clone. This option should
-be used if you want to migrate your RT database from one database type
-to another (e.g. MySQL to Postgres). It is an error to combine
-C<--clone> with any option that limits object types serialized. No
-dependency walking is performed when cloning. C<rt-importer> will detect
-that your serialized data set was generated by a clone.
-
-=item B<--incremental>
-
-Will generate an incremenal serialized dataset using the data stored in
-your IncrementalRecords database table. This assumes that you have created
-that table and run RT using the Record_Local.pm shim as documented in
-C<docs/incremental-export/>.
-
-=item B<--gc> I<n>
-
-Adjust how often the garbage collection sweep is done; lower numbers are
-more frequent. See L</GARBAGE COLLECTION>.
-
-=item B<--page> I<n>
-
-Adjust how many rows are pulled from the database in a single query. Disable
-paging by setting this to 0. Defaults to 100.
-
-Keep in mind that rows from RT's Attachments table are the limiting factor when
-determining page size. You should likely be aiming for 60-75% of your total
-memory on an otherwise unloaded box.
-
-=item B<--quiet>
-
-Do not show graphical progress UI.
-
-=item B<--verbose>
-
-Do not show graphical progress UI, but rather log was each row is
-written out.
-
-=back
-
-=head1 GARBAGE COLLECTION
-
-C<rt-serializer> maintains a priority queue of objects to serialize, or
-searches which may result in objects to serialize. When inserting into
-this queue, it does no checking if the object in question is already in
-the queue, or if the search will contain any results. These checks are
-done when the object reaches the front of the queue, or during periodic
-garbage collection.
-
-During periodic garbage collection, the entire queue is swept for
-objects which have already been serialized, occur more than once in the
-queue, and searches which contain no results in the database. This is
-done to reduce the memory footprint of the serialization process, and is
-triggered when enough new objects have been placed in the queue. This
-parameter is tunable via the C<--gc> parameter, which defaults to
-running garbage collection every 5,000 objects inserted into the queue;
-smaller numbers will result in more frequent garbage collection.
-
-The default of 5,000 is roughly tuned based on a database with several
-thousand tickets, but optimal values will vary wildly depending on
-database configuration and size. Values as low as 25 have provided
-speedups with smaller databases; if speed is a factor, experimenting
-with different C<--gc> values may be helpful. Note that there are
-significant boundary condition changes in serialization rate, as the
-queue empties and fills, causing the time estimates to be rather
-imprecise near the start and end of the process.
-
-Setting C<--gc> to 0 turns off all garbage collection. Be aware that
-this will bloat the memory usage of the serializer. Any negative value
-for C<--gc> turns off periodic garbage collection and instead objects
-already serialized or in the queue are checked for at the time they
-would be inserted.
-
-=cut
-
diff --git a/t/data/configs/apache2.4+fastcgi.conf b/t/data/configs/apache2.4+fastcgi.conf
deleted file mode 100644
index 5350a2d..0000000
--- a/t/data/configs/apache2.4+fastcgi.conf
+++ /dev/null
@@ -1,48 +0,0 @@
-ServerRoot %%SERVER_ROOT%%
-PidFile %%PID_FILE%%
-ServerAdmin root at localhost
-
-%%LOAD_MODULES%%
-
-<IfModule !mpm_netware_module>
-<IfModule !mpm_winnt_module>
-User www
-Group www
-</IfModule>
-</IfModule>
-
-ServerName localhost
-Listen %%LISTEN%%
-
-ErrorLog "%%LOG_FILE%%"
-LogLevel debug
-
-<Directory />
- Options FollowSymLinks
- AllowOverride None
- Require all denied
-</Directory>
-
-AddDefaultCharset UTF-8
-
-FastCgiServer %%RT_SBIN_PATH%%/rt-server.fcgi \
- -socket %%TMP_DIR%%/socket \
- -processes 1 \
- -idle-timeout 180 \
- -initial-env RT_SITE_CONFIG=%%RT_SITE_CONFIG%% \
- -initial-env RT_TESTING=1
-
-ScriptAlias / %%RT_SBIN_PATH%%/rt-server.fcgi/
-
-DocumentRoot "%%DOCUMENT_ROOT%%"
-<Location />
-
- <RequireAll>
- Require all granted
-%%BASIC_AUTH%%
- </RequireAll>
-
- Options +ExecCGI
- AddHandler fastcgi-script fcgi
-</Location>
-
diff --git a/t/data/configs/apache2.4+mod_perl.conf b/t/data/configs/apache2.4+mod_perl.conf
deleted file mode 100644
index 3917bc6..0000000
--- a/t/data/configs/apache2.4+mod_perl.conf
+++ /dev/null
@@ -1,66 +0,0 @@
-<IfModule mpm_prefork_module>
- StartServers 1
- MinSpareServers 1
- MaxSpareServers 1
- MaxClients 1
- MaxRequestsPerChild 0
-</IfModule>
-
-<IfModule mpm_worker_module>
- StartServers 1
- MinSpareThreads 1
- MaxSpareThreads 1
- ThreadLimit 1
- ThreadsPerChild 1
- MaxClients 1
- MaxRequestsPerChild 0
-</IfModule>
-
-ServerRoot %%SERVER_ROOT%%
-PidFile %%PID_FILE%%
-ServerAdmin root at localhost
-
-%%LOAD_MODULES%%
-
-<IfModule !mpm_netware_module>
-<IfModule !mpm_winnt_module>
-User www
-Group www
-</IfModule>
-</IfModule>
-
-ServerName localhost
-Listen %%LISTEN%%
-
-ErrorLog "%%LOG_FILE%%"
-LogLevel debug
-
-<Directory />
- Options FollowSymLinks
- AllowOverride None
- Require all denied
-</Directory>
-
-AddDefaultCharset UTF-8
-PerlSetEnv RT_SITE_CONFIG %%RT_SITE_CONFIG%%
-
-DocumentRoot "%%DOCUMENT_ROOT%%"
-<Location />
-
- <RequireAll>
- Require all granted
-%%BASIC_AUTH%%
- </RequireAll>
-
- SetHandler modperl
-
- PerlResponseHandler Plack::Handler::Apache2
- PerlSetVar psgi_app %%RT_SBIN_PATH%%/rt-server
-</Location>
-
-<Perl>
- $ENV{RT_TESTING}=1;
- use Plack::Handler::Apache2;
- Plack::Handler::Apache2->preload("%%RT_SBIN_PATH%%/rt-server");
-</Perl>
-
-----------------------------------------------------------------------
More information about the rt-commit
mailing list