diff options
author | Ivan Kohler <ivan@freeside.biz> | 2012-06-07 15:45:05 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2012-06-07 15:45:05 -0700 |
commit | 02533bdefedd9541d55a8655a0ee7b3a835019b7 (patch) | |
tree | cbf7957e988208cdb892070dee4a338d199c00a7 /rt | |
parent | e631e8d11e53584cf9ae443132d3f361cc26861b (diff) |
remove autogenerated files entirely to avoid git merge pain
Diffstat (limited to 'rt')
27 files changed, 0 insertions, 12425 deletions
diff --git a/rt/Makefile b/rt/Makefile deleted file mode 100644 index 6b172a606..000000000 --- a/rt/Makefile +++ /dev/null @@ -1,574 +0,0 @@ -# BEGIN BPS TAGGED BLOCK {{{ -# -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC -# <sales@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 }}} -# -# DO NOT HAND-EDIT the file named 'Makefile'. This file is autogenerated. -# Have a look at "configure" and "Makefile.in" instead -# - - -PERL = /usr/bin/perl -INSTALL = /usr/bin/install -c -CC = gcc - -RT_LAYOUT = Freeside - -CONFIG_FILE_PATH = /opt/rt3/etc -CONFIG_FILE = $(CONFIG_FILE_PATH)/RT_Config.pm -SITE_CONFIG_FILE = $(CONFIG_FILE_PATH)/RT_SiteConfig.pm - - -RT_VERSION_MAJOR = 4 -RT_VERSION_MINOR = 0 -RT_VERSION_PATCH = 5 - -RT_VERSION = $(RT_VERSION_MAJOR).$(RT_VERSION_MINOR).$(RT_VERSION_PATCH) -TAG = rt-$(RT_VERSION_MAJOR)-$(RT_VERSION_MINOR)-$(RT_VERSION_PATCH) - - -# This is the group that all of the installed files will be chgrp'ed to. -RTGROUP = freeside - - -# User which should own rt binaries. -BIN_OWNER = root - -# User that should own all of RT's libraries, generally root. -LIBS_OWNER = root - -# Group that should own all of RT's libraries, generally root. -LIBS_GROUP = bin - -WEB_USER = freeside -WEB_GROUP = freeside - - -APACHECTL = /usr/sbin/apachectl - - -# DESTDIR allows you to specify that RT be installed somewhere other than -# where it will eventually reside. DESTDIR _must_ have a trailing slash -# if it's defined. - -DESTDIR = - - - -RT_PATH = /opt/rt3 -RT_ETC_PATH = /opt/rt3/etc -RT_BIN_PATH = /opt/rt3/bin -RT_SBIN_PATH = /opt/rt3/sbin -RT_LIB_PATH = /opt/rt3/lib -RT_MAN_PATH = /opt/rt3/man -RT_VAR_PATH = /opt/rt3/var -RT_DOC_PATH = /opt/rt3/docs -RT_FONT_PATH = /opt/rt3/share/fonts -RT_LEXICON_PATH = /opt/rt3/share/po -RT_LOCAL_PATH = /opt/rt3/local -LOCAL_PLUGIN_PATH = /opt/rt3/local/plugins -LOCAL_ETC_PATH = /opt/rt3/local/etc -LOCAL_LIB_PATH = /opt/rt3/local/lib -LOCAL_LEXICON_PATH = /opt/rt3/local/po -MASON_HTML_PATH = /var/www/freeside/rt -MASON_LOCAL_HTML_PATH = /opt/rt3/local/html -MASON_DATA_PATH = /usr/local/etc/freeside/masondata -MASON_SESSION_PATH = /opt/rt3/var/session_data -RT_LOG_PATH = /opt/rt3/var/log - -# RT_READABLE_DIR_MODE is the mode of directories that are generally meant -# to be accessable -RT_READABLE_DIR_MODE = 0755 - - - - - -# RT's CLI -RT_CLI_BIN = rt -# RT's mail gateway -RT_MAILGATE_BIN = rt-mailgate -# RT's cron tool -RT_CRON_BIN = rt-crontool - - - -BINARIES = $(RT_MAILGATE_BIN) \ - $(RT_CLI_BIN) \ - $(RT_CRON_BIN) - -SYSTEM_BINARIES = rt-attributes-viewer \ - rt-clean-sessions \ - rt-dump-metadata \ - rt-email-dashboards \ - rt-email-digest \ - rt-email-group-admin \ - rt-fulltext-indexer \ - rt-preferences-viewer \ - rt-server \ - rt-session-viewer \ - rt-server.fcgi \ - rt-session-viewer \ - rt-setup-database \ - rt-setup-fulltext-index \ - rt-shredder \ - rt-test-dependencies \ - rt-validator \ - standalone_httpd - - -ETC_FILES = acl.Pg \ - acl.Oracle \ - acl.mysql \ - schema.Pg \ - schema.Oracle \ - schema.mysql \ - schema.SQLite \ - initialdata - - - -WEB_HANDLER = modperl2 - - - -# -# DB_TYPE defines what sort of database RT trys to talk to -# "mysql", "Oracle", "Pg", and "SQLite" are known to work. - -DB_TYPE = Pg - -# Set DBA to the name of a unix account with the proper permissions and -# environment to run your commandline SQL sbin - -# Set DB_DBA to the name of a DB user with permission to create new databases - -# For mysql, you probably want 'root' -# For Pg, you probably want 'postgres' -# For Oracle, you want 'system' - -DB_DBA = freeside - -DB_HOST = localhost - -# If you're not running your database server on its default port, -# specifiy the port the database server is running on below. -# It's generally safe to leave this blank - -DB_PORT = - - - - -# -# Set this to the canonical name of the interface RT will be talking to the -# database on. If you said that the RT_DB_HOST above was "localhost," this -# should be too. This value will be used to grant rt access to the database. -# If you want to access the RT database from multiple hosts, you'll need -# to grant those database rights by hand. -# - -DB_RT_HOST = localhost - -# set this to the name you want to give to the RT database in -# your database server. For Oracle, this should be the name of your sid - -DB_DATABASE = freeside -DB_RT_USER = freeside -DB_RT_PASS = - - - -TEST_FILES = t/*.t t/*/*.t -TEST_VERBOSE = 0 - - -#################################################################### - -all: default - -default: - @echo "Please read RT's README before beginning your installation." - - - -instruct: - @echo "Congratulations. RT is now installed." - @echo "" - @echo "" - @echo "You must now configure RT by editing $(SITE_CONFIG_FILE)." - @echo "" - @echo "(You will definitely need to set RT's database password in " - @echo "$(SITE_CONFIG_FILE) before continuing. Not doing so could be " - @echo "very dangerous. Note that you do not have to manually add a " - @echo "database user or set up a database for RT. These actions will be " - @echo "taken care of in the next step.)" - @echo "" - @echo "After that, you need to initialize RT's database by running" - @echo " 'make initialize-database'" - - -upgrade-instruct: - @echo "Congratulations. RT has been upgraded. You should now check over" - @echo "$(CONFIG_FILE) for any necessary site customization. Additionally," - @echo "you should update RT's system database objects by running " - @echo " make upgrade-database" - - -upgrade: testdeps config-install dirs files-install fixperms upgrade-instruct - -my_with_web_handlers= $(shell $(PERL) -e 'print join " ", map "--with-$$_", grep defined && length, split /,/, "$(WEB_HANDLER)"') -testdeps: - $(PERL) ./sbin/rt-test-dependencies --verbose --with-$(DB_TYPE) $(my_with_web_handlers) - -depends: fixdeps - -fixdeps: - $(PERL) ./sbin/rt-test-dependencies --verbose --install --with-$(DB_TYPE) $(my_with_web_handlers) - -#}}} - -fixperms: - # Make the libraries readable - chmod $(RT_READABLE_DIR_MODE) $(DESTDIR)$(RT_PATH) - chown -R $(LIBS_OWNER) $(DESTDIR)$(RT_LIB_PATH) - chgrp -R $(LIBS_GROUP) $(DESTDIR)$(RT_LIB_PATH) - chmod -R u+rwX,go-w,go+rX $(DESTDIR)$(RT_LIB_PATH) - - - chmod $(RT_READABLE_DIR_MODE) $(DESTDIR)$(RT_BIN_PATH) - - chmod 0755 $(DESTDIR)$(RT_ETC_PATH) - cd $(DESTDIR)$(RT_ETC_PATH) && chmod 0400 $(ETC_FILES) || true - - #TODO: the config file should probably be able to have its - # owner set separately from the binaries. - chown -R $(BIN_OWNER) $(DESTDIR)$(RT_ETC_PATH) - chgrp -R $(RTGROUP) $(DESTDIR)$(RT_ETC_PATH) - - chmod 0440 $(DESTDIR)$(CONFIG_FILE) - chmod 0640 $(DESTDIR)$(SITE_CONFIG_FILE) - # Make this externally readable - chmod 0440 $(DESTDIR)$(RT_ETC_PATH)/initialdata - - # Make the system binaries - cd $(DESTDIR)$(RT_BIN_PATH) && ( chmod 0755 $(BINARIES) ; chown $(BIN_OWNER) $(BINARIES); chgrp $(RTGROUP) $(BINARIES)) - - # Make the system binaries executable also - cd $(DESTDIR)$(RT_SBIN_PATH) && ( chmod 0755 $(SYSTEM_BINARIES) ; chown $(BIN_OWNER) $(SYSTEM_BINARIES); chgrp $(RTGROUP) $(SYSTEM_BINARIES)) - - - # Make the web ui readable by all. - chmod -R u+rwX,go-w,go+rX $(DESTDIR)$(MASON_HTML_PATH) \ - $(DESTDIR)$(MASON_LOCAL_HTML_PATH) \ - $(DESTDIR)$(RT_LEXICON_PATH) \ - $(DESTDIR)$(LOCAL_LEXICON_PATH) - chown -R $(LIBS_OWNER) $(DESTDIR)$(MASON_HTML_PATH) \ - $(DESTDIR)$(MASON_LOCAL_HTML_PATH) \ - $(DESTDIR)$(RT_LEXICON_PATH) \ - $(DESTDIR)$(LOCAL_LEXICON_PATH) - chgrp -R $(LIBS_GROUP) $(DESTDIR)$(MASON_HTML_PATH) \ - $(DESTDIR)$(MASON_LOCAL_HTML_PATH) \ - $(DESTDIR)$(RT_LEXICON_PATH) \ - $(DESTDIR)$(LOCAL_LEXICON_PATH) - - # Make the web ui's data dir writable - chmod 0770 $(DESTDIR)$(MASON_DATA_PATH) \ - $(DESTDIR)$(MASON_SESSION_PATH) - chown -R $(WEB_USER) $(DESTDIR)$(MASON_DATA_PATH) \ - $(DESTDIR)$(MASON_SESSION_PATH) - chgrp -R $(WEB_GROUP) $(DESTDIR)$(MASON_DATA_PATH) \ - $(DESTDIR)$(MASON_SESSION_PATH) - -dirs: - $(INSTALL) -m 0755 -d $(DESTDIR)$(RT_LOG_PATH) - $(INSTALL) -m 0755 -d $(DESTDIR)$(RT_FONT_PATH) - $(INSTALL) -m 0755 -d $(DESTDIR)$(RT_LEXICON_PATH) - $(INSTALL) -m 0770 -d $(DESTDIR)$(MASON_DATA_PATH) - $(INSTALL) -m 0770 -d $(DESTDIR)$(MASON_DATA_PATH)/cache - $(INSTALL) -m 0770 -d $(DESTDIR)$(MASON_DATA_PATH)/etc - $(INSTALL) -m 0770 -d $(DESTDIR)$(MASON_DATA_PATH)/obj - $(INSTALL) -m 0770 -d $(DESTDIR)$(MASON_SESSION_PATH) - $(INSTALL) -m 0755 -d $(DESTDIR)$(MASON_HTML_PATH) - $(INSTALL) -m 0755 -d $(DESTDIR)$(MASON_LOCAL_HTML_PATH) - $(INSTALL) -m 0755 -d $(DESTDIR)$(LOCAL_ETC_PATH) - $(INSTALL) -m 0755 -d $(DESTDIR)$(LOCAL_LIB_PATH) - $(INSTALL) -m 0755 -d $(DESTDIR)$(LOCAL_PLUGIN_PATH) - $(INSTALL) -m 0755 -d $(DESTDIR)$(LOCAL_LEXICON_PATH) - -install: testdeps config-install dirs files-install fixperms instruct - -files-install: libs-install etc-install config-install bin-install sbin-install html-install local-install doc-install font-install po-install - -config-install: - $(INSTALL) -m 0755 -o $(BIN_OWNER) -g $(RTGROUP) -d $(DESTDIR)$(CONFIG_FILE_PATH) - -$(INSTALL) -m 0440 -o $(BIN_OWNER) -g $(RTGROUP) etc/RT_Config.pm $(DESTDIR)$(CONFIG_FILE) - [ -f $(DESTDIR)$(SITE_CONFIG_FILE) ] || $(INSTALL) -m 0640 -o $(BIN_OWNER) -g $(RTGROUP) etc/RT_SiteConfig.pm $(DESTDIR)$(SITE_CONFIG_FILE) - @echo "Installed configuration. About to install RT in $(RT_PATH)" - -test: - $(PERL) "-MExtUtils::Command::MM" -e "test_harness($(TEST_VERBOSE), 'lib')" $(TEST_FILES) - -parallel-test: test-parallel - -test-parallel: - RT_TEST_PARALLEL=1 $(PERL) "-MApp::Prove" -e 'my $$p = App::Prove->new(); $$p->process_args("-wlrj5","--state=slow,save", "t"); $$p->run()' - -regression-reset-db: force-dropdb - $(PERL) -I$(LOCAL_LIB_PATH) -I$(RT_LIB_PATH) sbin/rt-setup-database --action init --dba-password '' - -initdb :: initialize-database - -initialize-database: - $(PERL) -I$(LOCAL_LIB_PATH) -I$(RT_LIB_PATH) sbin/rt-setup-database --action init --prompt-for-dba-password - -upgrade-database: - $(PERL) -I$(LOCAL_LIB_PATH) -I$(RT_LIB_PATH) sbin/rt-setup-database --action upgrade --prompt-for-dba-password - -dropdb: - $(PERL) -I$(LOCAL_LIB_PATH) -I$(RT_LIB_PATH) sbin/rt-setup-database --action drop --prompt-for-dba-password - -force-dropdb: - $(PERL) -I$(LOCAL_LIB_PATH) -I$(RT_LIB_PATH) sbin/rt-setup-database --action drop --dba-password '' --force - -critic: - perlcritic --quiet sbin bin lib - -libs-install: - [ -d $(DESTDIR)$(RT_LIB_PATH) ] || $(INSTALL) -m 0755 -d $(DESTDIR)$(RT_LIB_PATH) - -( cd lib && find . -type d -print ) | while read dir ; do \ - $(INSTALL) -m 0755 -d "$(DESTDIR)$(RT_LIB_PATH)/$$dir" ; \ - done - -( cd lib && find . -type f -print ) | while read file ; do \ - $(INSTALL) -m 0644 "lib/$$file" "$(DESTDIR)$(RT_LIB_PATH)/$$file" ; \ - done - -html-install: - [ -d $(DESTDIR)$(MASON_HTML_PATH) ] || $(INSTALL) -m 0755 -d $(DESTDIR)$(MASON_HTML_PATH) - -( cd share/html && find . -type d -print ) | while read dir ; do \ - $(INSTALL) -m 0755 -d "$(DESTDIR)$(MASON_HTML_PATH)/$$dir" ; \ - done - -( cd share/html && find . -type f -print ) | while read file ; do \ - $(INSTALL) -m 0644 "share/html/$$file" "$(DESTDIR)$(MASON_HTML_PATH)/$$file" ; \ - done - -font-install: - [ -d $(DESTDIR)$(RT_FONT_PATH) ] || $(INSTALL) -m 0755 -d $(DESTDIR)$(RT_FONT_PATH) - -( cd share/fonts && find . -type f -print ) | while read file ; do \ - $(INSTALL) -m 0644 "share/fonts/$$file" "$(DESTDIR)$(RT_FONT_PATH)/$$file" ; \ - done - - -po-install: - [ -d $(DESTDIR)$(RT_LEXICON_PATH) ] || $(INSTALL) -m 0755 -d $(DESTDIR)$(RT_LEXICON_PATH) - -( cd share/po && find . -type f -print ) | while read file ; do \ - $(INSTALL) -m 0644 "share/po/$$file" "$(DESTDIR)$(RT_LEXICON_PATH)/$$file" ; \ - done - - - -doc-install: - # RT 3.0.0 - RT 3.0.2 would accidentally create a file instead of a dir - -[ -f $(DESTDIR)$(RT_DOC_PATH) ] && rm $(DESTDIR)$(RT_DOC_PATH) - [ -d $(DESTDIR)$(RT_DOC_PATH) ] || $(INSTALL) -m 0755 -d $(DESTDIR)$(RT_DOC_PATH) - -( cd docs && find . -type d -print ) | while read dir ; do \ - $(INSTALL) -m 0755 -d "$(DESTDIR)$(RT_DOC_PATH)/$$dir" ; \ - done - -( cd docs && find . -type f -print ) | while read file ; do \ - $(INSTALL) -m 0644 "docs/$$file" "$(DESTDIR)$(RT_DOC_PATH)/$$file" ; \ - done - -$(INSTALL) -m 0644 ./README $(DESTDIR)$(RT_DOC_PATH)/ - - -etc-install: - [ -d $(DESTDIR)$(RT_ETC_PATH) ] || $(INSTALL) -m 0755 -d $(DESTDIR)$(RT_ETC_PATH) - for file in $(ETC_FILES) ; do \ - $(INSTALL) -m 0644 "etc/$$file" "$(DESTDIR)$(RT_ETC_PATH)/" ; \ - done - - -sbin-install: - $(INSTALL) -m 0755 -d $(DESTDIR)$(RT_SBIN_PATH) - for file in $(SYSTEM_BINARIES) ; do \ - $(INSTALL) -o $(BIN_OWNER) -g $(RTGROUP) -m 0755 "sbin/$$file" "$(DESTDIR)$(RT_SBIN_PATH)/" ; \ - done - - - -bin-install: - $(INSTALL) -m 0755 -d $(DESTDIR)$(RT_BIN_PATH) - for file in $(BINARIES) ; do \ - $(INSTALL) -o $(BIN_OWNER) -g $(RTGROUP) -m 0755 "bin/$$file" "$(DESTDIR)$(RT_BIN_PATH)/" ; \ - done - -local-install: - -( cd local/html && find . -type d -print ) | while read dir ; do \ - $(INSTALL) -m 0755 -d "$(DESTDIR)$(MASON_LOCAL_HTML_PATH)/$$dir" ; \ - done - -( cd local/html && find . -type f -print ) | while read file ; do \ - $(INSTALL) -m 0644 "local/html/$$file" "$(DESTDIR)$(MASON_LOCAL_HTML_PATH)/$$file" ; \ - done - -( cd local/po && find . -type d -print ) | while read dir ; do \ - $(INSTALL) -m 0755 -d "$(DESTDIR)$(LOCAL_LEXICON_PATH)/$$dir" ; \ - done - -( cd local/po && find . -type f -print ) | while read file ; do \ - $(INSTALL) -m 0644 "local/po/$$file" "$(DESTDIR)$(LOCAL_LEXICON_PATH)/$$file" ; \ - done - -( cd local/etc && find . -type d -print ) | while read dir ; do \ - $(INSTALL) -m 0755 -d "$(DESTDIR)$(LOCAL_ETC_PATH)/$$dir" ; \ - done - -( cd local/etc && find . -type f -print ) | while read file ; do \ - $(INSTALL) -m 0644 "etc/$$file" "$(DESTDIR)$(LOCAL_ETC_PATH)/$$file" ; \ - done - - -regenerate-catalogs: - $(PERL) devel/tools/extract-message-catalog - -license-tag: - $(PERL) devel/tools/license_tag - -factory: initialize-database - cd lib; $(PERL) ../devel/tools/factory $(DB_DATABASE) RT - -start-httpd: - $(PERL) sbin/standalone_httpd & - -start-server: - $(PERL) sbin/rt-server & - -apachectl: - $(APACHECTL) stop - sleep 10 - $(APACHECTL) start - sleep 5 - -SNAPSHOT=$(shell git describe --tags) -THIRD_PARTY=devel/third-party/ -snapshot: build-snapshot build-third-party clearsign-snapshot clearsign-third-party snapshot-shasums - -build-snapshot: - git archive --prefix "$(SNAPSHOT)/" HEAD | tar -xf - - ( cd $(SNAPSHOT) && \ - echo "$(SNAPSHOT)" > .tag && \ - autoconf && \ - INSTALL=./install-sh PERL=/usr/bin/perl ./configure \ - --with-db-type=SQLite \ - --enable-layout=relative \ - --with-web-handler=standalone && \ - rm -rf autom4te.cache \ - config.status config.log config.pld \ - ) - tar -czf "$(SNAPSHOT).tar.gz" "$(SNAPSHOT)/" - rm -fr "$(SNAPSHOT)/" - -clearsign-snapshot: - gpg --no-armor --detach-sign "$(SNAPSHOT).tar.gz" - -build-third-party: - git archive --prefix "$(SNAPSHOT)/$(THIRD_PARTY)" HEAD:$(THIRD_PARTY) \ - | gzip > "$(SNAPSHOT)-third-party-source.tar.gz" - rm -rf "$(SNAPSHOT)/$(THIRD_PARTY)" - -clearsign-third-party: - gpg --no-armor --detach-sign "$(SNAPSHOT)-third-party-source.tar.gz" - -snapshot-shasums: - sha1sum $(SNAPSHOT)*.tar.gz* - -vessel-import: build-snapshot - [ -d $(VESSEL) ] || (echo "VESSEL isn't a path to your shipwright vessel" && exit -1) - cp $(VESSEL)/scripts/RT/build.pl /tmp/build.pl - ./sbin/rt-test-dependencies --with-standalone --with-fastcgi --with-sqlite --list > /tmp/rt.yml - shipwright import file:$(SNAPSHOT).tar.gz \ - --require-yml /tmp/rt.yml \ - --build-script /tmp/build.pl \ - --name RT \ - --repository fs:$(VESSEL) \ - --log-level=info \ - --skip cpan-capitalization,cpan-mod_perl,cpan-Encode,cpan-PPI,cpan-Test-Exception-LessClever,cpan-Test-Manifest,cpan-Test-Object,cpan-Test-Pod,cpan-Test-Requires,cpan-Test-SubCalls,cpan-Test-cpan-Tester,cpan-Test-Warn --skip-all-recommends - mv $(VESSEL)/scripts/RT/build $(VESSEL)/scripts/RT/build.pl - -JSMIN_URL = http://download.bestpractical.com/mirror/jsmin-2011-01-22.c -JSMIN_SHA = 8a6b3b980a52c028eb73aee4a82ebe060c1ee854 - -jsmin: jsmin-checkcc jsmin-fetch jsmin-verify jsmin-confirm jsmin-build jsmin-install - @echo "" - @echo "To configure RT to use jsmin, add the following line to $(DESTDIR)$(RT_ETC_PATH)/RT_SiteConfig.pm:" - @echo "" - @echo " Set(\$$JSMinPath, '$(DESTDIR)$(RT_BIN_PATH)/jsmin');" - @echo "" - -jsmin-checkcc: - @[ -n "$(CC)" ] || (echo "You don't appear to have a C compiler, please set CC and re-run configure" && exit 1) - -jsmin-confirm: - @echo "jsmin is distributed under a slightly unusual license and can't be shipped" - @echo "with RT. Before configuring RT to use jsmin, please read jsmin's license" - @echo "below:" - @echo "" - @$(PERL) -pe 'print && exit if /^\*\// or /^#include/' jsmin.c - @echo "" - @echo "Press Enter to accept the license, or Ctrl-C to stop now." - @$(PERL) -e '<STDIN>' - -jsmin-fetch: - @echo "" - @echo "Downloading jsmin.c from $(JSMIN_URL)" - @echo "" - @$(PERL) -MLWP::Simple -e 'exit not is_success(getstore("$(JSMIN_URL)", "jsmin.c"))' \ - || (echo "Failed to download $(JSMIN_URL)" && exit 1) - -jsmin-verify: - @$(PERL) -MDigest::SHA -e \ - 'exit not Digest::SHA->new(1)->addfile("jsmin.c")->hexdigest eq "$(JSMIN_SHA)"' \ - || (echo "Verification of jsmin.c failed! Possible man in the middle?" && exit 1) - -jsmin-build: - $(CC) -o jsmin jsmin.c - -jsmin-install: - $(INSTALL) -o $(BIN_OWNER) -g $(RTGROUP) -m 0755 "jsmin" "$(DESTDIR)$(RT_BIN_PATH)/" diff --git a/rt/bin/rt-crontool b/rt/bin/rt-crontool deleted file mode 100755 index e58bafce8..000000000 --- a/rt/bin/rt-crontool +++ /dev/null @@ -1,483 +0,0 @@ -#!/usr/bin/perl -# BEGIN BPS TAGGED BLOCK {{{ -# -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC -# <sales@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 Carp; - -# fix lib paths, some may be relative -BEGIN { - require File::Spec; - my @libs = ("/opt/rt3/lib", "/opt/rt3/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; - -use Getopt::Long; - -use RT::Interface::CLI qw(CleanEnv GetCurrentUser GetMessageContent loc); - -#Clean out all the nasties from the environment -CleanEnv(); - -my ( $search, $condition, $action, $search_arg, $condition_arg, $action_arg, - $template, $template_id, $transaction, $transaction_type, $help, $log, $verbose ); -GetOptions( - "search=s" => \$search, - "search-arg=s" => \$search_arg, - "condition=s" => \$condition, - "condition-arg=s" => \$condition_arg, - "action-arg=s" => \$action_arg, - "action=s" => \$action, - "template=s" => \$template, - "template-id=s" => \$template_id, - "transaction=s" => \$transaction, - "transaction-type=s" => \$transaction_type, - "log=s" => \$log, - "verbose|v" => \$verbose, - "help" => \$help, -); - -# Load the config file -RT::LoadConfig(); - -# adjust logging to the screen according to options -RT->Config->Set( LogToScreen => $log ) if $log; - -#Connect to the database and get RT::SystemUser and RT::Nobody loaded -RT::Init(); - -require RT::Tickets; -require RT::Template; - -#Get the current user all loaded -my $CurrentUser = GetCurrentUser(); - -# show help even if there is no current user -help() if $help; - -unless ( $CurrentUser->Id ) { - print loc("No RT user found. Please consult your RT administrator."); - exit(1); -} - -help() unless $search && $action; - -$transaction = lc( $transaction||'' ); -if ( $transaction && $transaction !~ /^(first|all|last)$/i ) { - print STDERR loc("--transaction argument could be only 'first', 'last' or 'all'"); - exit 1; -} - -if ( $template && $template_id ) { - print STDERR loc("--template-id is deprecated argument and can not be used with --template"); - exit 1; -} -elsif ( $template_id ) { -# don't warn - $template = $template_id; -} - -# We _must_ have a search object -load_module($search); -load_module($action) if ($action); -load_module($condition) if ($condition); - -my $void_scrip = RT::Scrip->new( $CurrentUser ); -my $void_scrip_action = RT::ScripAction->new( $CurrentUser ); - -#At the appointed time: - -#find a bunch of tickets -my $tickets = RT::Tickets->new($CurrentUser); -my $search = $search->new( - TicketsObj => $tickets, - Argument => $search_arg, - CurrentUser => $CurrentUser -); - -$search->Prepare(); - -# TicketsFound is an RT::Tickets object -my $tickets = $search->TicketsObj; - -#for each ticket we've found -while ( my $ticket = $tickets->Next() ) { - print $ticket->Id() . ":\n" if ($verbose); - - my $template_obj = get_template( $ticket ); - - if ( $transaction ) { - my $txns = get_transactions($ticket); - my $found = 0; - while ( my $txn = $txns->Next ) { - print "\t".loc("Using transaction #[_1]...", $txn->id)."\n" - if $verbose; - process($ticket, $txn, $template_obj); - $found = 1; - } - print "\t".loc("Couldn't find suitable transaction, skipping")."\n" - if $verbose && !$found; - } else { - print "\t".loc("Processing without transaction, some conditions and actions may fail. Consider using --transaction argument")."\n" - if $verbose; - - process($ticket, undef, $template_obj); - } -} - -sub process { - my $ticket = shift; - my $transaction = shift; - my $template_obj = shift; - - # perform some more advanced check - if ($condition) { - my $condition_obj = $condition->new( - TransactionObj => $transaction, - TicketObj => $ticket, - ScripObj => $void_scrip, - TemplateObj => $template_obj, - Argument => $condition_arg, - CurrentUser => $CurrentUser, - ); - - # if the condition doesn't apply, get out of here - - return unless $condition_obj->IsApplicable; - print "\t".loc("Condition matches...")."\n" if $verbose; - } - - #prepare our action - my $action_obj = $action->new( - TicketObj => $ticket, - TransactionObj => $transaction, - TemplateObj => $template_obj, - Argument => $action_arg, - ScripObj => $void_scrip, - ScripActionObj => $void_scrip_action, - CurrentUser => $CurrentUser, - ); - - #if our preparation, move onto the next ticket - return unless $action_obj->Prepare; - print "\t".loc("Action prepared...")."\n" if $verbose; - - #commit our action. - return unless $action_obj->Commit; - print "\t".loc("Action committed.")."\n" if $verbose; -} - -# =head2 get_transactions -# -# Takes ticket and returns L<RT::Transactions> object with transactions -# of the ticket according to command line arguments C<--transaction> -# and <--transaction-type>. -# -# =cut - -sub get_transactions { - my $ticket = shift; - my $txns = $ticket->Transactions; - my $order = $transaction eq 'last'? 'DESC': 'ASC'; - $txns->OrderByCols( - { FIELD => 'Created', ORDER => $order }, - { FIELD => 'id', ORDER => $order }, - ); - if ( $transaction_type ) { - $transaction_type =~ s/^\s+//; - $transaction_type =~ s/\s+$//; - foreach my $type ( split /\s*,\s*/, $transaction_type ) { - $txns->Limit( FIELD => 'Type', VALUE => $type, ENTRYAGGREGATOR => 'OR' ); - } - } - $txns->RowsPerPage(1) unless $transaction eq 'all'; - return $txns; -} - -# =head2 get_template -# -# Takes a ticket and returns a template according to command line options. -# -# =cut - -{ my $cache = undef; -sub get_template { - my $ticket = shift; - return undef unless $template; - - unless ( $template =~ /\D/ ) { - # by id - return $cache if $cache; - - my $cache = RT::Template->new( RT->SystemUser ); - $cache->Load( $template ); - die "Failed to load template '$template'" - unless $cache->id; - return $cache; - } - - my $queue = $ticket->Queue; - return $cache->{ $queue } if $cache->{ $queue }; - - my $res = RT::Template->new( RT->SystemUser ); - $res->LoadQueueTemplate( Queue => $queue, Name => $template ); - unless ( $res->id ) { - $res->LoadGlobalTemplate( $template ); - die "Failed to load template '$template', either for queue #$queue or global" - unless $res->id; - } - return $cache->{ $queue } = $res; -} } - - -# =head2 load_module -# -# Loads a perl module, dying nicely if it can't find it. -# -# =cut - -sub load_module { - my $modname = shift; - eval "require $modname"; - if ($@) { - die loc( "Failed to load module [_1]. ([_2])", $modname, $@ ); - } - -} - - - -# =head2 loc LIST -# -# Localize this string, with the current user's currentuser object -# -# =cut - -sub loc { - $CurrentUser->loc(@_); -} - - -sub help { - - print loc( "[_1] is a tool to act on tickets from an external scheduling tool, such as cron.", $0 ) - . "\n"; - print loc("It takes several arguments:") . "\n\n"; - - print " " - . loc( "[_1] - Specify the search module you want to use", "--search" ) - . "\n"; - print " " - . loc( "[_1] - An argument to pass to [_2]", "--search-arg", "--search" ) - . "\n"; - - print " " - . loc( "[_1] - Specify the condition module you want to use", "--condition" ) - . "\n"; - print " " - . loc( "[_1] - An argument to pass to [_2]", "--condition-arg", "--condition" ) - . "\n"; - print " " - . loc( "[_1] - Specify the action module you want to use", "--action" ) - . "\n"; - print " " - . loc( "[_1] - An argument to pass to [_2]", "--action-arg", "--action" ) - . "\n"; - print " " - . loc( "[_1] - Specify name or id of template(s) you want to use", "--template" ) - . "\n"; - print " " - . loc( "[_1] - Specify if you want to use either 'first', 'last' or 'all' transactions", "--transaction" ) - . "\n"; - print " " - . loc( "[_1] - Specify the comma separated list of transactions' types you want to use", "--transaction-type" ) - . "\n"; - print " " - . loc( "[_1] - Adjust LogToScreen config option", "--log" ) . "\n"; - print " " - . loc( "[_1] - Output status updates to STDOUT", "--verbose" ) . "\n"; - print "\n"; - print "\n"; - print loc("Security:")."\n"; - print loc("This tool allows the user to run arbitrary perl modules from within RT.")." ". - loc("If this tool were setgid, a hostile local user could use this tool to gain administrative access to RT.")." ". - loc("It is incredibly important that nonprivileged users not be allowed to run this tool."). " " . - loc("It is suggested that you create a non-privileged unix user with the correct group membership and RT access to run this tool.")."\n"; - print "\n"; - print loc("Example:"); - print "\n"; - print " " - . loc( "The following command will find all active tickets in the queue 'general' and set their priority to 99 if they are overdue:" - ) - . "\n\n"; - - print " bin/rt-crontool \\\n"; - print " --search RT::Search::ActiveTicketsInQueue --search-arg general \\\n"; - print " --condition RT::Condition::Overdue \\\n"; - print " --action RT::Action::SetPriority --action-arg 99 \\\n"; - print " --verbose\n"; - - print "\n"; - print loc("Escalate tickets"). "\n"; - print " bin/rt-crontool \\\n"; - print " --search RT::Search::ActiveTicketsInQueue --search-arg general \\\n"; - print" --action RT::Action::EscalatePriority\n"; - - - - - - - exit(0); -} - -__END__ - -=head1 NAME - -rt-crontool - a tool to act on tickets from an external scheduling tool - -=head1 SYNOPSIS - - # find all active tickets in the queue 'general' and set their priority to 99 if they are overdue: - rt-crontool \ - --search RT::Search::ActiveTicketsInQueue --search-arg general \ - --condition RT::Condition::Overdue \ - --action RT::Action::SetPriority --action-arg 99 \ - --verbose - - # Escalate tickets - rt-crontool \ - --search RT::Search::ActiveTicketsInQueue --search-arg general \ - --action RT::Action::EscalatePriority - -=head1 DESCRIPTION - -This script is a tool to act on tickets from an external scheduling tool, such -as cron. - -Security: - -This tool allows the user to run arbitrary perl modules from within RT. If -this tool were setgid, a hostile local user could use this tool to gain -administrative access to RT. It is incredibly important that nonprivileged -users not be allowed to run this tool. It is suggested that you create a -non-privileged unix user with the correct group membership and RT access to -run this tool. - - -=head1 OPTIONS - -=over - -=item search - -Specify the search module you want to use - -=item search-arg - -An argument to pass to --search - -=item condition - -Specify the condition module you want to use - -=item condition-arg - -An argument to pass to --condition - -=item action - -Specify the action module you want to use - -=item action-arg - -An argument to pass to --action - -=item template - -Specify name or id of template(s) you want to use - -=item transaction - -Specify if you want to use either 'first', 'last' or 'all' transactions - - -=item transaction-type - -Specify the comma separated list of transactions' types you want to use - -=item log - -Adjust LogToScreen config option - -=item verbose - -Output status updates to STDOUT - -=back - diff --git a/rt/bin/rt-mailgate b/rt/bin/rt-mailgate deleted file mode 100755 index 98da58739..000000000 --- a/rt/bin/rt-mailgate +++ /dev/null @@ -1,534 +0,0 @@ -#!/usr/bin/perl -# BEGIN BPS TAGGED BLOCK {{{ -# -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC -# <sales@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 }}} -=head1 NAME - -rt-mailgate - Mail interface to RT. - -=cut - -use strict; -use warnings; - -use Getopt::Long; - -my $opts = { }; -GetOptions( $opts, "queue=s", "action=s", "url=s", - "jar=s", "help", "debug", "extension=s", - "timeout=i", "verify-ssl!", "ca-file=s", - ); - -my $gateway = RT::Client::MailGateway->new(); - -$gateway->run($opts); - -package RT::Client::MailGateway; - -use LWP::UserAgent; -use HTTP::Request::Common qw($DYNAMIC_FILE_UPLOAD); -use File::Temp qw(tempfile tempdir); -$DYNAMIC_FILE_UPLOAD = 1; - -use constant EX_TEMPFAIL => 75; -use constant BUFFER_SIZE => 8192; - -sub new { - my $class = shift; - my $self = bless {}, $class; - return $self; -} - -sub run { - my $self = shift; - my $opts = shift; - - if ( $opts->{running_in_test_harness} ) { - $self->{running_in_test_harness} = 1; - } - - $self->validate_cli_flags($opts); - - my $ua = $self->get_useragent($opts); - my $post_params = $self->setup_session($opts); - $self->upload_message( $ua => $post_params ); - $self->exit_with_success(); -} - -sub exit_with_success { - my $self = shift; - if ( $self->{running_in_test_harness} ) { - return 1; - } else { - exit 0; - } -} - -sub tempfail { - my $self = shift; - if ( $self->{running_in_test_harness} ) { - die "tempfail"; - } else { - - exit EX_TEMPFAIL; - } -} - -sub permfail { - my $self = shift; - if ( $self->{running_in_test_harness} ) { - die "permfail"; - } else { - - exit 1; - } -} - -sub validate_cli_flags { - my $self = shift; - my $opts = shift; - if ( $opts->{'help'} ) { - require Pod::Usage; - Pod::Usage::pod2usage( { verbose => 2 } ); - return $self->permfail() - ; # Don't want to succeed if this is really an email! - } - - unless ( $opts->{'url'} ) { - print STDERR - "$0 invoked improperly\n\nNo 'url' provided to mail gateway!\n"; - return $self->permfail(); - } - - if (($opts->{'ca-file'} or $opts->{"verify-ssl"}) - and not LWP::UserAgent->can("ssl_opts")) { - print STDERR "Verifying SSL certificates requires LWP::UserAgent 6.0 or higher.\n"; - return $self->tempfail(); - } - - $opts->{"verify-ssl"} = 1 unless defined $opts->{"verify-ssl"}; -} - -sub get_useragent { - my $self = shift; - my $opts = shift; - my $ua = LWP::UserAgent->new(); - $ua->cookie_jar( { file => $opts->{'jar'} } ) if $opts->{'jar'}; - - if ( $ua->can("ssl_opts") ) { - $ua->ssl_opts( verify_hostname => $opts->{'verify-ssl'} ); - $ua->ssl_opts( SSL_ca_file => $opts->{'ca-file'} ) - if $opts->{'ca-file'}; - } - - return $ua; -} - -sub setup_session { - my $self = shift; - my $opts = shift; - my %post_params; - $post_params{SessionType} = 'REST'; # Surpress login box - foreach (qw(queue action)) { - $post_params{$_} = $opts->{$_} if defined $opts->{$_}; - } - - if ( ( $opts->{'extension'} || '' ) =~ /^(?:action|queue|ticket)$/i ) { - $post_params{ lc $opts->{'extension'} } = $ENV{'EXTENSION'} - || $opts->{ $opts->{'extension'} }; - } elsif ( $opts->{'extension'} && $ENV{'EXTENSION'} ) { - print STDERR - "Value of the --extension argument is not action, queue or ticket" - . ", but environment variable EXTENSION is also defined. The former is ignored.\n"; - } - - # add ENV{'EXTENSION'} as X-RT-MailExtension to the message header - if ( my $value = ( $ENV{'EXTENSION'} || $opts->{'extension'} ) ) { - - # prepare value to avoid MIME format breakage - # strip trailing newline symbols - $value =~ s/(\r*\n)+$//; - - # make a correct multiline header field, - # with tabs in the beginning of each line - $value =~ s/(\r*\n)/$1\t/g; - $opts->{'headers'} .= "X-RT-Mail-Extension: $value\n"; - } - - # Read the message in from STDIN - # _raw_message is used for testing - my $message = $opts->{'_raw_message'} || $self->slurp_message(); - unless ( $message->{'filename'} ) { - $post_params{'message'} = [ - undef, '', - 'Content-Type' => 'application/octet-stream', - Content => ${ $message->{'content'} }, - ]; - } else { - $post_params{'message'} = [ - $message->{'filename'}, '', - 'Content-Type' => 'application/octet-stream', - ]; - } - - return \%post_params; -} - -sub upload_message { - my $self = shift; - my $ua = shift; - my $post_params = shift; - my $full_url = $opts->{'url'} . "/REST/1.0/NoAuth/mail-gateway"; - print STDERR "$0: connecting to $full_url\n" if $opts->{'debug'}; - - $ua->timeout( exists( $opts->{'timeout'} ) ? $opts->{'timeout'} : 180 ); - my $r = $ua->post( $full_url, $post_params, Content_Type => 'form-data' ); - $self->check_failure($r); - - my $content = $r->content; - print STDERR $content . "\n" if $opts->{'debug'}; - - return if ( $content =~ /^(ok|not ok)/ ); - - # It's not the server's fault if the mail is bogus. We just want to know that - # *something* came out of the server. - print STDERR <<EOF; -RT server error. - -The RT server which handled your email did not behave as expected. It -said: - -$content -EOF - - return $self->tempfail(); -} - -sub check_failure { - my $self = shift; - my $r = shift; - return if $r->is_success; - - # This ordinarily oughtn't to be able to happen, suggests a bug in RT. - # So only load these heavy modules when they're needed. - require HTML::TreeBuilder; - require HTML::FormatText; - - my $error = $r->error_as_HTML; - my $tree = HTML::TreeBuilder->new->parse($error); - $tree->eof; - - # It'll be a cold day in hell before RT sends out bounces in HTML - my $formatter = - HTML::FormatText->new( leftmargin => 0, - rightmargin => 50, ); - print STDERR $formatter->format($tree); - print STDERR "\n$0: undefined server error\n" if $opts->{'debug'}; - return $self->tempfail(); -} - -sub slurp_message { - my $self = shift; - - local $@; - - my %message; - my ( $fh, $filename ) - = eval { tempfile( DIR => tempdir( CLEANUP => 1 ) ) }; - if ( !$fh || $@ ) { - print STDERR "$0: Couldn't create temp file, using memory\n"; - print STDERR "error: $@\n" if $@; - - my $message = \do { local ( @ARGV, $/ ); <STDIN> }; - unless ( $$message =~ /\S/ ) { - print STDERR "$0: no message passed on STDIN\n"; - $self->exit_with_success; - } - $$message = $opts->{'headers'} . $$message if $opts->{'headers'}; - return ( { content => $message } ); - } - - binmode $fh; - binmode \*STDIN; - - print $fh $opts->{'headers'} if $opts->{'headers'}; - - my $buf; - my $empty = 1; - while (1) { - my $status = read \*STDIN, $buf, BUFFER_SIZE; - unless ( defined $status ) { - print STDERR "$0: couldn't read message: $!\n"; - return $self->tempfail(); - } elsif ( !$status ) { - last; - } - $empty = 0 if $buf =~ /\S/; - print $fh $buf; - } - close $fh; - - if ($empty) { - print STDERR "$0: no message passed on STDIN\n"; - $self->exit_with_success; - } - print STDERR "$0: temp file is '$filename'\n" if $opts->{'debug'}; - return ( { filename => $filename } ); -} - -=head1 SYNOPSIS - - rt-mailgate --help : this text - -Usual invocation (from MTA): - - rt-mailgate --action (correspond|comment|...) --queue queuename - --url http://your.rt.server/ - [ --debug ] - [ --extension (queue|action|ticket) ] - [ --timeout seconds ] - - - -=head1 OPTIONS - -=over 3 - -=item C<--action> - -Specifies what happens to email sent to this alias. The avaliable -basic actions are: C<correspond>, C<comment>. - - -If you've set the RT configuration variable B<< C<UnsafeEmailCommands> >>, -C<take> and C<resolve> are also available. You can execute two or more -actions on a single message using a C<-> separated list. RT will execute -the actions in the listed order. For example you can use C<take-comment>, -C<correspond-resolve> or C<take-comment-resolve> as actions. - -Note that C<take> and C<resolve> actions ignore message text if used -alone. Include a C<comment> or C<correspond> action if you want RT -to record the incoming message. - -The default action is C<correspond>. - -=item C<--queue> - -This flag determines which queue this alias should create a ticket in if no ticket identifier -is found. - -=item C<--url> - -This flag tells the mail gateway where it can find your RT server. You should -probably use the same URL that users use to log into RT. - -If your RT server uses SSL, you will need to install additional Perl -libraries. RT will detect and install these dependencies if you pass the -C<--enable-ssl-mailgate> flag to configure as documented in RT's README. - -If you have a self-signed SSL certificate, you may also need to pass -C<--ca-file> or C<--no-verify-ssl>, below. - -=item C<--ca-file> I<path> - -Specifies the path to the public SSL certificate for the certificate -authority that should be used to verify the website's SSL certificate. -If your webserver uses a self-signed certificate, you should -preferentially use this option over C<--no-verify-ssl>, as it will -ensure that the self-signed certificate that the mailgate is seeing the -I<right> self-signed certificate. - -=item C<--no-verify-ssl> - -This flag tells the mail gateway to trust all SSL certificates, -regardless of if their hostname matches the certificate, and regardless -of CA. This is required if you have a self-signed certificate, or some -other certificate which is not traceable back to an certificate your -system ultimitely trusts. - -Verifying SSL certificates requires L<LWP::UserAgent> version 6.0 or -higher; explicitly passing C<--verify-ssl> on prior versions will error. - -=item C<--extension> OPTIONAL - -Some MTAs will route mail sent to user-foo@host or user+foo@host to user@host -and present "foo" in the environment variable $EXTENSION. By specifying -the value "queue" for this parameter, the queue this message should be -submitted to will be set to the value of $EXTENSION. By specifying -"ticket", $EXTENSION will be interpreted as the id of the ticket this message -is related to. "action" will allow the user to specify either "comment" or -"correspond" in the address extension. - -=item C<--debug> OPTIONAL - -Print debugging output to standard error - - -=item C<--timeout> OPTIONAL - -Configure the timeout for posting the message to the web server. The -default timeout is 3 minutes (180 seconds). - -=back - - -=head1 DESCRIPTION - -The RT mail gateway is the primary mechanism for communicating with RT -via email. This program simply directs the email to the RT web server, -which handles filing correspondence and sending out any required mail. -It is designed to be run as part of the mail delivery process, either -called directly by the MTA or C<procmail>, or in a F<.forward> or -equivalent. - -=head1 SETUP - -Much of the set up of the mail gateway depends on your MTA and mail -routing configuration. However, you will need first of all to create an -RT user for the mail gateway and assign it a password; this helps to -ensure that mail coming into the web server did originate from the -gateway. - -Next, you need to route mail to C<rt-mailgate> for the queues you're -monitoring. For instance, if you're using F</etc/aliases> and you have a -"bugs" queue, you will want something like this: - - bugs: "|/opt/rt4/bin/rt-mailgate --queue bugs --action correspond - --url http://rt.mycorp.com/" - - bugs-comment: "|/opt/rt4/bin/rt-mailgate --queue bugs --action comment - --url http://rt.mycorp.com/" - -Note that you don't have to run your RT server on your mail server, as -the mail gateway will happily relay to a different machine. - -=head1 CUSTOMIZATION - -By default, the mail gateway will accept mail from anyone. However, -there are situations in which you will want to authenticate users -before allowing them to communicate with the system. You can do this -via a plug-in mechanism in the RT configuration. - -You can set the array C<@MailPlugins> to be a list of plugins. The -default plugin, if this is not given, is C<Auth::MailFrom> - that is, -authentication of the person is done based on the C<From> header of the -email. If you have additional filters or authentication mechanisms, you -can list them here and they will be called in order: - - Set( @MailPlugins => - "Filter::SpamAssassin", - "Auth::LDAP", - # ... - ); - -See the documentation for any additional plugins you have. - -You may also put Perl subroutines into the C<@MailPlugins> array, if -they behave as described below. - -=head1 WRITING PLUGINS - -What's actually going on in the above is that C<@MailPlugins> is a -list of Perl modules; RT prepends C<RT::Interface::Email::> to the name, -to form a package name, and then C<use>'s this module. The module is -expected to provide a C<GetCurrentUser> subroutine, which takes a hash of -several parameters: - -=over 4 - -=item Message - -A C<MIME::Entity> object representing the email - -=item CurrentUser - -An C<RT::CurrentUser> object - -=item AuthStat - -The authentication level returned from the previous plugin. - -=item Ticket [OPTIONAL] - -The ticket under discussion - -=item Queue [OPTIONAL] - -If we don't already have a ticket id, we need to know which queue we're talking about - -=item Action - -The action being performed. At the moment, it's one of "comment" or "correspond" - -=back - -It returns two values, the new C<RT::CurrentUser> object, and the new -authentication level. The authentication level can be zero, not allowed -to communicate with RT at all, (a "permission denied" error is mailed to -the correspondent) or one, which is the normal mode of operation. -Additionally, if C<-1> is returned, then the processing of the plug-ins -stops immediately and the message is ignored. - -=head1 ENVIRONMENT - -=over 4 - -=item EXTENSION - -Some MTAs will route mail sent to user-foo@host or user+foo@host to user@host -and present "foo" in the environment variable C<EXTENSION>. Mailgate adds value -of this variable to message in the C<X-RT-Mail-Extension> field of the message -header. - -See also C<--extension> option. Note that value of the environment variable is -always added to the message header when it's not empty even if C<--extension> -option is not provided. - -=back - -=cut - diff --git a/rt/config.log b/rt/config.log deleted file mode 100644 index 9e10d30bd..000000000 --- a/rt/config.log +++ /dev/null @@ -1,409 +0,0 @@ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by RT configure rt-4.0.5, which was -generated by GNU Autoconf 2.68. Invocation command line was - - $ ./configure --enable-layout=Freeside --with-db-type=Pg --with-db-dba=freeside --with-db-database=freeside --with-db-rt-user=freeside --with-db-rt-pass= --with-web-user=freeside --with-web-group=freeside --with-rt-group=freeside --with-web-handler=modperl2 - -## --------- ## -## Platform. ## -## --------- ## - -hostname = fleetpaw -uname -m = x86_64 -uname -r = 3.2.0-2-amd64 -uname -s = Linux -uname -v = #1 SMP Sun Apr 15 16:47:38 UTC 2012 - -/usr/bin/uname -p = unknown -/bin/uname -X = unknown - -/bin/arch = unknown -/usr/bin/arch -k = unknown -/usr/convex/getsysinfo = unknown -/usr/bin/hostinfo = unknown -/bin/machine = unknown -/usr/bin/oslevel = unknown -/bin/universe = unknown - -PATH: /usr/local/sbin -PATH: /usr/local/bin -PATH: /usr/sbin -PATH: /usr/bin -PATH: /sbin -PATH: /bin - - -## ----------- ## -## Core tests. ## -## ----------- ## - -configure:2006: checking for a BSD-compatible install -configure:2074: result: /usr/bin/install -c -configure:2088: checking for perl -configure:2106: found /usr/bin/perl -configure:2119: result: /usr/bin/perl -configure:2497: checking for chosen layout -configure:2510: result: Freeside -configure:2744: checking if database name is set -configure:2747: result: yes -configure:2849: checking for gcc -configure:2865: found /usr/bin/gcc -configure:2876: result: gcc -configure:3105: checking for C compiler version -configure:3114: gcc --version >&5 -gcc (Debian 4.7.0-11) 4.7.0 -Copyright (C) 2012 Free Software Foundation, Inc. -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -configure:3125: $? = 0 -configure:3114: gcc -v >&5 -Using built-in specs. -COLLECT_GCC=gcc -COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper -Target: x86_64-linux-gnu -Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.0-11' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu -Thread model: posix -gcc version 4.7.0 (Debian 4.7.0-11) -configure:3125: $? = 0 -configure:3114: gcc -V >&5 -gcc: error: unrecognized command line option '-V' -gcc: fatal error: no input files -compilation terminated. -configure:3125: $? = 4 -configure:3114: gcc -qversion >&5 -gcc: error: unrecognized command line option '-qversion' -gcc: fatal error: no input files -compilation terminated. -configure:3125: $? = 4 -configure:3145: checking whether the C compiler works -configure:3167: gcc conftest.c >&5 -configure:3171: $? = 0 -configure:3219: result: yes -configure:3222: checking for C compiler default output file name -configure:3224: result: a.out -configure:3230: checking for suffix of executables -configure:3237: gcc -o conftest conftest.c >&5 -configure:3241: $? = 0 -configure:3263: result: -configure:3285: checking whether we are cross compiling -configure:3293: gcc -o conftest conftest.c >&5 -configure:3297: $? = 0 -configure:3304: ./conftest -configure:3308: $? = 0 -configure:3323: result: no -configure:3328: checking for suffix of object files -configure:3350: gcc -c conftest.c >&5 -configure:3354: $? = 0 -configure:3375: result: o -configure:3379: checking whether we are using the GNU C compiler -configure:3398: gcc -c conftest.c >&5 -configure:3398: $? = 0 -configure:3407: result: yes -configure:3416: checking whether gcc accepts -g -configure:3436: gcc -c -g conftest.c >&5 -configure:3436: $? = 0 -configure:3477: result: yes -configure:3494: checking for gcc option to accept ISO C89 -configure:3558: gcc -c -g -O2 conftest.c >&5 -configure:3558: $? = 0 -configure:3571: result: none needed -configure:3592: checking for aginitlib in -lgraph -configure:3617: gcc -o conftest -g -O2 conftest.c -lgraph >&5 -/usr/bin/ld: cannot find -lgraph -collect2: error: ld returned 1 exit status -configure:3617: $? = 1 -configure: failed program was: -| /* confdefs.h */ -| #define PACKAGE_NAME "RT" -| #define PACKAGE_TARNAME "rt" -| #define PACKAGE_VERSION "rt-4.0.5" -| #define PACKAGE_STRING "RT rt-4.0.5" -| #define PACKAGE_BUGREPORT "rt-bugs@bestpractical.com" -| #define PACKAGE_URL "" -| /* end confdefs.h. */ -| -| /* Override any GCC internal prototype to avoid an error. -| Use char because int might match the return type of a GCC -| builtin and then its argument prototype would still apply. */ -| #ifdef __cplusplus -| extern "C" -| #endif -| char aginitlib (); -| int -| main () -| { -| return aginitlib (); -| ; -| return 0; -| } -configure:3626: result: no -configure:3652: checking for gdlib-config -configure:3680: result: no -configure:3708: checking for gpg -configure:3724: found /usr/bin/gpg -configure:3736: result: yes -configure:4081: creating ./config.status - -## ---------------------- ## -## Running config.status. ## -## ---------------------- ## - -This file was extended by RT config.status rt-4.0.5, which was -generated by GNU Autoconf 2.68. Invocation command line was - - CONFIG_FILES = - CONFIG_HEADERS = - CONFIG_LINKS = - CONFIG_COMMANDS = - $ ./config.status - -on fleetpaw - -config.status:878: creating etc/upgrade/3.8-branded-queues-extension -config.status:878: creating etc/upgrade/3.8-ical-extension -config.status:878: creating etc/upgrade/split-out-cf-categories -config.status:878: creating etc/upgrade/generate-rtaddressregexp -config.status:878: creating etc/upgrade/upgrade-articles -config.status:878: creating etc/upgrade/vulnerable-passwords -config.status:878: creating sbin/rt-attributes-viewer -config.status:878: creating sbin/rt-preferences-viewer -config.status:878: creating sbin/rt-session-viewer -config.status:878: creating sbin/rt-dump-metadata -config.status:878: creating sbin/rt-setup-database -config.status:878: creating sbin/rt-test-dependencies -config.status:878: creating sbin/rt-email-digest -config.status:878: creating sbin/rt-email-dashboards -config.status:878: creating sbin/rt-clean-sessions -config.status:878: creating sbin/rt-shredder -config.status:878: creating sbin/rt-validator -config.status:878: creating sbin/rt-email-group-admin -config.status:878: creating sbin/rt-server -config.status:878: creating sbin/rt-server.fcgi -config.status:878: creating sbin/standalone_httpd -config.status:878: creating sbin/rt-setup-fulltext-index -config.status:878: creating sbin/rt-fulltext-indexer -config.status:878: creating bin/rt-crontool -config.status:878: creating bin/rt-mailgate -config.status:878: creating bin/rt -config.status:878: creating Makefile -config.status:878: creating etc/RT_Config.pm -config.status:878: creating lib/RT/Generated.pm -config.status:878: creating t/data/configs/apache2.2+mod_perl.conf -config.status:878: creating t/data/configs/apache2.2+fastcgi.conf - -## ---------------- ## -## Cache variables. ## -## ---------------- ## - -ac_cv_c_compiler_gnu=yes -ac_cv_env_CC_set= -ac_cv_env_CC_value= -ac_cv_env_CFLAGS_set= -ac_cv_env_CFLAGS_value= -ac_cv_env_CPPFLAGS_set= -ac_cv_env_CPPFLAGS_value= -ac_cv_env_LDFLAGS_set= -ac_cv_env_LDFLAGS_value= -ac_cv_env_LIBS_set= -ac_cv_env_LIBS_value= -ac_cv_env_PERL_set= -ac_cv_env_PERL_value= -ac_cv_env_build_alias_set= -ac_cv_env_build_alias_value= -ac_cv_env_host_alias_set= -ac_cv_env_host_alias_value= -ac_cv_env_target_alias_set= -ac_cv_env_target_alias_value= -ac_cv_lib_graph_aginitlib=no -ac_cv_objext=o -ac_cv_path_PERL=/usr/bin/perl -ac_cv_path_install='/usr/bin/install -c' -ac_cv_prog_RT_GD=no -ac_cv_prog_RT_GPG=yes -ac_cv_prog_ac_ct_CC=gcc -ac_cv_prog_cc_c89= -ac_cv_prog_cc_g=yes - -## ----------------- ## -## Output variables. ## -## ----------------- ## - -APACHECTL='/usr/sbin/apachectl' -BIN_OWNER='root' -CC='gcc' -CFLAGS='-g -O2' -COMMENT_INPLACE_LAYOUT='' -CONFIGURE_INCANT='./configure --enable-layout=Freeside --with-db-type=Pg --with-db-dba=freeside --with-db-database=freeside --with-db-rt-user=freeside --with-db-rt-pass= --with-web-user=freeside --with-web-group=freeside --with-rt-group=freeside --with-web-handler=modperl2' -CONFIG_FILE_PATH='/opt/rt3/etc' -CONFIG_FILE_PATH_R='/opt/rt3/etc' -CPPFLAGS='' -DATABASE_ENV_PREF='' -DB_DATABASE='freeside' -DB_DBA='freeside' -DB_HOST='localhost' -DB_PORT='' -DB_RT_HOST='localhost' -DB_RT_PASS='' -DB_RT_USER='freeside' -DB_TYPE='Pg' -DEFS='-DPACKAGE_NAME=\"RT\" -DPACKAGE_TARNAME=\"rt\" -DPACKAGE_VERSION=\"rt-4.0.5\" -DPACKAGE_STRING=\"RT\ rt-4.0.5\" -DPACKAGE_BUGREPORT=\"rt-bugs@bestpractical.com\" -DPACKAGE_URL=\"\"' -ECHO_C='' -ECHO_N='-n' -ECHO_T='' -EXEEXT='' -INSTALL_DATA='${INSTALL} -m 644' -INSTALL_PROGRAM='${INSTALL}' -INSTALL_SCRIPT='${INSTALL}' -LDFLAGS='' -LIBOBJS='' -LIBS='' -LIBS_GROUP='bin' -LIBS_OWNER='root' -LOCAL_ETC_PATH='/opt/rt3/local/etc' -LOCAL_ETC_PATH_R='/opt/rt3/local/etc' -LOCAL_LEXICON_PATH='/opt/rt3/local/po' -LOCAL_LEXICON_PATH_R='/opt/rt3/local/po' -LOCAL_LIB_PATH='/opt/rt3/local/lib' -LOCAL_LIB_PATH_R='/opt/rt3/local/lib' -LOCAL_PLUGIN_PATH='/opt/rt3/local/plugins' -LOCAL_PLUGIN_PATH_R='/opt/rt3/local/plugins' -LTLIBOBJS='' -MASON_DATA_PATH='/usr/local/etc/freeside/masondata' -MASON_DATA_PATH_R='/usr/local/etc/freeside/masondata' -MASON_HTML_PATH='/var/www/freeside/rt' -MASON_HTML_PATH_R='/var/www/freeside/rt' -MASON_LOCAL_HTML_PATH='/opt/rt3/local/html' -MASON_LOCAL_HTML_PATH_R='/opt/rt3/local/html' -MASON_SESSION_PATH='/opt/rt3/var/session_data' -MASON_SESSION_PATH_R='/opt/rt3/var/session_data' -OBJEXT='o' -PACKAGE_BUGREPORT='rt-bugs@bestpractical.com' -PACKAGE_NAME='RT' -PACKAGE_STRING='RT rt-4.0.5' -PACKAGE_TARNAME='rt' -PACKAGE_URL='' -PACKAGE_VERSION='rt-4.0.5' -PATH_SEPARATOR=':' -PERL='/usr/bin/perl' -RTGROUP='freeside' -RT_BIN_PATH='/opt/rt3/bin' -RT_BIN_PATH_R='/opt/rt3/bin' -RT_DEVEL_MODE='0' -RT_DOC_PATH='/opt/rt3/docs' -RT_DOC_PATH_R='/opt/rt3/docs' -RT_ETC_PATH='/opt/rt3/etc' -RT_ETC_PATH_R='/opt/rt3/etc' -RT_FONT_PATH='/opt/rt3/share/fonts' -RT_FONT_PATH_R='/opt/rt3/share/fonts' -RT_GD='0' -RT_GPG='1' -RT_GRAPHVIZ='0' -RT_LEXICON_PATH='/opt/rt3/share/po' -RT_LEXICON_PATH_R='/opt/rt3/share/po' -RT_LIB_PATH='/opt/rt3/lib' -RT_LIB_PATH_R='/opt/rt3/lib' -RT_LOCAL_PATH='/opt/rt3/local' -RT_LOCAL_PATH_R='/opt/rt3/local' -RT_LOG_PATH='/opt/rt3/var/log' -RT_LOG_PATH_R='/opt/rt3/var/log' -RT_MAN_PATH='/opt/rt3/man' -RT_MAN_PATH_R='/opt/rt3/man' -RT_PATH='/opt/rt3' -RT_PATH_R='/opt/rt3' -RT_PLUGIN_PATH='/opt/rt3/plugins' -RT_PLUGIN_PATH_R='/opt/rt3/plugins' -RT_SBIN_PATH='/opt/rt3/sbin' -RT_SBIN_PATH_R='/opt/rt3/sbin' -RT_SSL_MAILGATE='0' -RT_VAR_PATH='/opt/rt3/var' -RT_VAR_PATH_R='/opt/rt3/var' -RT_VERSION_MAJOR='4' -RT_VERSION_MINOR='0' -RT_VERSION_PATCH='5' -SHELL='/bin/bash' -WEB_GROUP='freeside' -WEB_HANDLER='modperl2' -WEB_USER='freeside' -ac_ct_CC='gcc' -bindir='/opt/rt3/bin' -build_alias='' -customdir='/opt/rt3/local' -custometcdir='/opt/rt3/local/etc' -customhtmldir='/opt/rt3/local/html' -customlexdir='/opt/rt3/local/po' -customlibdir='/opt/rt3/local/lib' -customplugindir='/opt/rt3/local/plugins' -datadir='/opt/rt3/share' -datarootdir='${prefix}/share' -docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' -dvidir='${docdir}' -exec_prefix='/opt/rt3' -exp_bindir='/opt/rt3/bin' -exp_customdir='/opt/rt3/local' -exp_custometcdir='/opt/rt3/local/etc' -exp_customhtmldir='/opt/rt3/local/html' -exp_customlexdir='/opt/rt3/local/po' -exp_customlibdir='/opt/rt3/local/lib' -exp_customplugindir='/opt/rt3/local/plugins' -exp_datadir='/opt/rt3/share' -exp_exec_prefix='/opt/rt3' -exp_fontdir='/opt/rt3/share/fonts' -exp_htmldir='/var/www/freeside/rt' -exp_lexdir='/opt/rt3/share/po' -exp_libdir='/opt/rt3/lib' -exp_localstatedir='/opt/rt3/var' -exp_logfiledir='/opt/rt3/var/log' -exp_mandir='/opt/rt3/man' -exp_manualdir='/opt/rt3/docs' -exp_masonstatedir='/usr/local/etc/freeside/masondata' -exp_plugindir='/opt/rt3/plugins' -exp_prefix='/opt/rt3' -exp_sbindir='/opt/rt3/sbin' -exp_sessionstatedir='/opt/rt3/var/session_data' -exp_sysconfdir='/opt/rt3/etc' -fontdir='/opt/rt3/share/fonts' -host_alias='' -htmldir='/var/www/freeside/rt' -includedir='${prefix}/include' -infodir='${datarootdir}/info' -lexdir='/opt/rt3/share/po' -libdir='/opt/rt3/lib' -libexecdir='${exec_prefix}/libexec' -localedir='${datarootdir}/locale' -localstatedir='/opt/rt3/var' -logfiledir='/opt/rt3/var/log' -mandir='/opt/rt3/man' -manualdir='/opt/rt3/docs' -masonstatedir='/usr/local/etc/freeside/masondata' -oldincludedir='/usr/include' -pdfdir='${docdir}' -plugindir='/opt/rt3/plugins' -prefix='/opt/rt3' -program_transform_name='s,x,x,' -psdir='${docdir}' -rt_layout_name='Freeside' -rt_version_major='4' -rt_version_minor='0' -rt_version_patch='5' -sbindir='/opt/rt3/sbin' -sessionstatedir='/opt/rt3/var/session_data' -sharedstatedir='${prefix}/com' -sysconfdir='/opt/rt3/etc' -target_alias='' - -## ----------- ## -## confdefs.h. ## -## ----------- ## - -/* confdefs.h */ -#define PACKAGE_NAME "RT" -#define PACKAGE_TARNAME "rt" -#define PACKAGE_VERSION "rt-4.0.5" -#define PACKAGE_STRING "RT rt-4.0.5" -#define PACKAGE_BUGREPORT "rt-bugs@bestpractical.com" -#define PACKAGE_URL "" - -configure: exit 0 diff --git a/rt/config.status b/rt/config.status deleted file mode 100755 index 769e1d4e1..000000000 --- a/rt/config.status +++ /dev/null @@ -1,1106 +0,0 @@ -#! /bin/bash -# Generated by configure. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false - -SHELL=${CONFIG_SHELL-/bin/bash} -export SHELL -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 -## ----------------------------------- ## -## Main body of $CONFIG_STATUS script. ## -## ----------------------------------- ## -# Save the log message, to keep $0 and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by RT $as_me rt-4.0.5, which was -generated by GNU Autoconf 2.68. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -# Files that config.status was made for. -config_files=" etc/upgrade/3.8-branded-queues-extension etc/upgrade/3.8-ical-extension etc/upgrade/split-out-cf-categories etc/upgrade/generate-rtaddressregexp etc/upgrade/upgrade-articles etc/upgrade/vulnerable-passwords sbin/rt-attributes-viewer sbin/rt-preferences-viewer sbin/rt-session-viewer sbin/rt-dump-metadata sbin/rt-setup-database sbin/rt-test-dependencies sbin/rt-email-digest sbin/rt-email-dashboards sbin/rt-clean-sessions sbin/rt-shredder sbin/rt-validator sbin/rt-email-group-admin sbin/rt-server sbin/rt-server.fcgi sbin/standalone_httpd sbin/rt-setup-fulltext-index sbin/rt-fulltext-indexer bin/rt-crontool bin/rt-mailgate bin/rt Makefile etc/RT_Config.pm lib/RT/Generated.pm t/data/configs/apache2.2+mod_perl.conf t/data/configs/apache2.2+fastcgi.conf" - -ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions -from templates according to the current configuration. Unless the files -and actions are specified as TAGs, all are instantiated by default. - -Usage: $0 [OPTION]... [TAG]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - --config print configuration, then exit - -q, --quiet, --silent - do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - -Configuration files: -$config_files - -Report bugs to <rt-bugs@bestpractical.com>." - -ac_cs_config="'--enable-layout=Freeside' '--with-db-type=Pg' '--with-db-dba=freeside' '--with-db-database=freeside' '--with-db-rt-user=freeside' '--with-db-rt-pass=' '--with-web-user=freeside' '--with-web-group=freeside' '--with-rt-group=freeside' '--with-web-handler=modperl2'" -ac_cs_version="\ -RT config.status rt-4.0.5 -configured by ./configure, generated by GNU Autoconf 2.68, - with options \"$ac_cs_config\" - -Copyright (C) 2010 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='/home/ivan/freeside_rt4/rt' -srcdir='.' -INSTALL='/usr/bin/install -c' -test -n "$AWK" || AWK=awk -# The default lists apply if the user does not specify any file. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=?*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - --*=) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg= - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; - --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - '') as_fn_error $? "missing file argument" ;; - esac - as_fn_append CONFIG_FILES " '$ac_optarg'" - ac_need_defaults=false;; - --he | --h | --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) as_fn_error $? "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; - - *) as_fn_append ac_config_targets " $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -if $ac_cs_recheck; then - set X '/bin/bash' './configure' '--enable-layout=Freeside' '--with-db-type=Pg' '--with-db-dba=freeside' '--with-db-database=freeside' '--with-db-rt-user=freeside' '--with-db-rt-pass=' '--with-web-user=freeside' '--with-web-group=freeside' '--with-rt-group=freeside' '--with-web-handler=modperl2' $ac_configure_extra_args --no-create --no-recursion - shift - $as_echo "running CONFIG_SHELL=/bin/bash $*" >&6 - CONFIG_SHELL='/bin/bash' - export CONFIG_SHELL - exec "$@" -fi - -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - $as_echo "$ac_log" -} >&5 - - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "etc/upgrade/3.8-branded-queues-extension") CONFIG_FILES="$CONFIG_FILES etc/upgrade/3.8-branded-queues-extension" ;; - "etc/upgrade/3.8-ical-extension") CONFIG_FILES="$CONFIG_FILES etc/upgrade/3.8-ical-extension" ;; - "etc/upgrade/split-out-cf-categories") CONFIG_FILES="$CONFIG_FILES etc/upgrade/split-out-cf-categories" ;; - "etc/upgrade/generate-rtaddressregexp") CONFIG_FILES="$CONFIG_FILES etc/upgrade/generate-rtaddressregexp" ;; - "etc/upgrade/upgrade-articles") CONFIG_FILES="$CONFIG_FILES etc/upgrade/upgrade-articles" ;; - "etc/upgrade/vulnerable-passwords") CONFIG_FILES="$CONFIG_FILES etc/upgrade/vulnerable-passwords" ;; - "sbin/rt-attributes-viewer") CONFIG_FILES="$CONFIG_FILES sbin/rt-attributes-viewer" ;; - "sbin/rt-preferences-viewer") CONFIG_FILES="$CONFIG_FILES sbin/rt-preferences-viewer" ;; - "sbin/rt-session-viewer") CONFIG_FILES="$CONFIG_FILES sbin/rt-session-viewer" ;; - "sbin/rt-dump-metadata") CONFIG_FILES="$CONFIG_FILES sbin/rt-dump-metadata" ;; - "sbin/rt-setup-database") CONFIG_FILES="$CONFIG_FILES sbin/rt-setup-database" ;; - "sbin/rt-test-dependencies") CONFIG_FILES="$CONFIG_FILES sbin/rt-test-dependencies" ;; - "sbin/rt-email-digest") CONFIG_FILES="$CONFIG_FILES sbin/rt-email-digest" ;; - "sbin/rt-email-dashboards") CONFIG_FILES="$CONFIG_FILES sbin/rt-email-dashboards" ;; - "sbin/rt-clean-sessions") CONFIG_FILES="$CONFIG_FILES sbin/rt-clean-sessions" ;; - "sbin/rt-shredder") CONFIG_FILES="$CONFIG_FILES sbin/rt-shredder" ;; - "sbin/rt-validator") CONFIG_FILES="$CONFIG_FILES sbin/rt-validator" ;; - "sbin/rt-email-group-admin") CONFIG_FILES="$CONFIG_FILES sbin/rt-email-group-admin" ;; - "sbin/rt-server") CONFIG_FILES="$CONFIG_FILES sbin/rt-server" ;; - "sbin/rt-server.fcgi") CONFIG_FILES="$CONFIG_FILES sbin/rt-server.fcgi" ;; - "sbin/standalone_httpd") CONFIG_FILES="$CONFIG_FILES sbin/standalone_httpd" ;; - "sbin/rt-setup-fulltext-index") CONFIG_FILES="$CONFIG_FILES sbin/rt-setup-fulltext-index" ;; - "sbin/rt-fulltext-indexer") CONFIG_FILES="$CONFIG_FILES sbin/rt-fulltext-indexer" ;; - "bin/rt-crontool") CONFIG_FILES="$CONFIG_FILES bin/rt-crontool" ;; - "bin/rt-mailgate") CONFIG_FILES="$CONFIG_FILES bin/rt-mailgate" ;; - "bin/rt") CONFIG_FILES="$CONFIG_FILES bin/rt" ;; - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "etc/RT_Config.pm") CONFIG_FILES="$CONFIG_FILES etc/RT_Config.pm" ;; - "lib/RT/Generated.pm") CONFIG_FILES="$CONFIG_FILES lib/RT/Generated.pm" ;; - "t/data/configs/apache2.2+mod_perl.conf") CONFIG_FILES="$CONFIG_FILES t/data/configs/apache2.2+mod_perl.conf" ;; - "t/data/configs/apache2.2+fastcgi.conf") CONFIG_FILES="$CONFIG_FILES t/data/configs/apache2.2+fastcgi.conf" ;; - - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= ac_tmp= - trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status -' 0 - trap 'as_fn_exit 1' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 -ac_tmp=$tmp - -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - - -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$ac_tmp/subs1.awk" && -cat >>"$ac_tmp/subs1.awk" <<\_ACAWK && -S["LTLIBOBJS"]="" -S["LIBOBJS"]="" -S["RT_LOG_PATH_R"]="/opt/rt3/var/log" -S["LOCAL_PLUGIN_PATH_R"]="/opt/rt3/local/plugins" -S["LOCAL_LIB_PATH_R"]="/opt/rt3/local/lib" -S["LOCAL_LEXICON_PATH_R"]="/opt/rt3/local/po" -S["MASON_LOCAL_HTML_PATH_R"]="/opt/rt3/local/html" -S["LOCAL_ETC_PATH_R"]="/opt/rt3/local/etc" -S["MASON_HTML_PATH_R"]="/var/www/freeside/rt" -S["MASON_SESSION_PATH_R"]="/opt/rt3/var/session_data" -S["MASON_DATA_PATH_R"]="/usr/local/etc/freeside/masondata" -S["RT_PLUGIN_PATH_R"]="/opt/rt3/plugins" -S["RT_LEXICON_PATH_R"]="/opt/rt3/share/po" -S["RT_FONT_PATH_R"]="/opt/rt3/share/fonts" -S["RT_MAN_PATH_R"]="/opt/rt3/man" -S["RT_VAR_PATH_R"]="/opt/rt3/var" -S["RT_SBIN_PATH_R"]="/opt/rt3/sbin" -S["RT_BIN_PATH_R"]="/opt/rt3/bin" -S["CONFIG_FILE_PATH_R"]="/opt/rt3/etc" -S["RT_ETC_PATH_R"]="/opt/rt3/etc" -S["RT_LIB_PATH_R"]="/opt/rt3/lib" -S["RT_LOCAL_PATH_R"]="/opt/rt3/local" -S["RT_DOC_PATH_R"]="/opt/rt3/docs" -S["RT_PATH_R"]="/opt/rt3" -S["RT_LOG_PATH"]="/opt/rt3/var/log" -S["LOCAL_PLUGIN_PATH"]="/opt/rt3/local/plugins" -S["LOCAL_LIB_PATH"]="/opt/rt3/local/lib" -S["LOCAL_LEXICON_PATH"]="/opt/rt3/local/po" -S["MASON_LOCAL_HTML_PATH"]="/opt/rt3/local/html" -S["LOCAL_ETC_PATH"]="/opt/rt3/local/etc" -S["MASON_HTML_PATH"]="/var/www/freeside/rt" -S["MASON_SESSION_PATH"]="/opt/rt3/var/session_data" -S["MASON_DATA_PATH"]="/usr/local/etc/freeside/masondata" -S["RT_PLUGIN_PATH"]="/opt/rt3/plugins" -S["RT_FONT_PATH"]="/opt/rt3/share/fonts" -S["RT_MAN_PATH"]="/opt/rt3/man" -S["RT_VAR_PATH"]="/opt/rt3/var" -S["RT_SBIN_PATH"]="/opt/rt3/sbin" -S["RT_BIN_PATH"]="/opt/rt3/bin" -S["CONFIG_FILE_PATH"]="/opt/rt3/etc" -S["RT_ETC_PATH"]="/opt/rt3/etc" -S["RT_LEXICON_PATH"]="/opt/rt3/share/po" -S["RT_LIB_PATH"]="/opt/rt3/lib" -S["RT_LOCAL_PATH"]="/opt/rt3/local" -S["RT_DOC_PATH"]="/opt/rt3/docs" -S["RT_PATH"]="/opt/rt3" -S["RT_VERSION_PATCH"]="5" -S["RT_VERSION_MINOR"]="0" -S["RT_VERSION_MAJOR"]="4" -S["RT_SSL_MAILGATE"]="0" -S["RT_GPG"]="1" -S["RT_GD"]="0" -S["RT_GRAPHVIZ"]="0" -S["OBJEXT"]="o" -S["EXEEXT"]="" -S["ac_ct_CC"]="gcc" -S["CPPFLAGS"]="" -S["LDFLAGS"]="" -S["CFLAGS"]="-g -O2" -S["CC"]="gcc" -S["RT_DEVEL_MODE"]="0" -S["APACHECTL"]="/usr/sbin/apachectl" -S["RTGROUP"]="freeside" -S["WEB_GROUP"]="freeside" -S["WEB_USER"]="freeside" -S["DB_RT_PASS"]="" -S["DB_RT_USER"]="freeside" -S["DB_DATABASE"]="freeside" -S["DB_DBA"]="freeside" -S["DB_RT_HOST"]="localhost" -S["DB_PORT"]="" -S["DB_HOST"]="localhost" -S["DATABASE_ENV_PREF"]="" -S["DB_TYPE"]="Pg" -S["LIBS_GROUP"]="bin" -S["LIBS_OWNER"]="root" -S["BIN_OWNER"]="root" -S["COMMENT_INPLACE_LAYOUT"]="" -S["rt_layout_name"]="Freeside" -S["exp_customlibdir"]="/opt/rt3/local/lib" -S["customlibdir"]="/opt/rt3/local/lib" -S["exp_customlexdir"]="/opt/rt3/local/po" -S["customlexdir"]="/opt/rt3/local/po" -S["exp_customhtmldir"]="/opt/rt3/local/html" -S["customhtmldir"]="/opt/rt3/local/html" -S["exp_customplugindir"]="/opt/rt3/local/plugins" -S["customplugindir"]="/opt/rt3/local/plugins" -S["exp_custometcdir"]="/opt/rt3/local/etc" -S["custometcdir"]="/opt/rt3/local/etc" -S["exp_customdir"]="/opt/rt3/local" -S["customdir"]="/opt/rt3/local" -S["exp_sessionstatedir"]="/opt/rt3/var/session_data" -S["sessionstatedir"]="/opt/rt3/var/session_data" -S["exp_masonstatedir"]="/usr/local/etc/freeside/masondata" -S["masonstatedir"]="/usr/local/etc/freeside/masondata" -S["exp_logfiledir"]="/opt/rt3/var/log" -S["logfiledir"]="/opt/rt3/var/log" -S["exp_localstatedir"]="/opt/rt3/var" -S["exp_plugindir"]="/opt/rt3/plugins" -S["plugindir"]="/opt/rt3/plugins" -S["exp_manualdir"]="/opt/rt3/docs" -S["manualdir"]="/opt/rt3/docs" -S["exp_fontdir"]="/opt/rt3/share/fonts" -S["fontdir"]="/opt/rt3/share/fonts" -S["exp_htmldir"]="/var/www/freeside/rt" -S["exp_datadir"]="/opt/rt3/share" -S["exp_lexdir"]="/opt/rt3/share/po" -S["lexdir"]="/opt/rt3/share/po" -S["exp_libdir"]="/opt/rt3/lib" -S["exp_mandir"]="/opt/rt3/man" -S["exp_sysconfdir"]="/opt/rt3/etc" -S["exp_sbindir"]="/opt/rt3/sbin" -S["exp_bindir"]="/opt/rt3/bin" -S["exp_exec_prefix"]="/opt/rt3" -S["exp_prefix"]="/opt/rt3" -S["WEB_HANDLER"]="modperl2" -S["PERL"]="/usr/bin/perl" -S["INSTALL_DATA"]="${INSTALL} -m 644" -S["INSTALL_SCRIPT"]="${INSTALL}" -S["INSTALL_PROGRAM"]="${INSTALL}" -S["rt_version_patch"]="5" -S["rt_version_minor"]="0" -S["rt_version_major"]="4" -S["CONFIGURE_INCANT"]="./configure --enable-layout=Freeside --with-db-type=Pg --with-db-dba=freeside --with-db-database=freeside --with-db-rt-user=freeside --with-db-rt-pa"\ -"ss= --with-web-user=freeside --with-web-group=freeside --with-rt-group=freeside --with-web-handler=modperl2" -S["target_alias"]="" -S["host_alias"]="" -S["build_alias"]="" -S["LIBS"]="" -S["ECHO_T"]="" -S["ECHO_N"]="-n" -S["ECHO_C"]="" -S["DEFS"]="-DPACKAGE_NAME=\\\"RT\\\" -DPACKAGE_TARNAME=\\\"rt\\\" -DPACKAGE_VERSION=\\\"rt-4.0.5\\\" -DPACKAGE_STRING=\\\"RT\\ rt-4.0.5\\\" -DPACKAGE_BUGREPORT=\\\"rt-bugs@bestpr"\ -"actical.com\\\" -DPACKAGE_URL=\\\"\\\"" -S["mandir"]="/opt/rt3/man" -S["localedir"]="${datarootdir}/locale" -S["libdir"]="/opt/rt3/lib" -S["psdir"]="${docdir}" -S["pdfdir"]="${docdir}" -S["dvidir"]="${docdir}" -S["htmldir"]="/var/www/freeside/rt" -S["infodir"]="${datarootdir}/info" -S["docdir"]="${datarootdir}/doc/${PACKAGE_TARNAME}" -S["oldincludedir"]="/usr/include" -S["includedir"]="${prefix}/include" -S["localstatedir"]="/opt/rt3/var" -S["sharedstatedir"]="${prefix}/com" -S["sysconfdir"]="/opt/rt3/etc" -S["datadir"]="/opt/rt3/share" -S["datarootdir"]="${prefix}/share" -S["libexecdir"]="${exec_prefix}/libexec" -S["sbindir"]="/opt/rt3/sbin" -S["bindir"]="/opt/rt3/bin" -S["program_transform_name"]="s,x,x," -S["prefix"]="/opt/rt3" -S["exec_prefix"]="/opt/rt3" -S["PACKAGE_URL"]="" -S["PACKAGE_BUGREPORT"]="rt-bugs@bestpractical.com" -S["PACKAGE_STRING"]="RT rt-4.0.5" -S["PACKAGE_VERSION"]="rt-4.0.5" -S["PACKAGE_TARNAME"]="rt" -S["PACKAGE_NAME"]="RT" -S["PATH_SEPARATOR"]=":" -S["SHELL"]="/bin/bash" -_ACAWK -cat >>"$ac_tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } - - print line -} - -_ACAWK -if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" -else - cat -fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ - || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 -fi # test -n "$CONFIG_FILES" - - -eval set X " :F $CONFIG_FILES " -shift -for ac_tag -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$ac_tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; - esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - as_fn_append ac_file_inputs " '$ac_f'" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' - `' by configure.' - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} - fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac - - case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir="$ac_dir"; as_fn_mkdir_p - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; - esac -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= -ac_sed_dataroot=' -/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p' -case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} - ac_datarootdir_hack=' - s&@datadir@&/opt/rt3/share&g - s&@docdir@&${datarootdir}/doc/${PACKAGE_TARNAME}&g - s&@infodir@&${datarootdir}/info&g - s&@localedir@&${datarootdir}/locale&g - s&@mandir@&/opt/rt3/man&g - s&\${datarootdir}&${prefix}/share&g' ;; -esac -ac_sed_extra="/^[ ]*VPATH[ ]*=[ ]*/{ -h -s/// -s/^/:/ -s/[ ]*$/:/ -s/:\$(srcdir):/:/g -s/:\${srcdir}:/:/g -s/:@srcdir@:/:/g -s/^:*// -s/:*$// -x -s/\(=[ ]*\).*/\1/ -G -s/\n// -s/^[^=]*=[ ]*$// -} - -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s|@configure_input@|$ac_sed_conf_input|;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@top_build_prefix@&$ac_top_build_prefix&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -s&@INSTALL@&$ac_INSTALL&;t t -$ac_datarootdir_hack -" -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ - >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ - "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&2;} - - rm -f "$ac_tmp/stdin" - case $ac_file in - -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; - *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; - esac \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - ;; - - - - esac - - - case $ac_file$ac_mode in - "etc/upgrade/3.8-branded-queues-extension":F) chmod ug+x $ac_file - ;; - "etc/upgrade/3.8-ical-extension":F) chmod ug+x $ac_file - ;; - "etc/upgrade/split-out-cf-categories":F) chmod ug+x $ac_file - ;; - "etc/upgrade/generate-rtaddressregexp":F) chmod ug+x $ac_file - ;; - "etc/upgrade/upgrade-articles":F) chmod ug+x $ac_file - ;; - "etc/upgrade/vulnerable-passwords":F) chmod ug+x $ac_file - ;; - "sbin/rt-attributes-viewer":F) chmod ug+x $ac_file - ;; - "sbin/rt-preferences-viewer":F) chmod ug+x $ac_file - ;; - "sbin/rt-session-viewer":F) chmod ug+x $ac_file - ;; - "sbin/rt-dump-metadata":F) chmod ug+x $ac_file - ;; - "sbin/rt-setup-database":F) chmod ug+x $ac_file - ;; - "sbin/rt-test-dependencies":F) chmod ug+x $ac_file - ;; - "sbin/rt-email-digest":F) chmod ug+x $ac_file - ;; - "sbin/rt-email-dashboards":F) chmod ug+x $ac_file - ;; - "sbin/rt-clean-sessions":F) chmod ug+x $ac_file - ;; - "sbin/rt-shredder":F) chmod ug+x $ac_file - ;; - "sbin/rt-validator":F) chmod ug+x $ac_file - ;; - "sbin/rt-email-group-admin":F) chmod ug+x $ac_file - ;; - "sbin/rt-server":F) chmod ug+x $ac_file - ;; - "sbin/rt-server.fcgi":F) chmod ug+x $ac_file - ;; - "sbin/standalone_httpd":F) chmod ug+x $ac_file - ;; - "sbin/rt-setup-fulltext-index":F) chmod ug+x $ac_file - ;; - "sbin/rt-fulltext-indexer":F) chmod ug+x $ac_file - ;; - "bin/rt-crontool":F) chmod ug+x $ac_file - ;; - "bin/rt-mailgate":F) chmod ug+x $ac_file - ;; - "bin/rt":F) chmod ug+x $ac_file - ;; - - esac -done # for ac_tag - - -as_fn_exit 0 diff --git a/rt/etc/RT_Config.pm b/rt/etc/RT_Config.pm deleted file mode 100644 index f2769c821..000000000 --- a/rt/etc/RT_Config.pm +++ /dev/null @@ -1,2686 +0,0 @@ -# -# RT was configured with: -# -# $ ./configure --enable-layout=Freeside --with-db-type=Pg --with-db-dba=freeside --with-db-database=freeside --with-db-rt-user=freeside --with-db-rt-pass= --with-web-user=freeside --with-web-group=freeside --with-rt-group=freeside --with-web-handler=modperl2 -# - -package RT; - -############################# WARNING ############################# -# # -# NEVER EDIT RT_Config.pm ! # -# # -# Instead, copy any sections you want to change to # -# RT_SiteConfig.pm and edit them there. Otherwise, # -# your changes will be lost when you upgrade RT. # -# # -############################# WARNING ############################# - -=head1 NAME - -RT::Config - -=head1 Base configuration - -=over 4 - -=item C<$rtname> - -C<$rtname> is the string that RT will look for in mail messages to -figure out what ticket a new piece of mail belongs to. - -Your domain name is recommended, so as not to pollute the namespace. -Once you start using a given tag, you should probably never change it; -otherwise, mail for existing tickets won't get put in the right place. - -=cut - -Set($rtname, "example.com"); - -=item C<$Organization> - -You should set this to your organization's DNS domain. For example, -I<fsck.com> or I<asylum.arkham.ma.us>. It is used by the linking -interface to guarantee that ticket URIs are unique and easy to -construct. Changing it after you have created tickets in the system -will B<break> all existing ticket links! - -=cut - -Set($Organization, "example.com"); - -=item C<$CorrespondAddress>, C<$CommentAddress> - -RT is designed such that any mail which already has a ticket-id -associated with it will get to the right place automatically. - -C<$CorrespondAddress> and C<$CommentAddress> are the default addresses -that will be listed in From: and Reply-To: headers of correspondence -and comment mail tracked by RT, unless overridden by a queue-specific -address. They should be set to email addresses which have been -configured as aliases for F<rt-mailgate>. - -=cut - -Set($CorrespondAddress, ''); - -Set($CommentAddress, ''); - -=item C<$WebDomain> - -Domain name of the RT server, e.g. 'www.example.com'. It should not -contain anything except the server name. - -=cut - -Set($WebDomain, "localhost"); - -=item C<$WebPort> - -If we're running as a superuser, run on port 80. Otherwise, pick a -high port for this user. - -443 is default port for https protocol. - -=cut - -Set($WebPort, 80); - -=item C<$WebPath> - -If you're putting the web UI somewhere other than at the root of your -server, you should set C<$WebPath> to the path you'll be serving RT -at. - -C<$WebPath> requires a leading / but no trailing /, or it can be -blank. - -In most cases, you should leave C<$WebPath> set to "" (an empty -value). - -=cut - -Set($WebPath, ""); - -=item C<$Timezone> - -C<$Timezone> is the default timezone, used to convert times entered by -users into GMT, as they are stored in the database, and back again; -users can override this. It should be set to a timezone recognized by -your server. - -=cut - -Set($Timezone, "US/Eastern"); - -=item C<@Plugins> - -Set C<@Plugins> to a list of external RT plugins that should be -enabled (those plugins have to be previously downloaded and -installed). - -Example: - -C<Set(@Plugins, (qw(Extension::QuickDelete RT::Extension::CommandByMail)));> - -=cut - -Set(@Plugins, (qw(RTx::Calendar - RT::Extension::MobileUI))); #RTx::Checklist )); - -=back - - - - -=head1 Database connection - -=over 4 - -=item C<$DatabaseType> - -Database driver being used; case matters. Valid types are "mysql", -"Oracle" and "Pg". - -=cut - -Set($DatabaseType, "Pg"); - -=item C<$DatabaseHost>, C<$DatabaseRTHost> - -The domain name of your database server. If you're running MySQL and -on localhost, leave it blank for enhanced performance. - -C<DatabaseRTHost> is the fully-qualified hostname of your RT server, -for use in granting ACL rights on MySQL. - -=cut - -Set($DatabaseHost, "localhost"); -Set($DatabaseRTHost, "localhost"); - -=item C<$DatabasePort> - -The port that your database server is running on. Ignored unless it's -a positive integer. It's usually safe to leave this blank; RT will -choose the correct default. - -=cut - -Set($DatabasePort, ""); - -=item C<$DatabaseUser> - -The name of the user to connect to the database as. - -=cut - -Set($DatabaseUser, "freeside"); - -=item C<$DatabasePassword> - -The password the C<$DatabaseUser> should use to access the database. - -=cut - -Set($DatabasePassword, q{}); - -=item C<$DatabaseName> - -The name of the RT database on your database server. For Oracle, the -SID and database objects are created in C<$DatabaseUser>'s schema. - -=cut - -Set($DatabaseName, q{freeside}); - -=item C<$DatabaseRequireSSL> - -If you're using PostgreSQL and have compiled in SSL support, set -C<$DatabaseRequireSSL> to 1 to turn on SSL communication with the -database. - -=cut - -Set($DatabaseRequireSSL, undef); - -=back - - - - -=head1 Logging - -The default is to log anything except debugging information to syslog. -Check the L<Log::Dispatch> POD for information about how to get things -by syslog, mail or anything else, get debugging info in the log, etc. - -It might generally make sense to send error and higher by email to -some administrator. If you do this, be careful that this email isn't -sent to this RT instance. Mail loops will generate a critical log -message. - -=over 4 - -=item C<$LogToSyslog>, C<$LogToScreen> - -The minimum level error that will be logged to the specific device. -From lowest to highest priority, the levels are: - - debug info notice warning error critical alert emergency - -Many syslogds are configured to discard or file debug messages away, so -if you're attempting to debug RT you may need to reconfigure your -syslogd or use one of the other logging options. - -Logging to your screen affects scripts run from the command line as well -as the STDERR sent to your webserver (so these logs will usually show up -in your web server's error logs). - -=cut - -Set($LogToSyslog, "info"); -Set($LogToScreen, "info"); - -=item C<$LogToFile>, C<$LogDir>, C<$LogToFileNamed> - -Logging to a standalone file is also possible. The file needs to both -exist and be writable by all direct users of the RT API. This generally -includes the web server and whoever rt-crontool runs as. Note that -rt-mailgate and the RT CLI go through the webserver, so their users do -not need to have write permissions to this file. If you expect to have -multiple users of the direct API, Best Practical recommends using syslog -instead of direct file logging. - -You should set C<$LogToFile> to one of the levels documented above. - -=cut - -Set($LogToFile, undef); -Set($LogDir, q{/opt/rt3/var/log}); -Set($LogToFileNamed, "rt.log"); #log to rt.log - -=item C<$LogStackTraces> - -If set to a log level then logging will include stack traces for -messages with level equal to or greater than specified. - -NOTICE: Stack traces include parameters supplied to functions or -methods. It is possible for stack trace logging to reveal sensitive -information such as passwords or ticket content in your logs. - -=cut - -Set($LogStackTraces, ""); - -=item C<@LogToSyslogConf> - -On Solaris or UnixWare, set to ( socket => 'inet' ). Options here -override any other options RT passes to L<Log::Dispatch::Syslog>. -Other interesting flags include facility and logopt. (See the -L<Log::Dispatch::Syslog> documentation for more information.) (Maybe -ident too, if you have multiple RT installations.) - -=cut - -Set(@LogToSyslogConf, ()); - -=back - - - -=head1 Incoming mail gateway - -=over 4 - -=item C<$EmailSubjectTagRegex> - -This regexp controls what subject tags RT recognizes as its own. If -you're not dealing with historical C<$rtname> values, you'll likely -never have to change this configuration. - -Be B<very careful> with it. Note that it overrides C<$rtname> for -subject token matching and that you should use only "non-capturing" -parenthesis grouping. For example: - -C<Set($EmailSubjectTagRegex, qr/(?:example.com|example.org)/i );> - -and NOT - -C<Set($EmailSubjectTagRegex, qr/(example.com|example.org)/i );> - -The setting below would make RT behave exactly as it does without the -setting enabled. - -=cut - -# Set($EmailSubjectTagRegex, qr/\Q$rtname\E/i ); - -=item C<$OwnerEmail> - -C<$OwnerEmail> is the address of a human who manages RT. RT will send -errors generated by the mail gateway to this address. This address -should I<not> be an address that's managed by your RT instance. - -=cut - -Set($OwnerEmail, 'root'); - -=item C<$LoopsToRTOwner> - -If C<$LoopsToRTOwner> is defined, RT will send mail that it believes -might be a loop to C<$OwnerEmail>. - -=cut - -Set($LoopsToRTOwner, 1); - -=item C<$StoreLoops> - -If C<$StoreLoops> is defined, RT will record messages that it believes -to be part of mail loops. As it does this, it will try to be careful -not to send mail to the sender of these messages. - -=cut - -Set($StoreLoops, undef); - -=item C<$MaxAttachmentSize> - -C<$MaxAttachmentSize> sets the maximum size (in bytes) of attachments -stored in the database. - -For MySQL and Oracle, we set this size to 10 megabytes. If you're -running a PostgreSQL version earlier than 7.1, you will need to drop -this to 8192. (8k) - -=cut - - -Set($MaxAttachmentSize, 10_000_000); - -=item C<$TruncateLongAttachments> - -If this is set to a non-undef value, RT will truncate attachments -longer than C<$MaxAttachmentSize>. - -=cut - -Set($TruncateLongAttachments, undef); - -=item C<$DropLongAttachments> - -If this is set to a non-undef value, RT will silently drop attachments -longer than C<MaxAttachmentSize>. C<$TruncateLongAttachments>, above, -takes priority over this. - -=cut - -Set($DropLongAttachments, undef); - -=item C<$RTAddressRegexp> - -C<$RTAddressRegexp> is used to make sure RT doesn't add itself as a -ticket CC if C<$ParseNewMessageForTicketCcs>, above, is enabled. It -is important that you set this to a regular expression that matches -all addresses used by your RT. This lets RT avoid sending mail to -itself. It will also hide RT addresses from the list of "One-time Cc" -and Bcc lists on ticket reply. - -If you have a number of addresses configured in your RT database -already, you can generate a naive first pass regexp by using: - - perl etc/upgrade/generate-rtaddressregexp - -If left blank, RT will generate a regexp for you, based on your -comment and correspond address settings on your queues; this comes at -a small cost in start-up speed. - -=cut - -Set($RTAddressRegexp, undef); - -=item C<$IgnoreCcRegexp> - -C<$IgnoreCcRegexp> is a regexp to exclude addresses from automatic addition -to the Cc list. Use this for addresses that are I<not> received by RT but -are sometimes added to Cc lists by mistake. Unlike C<$RTAddressRegexp>, -these addresses can still receive email from RT otherwise. - -=cut - -Set($IgnoreCcRegexp, undef); - -=item C<$CanonicalizeEmailAddressMatch>, C<$CanonicalizeEmailAddressReplace> - -RT provides functionality which allows the system to rewrite incoming -email addresses. In its simplest form, you can substitute the value -in C<CanonicalizeEmailAddressReplace> for the value in -C<CanonicalizeEmailAddressMatch> (These values are passed to the -C<CanonicalizeEmailAddress> subroutine in F<RT/User.pm>) - -By default, that routine performs a C<s/$Match/$Replace/gi> on any -address passed to it. - -=cut - -# Set($CanonicalizeEmailAddressMatch, '@subdomain\.example\.com$'); -# Set($CanonicalizeEmailAddressReplace, '@example.com'); - -=item C<$CanonicalizeOnCreate> - -Set this to 1 and the create new user page will use the values that -you enter in the form but use the function CanonicalizeUserInfo in -F<RT/User_Local.pm> - -=cut - -Set($CanonicalizeOnCreate, 0); - -=item C<$ValidateUserEmailAddresses> - -If C<$ValidateUserEmailAddresses> is 1, RT will refuse to create -users with an invalid email address (as specified in RFC 2822) or with -an email address made of multiple email addresses. - -=cut - -Set($ValidateUserEmailAddresses, undef); - -=item C<$NonCustomerEmailRegexp> - -Normally, when a ticket is linked to a customer, any requestors on that -ticket that didn't previously have customer memberships are linked to -the customer also. C<$NonCustomerEmailRegexp> is a regexp for email -addresses that should I<not> automatically be linked to a customer in -this way. - -=cut - -Set($NonCustomerEmailRegexp, undef); - -=item C<@MailPlugins> - -C<@MailPlugins> is a list of authentication plugins for -L<RT::Interface::Email> to use; see L<rt-mailgate> - -=cut - -=item C<$UnsafeEmailCommands> - -C<$UnsafeEmailCommands>, if set to 1, enables 'take' and 'resolve' -as possible actions via the mail gateway. As its name implies, this -is very unsafe, as it allows email with a forged sender to possibly -resolve arbitrary tickets! - -=cut - -=item C<$ExtractSubjectTagMatch>, C<$ExtractSubjectTagNoMatch> - -The default "extract remote tracking tags" scrip settings; these -detect when your RT is talking to another RT, and adjust the subject -accordingly. - -=cut - -Set($ExtractSubjectTagMatch, qr/\[.+? #\d+\]/); -Set($ExtractSubjectTagNoMatch, ( ${RT::EmailSubjectTagRegex} - ? qr/\[(?:${RT::EmailSubjectTagRegex}) #\d+\]/ - : qr/\[\Q$RT::rtname\E #\d+\]/)); - -=back - - - -=head1 Outgoing mail - -=over 4 - -=item C<$MailCommand> - -C<$MailCommand> defines which method RT will use to try to send mail. -We know that 'sendmailpipe' works fairly well. If 'sendmailpipe' -doesn't work well for you, try 'sendmail'. Other options are 'smtp' -or 'qmail'. - -Note that you should remove the '-t' from C<$SendmailArguments> if you -use 'sendmail' rather than 'sendmailpipe' - -For testing purposes, or to simply disable sending mail out into the -world, you can set C<$MailCommand> to 'testfile' which writes all mail -to a temporary file. RT will log the location of the temporary file -so you can extract mail from it afterward. - -=cut - -Set($MailCommand, "sendmailpipe"); - -=item C<$SetOutgoingMailFrom> - -C<$SetOutgoingMailFrom> tells RT to set the sender envelope to the -Correspond mail address of the ticket's queue. - -Warning: If you use this setting, bounced mails will appear to be -incoming mail to the system, thus creating new tickets. - -=cut - -Set($SetOutgoingMailFrom, 0); - -=item C<$OverrideOutgoingMailFrom> - -C<$OverrideOutgoingMailFrom> is used for overwriting the Correspond -address of the queue as it is handed to sendmail -f. This helps force -the From_ header away from www-data or other email addresses that show -up in the "Sent by" line in Outlook. - -The option is a hash reference of queue name to email address. If -there is no ticket involved, then the value of the C<Default> key will -be used. - -This option is irrelevant unless C<$SetOutgoingMailFrom> is set. - -=cut - -Set($OverrideOutgoingMailFrom, { -# 'Default' => 'admin@rt.example.com', -# 'General' => 'general@rt.example.com', -}); - -=item C<$DefaultMailPrecedence> - -C<$DefaultMailPrecedence> is used to control the default Precedence -level of outgoing mail where none is specified. By default it is -C<bulk>, but if you only send mail to your staff, you may wish to -change it. - -Note that you can set the precedence of individual templates by -including an explicit Precedence header. - -If you set this value to C<undef> then we do not set a default -Precedence header to outgoing mail. However, if there already is a -Precedence header, it will be preserved. - -=cut - -Set($DefaultMailPrecedence, "bulk"); - -=item C<$DefaultErrorMailPrecedence> - -C<$DefaultErrorMailPrecedence> is used to control the default -Precedence level of outgoing mail that indicates some kind of error -condition. By default it is C<bulk>, but if you only send mail to your -staff, you may wish to change it. - -If you set this value to C<undef> then we do not add a Precedence -header to error mail. - -=cut - -Set($DefaultErrorMailPrecedence, "bulk"); - -=item C<$UseOriginatorHeader> - -C<$UseOriginatorHeader> is used to control the insertion of an -RT-Originator Header in every outgoing mail, containing the mail -address of the transaction creator. - -=cut - -Set($UseOriginatorHeader, 1); - -=item C<$UseFriendlyFromLine> - -By default, RT sets the outgoing mail's "From:" header to "SenderName -via RT". Setting C<$UseFriendlyFromLine> to 0 disables it. - -=cut - -Set($UseFriendlyFromLine, 1); - -=item C<$FriendlyFromLineFormat> - -C<sprintf()> format of the friendly 'From:' header; its arguments are -SenderName and SenderEmailAddress. - -=cut - -Set($FriendlyFromLineFormat, "\"%s via RT\" <%s>"); - -=item C<$UseFriendlyToLine> - -RT can optionally set a "Friendly" 'To:' header when sending messages -to Ccs or AdminCcs (rather than having a blank 'To:' header. - -This feature DOES NOT WORK WITH SENDMAIL[tm] BRAND SENDMAIL. If you -are using sendmail, rather than postfix, qmail, exim or some other -MTA, you _must_ disable this option. - -=cut - -Set($UseFriendlyToLine, 0); - -=item C<$FriendlyToLineFormat> - -C<sprintf()> format of the friendly 'To:' header; its arguments are -WatcherType and TicketId. - -=cut - -Set($FriendlyToLineFormat, "\"%s of ". RT->Config->Get('rtname') ." Ticket #%s\":;"); - -=item C<$NotifyActor> - -By default, RT doesn't notify the person who performs an update, as -they already know what they've done. If you'd like to change this -behavior, Set C<$NotifyActor> to 1 - -=cut - -Set($NotifyActor, 0); - -=item C<$RecordOutgoingEmail> - -By default, RT records each message it sends out to its own internal -database. To change this behavior, set C<$RecordOutgoingEmail> to 0 - -=cut - -Set($RecordOutgoingEmail, 1); - -=item C<$VERPPrefix>, C<$VERPDomain> - -Setting these options enables VERP support -L<http://cr.yp.to/proto/verp.txt>. - -Uncomment the following two directives to generate envelope senders -of the form C<${VERPPrefix}${originaladdress}@${VERPDomain}> -(i.e. rt-jesse=fsck.com@rt.example.com ). - -This currently only works with sendmail and sendmailpipe. - -=cut - -# Set($VERPPrefix, "rt-"); -# Set($VERPDomain, $RT::Organization); - - -=item C<$ForwardFromUser> - -By default, RT forwards a message using queue's address and adds RT's -tag into subject of the outgoing message, so recipients' replies go -into RT as correspondents. - -To change this behavior, set C<$ForwardFromUser> to 1 and RT -will use the address of the current user and remove RT's subject tag. - -=cut - -Set($ForwardFromUser, 0); - -=back - -=head2 Email dashboards - -=over 4 - -=item C<$DashboardAddress> - -The email address from which RT will send dashboards. If none is set, -then C<$OwnerEmail> will be used. - -=cut - -Set($DashboardAddress, ''); - -=item C<$DashboardSubject> - -Lets you set the subject of dashboards. Arguments are the frequency (Daily, -Weekly, Monthly) of the dashboard and the dashboard's name. - -=cut - -Set($DashboardSubject, "%s Dashboard: %s"); - -=item C<@EmailDashboardRemove> - -A list of regular expressions that will be used to remove content from -mailed dashboards. - -=cut - -Set(@EmailDashboardRemove, ()); - -=back - - - -=head2 Sendmail configuration - -These options only take effect if C<$MailCommand> is 'sendmail' or -'sendmailpipe' - -=over 4 - -=item C<$SendmailArguments> - -C<$SendmailArguments> defines what flags to pass to C<$SendmailPath> -If you picked 'sendmailpipe', you MUST add a -t flag to -C<$SendmailArguments> These options are good for most sendmail -wrappers and work-a-likes. - -These arguments are good for sendmail brand sendmail 8 and newer: -C<Set($SendmailArguments,"-oi -t -ODeliveryMode=b -OErrorMode=m");> - -=cut - -Set($SendmailArguments, "-oi -t"); - - -=item C<$SendmailBounceArguments> - -C<$SendmailBounceArguments> defines what flags to pass to C<$Sendmail> -assuming RT needs to send an error (i.e. bounce). - -=cut - -Set($SendmailBounceArguments, '-f "<>"'); - -=item C<$SendmailPath> - -If you selected 'sendmailpipe' above, you MUST specify the path to -your sendmail binary in C<$SendmailPath>. - -=cut - -Set($SendmailPath, "/usr/sbin/sendmail"); - - -=back - -=head2 SMTP configuration - -These options only take effect if C<$MailCommand> is 'smtp' - -=over 4 - -=item C<$SMTPServer> - -C<$SMTPServer> should be set to the hostname of the SMTP server to use - -=cut - -Set($SMTPServer, undef); - -=item C<$SMTPFrom> - -C<$SMTPFrom> should be set to the 'From' address to use, if not the -email's 'From' - -=cut - -Set($SMTPFrom, undef); - -=item C<$SMTPDebug> - -C<$SMTPDebug> should be set to 1 to debug SMTP mail sending - -=cut - -Set($SMTPDebug, 0); - -=back - -=head2 Other mailers - -=over 4 - -=item C<@MailParams> - -C<@MailParams> defines a list of options passed to $MailCommand if it -is not 'sendmailpipe', 'sendmail', or 'smtp' - -=cut - -Set(@MailParams, ()); - -=back - - -=head1 Web interface - -=over 4 - -=item C<$WebDefaultStylesheet> - -This determines the default stylesheet the RT web interface will use. -RT ships with several themes by default: - - web2 The default layout for RT 3.8 - aileron The default layout for RT 4.0 - ballard Theme which doesn't rely on JavaScript for menuing - -This bundled distibution of RT also includes: - freeside3 Integration with Freeside (enabled by default) - freeside2.1 Previous Freeside theme - -This value actually specifies a directory in F<share/html/NoAuth/css/> -from which RT will try to load the file main.css (which should @import -any other files the stylesheet needs). This allows you to easily and -cleanly create your own stylesheets to apply to RT. This option can -be overridden by users in their preferences. - -=cut - -Set($WebDefaultStylesheet, "freeside3"); - -=item C<$DefaultQueue> - -Use this to select the default queue name that will be used for -creating new tickets. You may use either the queue's name or its -ID. This only affects the queue selection boxes on the web interface. - -=cut - -# Set($DefaultQueue, "General"); - -=item C<$RememberDefaultQueue> - -When a queue is selected in the new ticket dropdown, make it the new -default for the new ticket dropdown. - -=cut - -# Set($RememberDefaultQueue, 1); - -=item C<$EnableReminders> - -Hide all links and portlets related to Reminders by setting this to 0 - -=cut - -Set($EnableReminders, 1); - -=item C<@CustomFieldValuesSources> - -Set C<@CustomFieldValuesSources> to a list of class names which extend -L<RT::CustomFieldValues::External>. This can be used to pull lists of -custom field values from external sources at runtime. - -=cut - -Set(@CustomFieldValuesSources, ('RT::CustomFieldValues::Queues')); - -=item C<$CanonicalizeRedirectURLs> - -Set C<$CanonicalizeRedirectURLs> to 1 to use C<$WebURL> when -redirecting rather than the one we get from C<%ENV>. - -Apache's UseCanonicalName directive changes the hostname that RT -finds in C<%ENV>. You can read more about what turning it On or Off -means in the documentation for your version of Apache. - -If you use RT behind a reverse proxy, you almost certainly want to -enable this option. - -=cut - -Set($CanonicalizeRedirectURLs, 0); - -=item C<@JSFiles> - -A list of JavaScript files to be included in head. Removing any of -the default entries is not suggested. - -=cut - -Set(@JSFiles, qw/ - jquery-1.4.2.min.js - jquery_noconflict.js - jquery-ui-1.8.4.custom.min.js - jquery-ui-patch-datepicker.js - ui.timepickr.js - titlebox-state.js - util.js - userautocomplete.js - jquery.event.hover-1.0.js - superfish.js - supersubs.js - jquery.supposition.js - history-folding.js - late.js -/); - -=item C<$JSMinPath> - -Path to the jsmin binary; if specified, it will be used to minify -C<JSFiles>. The default, and the fallback if the binary cannot be -found, is to simply concatenate the files. - -jsmin can be installed by running 'make jsmin' from the RT install -directory, or from http://www.crockford.com/javascript/jsmin.html - -=cut - -# Set($JSMinPath, "/path/to/jsmin"); - -=item C<@CSSFiles> - -A list of additional CSS files to be included in head. - -=cut - -Set(@CSSFiles, qw//); - -=item C<$UsernameFormat> - -This determines how user info is displayed. 'concise' will show one of -either NickName, RealName, Name or EmailAddress, depending on what -exists and whether the user is privileged or not. 'verbose' will show -RealName and EmailAddress. - -=cut - -Set($UsernameFormat, "verbose"); - -=item C<$WebBaseURL>, C<$WebURL> - -Usually you don't want to set these options. The only obvious reason -is if RT is accessible via https protocol on a non standard port, e.g. -'https://rt.example.com:9999'. In all other cases these options are -computed using C<$WebDomain>, C<$WebPort> and C<$WebPath>. - -C<$WebBaseURL> is the scheme, server and port -(e.g. 'http://rt.example.com') for constructing URLs to the web -UI. C<$WebBaseURL> doesn't need a trailing /. - -C<$WebURL> is the C<$WebBaseURL>, C<$WebPath> and trailing /, for -example: 'http://www.example.com/rt/'. - -=cut - -my $port = RT->Config->Get('WebPort'); -Set($WebBaseURL, - ($port == 443? 'https': 'http') .'://' - . RT->Config->Get('WebDomain') - . ($port != 80 && $port != 443? ":$port" : '') -); - -Set($WebURL, RT->Config->Get('WebBaseURL') . RT->Config->Get('WebPath') . "/"); - -=item C<$WebImagesURL> - -C<$WebImagesURL> points to the base URL where RT can find its images. -Define the directory name to be used for images in RT web documents. - -=cut - -Set($WebImagesURL, RT->Config->Get('WebPath') . "/NoAuth/images/"); - -=item C<$LogoURL> - -C<$LogoURL> points to the URL of the RT logo displayed in the web UI. -This can also be configured via the web UI. - -=cut - -Set($LogoURL, RT->Config->Get('WebImagesURL') . "bpslogo.png"); - -=item C<$LogoLinkURL> - -C<$LogoLinkURL> is the URL that the RT logo hyperlinks to. - -=cut - -Set($LogoLinkURL, "http://bestpractical.com"); - -=item C<$LogoAltText> - -C<$LogoAltText> is a string of text for the alt-text of the logo. It -will be passed through C<loc> for localization. - -=cut - -Set($LogoAltText, "Best Practical Solutions, LLC corporate logo"); - -=item C<$LogoImageHeight> - -C<$LogoImageHeight> is the value of the C<height> attribute of the logo -C<img> tag. - -=cut - -Set($LogoImageHeight, 38); - -=item C<$LogoImageWidth> - -C<$LogoImageWidth> is the value of the C<width> attribute of the logo -C<img> tag. - -=cut - -Set($LogoImageWidth, 181); - -=item C<$WebNoAuthRegex> - -What portion of RT's URL space should not require authentication. The -default is almost certainly correct, and should only be changed if you -are extending RT. - -=cut - -Set($WebNoAuthRegex, qr{^ /rt (?:/+NoAuth/ | /+REST/\d+\.\d+/NoAuth/) }x ); - -=item C<$SelfServiceRegex> - -What portion of RT's URLspace should be accessible to Unprivileged -users This does not override the redirect from F</Ticket/Display.html> -to F</SelfService/Display.html> when Unprivileged users attempt to -access ticked displays. - -=cut - -Set($SelfServiceRegex, qr!^(?:/+SelfService/)!x ); - -=item C<$WebFlushDbCacheEveryRequest> - -By default, RT clears its database cache after every page view. This -ensures that you've always got the most current information when -working in a multi-process (mod_perl or FastCGI) Environment. Setting -C<$WebFlushDbCacheEveryRequest> to 0 will turn this off, which will -speed RT up a bit, at the expense of a tiny bit of data accuracy. - -=cut - -Set($WebFlushDbCacheEveryRequest, 1); - -=item C<%ChartFont> - -The L<GD> module (which RT uses for graphs) ships with a built-in font -that doesn't have full Unicode support. You can use a given TrueType -font for a specific language by setting %ChartFont to (language =E<gt> -the absolute path of a font) pairs. Your GD library must have support -for TrueType fonts to use this option. If there is no entry for a -language in the hash then font with 'others' key is used. - -RT comes with two TrueType fonts covering most available languages. - -=cut - -Set( - %ChartFont, - 'zh-cn' => "$RT::BasePath/share/fonts/DroidSansFallback.ttf", - 'zh-tw' => "$RT::BasePath/share/fonts/DroidSansFallback.ttf", - 'ja' => "$RT::BasePath/share/fonts/DroidSansFallback.ttf", - 'others' => "$RT::BasePath/share/fonts/DroidSans.ttf", -); - -=item C<$ChartsTimezonesInDB> - -RT stores dates using the UTC timezone in the DB, so charts grouped by -dates and time are not representative. Set C<$ChartsTimezonesInDB> to 1 -to enable timezone conversions using your DB's capabilities. You may -need to do some work on the DB side to use this feature, read more in -F<docs/customizing/timezones_in_charts.pod>. - -At this time, this feature only applies to MySQL and PostgreSQL. - -=cut - -Set($ChartsTimezonesInDB, 0); - -=back - - - -=head2 Home page - -=over 4 - -=item C<$DefaultSummaryRows> - -C<$DefaultSummaryRows> is default number of rows displayed in for -search results on the front page. - -=cut - -Set($DefaultSummaryRows, 10); - -=item C<$HomePageRefreshInterval> - -C<$HomePageRefreshInterval> is default number of seconds to refresh -the RT home page. Choose from [0, 120, 300, 600, 1200, 3600, 7200]. - -=cut - -Set($HomePageRefreshInterval, 0); - -=item C<$HomepageComponents> - -C<$HomepageComponents> is an arrayref of allowed components on a -user's customized homepage ("RT at a glance"). - -=cut - -Set($HomepageComponents, [qw(QuickCreate Quicksearch MyCalendar MyAdminQueues MySupportQueues MyReminders RefreshHomepage Dashboards SavedSearches)]); - -=back - - - - -=head2 Ticket search - -=over 4 - -=item C<$UseSQLForACLChecks> - -Historically, ACLs were checked on display, which could lead to empty -search pages and wrong ticket counts. Set C<$UseSQLForACLChecks> to 1 -to limit search results in SQL instead, which eliminates these -problems. - -This option is still relatively new; it may result in performance -problems in some cases, or significant speedups in others. - -=cut - -Set($UseSQLForACLChecks, undef); - -=item C<$TicketsItemMapSize> - -On the display page of a ticket from search results, RT provides links -to the first, next, previous and last ticket from the results. In -order to build these links, RT needs to fetch the full result set from -the database, which can be resource-intensive. - -Set C<$TicketsItemMapSize> to number of tickets you want RT to examine -to build these links. If the full result set is larger than this -number, RT will omit the "last" link in the menu. Set this to zero to -always examine all results. - -=cut - -Set($TicketsItemMapSize, 1000); - -=item C<$SearchResultsRefreshInterval> - -C<$SearchResultsRefreshInterval> is default number of seconds to -refresh search results in RT. Choose from [0, 120, 300, 600, 1200, -3600, 7200]. - -=cut - -Set($SearchResultsRefreshInterval, 0); - -=item C<$DefaultSearchResultFormat> - -C<$DefaultSearchResultFormat> is the default format for RT search -results - -=cut - -Set ($DefaultSearchResultFormat, qq{ - '<B><A HREF="__WebPath__/Ticket/Display.html?id=__id__">__id__</a></B>/TITLE:#', - '<B><A HREF="__WebPath__/Ticket/Display.html?id=__id__">__Subject__</a></B>/TITLE:Subject', - Customer, - Status, - QueueName, - OwnerName, - Priority, - '__NEWLINE__', - '', - '<small>__Requestors__</small>', - '<small>__CustomerTags__</small>', - '<small>__CreatedRelative__</small>', - '<small>__ToldRelative__</small>', - '<small>__LastUpdatedRelative__</small>', - '<small>__TimeLeft__</small>'}); - -=item C<$DefaultSelfServiceSearchResultFormat> - -C<$DefaultSelfServiceSearchResultFormat> is the default format of -searches displayed in the SelfService interface. - -=cut - -Set($DefaultSelfServiceSearchResultFormat, qq{ - '<B><A HREF="__WebPath__/SelfService/Display.html?id=__id__">__id__</a></B>/TITLE:#', - '<B><A HREF="__WebPath__/SelfService/Display.html?id=__id__">__Subject__</a></B>/TITLE:Subject', - Status, - Requestors, - OwnerName}); - -=item C<%FullTextSearch> - -Full text search (FTS) without database indexing is a very slow -operation, and is thus disabled by default. - -Before setting C<Indexed> to 1, read F<docs/full_text_indexing.pod> for -the full details of FTS on your particular database. - -It is possible to enable FTS without database indexing support, simply -by setting the C<Enable> key to 1, while leaving C<Indexed> set to 0. -This is not generally suggested, as unindexed full-text searching can -cause severe performance problems. - -=cut - -Set(%FullTextSearch, - Enable => 0, - Indexed => 0, -); - - -=item C<$OnlySearchActiveTicketsInSimpleSearch> - -When query in simple search doesn't have status info, use this to only -search active ones. - -=cut - -Set($OnlySearchActiveTicketsInSimpleSearch, 1); - -=item C<$SearchResultsAutoRedirect> - -When only one ticket is found in search, use this to redirect to the -ticket display page automatically. - -=cut - -Set($SearchResultsAutoRedirect, 0); - -=back - - - -=head2 Ticket display - -=over 4 - -=item C<$ShowMoreAboutPrivilegedUsers> - -This determines if the 'More about requestor' box on -Ticket/Display.html is shown for Privileged Users. - -=cut - -Set($ShowMoreAboutPrivilegedUsers, 0); - -=item C<$MoreAboutRequestorTicketList> - -This can be set to Active, Inactive, All or None. It controls what -ticket list will be displayed in the 'More about requestor' box on -Ticket/Display.html. This option can be controlled by users also. - -=cut - -Set($MoreAboutRequestorTicketList, "Active"); - -=item C<$MoreAboutRequestorExtraInfo> - -By default, the 'More about requestor' box on Ticket/Display.html -shows the Requestor's name and ticket list. If you would like to see -extra information about the user, this expects a Format string of user -attributes. Please note that not all the attributes are supported in -this display because we're not building a table. - -Example: -C<Set($MoreAboutRequestorExtraInfo,"Organization, Address1")> - -=cut - -Set($MoreAboutRequestorExtraInfo, ""); - -=item C<$MoreAboutRequestorGroupsLimit> - -By default, the 'More about requestor' box on Ticket/Display.html -shows all the groups of the Requestor. Use this to limit the number -of groups; a value of undef removes the group display entirely. - -=cut - -Set($MoreAboutRequestorGroupsLimit, 0); - -=item C<$UseSideBySideLayout> - -Should the ticket create and update forms use a more space efficient -two column layout. This layout may not work in narrow browsers if you -set a MessageBoxWidth (below). - -=cut - -Set($UseSideBySideLayout, 1); - -=item C<$EditCustomFieldsSingleColumn> - -When displaying a list of Ticket Custom Fields for editing, RT -defaults to a 2 column list. If you set this to 1, it will instead -display the Custom Fields in a single column. - -=cut - -Set($EditCustomFieldsSingleColumn, 0); - -=item C<$ShowUnreadMessageNotifications> - -If set to 1, RT will prompt users when there are new, -unread messages on tickets they are viewing. - -=cut - -Set($ShowUnreadMessageNotifications, 0); - -=item C<$AutocompleteOwners> - -If set to 1, the owner drop-downs for ticket update/modify and the query -builder are replaced by text fields that autocomplete. This can -alleviate the sometimes huge owner list for installations where many -users have the OwnTicket right. - -=cut - -Set($AutocompleteOwners, 0); - -=item C<$AutocompleteOwnersForSearch> - -If set to 1, the owner drop-downs for the query builder are always -replaced by text field that autocomplete and C<$AutocompleteOwners> -is ignored. Helpful when owners list is huge in the query builder. - -=cut - -Set($AutocompleteOwnersForSearch, 0); - -=item C<$UserAutocompleteFields> - -Specifies which fields of L<RT::User> to match against and how to -match each field when autocompleting users. Valid match methods are -LIKE, STARTSWITH, ENDSWITH, =, and !=. - -=cut - -Set($UserAutocompleteFields, { - EmailAddress => 'STARTSWITH', - Name => 'STARTSWITH', - RealName => 'LIKE', -}); - -=item C<$AllowUserAutocompleteForUnprivileged> - -Should unprivileged users be allowed to autocomplete users. Setting -this option to 1 means unprivileged users will be able to search all -your users. - -=cut - -Set($AllowUserAutocompleteForUnprivileged, 0); - -=item C<$DisplayTicketAfterQuickCreate> - -Enable this to redirect to the created ticket display page -automatically when using QuickCreate. - -=cut - -Set($DisplayTicketAfterQuickCreate, 0); - -=item C<$WikiImplicitLinks> - -Support implicit links in WikiText custom fields? Setting this to 1 -causes InterCapped or ALLCAPS words in WikiText fields to automatically -become links to searches for those words. If used on Articles, it links -to the Article with that name. - -=cut - -Set($WikiImplicitLinks, 0); - -=item C<$PreviewScripMessages> - -Set C<$PreviewScripMessages> to 1 if the scrips preview on the ticket -reply page should include the content of the messages to be sent. - -=cut - -Set($PreviewScripMessages, 0); - -=item C<$SimplifiedRecipients> - -If C<$SimplifiedRecipients> is set, a simple list of who will receive -B<any> kind of mail will be shown on the ticket reply page, instead of a -detailed breakdown by scrip. - -=cut - -Set($SimplifiedRecipients, 0); - -=item C<$HideResolveActionsWithDependencies> - -If set to 1, this option will skip ticket menu actions which can't be -completed successfully because of outstanding active Depends On tickets. - -By default, all ticket actions are displayed in the menu even if some of -them can't be successful until all Depends On links are resolved or -transitioned to another inactive status. - -=cut - -Set($HideResolveActionsWithDependencies, 0); - -=back - - - -=head2 Articles - -=over 4 - -=item C<$ArticleOnTicketCreate> - -Set this to 1 to display the Articles interface on the Ticket Create -page in addition to the Reply/Comment page. - -=cut - -Set($ArticleOnTicketCreate, 0); - -=item C<$HideArticleSearchOnReplyCreate> - -Set this to 1 to hide the search and include boxes from the Article -UI. This assumes you have enabled Article Hotlist feature, otherwise -you will have no access to Articles. - -=cut - -Set($HideArticleSearchOnReplyCreate, 0); - -=back - - - -=head2 Message box properties - -=over 4 - -=item C<$MessageBoxWidth>, C<$MessageBoxHeight> - -For message boxes, set the entry box width, height and what type of -wrapping to use. These options can be overridden by users in their -preferences. - -When the width is set to undef, no column count is specified and the -message box will take up 100% of the available width. Combining this -with HARD messagebox wrapping (below) is not recommended, as it will -lead to inconsistent width in transactions between browsers. - -These settings only apply to the non-RichText message box. See below -for Rich Text settings. - -=cut - -Set($MessageBoxWidth, undef); -Set($MessageBoxHeight, 15); - -=item C<$MessageBoxWrap> - -Wrapping is disabled when using MessageBoxRichText because of a bad -interaction between IE and wrapping with the Rich Text Editor. - -=cut - -Set($MessageBoxWrap, "SOFT"); - -=item C<$MessageBoxRichText> - -Should "rich text" editing be enabled? This option lets your users -send HTML email messages from the web interface. - -=cut - -Set($MessageBoxRichText, 1); - -=item C<$MessageBoxRichTextHeight> - -Height of rich text JavaScript enabled editing boxes (in pixels) - -=cut - -Set($MessageBoxRichTextHeight, 200); - -=item C<$MessageBoxIncludeSignature> - -Should your users' signatures (from their Preferences page) be -included in Comments and Replies. - -=cut - -Set($MessageBoxIncludeSignature, 1); - -=item C<$MessageBoxIncludeSignatureOnComment> - -Should your users' signatures (from their Preferences page) be -included in Comments. Setting this to false overrides -C<$MessageBoxIncludeSignature>. - -=cut - -Set($MessageBoxIncludeSignatureOnComment, 1); - -=back - - -=head2 Transaction display - -=over 4 - -=item C<$OldestTransactionsFirst> - -By default, RT shows newest transactions at the bottom of the ticket -history page, if you want see them at the top set this to 0. This -option can be overridden by users in their preferences. - -=cut - -Set($OldestTransactionsFirst, 1); - -=item C<$DeferTransactionLoading> - -When set, defers loading ticket history until the user clicks a link. -This should end up serving pages to users quicker, since generating -all the HTML for transaction history can be slow for long tickets. - -=cut - -# Set($DeferTransactionLoading, 1); - -=item C<$ShowBccHeader> - -By default, RT hides from the web UI information about blind copies -user sent on reply or comment. - -=cut - -Set($ShowBccHeader, 0); - -=item C<$TrustHTMLAttachments> - -If C<TrustHTMLAttachments> is not defined, we will display them as -text. This prevents malicious HTML and JavaScript from being sent in a -request (although there is probably more to it than that) - -=cut - -Set($TrustHTMLAttachments, undef); - -=item C<$AlwaysDownloadAttachments> - -Always download attachments, regardless of content type. If set, this -overrides C<TrustHTMLAttachments>. - -=cut - -Set($AlwaysDownloadAttachments, undef); - -=item C<$AttachmentUnits> - -Controls the units (kilobytes or bytes) that attachment sizes use for -display. The default is to display kilobytes if the attachment is -larger than 1024 bytes, bytes otherwise. If you set -C<$AttachmentUnits> to C<'k'> then attachment sizes will always be -displayed in kilobytes. If set to C<'b'>, then sizes will be bytes. - -=cut - -Set($AttachmentUnits, undef); - -=item C<$PreferRichText> - -If C<$PreferRichText> is set to 1, RT will show HTML/Rich text messages -in preference to their plain-text alternatives. RT "scrubs" the HTML to -show only a minimal subset of HTML to avoid possible contamination by -cross-site-scripting attacks. - -=cut - -Set($PreferRichText, undef); - -=item C<$MaxInlineBody> - -C<$MaxInlineBody> is the maximum attachment size that we want to see -inline when viewing a transaction. RT will inline any text if the -value is undefined or 0. This option can be overridden by users in -their preferences. - -=cut - -Set($MaxInlineBody, 12000); - -=item C<$ShowTransactionImages> - -By default, RT shows images attached to incoming (and outgoing) ticket -updates inline. Set this variable to 0 if you'd like to disable that -behavior. - -=cut - -Set($ShowTransactionImages, 1); - -=item C<$PlainTextPre> - -Normally plaintext attachments are displayed as HTML with line breaks -preserved. This causes space- and tab-based formatting not to be -displayed correctly. By setting $PlainTextPre messages will be -displayed using <pre>. - -=cut - -Set($PlainTextPre, 0); - - -=item C<$PlainTextMono> - -Set C<$PlainTextMono> to 1 to use monospaced font and preserve -formatting; unlike C<$PlainTextPre>, the text will wrap to fit width -of the browser window; this option overrides C<$PlainTextPre>. - -=cut - -Set($PlainTextMono, 0); - -=item C<$SuppressInlineTextFiles> - -If C<$SuppressInlineTextFiles> is set to 1, then uploaded text files -(text-type attachments with file names) are prevented from being -displayed in-line when viewing a ticket's history. - -=cut - -Set($SuppressInlineTextFiles, undef); - - -=item C<@Active_MakeClicky> - -MakeClicky detects various formats of data in headers and email -messages, and extends them with supporting links. By default, RT -provides two formats: - -* 'httpurl': detects http:// and https:// URLs and adds '[Open URL]' - link after the URL. - -* 'httpurl_overwrite': also detects URLs as 'httpurl' format, but - replaces the URL with a link. - -See F<share/html/Elements/MakeClicky> for documentation on how to add -your own styles of link detection. - -=cut - -Set(@Active_MakeClicky, qw()); - -=back - - - -=head1 Application logic - -=over 4 - -=item C<$ParseNewMessageForTicketCcs> - -If C<$ParseNewMessageForTicketCcs> is set to 1, RT will attempt to -divine Ticket 'Cc' watchers from the To and Cc lines of incoming -messages. Be forewarned that if you have I<any> addresses which forward -mail to RT automatically and you enable this option without modifying -C<$RTAddressRegexp> below, you will get yourself into a heap of trouble. - -=cut - -Set($ParseNewMessageForTicketCcs, undef); - -=item C<$UseTransactionBatch> - -Set C<$UseTransactionBatch> to 1 to execute transactions in batches, -such that a resolve and comment (for example) would happen -simultaneously, instead of as two transactions, unaware of each -others' existence. - -=cut - -Set($UseTransactionBatch, 1); - -=item C<$StrictLinkACL> - -When this feature is enabled a user needs I<ModifyTicket> rights on -both tickets to link them together; otherwise, I<ModifyTicket> rights -on either of them is sufficient. - -=cut - -Set($StrictLinkACL, 1); - -=item C<$RedistributeAutoGeneratedMessages> - -Should RT redistribute correspondence that it identifies as machine -generated? A 1 will do so; setting this to 0 will cause no -such messages to be redistributed. You can also use 'privileged' (the -default), which will redistribute only to privileged users. This helps -to protect against malformed bounces and loops caused by auto-created -requestors with bogus addresses. - -=cut - -Set($RedistributeAutoGeneratedMessages, "privileged"); - -=item C<$ApprovalRejectionNotes> - -Should rejection notes from approvals be sent to the requestors? - -=cut - -Set($ApprovalRejectionNotes, 1); - -=item C<$ForceApprovalsView> - -Should approval tickets only be viewed and modified through the standard -approval interface? Changing this setting to 1 will redirect any attempt to -use the normal ticket display and modify page for approval tickets. - -For example, with this option set to 1 and an approval ticket #123: - - /Ticket/Display.html?id=123 - -is redirected to - - /Approval/Display.html?id=123 - -=back - -=cut - -Set($ForceApprovalsView, 0); - -=head1 Extra security - -=over 4 - -This is a list of extra security measures to enable that help keep your RT -safe. If you don't know what these mean, you should almost certainly leave the -defaults alone. - -=item C<$DisallowExecuteCode> - -If set to a true value, the C<ExecuteCode> right will be removed from -all users, B<including> the superuser. This is intended for when RT is -installed into a shared environment where even the superuser should not -be allowed to run arbitrary Perl code on the server via scrips. - -=cut - -Set($DisallowExecuteCode, 0); - -=item C<$Framebusting> - -If set to a false value, framekiller javascript will be disabled and the -X-Frame-Options: DENY header will be suppressed from all responses. -This disables RT's clickjacking protection. - -=cut - -Set($Framebusting, 1); - -=back - -=head1 Authorization and user configuration - -=over 4 - -=item C<$WebExternalAuth> - -If C<$WebExternalAuth> is defined, RT will defer to the environment's -REMOTE_USER variable. - -=cut - -Set($WebExternalAuth, undef); - -=item C<$WebExternalAuthContinuous> - -If C<$WebExternalAuthContinuous> is defined, RT will check for the -REMOTE_USER on each access. If you would prefer this to only happen -once (at initial login) set this to a false value. The default -setting will help ensure that if your external authentication system -deauthenticates a user, RT notices as soon as possible. - -=cut - -Set($WebExternalAuthContinuous, 1); - -=item C<$WebFallbackToInternalAuth> - -If C<$WebFallbackToInternalAuth> is defined, the user is allowed a -chance of fallback to the login screen, even if REMOTE_USER failed. - -=cut - -Set($WebFallbackToInternalAuth, undef); - -=item C<$WebExternalGecos> - -C<$WebExternalGecos> means to match 'gecos' field as the user -identity); useful with mod_auth_pwcheck and IIS Integrated Windows -logon. - -=cut - -Set($WebExternalGecos, undef); - -=item C<$WebExternalAuto> - -C<$WebExternalAuto> will create users under the same name as -REMOTE_USER upon login, if it's missing in the Users table. - -=cut - -Set($WebExternalAuto, undef); - -=item C<$AutoCreate> - -If C<$WebExternalAuto> is set to 1, C<$AutoCreate> will be passed to -User's Create method. Use it to set defaults, such as creating -Unprivileged users with C<{ Privileged => 0 }> This must be a hashref. - -=cut - -Set($AutoCreate, undef); - -=item C<$WebSessionClass> - -C<$WebSessionClass> is the class you wish to use for managing -Sessions. It defaults to use your SQL database, but if you are using -MySQL 3.x and plans to use non-ascii Queue names, uncomment and add -this line to F<RT_SiteConfig.pm> to prevent session corruption. - -=cut - -# Set($WebSessionClass, "Apache::Session::File"); - -=item C<$AutoLogoff> - -By default, RT's user sessions persist until a user closes his or her -browser. With the C<$AutoLogoff> option you can setup session lifetime -in minutes. A user will be logged out if he or she doesn't send any -requests to RT for the defined time. - -=cut - -Set($AutoLogoff, 0); - -=item C<$LogoutRefresh> - -The number of seconds to wait after logout before sending the user to -the login page. By default, 1 second, though you may want to increase -this if you display additional information on the logout page. - -=cut - -Set($LogoutRefresh, 1); - -=item C<$WebSecureCookies> - -By default, RT's session cookie isn't marked as "secure". Some web -browsers will treat secure cookies more carefully than non-secure -ones, being careful not to write them to disk, only sending them over -an SSL secured connection, and so on. To enable this behavior, set -C<$WebSecureCookies> to 1. NOTE: You probably don't want to turn this -on I<unless> users are only connecting via SSL encrypted HTTPS -connections. - -=cut - -Set($WebSecureCookies, 0); - -=item C<$WebHttpOnlyCookies> - -Default RT's session cookie to not being directly accessible to -javascript. The content is still sent during regular and AJAX requests, -and other cookies are unaffected, but the session-id is less -programmatically accessible to javascript. Turning this off should only -be necessary in situations with odd client-side authentication -requirements. - -=cut - -Set($WebHttpOnlyCookies, 1); - -=item C<$MinimumPasswordLength> - -C<$MinimumPasswordLength> defines the minimum length for user -passwords. Setting it to 0 disables this check. - -=cut - -Set($MinimumPasswordLength, 5); - -=back - - -=head1 Internationalization - -=over 4 - -=item C<@LexiconLanguages> - -An array that contains languages supported by RT's -internationalization interface. Defaults to all *.po lexicons; -setting it to C<qw(en ja)> will make RT bilingual instead of -multilingual, but will save some memory. - -=cut - -Set(@LexiconLanguages, qw(*)); - -=item C<@EmailInputEncodings> - -An array that contains default encodings used to guess which charset -an attachment uses, if it does not specify one explicitly. All -options must be recognized by L<Encode::Guess>. The first element may -also be '*', which enables encoding detection using -L<Encode::Detect::Detector>, if installed. - -=cut - -Set(@EmailInputEncodings, qw(utf-8 iso-8859-1 us-ascii)); - -=item C<$EmailOutputEncoding> - -The charset for localized email. Must be recognized by Encode. - -=cut - -Set($EmailOutputEncoding, "utf-8"); - -=back - - - - - - - -=head1 Date and time handling - -=over 4 - -=item C<$DateTimeFormat> - -You can choose date and time format. See the "Output formatters" -section in perldoc F<lib/RT/Date.pm> for more options. This option -can be overridden by users in their preferences. - -Some examples: - -C<Set($DateTimeFormat, "LocalizedDateTime");> -C<Set($DateTimeFormat, { Format => "ISO", Seconds => 0 });> -C<Set($DateTimeFormat, "RFC2822");> -C<Set($DateTimeFormat, { Format => "RFC2822", Seconds => 0, DayOfWeek => 0 });> - -=cut - -Set($DateTimeFormat, "DefaultFormat"); - -# Next two options are for Time::ParseDate - -=item C<$DateDayBeforeMonth> - -Set this to 1 if your local date convention looks like "dd/mm/yy" -instead of "mm/dd/yy". Used only for parsing, not for displaying -dates. - -=cut - -Set($DateDayBeforeMonth, 1); - -=item C<$AmbiguousDayInPast>, C<$AmbiguousDayInFuture> - -Should an unspecified day or year in a date refer to a future or a -past value? For example, should a date of "Tuesday" default to mean -the date for next Tuesday or last Tuesday? Should the date "March 1" -default to the date for next March or last March? - -Set C<$AmbiguousDayInPast> for the last date, or -C<$AmbiguousDayInFuture> for the next date; the default is usually -correct. If both are set, C<$AmbiguousDayInPast> takes precedence. - -=cut - -Set($AmbiguousDayInPast, 0); -Set($AmbiguousDayInFuture, 0); - -=item C<$DefaultTimeUnitsToHours> - -Use this to set the default units for time entry to hours instead of -minutes. Note that this only effects entry, not display. - -=cut - -Set($DefaultTimeUnitsToHours, 0); - -=item C<$SimpleSearchIncludeResolved> - -By default, the simple ticket search in the top bar excludes "resolved" tickets -unless a status argument is specified. Set this to a true value to include -them. - -=cut - -Set($SimpleSearchIncludeResolved, 0); - -=back - - - - -=head1 GnuPG integration - -A full description of the (somewhat extensive) GnuPG integration can -be found by running the command `perldoc L<RT::Crypt::GnuPG>` (or -`perldoc lib/RT/Crypt/GnuPG.pm` from your RT install directory). - -=over 4 - -=item C<%GnuPG> - -Set C<OutgoingMessagesFormat> to 'inline' to use inline encryption and -signatures instead of 'RFC' (GPG/MIME: RFC3156 and RFC1847) format. - -If you want to allow people to encrypt attachments inside the DB then -set C<AllowEncryptDataInDB> to 1. - -Set C<RejectOnMissingPrivateKey> to false if you don't want to reject -emails encrypted for key RT doesn't have and can not decrypt. - -Set C<RejectOnBadData> to false if you don't want to reject letters -with incorrect GnuPG data. - -=cut - -Set(%GnuPG, - Enable => 1, - OutgoingMessagesFormat => "RFC", # Inline - AllowEncryptDataInDB => 0, - - RejectOnMissingPrivateKey => 1, - RejectOnBadData => 1, -); - -=item C<%GnuPGOptions> - -Options to pass to the GnuPG program. - -If you override this in your RT_SiteConfig, you should be sure to -include a homedir setting. - -Note that options with '-' character MUST be quoted. - -=cut - -Set(%GnuPGOptions, - homedir => q{/opt/rt3/var/data/gpg}, - -# URL of a keyserver -# keyserver => 'hkp://subkeys.pgp.net', - -# enables the automatic retrieving of keys when encrypting -# 'auto-key-locate' => 'keyserver', - -# enables the automatic retrieving of keys when verifying signatures -# 'auto-key-retrieve' => undef, -); - -=back - - - -=head1 Lifecycles - -=head2 Lifecycle definitions - -Each lifecycle is a list of possible statuses split into three logic -sets: B<initial>, B<active> and B<inactive>. Each status in a -lifecycle must be unique. (Statuses may not be repeated across sets.) -Each set may have any number of statuses. - -For example: - - default => { - initial => ['new'], - active => ['open', 'stalled'], - inactive => ['resolved', 'rejected', 'deleted'], - ... - }, - -Status names can be from 1 to 64 ASCII characters. Statuses are -localized using RT's standard internationalization and localization -system. - -=over 4 - -=item initial - -You can define multiple B<initial> statuses for tickets in a given -lifecycle. - -RT will automatically set its B<Started> date when you change a -ticket's status from an B<initial> state to an B<active> or -B<inactive> status. - -=item active - -B<Active> tickets are "currently in play" - they're things that are -being worked on and not yet complete. - -=item inactive - -B<Inactive> tickets are typically in their "final resting state". - -While you're free to implement a workflow that ignores that -description, typically once a ticket enters an inactive state, it will -never again enter an active state. - -RT will automatically set the B<Resolved> date when a ticket's status -is changed from an B<Initial> or B<Active> status to an B<Inactive> -status. - -B<deleted> is still a special status and protected by the -B<DeleteTicket> right, unless you re-defined rights (read below). If -you don't want to allow ticket deletion at any time simply don't -include it in your lifecycle. - -=back - -Statuses in each set are ordered and listed in the UI in the defined -order. - -Changes between statuses are constrained by transition rules, as -described below. - -=head2 Default values - -In some cases a default value is used to display in UI or in API when -value is not provided. You can configure defaults using the following -syntax: - - default => { - ... - defaults => { - on_create => 'new', - on_resolve => 'resolved', - ... - }, - }, - -The following defaults are used. - -=over 4 - -=item on_create - -If you (or your code) doesn't specify a status when creating a ticket, -RT will use the this status. See also L</Statuses available during -ticket creation>. - -=item on_merge - -When tickets are merged, the status of the ticket that was merged -away is forced to this value. It should be one of inactive statuses; -'resolved' or its equivalent is most probably the best candidate. - -=item approved - -When an approval is accepted, the status of depending tickets will -be changed to this value. - -=item denied - -When an approval is denied, the status of depending tickets will -be changed to this value. - -=back - -=head2 Transitions between statuses and UI actions - -A B<Transition> is a change of status from A to B. You should define -all possible transitions in each lifecycle using the following format: - - default => { - ... - transitions => { - '' => [qw(new open resolved)], - new => [qw(open resolved rejected deleted)], - open => [qw(stalled resolved rejected deleted)], - stalled => [qw(open)], - resolved => [qw(open)], - rejected => [qw(open)], - deleted => [qw(open)], - }, - ... - }, - -=head3 Statuses available during ticket creation - -By default users can create tickets with any status, except -deleted. If you want to restrict statuses available during creation -then describe transition from '' (empty string), like in the example -above. - -=head3 Protecting status changes with rights - -A transition or group of transitions can be protected by a specific -right. Additionally, you can name new right names, which will be added -to the system to control that transition. For example, if you wished to -create a lesser right than ModifyTicket for rejecting tickets, you could -write: - - default => { - ... - rights => { - '* -> deleted' => 'DeleteTicket', - '* -> rejected' => 'RejectTicket', - '* -> *' => 'ModifyTicket', - }, - ... - }, - -This would create a new C<RejectTicket> right in the system which you -could assign to whatever groups you choose. - -On the left hand side you can have the following variants: - - '<from> -> <to>' - '* -> <to>' - '<from> -> *' - '* -> *' - -Valid transitions are listed in order of priority. If a user attempts -to change a ticket's status from B<new> to B<open> then the lifecycle -is checked for presence of an exact match, then for 'any to B<open>', -'B<new> to any' and finally 'any to any'. - -If you don't define any rights, or there is no match for a transition, -RT will use the B<DeleteTicket> or B<ModifyTicket> as appropriate. - -=head3 Labeling and defining actions - -For each transition you can define an action that will be shown in the -UI; each action annotated with a label and an update type. - -Each action may provide a default update type, which can be -B<Comment>, B<Respond>, or absent. For example, you may want your -staff to write a reply to the end user when they change status from -B<new> to B<open>, and thus set the update to B<Respond>. Neither -B<Comment> nor B<Respond> are mandatory, and user may leave the -message empty, regardless of the update type. - -This configuration can be used to accomplish what -$ResolveDefaultUpdateType was used for in RT 3.8. - -Use the following format to define labels and actions of transitions: - - default => { - ... - actions => [ - 'new -> open' => { label => 'Open it', update => 'Respond' }, - 'new -> resolved' => { label => 'Resolve', update => 'Comment' }, - 'new -> rejected' => { label => 'Reject', update => 'Respond' }, - 'new -> deleted' => { label => 'Delete' }, - - 'open -> stalled' => { label => 'Stall', update => 'Comment' }, - 'open -> resolved' => { label => 'Resolve', update => 'Comment' }, - 'open -> rejected' => { label => 'Reject', update => 'Respond' }, - - 'stalled -> open' => { label => 'Open it' }, - 'resolved -> open' => { label => 'Re-open', update => 'Comment' }, - 'rejected -> open' => { label => 'Re-open', update => 'Comment' }, - 'deleted -> open' => { label => 'Undelete' }, - ], - ... - }, - -In addition, you may define multiple actions for the same transition. -Alternately, you may use '* -> x' to match more than one transition. -For example: - - default => { - ... - actions => [ - ... - 'new -> rejected' => { label => 'Reject', update => 'Respond' }, - 'new -> rejected' => { label => 'Quick Reject' }, - ... - '* -> deleted' => { label => 'Delete' }, - ... - ], - ... - }, - -=head2 Moving tickets between queues with different lifecycles - -Unless there is an explicit mapping between statuses in two different -lifecycles, you can not move tickets between queues with these -lifecycles. This is true even if the different lifecycles use the exact -same set of statuses. Such a mapping is defined as follows: - - __maps__ => { - 'from lifecycle -> to lifecycle' => { - 'status in left lifecycle' => 'status in right lifecycle', - ... - }, - ... - }, - -=cut - -Set(%Lifecycles, - default => { - initial => [ 'new' ], - active => [ 'open', 'stalled' ], - inactive => [ 'resolved', 'rejected', 'deleted' ], - - defaults => { - on_create => 'new', - on_merge => 'resolved', - approved => 'open', - denied => 'rejected', - }, - - transitions => { - '' => [qw(new open resolved)], - - # from => [ to list ], - new => [qw(open stalled resolved rejected deleted)], - open => [qw(new stalled resolved rejected deleted)], - stalled => [qw(new open rejected resolved deleted)], - resolved => [qw(new open stalled rejected deleted)], - rejected => [qw(new open stalled resolved deleted)], - deleted => [qw(new open stalled rejected resolved)], - }, - rights => { - '* -> deleted' => 'DeleteTicket', - '* -> *' => 'ModifyTicket', - }, - actions => [ - 'new -> open' => { - label => 'Open It', # loc - update => 'Respond', - }, - 'new -> resolved' => { - label => 'Resolve', # loc - update => 'Comment', - }, - 'new -> rejected' => { - label => 'Reject', # loc - update => 'Respond', - }, - 'new -> deleted' => { - label => 'Delete', # loc - }, - - 'open -> stalled' => { - label => 'Stall', # loc - update => 'Comment', - }, - 'open -> resolved' => { - label => 'Resolve', # loc - update => 'Comment', - }, - 'open -> rejected' => { - label => 'Reject', # loc - update => 'Respond', - }, - - 'stalled -> open' => { - label => 'Open It', # loc - }, - 'resolved -> open' => { - label => 'Re-open', # loc - update => 'Comment', - }, - 'rejected -> open' => { - label => 'Re-open', # loc - update => 'Comment', - }, - 'deleted -> open' => { - label => 'Undelete', # loc - }, - ], - }, -# don't change lifecyle of the approvals, they are not capable to deal with -# custom statuses - approvals => { - initial => [ 'new' ], - active => [ 'open', 'stalled' ], - inactive => [ 'resolved', 'rejected', 'deleted' ], - - defaults => { - on_create => 'new', - on_merge => 'resolved', - }, - - transitions => { - '' => [qw(new open resolved)], - - # from => [ to list ], - new => [qw(open stalled resolved rejected deleted)], - open => [qw(new stalled resolved rejected deleted)], - stalled => [qw(new open rejected resolved deleted)], - resolved => [qw(new open stalled rejected deleted)], - rejected => [qw(new open stalled resolved deleted)], - deleted => [qw(new open stalled rejected resolved)], - }, - rights => { - '* -> deleted' => 'DeleteTicket', - '* -> rejected' => 'ModifyTicket', - '* -> *' => 'ModifyTicket', - }, - actions => [ - 'new -> open' => { - label => 'Open It', # loc - update => 'Respond', - }, - 'new -> resolved' => { - label => 'Resolve', # loc - update => 'Comment', - }, - 'new -> rejected' => { - label => 'Reject', # loc - update => 'Respond', - }, - 'new -> deleted' => { - label => 'Delete', # loc - }, - - 'open -> stalled' => { - label => 'Stall', # loc - update => 'Comment', - }, - 'open -> resolved' => { - label => 'Resolve', # loc - update => 'Comment', - }, - 'open -> rejected' => { - label => 'Reject', # loc - update => 'Respond', - }, - - 'stalled -> open' => { - label => 'Open It', # loc - }, - 'resolved -> open' => { - label => 'Re-open', # loc - update => 'Comment', - }, - 'rejected -> open' => { - label => 'Re-open', # loc - update => 'Comment', - }, - 'deleted -> open' => { - label => 'Undelete', # loc - }, - ], - }, -); - - - - - -=head1 Administrative interface - -=over 4 - -=item C<$ShowRTPortal> - -RT can show administrators a feed of recent RT releases and other -related announcements and information from Best Practical on the top -level Configuration page. This feature helps you stay up to date on -RT security announcements and version updates. - -RT provides this feature using an "iframe" on C</Admin/index.html> -which asks the administrator's browser to show an inline page from -Best Practical's website. - -If you'd rather not make this feature available to your -administrators, set C<$ShowRTPortal> to a false value. - -=cut - -Set($ShowRTPortal, 1); - -=item C<%AdminSearchResultFormat> - -In the admin interface, format strings similar to tickets result -formats are used. Use C<%AdminSearchResultFormat> to define the format -strings used in the admin interface on a per-RT-class basis. - -=cut - -Set(%AdminSearchResultFormat, - Queues => - q{'<a href="__WebPath__/Admin/Queues/Modify.html?id=__id__">__id__</a>/TITLE:#'} - .q{,'<a href="__WebPath__/Admin/Queues/Modify.html?id=__id__">__Name__</a>/TITLE:Name'} - .q{,__Description__,__Address__,__Priority__,__DefaultDueIn__,__Disabled__}, - - Groups => - q{'<a href="__WebPath__/Admin/Groups/Modify.html?id=__id__">__id__</a>/TITLE:#'} - .q{,'<a href="__WebPath__/Admin/Groups/Modify.html?id=__id__">__Name__</a>/TITLE:Name'} - .q{,'__Description__'}, - - Users => - q{'<a href="__WebPath__/Admin/Users/Modify.html?id=__id__">__id__</a>/TITLE:#'} - .q{,'<a href="__WebPath__/Admin/Users/Modify.html?id=__id__">__Name__</a>/TITLE:Name'} - .q{,__RealName__, __EmailAddress__}, - - CustomFields => - q{'<a href="__WebPath__/Admin/CustomFields/Modify.html?id=__id__">__id__</a>/TITLE:#'} - .q{,'<a href="__WebPath__/Admin/CustomFields/Modify.html?id=__id__">__Name__</a>/TITLE:Name'} - .q{,__AppliedTo__, __FriendlyType__, __FriendlyPattern__}, - - Scrips => - q{'<a href="__WebPath__/Admin/Queues/Scrip.html?id=__id__&Queue=__QueueId__">__id__</a>/TITLE:#'} - .q{,'<a href="__WebPath__/Admin/Queues/Scrip.html?id=__id__&Queue=__QueueId__">__Description__</a>/TITLE:Description'} - .q{,__Stage__, __Condition__, __Action__, __Template__}, - - GlobalScrips => - q{'<a href="__WebPath__/Admin/Global/Scrip.html?id=__id__">__id__</a>/TITLE:#'} - .q{,'<a href="__WebPath__/Admin/Global/Scrip.html?id=__id__">__Description__</a>/TITLE:Description'} - .q{,__Stage__, __Condition__, __Action__, __Template__}, - - Templates => - q{'<a href="__WebPath__/__WebRequestPathDir__/Template.html?Queue=__QueueId__&Template=__id__">__id__</a>/TITLE:#'} - .q{,'<a href="__WebPath__/__WebRequestPathDir__/Template.html?Queue=__QueueId__&Template=__id__">__Name__</a>/TITLE:Name'} - .q{,'__Description__'}, - Classes => - q{ '<a href="__WebPath__/Admin/Articles/Classes/Modify.html?id=__id__">__id__</a>/TITLE:#'} - .q{,'<a href="__WebPath__/Admin/Articles/Classes/Modify.html?id=__id__">__Name__</a>/TITLE:Name'} - .q{,__Description__}, -); - -=back - - - - -=head1 Development options - -=over 4 - -=item C<$DevelMode> - -RT comes with a "Development mode" setting. This setting, as a -convenience for developers, turns on several of development options -that you most likely don't want in production: - -=over 4 - -=item * - -Disables CSS and JS minification and concatenation. Both CSS and JS -will be instead be served as a number of individual smaller files, -unchanged from how they are stored on disk. - -=item * - -Uses L<Module::Refresh> to reload changed Perl modules on each -request. - -=item * - -Turns off Mason's C<static_source> directive; this causes Mason to -reload template files which have been modified on disk. - -=item * - -Turns on Mason's HTML C<error_format>; this renders compilation errors -to the browser, along with a full stack trace. It is possible for -stack traces to reveal sensitive information such as passwords or -ticket content. - -=item * - -Turns off caching of callbacks; this enables additional callbacks to -be added while the server is running. - -=back - -=cut - -Set($DevelMode, "0"); - - -=item C<$RecordBaseClass> - -What abstract base class should RT use for its records. You should -probably never change this. - -Valid values are C<DBIx::SearchBuilder::Record> or -C<DBIx::SearchBuilder::Record::Cachable> - -=cut - -Set($RecordBaseClass, "DBIx::SearchBuilder::Record::Cachable"); - - -=item C<@MasonParameters> - -C<@MasonParameters> is the list of parameters for the constructor of -HTML::Mason's Apache or CGI Handler. This is normally only useful for -debugging, e.g. profiling individual components with: - - use MasonX::Profiler; # available on CPAN - Set(@MasonParameters, (preamble => 'my $p = MasonX::Profiler->new($m, $r);')); - -=cut - -Set(@MasonParameters, ()); - -=item C<$StatementLog> - -RT has rudimentary SQL statement logging support; simply set -C<$StatementLog> to be the level that you wish SQL statements to be -logged at. - -Enabling this option will also expose the SQL Queries page in the -Configuration -> Tools menu for SuperUsers. - -=cut - -Set($StatementLog, undef); - -=back - - - - -=head1 Deprecated options - -=over 4 - -=item C<$LinkTransactionsRun1Scrip> - -RT-3.4 backward compatibility setting. Add/Delete Link used to record -one transaction and run one scrip. Set this value to 1 if you want -only one of the link transactions to have scrips run. - -=cut - -Set($LinkTransactionsRun1Scrip, 0); - -=item C<$ResolveDefaultUpdateType> - -This option has been deprecated. You can configure this site-wide -with L</Lifecycles> (see L</Labeling and defining actions>). - -=cut - -1; diff --git a/rt/etc/upgrade/3.8-branded-queues-extension b/rt/etc/upgrade/3.8-branded-queues-extension deleted file mode 100755 index 08eebad06..000000000 --- a/rt/etc/upgrade/3.8-branded-queues-extension +++ /dev/null @@ -1,95 +0,0 @@ -#!/usr/bin/perl -# BEGIN BPS TAGGED BLOCK {{{ -# -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC -# <sales@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; - -use lib "/opt/rt3/local/lib"; -use lib "/opt/rt3/lib"; - - -use RT; -RT::LoadConfig(); -RT::Init(); - -use RT::Queues; - -my $queues = RT::Queues->new( RT->SystemUser ); -$queues->UnLimit(); -while ( my $queue = $queues->Next ) { - print "Processing queue ". ($queue->Name || $queue->id) ."...\n"; - my $old_attr = $queue->FirstAttribute('BrandedSubjectTag'); - unless ( $old_attr ) { - print "\thas no old-style subject tag. skipping\n"; - next; - } - my $old_value = $old_attr->Content; - unless ( $old_value ) { - print "\thas empty old-style subject tag\n"; - } else { - my ($status, $msg) = $queue->SetSubjectTag( $old_value ); - unless ( $status ) { - print STDERR "\tERROR. Couldn't set tag: $msg\n"; - next; - } else { - print "\thave set new-style subject tag to '$old_value'\n"; - } - } - - my ($status, $msg) = $queue->DeleteAttribute('BrandedSubjectTag'); - unless ( $status ) { - print STDERR "\tERROR. Couldn't delete old-style tag: $msg\n"; - next; - } else { - print "\tdeleted old-style tag entry\n"; - } - print "\tDONE\n"; -} - -exit 0; - diff --git a/rt/etc/upgrade/3.8-ical-extension b/rt/etc/upgrade/3.8-ical-extension deleted file mode 100755 index fa6cfd003..000000000 --- a/rt/etc/upgrade/3.8-ical-extension +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/perl -# BEGIN BPS TAGGED BLOCK {{{ -# -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC -# <sales@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; - -use lib "/opt/rt3/local/lib"; -use lib "/opt/rt3/lib"; - - -use RT; -RT::LoadConfig(); -RT::Init(); - -use RT::Attributes; -my $attrs = RT::Attributes->new( RT->SystemUser ); -$attrs->Limit(FIELD => 'ObjectType', OPERATOR=> '=', VALUE => 'RT::User'); -$attrs->Limit(FIELD => 'Name', OPERATOR=> '=', VALUE => 'ical-auth-token'); -while ( my $attr = $attrs->Next ) { - my $uid = $attr->ObjectId; - print "Processing auth token of user #". $uid ."...\n"; - - my $user = RT::User->new( RT->SystemUser ); - $user->Load( $uid ); - unless ( $user->id ) { - print STDERR "\tERROR. Couldn't load user record\n"; - next; - } - - my ($status, $msg); - - ($status, $msg) = $user->DeleteAttribute('AuthToken') - if $user->FirstAttribute('AuthToken'); - unless ( $status ) { - print STDERR "\tERROR. Couldn't delete duplicated attribute: $msg\n"; - next; - } else { - print "\tdeleted duplicate attribute\n"; - } - - ($status, $msg) = $attr->SetName('AuthToken'); - unless ( $status ) { - print STDERR "\tERROR. Couldn't rename attribute: $msg\n"; - next; - } else { - print "\trenamed attribute\n"; - } - print "\tDONE\n"; -} - -exit 0; diff --git a/rt/etc/upgrade/generate-rtaddressregexp b/rt/etc/upgrade/generate-rtaddressregexp deleted file mode 100755 index 443dd7cf8..000000000 --- a/rt/etc/upgrade/generate-rtaddressregexp +++ /dev/null @@ -1,109 +0,0 @@ -#!/usr/bin/perl -# BEGIN BPS TAGGED BLOCK {{{ -# -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC -# <sales@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; - -use lib "/opt/rt3/local/lib"; -use lib "/opt/rt3/lib"; - -use RT; -RT::LoadConfig(); -RT->Config->Set('LogToScreen' => 'debug'); -RT::Init(); - -$| = 1; - -if (my $re = RT->Config->Get('RTAddressRegexp')) { - print "No need to use this script, you already have RTAddressRegexp set to $re\n"; - exit; -} - -use RT::Queues; -my $queues = RT::Queues->new( RT->SystemUser ); -$queues->UnLimit; - -my %merged; -merge(\%merged, RT->Config->Get('CorrespondAddress'), RT->Config->Get('CommentAddress')); -while ( my $queue = $queues->Next ) { - merge(\%merged, $queue->CorrespondAddress, $queue->CommentAddress); -} - -my @domains; -for my $domain (sort keys %merged) { - my @addresses; - for my $base (sort keys %{$merged{$domain}}) { - my @subbits = keys(%{$merged{$domain}{$base}}); - if (@subbits > 1) { - push @addresses, "\Q$base\E(?:".join("|",@subbits).")"; - } else { - push @addresses, "\Q$base\E$subbits[0]"; - } - } - if (@addresses > 1) { - push @domains, "(?:".join("|", @addresses).")\Q\@".$domain."\E"; - } else { - push @domains, "$addresses[0]\Q\@$domain\E"; - } -} -my $re = join "|", @domains; - -print <<ENDDESCRIPTION; -You can add the following to RT_SiteConfig.pm, but may want to collapse it into a more efficient regexp. -Keep in mind that this only contains the email addresses that RT knows about, you should also examine -your mail system for aliases that reach RT but which RT doesn't know about. -ENDDESCRIPTION -print "Set(\$RTAddressRegexp,qr{^(?:${re})\$}i);\n"; - -sub merge { - my $merged = shift; - for my $address (grep {defined and length} @_) { - $address =~ /^\s*(.*?)(-comments?)?\@(.*?)\s*$/; - $merged->{lc $3}{$1}{$2||''}++; - } -} diff --git a/rt/etc/upgrade/split-out-cf-categories b/rt/etc/upgrade/split-out-cf-categories deleted file mode 100755 index a5c354d3d..000000000 --- a/rt/etc/upgrade/split-out-cf-categories +++ /dev/null @@ -1,171 +0,0 @@ -#!/usr/bin/perl -# BEGIN BPS TAGGED BLOCK {{{ -# -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC -# <sales@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; - -use lib "/opt/rt3/local/lib"; -use lib "/opt/rt3/lib"; - -use RT; -RT::LoadConfig(); -RT->Config->Set('LogToScreen' => 'debug'); -RT::Init(); - -$| = 1; - -$RT::Handle->BeginTransaction(); - -use RT::CustomFields; -my $CFs = RT::CustomFields->new( RT->SystemUser ); -$CFs->UnLimit; -$CFs->Limit( FIELD => 'Type', VALUE => 'Select' ); - -my $seen; -while (my $cf = $CFs->Next ) { - next if $cf->BasedOnObj->Id; - my @categories; - my %mapping; - my $values = $cf->Values; - while (my $value = $values->Next) { - next unless defined $value->Category and length $value->Category; - push @categories, $value->Category unless grep {$_ eq $value->Category} @categories; - $mapping{$value->Name} = $value->Category; - } - next unless @categories; - - $seen++; - print "Found CF '@{[$cf->Name]}' with categories:\n"; - print " $_\n" for @categories; - - print "Split this CF's categories into a hierarchical custom field (Y/n)? "; - my $dothis = <>; - next if $dothis =~ /n/i; - - print "Enter name of CF to create as category ('@{[$cf->Name]} category'): "; - my $newname = <>; - chomp $newname; - $newname = $cf->Name . " category" unless length $newname; - - # bump the CF's sort oder up by one - $cf->SetSortOrder( ($cf->SortOrder || 0) + 1 ); - - # ..and add a new CF before it - my $new = RT::CustomField->new( RT->SystemUser ); - my ($id, $msg) = $new->Create( - Name => $newname, - Type => 'Select', - MaxValues => 1, - LookupType => $cf->LookupType, - SortOrder => $cf->SortOrder - 1, - ); - die "Can't create custom field '$newname': $msg" unless $id; - - # Set the CF to be based on what we just made - $cf->SetBasedOn( $new->Id ); - - # Apply it to all of the same things - { - my $ocfs = RT::ObjectCustomFields->new( RT->SystemUser ); - $ocfs->LimitToCustomField( $cf->Id ); - while (my $ocf = $ocfs->Next) { - my $newocf = RT::ObjectCustomField->new( RT->SystemUser ); - ($id, $msg) = $newocf->Create( - SortOrder => $ocf->SortOrder, - CustomField => $new->Id, - ObjectId => $ocf->ObjectId, - ); - die "Can't create ObjectCustomField: $msg" unless $id; - } - } - - # Copy over all of the rights - { - my $acl = RT::ACL->new( RT->SystemUser ); - $acl->LimitToObject( $cf ); - while (my $ace = $acl->Next) { - my $newace = RT::ACE->new( RT->SystemUser ); - ($id, $msg) = $newace->Create( - PrincipalId => $ace->PrincipalId, - PrincipalType => $ace->PrincipalType, - RightName => $ace->RightName, - Object => $new, - ); - die "Can't assign rights: $msg" unless $id; - } - } - - # Add values for all of the categories - for my $i (0..$#categories) { - ($id, $msg) = $new->AddValue( - Name => $categories[$i], - SortOrder => $i + 1, - ); - die "Can't create custom field value: $msg" unless $id; - } - - # Grovel through all ObjectCustomFieldValues, and add the - # appropriate category - { - my $ocfvs = RT::ObjectCustomFieldValues->new( RT->SystemUser ); - $ocfvs->LimitToCustomField( $cf->Id ); - while (my $ocfv = $ocfvs->Next) { - next unless exists $mapping{$ocfv->Content}; - my $newocfv = RT::ObjectCustomFieldValue->new( RT->SystemUser ); - ($id, $msg) = $newocfv->Create( - CustomField => $new->Id, - ObjectType => $ocfv->ObjectType, - ObjectId => $ocfv->ObjectId, - Content => $mapping{$ocfv->Content}, - ); - } - } -} - -$RT::Handle->Commit; -print "No custom fields with categories found\n" unless $seen; diff --git a/rt/etc/upgrade/vulnerable-passwords b/rt/etc/upgrade/vulnerable-passwords deleted file mode 100755 index 71457b149..000000000 --- a/rt/etc/upgrade/vulnerable-passwords +++ /dev/null @@ -1,139 +0,0 @@ -#!/usr/bin/perl -# BEGIN BPS TAGGED BLOCK {{{ -# -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC -# <sales@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; - -use lib "/opt/rt3/local/lib"; -use lib "/opt/rt3/lib"; - -use RT; -RT::LoadConfig; -RT::Init; - -$| = 1; - -use Getopt::Long; -use Digest::SHA; -my $fix; -GetOptions("fix!" => \$fix); - -use RT::Users; -my $users = RT::Users->new( $RT::SystemUser ); -$users->Limit( - FIELD => 'Password', - OPERATOR => 'IS NOT', - VALUE => 'NULL', - ENTRYAGGREGATOR => 'AND', -); -$users->Limit( - FIELD => 'Password', - OPERATOR => '!=', - VALUE => '*NO-PASSWORD*', - ENTRYAGGREGATOR => 'AND', -); -$users->Limit( - FIELD => 'Password', - OPERATOR => 'NOT STARTSWITH', - VALUE => '!', - ENTRYAGGREGATOR => 'AND', -); -push @{$users->{'restrictions'}{ "main.Password" }}, "AND", { - field => 'LENGTH(main.Password)', - op => '<', - value => '40', -}; - -my $count = $users->Count; -if ($count == 0) { - print "No users with unsalted or weak cryptography found.\n"; - exit 0; -} - -if ($fix) { - print "Upgrading $count users...\n"; - while (my $u = $users->Next) { - my $stored = $u->__Value("Password"); - my $raw; - if (length $stored == 32) { - $raw = pack("H*",$stored); - } elsif (length $stored == 22) { - $raw = MIME::Base64::decode_base64($stored); - } elsif (length $stored == 13) { - printf "%20s => Old crypt() format, cannot upgrade\n", $u->Name; - } else { - printf "%20s => Unknown password format!\n", $u->Name; - } - next unless $raw; - - my $salt = pack("C4",map{int rand(256)} 1..4); - my $sha = Digest::SHA::sha256( - $salt . $raw - ); - $u->_Set( - Field => "Password", - Value => MIME::Base64::encode_base64( - $salt . substr($sha,0,26), ""), - ); - } - print "Done.\n"; - exit 0; -} else { - if ($count < 20) { - print "$count users found with unsalted or weak-cryptography passwords:\n"; - print " Id | Name\n", "-"x9, "+", "-"x9, "\n"; - while (my $u = $users->Next) { - printf "%8d | %s\n", $u->Id, $u->Name; - } - } else { - print "$count users found with unsalted or weak-cryptography passwords\n"; - } - - print "\n", "Run again with --fix to upgrade.\n"; - exit 1; -} diff --git a/rt/lib/RT.pm b/rt/lib/RT.pm deleted file mode 100644 index ec2e6cc97..000000000 --- a/rt/lib/RT.pm +++ /dev/null @@ -1,818 +0,0 @@ -# BEGIN BPS TAGGED BLOCK {{{ -# -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC -# <sales@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; - -package RT; - - -use File::Spec (); -use Cwd (); - -use vars qw($Config $System $SystemUser $Nobody $Handle $Logger $_Privileged $_Unprivileged $_INSTALL_MODE); - -use vars qw($BasePath - $EtcPath - $BinPath - $SbinPath - $VarPath - $LexiconPath - $PluginPath - $LocalPath - $LocalEtcPath - $LocalLibPath - $LocalLexiconPath - $LocalPluginPath - $MasonComponentRoot - $MasonLocalComponentRoot - $MasonDataDir - $MasonSessionDir); - - -RT->LoadGeneratedData(); - -=head1 NAME - -RT - Request Tracker - -=head1 SYNOPSIS - -A fully featured request tracker package - -=head1 DESCRIPTION - -=head2 INITIALIZATION - -=head2 LoadConfig - -Load RT's config file. First, the site configuration file -(F<RT_SiteConfig.pm>) is loaded, in order to establish overall site -settings like hostname and name of RT instance. Then, the core -configuration file (F<RT_Config.pm>) is loaded to set fallback values -for all settings; it bases some values on settings from the site -configuration file. - -In order for the core configuration to not override the site's -settings, the function C<Set> is used; it only sets values if they -have not been set already. - -=cut - -sub LoadConfig { - require RT::Config; - $Config = RT::Config->new; - $Config->LoadConfigs; - require RT::I18N; - - # RT::Essentials mistakenly recommends that WebPath be set to '/'. - # If the user does that, do what they mean. - $RT::WebPath = '' if ($RT::WebPath eq '/'); - - # fix relative LogDir and GnuPG homedir - unless ( File::Spec->file_name_is_absolute( $Config->Get('LogDir') ) ) { - $Config->Set( LogDir => - File::Spec->catfile( $BasePath, $Config->Get('LogDir') ) ); - } - - my $gpgopts = $Config->Get('GnuPGOptions'); - unless ( File::Spec->file_name_is_absolute( $gpgopts->{homedir} ) ) { - $gpgopts->{homedir} = File::Spec->catfile( $BasePath, $gpgopts->{homedir} ); - } - - return $Config; -} - -=head2 Init - -L<Connects to the database|/ConnectToDatabase>, L<initilizes system -objects|/InitSystemObjects>, L<preloads classes|/InitClasses>, L<sets -up logging|/InitLogging>, and L<loads plugins|/InitPlugins>. - -=cut - -sub Init { - - my @arg = @_; - - CheckPerlRequirements(); - - InitPluginPaths(); - - #Get a database connection - ConnectToDatabase(); - InitSystemObjects(); - InitClasses(); - InitLogging(@arg); - InitPlugins(); - RT::I18N->Init; - RT->Config->PostLoadCheck; - -} - -=head2 ConnectToDatabase - -Get a database connection. See also L</Handle>. - -=cut - -sub ConnectToDatabase { - require RT::Handle; - $Handle = RT::Handle->new unless $Handle; - $Handle->Connect; - return $Handle; -} - -=head2 InitLogging - -Create the Logger object and set up signal handlers. - -=cut - -sub InitLogging { - - my %arg = @_; - - # We have to set the record separator ($, man perlvar) - # or Log::Dispatch starts getting - # really pissy, as some other module we use unsets it. - $, = ''; - use Log::Dispatch 1.6; - - my %level_to_num = ( - map( { $_ => } 0..7 ), - debug => 0, - info => 1, - notice => 2, - warning => 3, - error => 4, 'err' => 4, - critical => 5, crit => 5, - alert => 6, - emergency => 7, emerg => 7, - ); - - unless ( $RT::Logger ) { - - $RT::Logger = Log::Dispatch->new; - - my $stack_from_level; - if ( $stack_from_level = RT->Config->Get('LogStackTraces') ) { - # if option has old style '\d'(true) value - $stack_from_level = 0 if $stack_from_level =~ /^\d+$/; - $stack_from_level = $level_to_num{ $stack_from_level } || 0; - } else { - $stack_from_level = 99; # don't log - } - - my $simple_cb = sub { - # if this code throw any warning we can get segfault - no warnings; - my %p = @_; - - # skip Log::* stack frames - my $frame = 0; - $frame++ while caller($frame) && caller($frame) =~ /^Log::/; - my ($package, $filename, $line) = caller($frame); - - $p{'message'} =~ s/(?:\r*\n)+$//; - return "[". gmtime(time) ."] [". $p{'level'} ."]: " - . $p{'message'} ." ($filename:$line)\n"; - }; - - my $syslog_cb = sub { - # if this code throw any warning we can get segfault - no warnings; - my %p = @_; - - my $frame = 0; # stack frame index - # skip Log::* stack frames - $frame++ while caller($frame) && caller($frame) =~ /^Log::/; - my ($package, $filename, $line) = caller($frame); - - # syswrite() cannot take utf8; turn it off here. - Encode::_utf8_off($p{message}); - - $p{message} =~ s/(?:\r*\n)+$//; - if ($p{level} eq 'debug') { - return "$p{message}\n"; - } else { - return "$p{message} ($filename:$line)\n"; - } - }; - - my $stack_cb = sub { - no warnings; - my %p = @_; - return $p{'message'} unless $level_to_num{ $p{'level'} } >= $stack_from_level; - - require Devel::StackTrace; - my $trace = Devel::StackTrace->new( ignore_class => [ 'Log::Dispatch', 'Log::Dispatch::Base' ] ); - return $p{'message'} . $trace->as_string; - - # skip calling of the Log::* subroutins - my $frame = 0; - $frame++ while caller($frame) && caller($frame) =~ /^Log::/; - $frame++ while caller($frame) && (caller($frame))[3] =~ /^Log::/; - - $p{'message'} .= "\nStack trace:\n"; - while( my ($package, $filename, $line, $sub) = caller($frame++) ) { - $p{'message'} .= "\t$sub(...) called at $filename:$line\n"; - } - return $p{'message'}; - }; - - if ( $Config->Get('LogToFile') ) { - my ($filename, $logdir) = ( - $Config->Get('LogToFileNamed') || 'rt.log', - $Config->Get('LogDir') || File::Spec->catdir( $VarPath, 'log' ), - ); - if ( $filename =~ m![/\\]! ) { # looks like an absolute path. - ($logdir) = $filename =~ m{^(.*[/\\])}; - } - else { - $filename = File::Spec->catfile( $logdir, $filename ); - } - - unless ( -d $logdir && ( ( -f $filename && -w $filename ) || -w $logdir ) ) { - # localizing here would be hard when we don't have a current user yet - die "Log file '$filename' couldn't be written or created.\n RT can't run."; - } - - require Log::Dispatch::File; - $RT::Logger->add( Log::Dispatch::File->new - ( name=>'file', - min_level=> $Config->Get('LogToFile'), - filename=> $filename, - mode=>'append', - callbacks => [ $simple_cb, $stack_cb ], - )); - } - if ( $Config->Get('LogToScreen') ) { - require Log::Dispatch::Screen; - $RT::Logger->add( Log::Dispatch::Screen->new - ( name => 'screen', - min_level => $Config->Get('LogToScreen'), - callbacks => [ $simple_cb, $stack_cb ], - stderr => 1, - )); - } - if ( $Config->Get('LogToSyslog') ) { - require Log::Dispatch::Syslog; - $RT::Logger->add(Log::Dispatch::Syslog->new - ( name => 'syslog', - ident => 'RT', - min_level => $Config->Get('LogToSyslog'), - callbacks => [ $syslog_cb, $stack_cb ], - stderr => 1, - $Config->Get('LogToSyslogConf'), - )); - } - } - InitSignalHandlers(%arg); -} - -sub InitSignalHandlers { - - my %arg = @_; - -# Signal handlers -## This is the default handling of warnings and die'ings in the code -## (including other used modules - maybe except for errors catched by -## Mason). It will log all problems through the standard logging -## mechanism (see above). - - unless ( $arg{'NoSignalHandlers'} ) { - - $SIG{__WARN__} = sub { - # The 'wide character' warnings has to be silenced for now, at least - # until HTML::Mason offers a sane way to process both raw output and - # unicode strings. - # use 'goto &foo' syntax to hide ANON sub from stack - if( index($_[0], 'Wide character in ') != 0 ) { - unshift @_, $RT::Logger, qw(level warning message); - goto &Log::Dispatch::log; - } - }; - - #When we call die, trap it and log->crit with the value of the die. - - $SIG{__DIE__} = sub { - # if we are not in eval and perl is not parsing code - # then rollback transactions and log RT error - unless ($^S || !defined $^S ) { - $RT::Handle->Rollback(1) if $RT::Handle; - $RT::Logger->crit("$_[0]") if $RT::Logger; - } - die $_[0]; - }; - - } -} - - -sub CheckPerlRequirements { - if ($^V < 5.008003) { - die sprintf "RT requires Perl v5.8.3 or newer. Your current Perl is v%vd\n", $^V; - } - - # use $error here so the following "die" can still affect the global $@ - my $error; - { - local $@; - eval { - my $x = ''; - my $y = \$x; - require Scalar::Util; - Scalar::Util::weaken($y); - }; - $error = $@; - } - - if ($error) { - die <<"EOF"; - -RT requires the Scalar::Util module be built with support for the 'weaken' -function. - -It is sometimes the case that operating system upgrades will replace -a working Scalar::Util with a non-working one. If your system was working -correctly up until now, this is likely the cause of the problem. - -Please reinstall Scalar::Util, being careful to let it build with your C -compiler. Usually this is as simple as running the following command as -root. - - perl -MCPAN -e'install Scalar::Util' - -EOF - - } -} - -=head2 InitClasses - -Load all modules that define base classes. - -=cut - -sub InitClasses { - shift if @_%2; # so we can call it as a function or method - my %args = (@_); - require RT::Tickets; - require RT::Transactions; - require RT::Attachments; - require RT::Users; - require RT::Principals; - require RT::CurrentUser; - require RT::Templates; - require RT::Queues; - require RT::ScripActions; - require RT::ScripConditions; - require RT::Scrips; - require RT::Groups; - require RT::GroupMembers; - require RT::CustomFields; - require RT::CustomFieldValues; - require RT::ObjectCustomFields; - require RT::ObjectCustomFieldValues; - require RT::Attributes; - require RT::Dashboard; - require RT::Approval; - require RT::Lifecycle; - require RT::Link; - require RT::Article; - require RT::Articles; - require RT::Class; - require RT::Classes; - require RT::ObjectClass; - require RT::ObjectClasses; - require RT::ObjectTopic; - require RT::ObjectTopics; - require RT::Topic; - require RT::Topics; - - # on a cold server (just after restart) people could have an object - # in the session, as we deserialize it so we never call constructor - # of the class, so the list of accessible fields is empty and we die - # with "Method xxx is not implemented in RT::SomeClass" - - # without this, we also can never call _ClassAccessible, because we - # won't have filled RT::Record::_TABLE_ATTR - $_->_BuildTableAttributes foreach qw( - RT::Ticket - RT::Transaction - RT::Attachment - RT::User - RT::Principal - RT::Template - RT::Queue - RT::ScripAction - RT::ScripCondition - RT::Scrip - RT::Group - RT::GroupMember - RT::CustomField - RT::CustomFieldValue - RT::ObjectCustomField - RT::ObjectCustomFieldValue - RT::Attribute - RT::ACE - RT::Link - RT::Article - RT::Class - RT::ObjectClass - RT::ObjectTopic - RT::Topic - ); - - if ( $args{'Heavy'} ) { - # load scrips' modules - my $scrips = RT::Scrips->new(RT->SystemUser); - $scrips->Limit( FIELD => 'Stage', OPERATOR => '!=', VALUE => 'Disabled' ); - while ( my $scrip = $scrips->Next ) { - local $@; - eval { $scrip->LoadModules } or - $RT::Logger->error("Invalid Scrip ".$scrip->Id.". Unable to load the Action or Condition. ". - "You should delete or repair this Scrip in the admin UI.\n$@\n"); - } - - foreach my $class ( grep $_, RT->Config->Get('CustomFieldValuesSources') ) { - local $@; - eval "require $class; 1" or $RT::Logger->error( - "Class '$class' is listed in CustomFieldValuesSources option" - ." in the config, but we failed to load it:\n$@\n" - ); - } - - } -} - -=head2 InitSystemObjects - -Initializes system objects: C<$RT::System>, C<< RT->SystemUser >> -and C<< RT->Nobody >>. - -=cut - -sub InitSystemObjects { - - #RT's system user is a genuine database user. its id lives here - require RT::CurrentUser; - $SystemUser = RT::CurrentUser->new; - $SystemUser->LoadByName('RT_System'); - - #RT's "nobody user" is a genuine database user. its ID lives here. - $Nobody = RT::CurrentUser->new; - $Nobody->LoadByName('Nobody'); - - require RT::System; - $System = RT::System->new( $SystemUser ); -} - -=head1 CLASS METHODS - -=head2 Config - -Returns the current L<config object|RT::Config>, but note that -you must L<load config|/LoadConfig> first otherwise this method -returns undef. - -Method can be called as class method. - -=cut - -sub Config { return $Config || shift->LoadConfig(); } - -=head2 DatabaseHandle - -Returns the current L<database handle object|RT::Handle>. - -See also L</ConnectToDatabase>. - -=cut - -sub DatabaseHandle { return $Handle } - -=head2 Logger - -Returns the logger. See also L</InitLogging>. - -=cut - -sub Logger { return $Logger } - -=head2 System - -Returns the current L<system object|RT::System>. See also -L</InitSystemObjects>. - -=cut - -sub System { return $System } - -=head2 SystemUser - -Returns the system user's object, it's object of -L<RT::CurrentUser> class that represents the system. See also -L</InitSystemObjects>. - -=cut - -sub SystemUser { return $SystemUser } - -=head2 Nobody - -Returns object of Nobody. It's object of L<RT::CurrentUser> class -that represents a user who can own ticket and nothing else. See -also L</InitSystemObjects>. - -=cut - -sub Nobody { return $Nobody } - -sub PrivilegedUsers { - if (!$_Privileged) { - $_Privileged = RT::Group->new(RT->SystemUser); - $_Privileged->LoadSystemInternalGroup('Privileged'); - } - return $_Privileged; -} - -sub UnprivilegedUsers { - if (!$_Unprivileged) { - $_Unprivileged = RT::Group->new(RT->SystemUser); - $_Unprivileged->LoadSystemInternalGroup('Unprivileged'); - } - return $_Unprivileged; -} - - -=head2 Plugins - -Returns a listref of all Plugins currently configured for this RT instance. -You can define plugins by adding them to the @Plugins list in your RT_SiteConfig - -=cut - -our @PLUGINS = (); -sub Plugins { - my $self = shift; - unless (@PLUGINS) { - $self->InitPluginPaths; - @PLUGINS = $self->InitPlugins; - } - return \@PLUGINS; -} - -=head2 PluginDirs - -Takes an optional subdir (e.g. po, lib, etc.) and returns a list of -directories from plugins where that subdirectory exists. - -This code does not check plugin names, plugin validitity, or load -plugins (see L</InitPlugins>) in any way, and requires that RT's -configuration have been already loaded. - -=cut - -sub PluginDirs { - my $self = shift; - my $subdir = shift; - - require RT::Plugin; - - my @res; - foreach my $plugin (grep $_, RT->Config->Get('Plugins')) { - my $path = RT::Plugin->new( name => $plugin )->Path( $subdir ); - next unless -d $path; - push @res, $path; - } - return @res; -} - -=head2 InitPluginPaths - -Push plugins' lib paths into @INC right after F<local/lib>. -In case F<local/lib> isn't in @INC, append them to @INC - -=cut - -sub InitPluginPaths { - my $self = shift || __PACKAGE__; - - my @lib_dirs = $self->PluginDirs('lib'); - - my @tmp_inc; - my $added; - for (@INC) { - if ( Cwd::realpath($_) eq $RT::LocalLibPath) { - push @tmp_inc, $_, @lib_dirs; - $added = 1; - } else { - push @tmp_inc, $_; - } - } - - # append @lib_dirs in case $RT::LocalLibPath isn't in @INC - push @tmp_inc, @lib_dirs unless $added; - - my %seen; - @INC = grep !$seen{$_}++, @tmp_inc; -} - -=head2 InitPlugins - -Initialize all Plugins found in the RT configuration file, setting up -their lib and L<HTML::Mason> component roots. - -=cut - -sub InitPlugins { - my $self = shift; - my @plugins; - require RT::Plugin; - foreach my $plugin (grep $_, RT->Config->Get('Plugins')) { - $plugin->require; - die $UNIVERSAL::require::ERROR if ($UNIVERSAL::require::ERROR); - push @plugins, RT::Plugin->new(name =>$plugin); - } - return @plugins; -} - - -sub InstallMode { - my $self = shift; - if (@_) { - $_INSTALL_MODE = shift; - if($_INSTALL_MODE) { - require RT::CurrentUser; - $SystemUser = RT::CurrentUser->new(); - } - } - return $_INSTALL_MODE; -} - -sub LoadGeneratedData { - my $class = shift; - my $pm_path = ( File::Spec->splitpath( $INC{'RT.pm'} ) )[1]; - - require "$pm_path/RT/Generated.pm" || die "Couldn't load RT::Generated: $@"; - $class->CanonicalizeGeneratedPaths(); -} - -sub CanonicalizeGeneratedPaths { - my $class = shift; - unless ( File::Spec->file_name_is_absolute($EtcPath) ) { - - # if BasePath exists and is absolute, we won't infer it from $INC{'RT.pm'}. - # otherwise RT.pm will make the source dir(where we configure RT) be the - # BasePath instead of the one specified by --prefix - unless ( -d $BasePath - && File::Spec->file_name_is_absolute($BasePath) ) - { - my $pm_path = ( File::Spec->splitpath( $INC{'RT.pm'} ) )[1]; - - # need rel2abs here is to make sure path is absolute, since $INC{'RT.pm'} - # is not always absolute - $BasePath = File::Spec->rel2abs( - File::Spec->catdir( $pm_path, File::Spec->updir ) ); - } - - $BasePath = Cwd::realpath($BasePath); - - for my $path ( - qw/EtcPath BinPath SbinPath VarPath LocalPath LocalEtcPath - LocalLibPath LexiconPath LocalLexiconPath PluginPath - LocalPluginPath MasonComponentRoot MasonLocalComponentRoot - MasonDataDir MasonSessionDir/ - ) - { - no strict 'refs'; - - # just change relative ones - $$path = File::Spec->catfile( $BasePath, $$path ) - unless File::Spec->file_name_is_absolute($$path); - } - } - -} - -=head2 AddJavaScript - -helper method to add js files to C<JSFiles> config. -to add extra css files, you can add the following line -in the plugin's main file: - - RT->AddJavaScript( 'foo.js', 'bar.js' ); - -=cut - -sub AddJavaScript { - my $self = shift; - - my @old = RT->Config->Get('JSFiles'); - RT->Config->Set( 'JSFiles', @old, @_ ); - return RT->Config->Get('JSFiles'); -} - -=head2 AddStyleSheets - -helper method to add css files to C<CSSFiles> config - -to add extra css files, you can add the following line -in the plugin's main file: - - RT->AddStyleSheets( 'foo.css', 'bar.css' ); - -=cut - -sub AddStyleSheets { - my $self = shift; - my @old = RT->Config->Get('CSSFiles'); - RT->Config->Set( 'CSSFiles', @old, @_ ); - return RT->Config->Get('CSSFiles'); -} - -=head2 JavaScript - -helper method of RT->Config->Get('JSFiles') - -=cut - -sub JavaScript { - return RT->Config->Get('JSFiles'); -} - -=head2 StyleSheets - -helper method of RT->Config->Get('CSSFiles') - -=cut - -sub StyleSheets { - return RT->Config->Get('CSSFiles'); -} - -=head1 BUGS - -Please report them to rt-bugs@bestpractical.com, if you know what's -broken and have at least some idea of what needs to be fixed. - -If you're not sure what's going on, report them rt-devel@lists.bestpractical.com. - -=head1 SEE ALSO - -L<RT::StyleGuide> -L<DBIx::SearchBuilder> - -=cut - -require RT::Base; -RT::Base->_ImportOverlays(); - -1; diff --git a/rt/sbin/rt-attributes-viewer b/rt/sbin/rt-attributes-viewer deleted file mode 100755 index b95f0884b..000000000 --- a/rt/sbin/rt-attributes-viewer +++ /dev/null @@ -1,122 +0,0 @@ -#!/usr/bin/perl -# BEGIN BPS TAGGED BLOCK {{{ -# -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC -# <sales@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 = ("/opt/rt3/lib", "/opt/rt3/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 Getopt::Long; -my %opt; -GetOptions( \%opt, 'help|h', ); - -my $id = shift; - -if ( $opt{help} || !$id ) { - require Pod::Usage; - Pod::Usage::pod2usage({ verbose => 2 }); - exit; -} - -require RT; -RT::LoadConfig(); -RT::Init(); - -require RT::Attribute; -my $attr = RT::Attribute->new( RT->SystemUser ); -$attr->Load( $id ); -unless ( $attr->id ) { - print STDERR "Couldn't load attribute #$id\n"; - exit 1; -} - -my %res = (); -$res{$_} = $attr->$_() foreach qw(ObjectType ObjectId Name Description Content ContentType); - -use Data::Dumper; -print "Content of attribute #$id: ". Dumper( \%res ); - -__END__ - -=head1 NAME - -rt-attributes-viewer - show the content of an attribute - -=head1 SYNOPSIS - - # show the content of attribute 2 - rt-attributes-viewer 2 - -=head1 DESCRIPTION - -This script deserializes and print content of an attribute defined -by <attribute id>. May be useful for developers and for troubleshooting -problems. - diff --git a/rt/sbin/rt-clean-sessions b/rt/sbin/rt-clean-sessions deleted file mode 100755 index 6189c4683..000000000 --- a/rt/sbin/rt-clean-sessions +++ /dev/null @@ -1,190 +0,0 @@ -#!/usr/bin/perl -# BEGIN BPS TAGGED BLOCK {{{ -# -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC -# <sales@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 = ("/opt/rt3/lib", "/opt/rt3/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 Getopt::Long; -my %opt; -GetOptions( \%opt, "older=s", "debug", "help|h", "skip-user" ); - - -if ( $opt{help} ) { - require Pod::Usage; - Pod::Usage::pod2usage({ verbose => 2 }); - exit; -} - - -if( $opt{'older'} ) { - unless( $opt{'older'} =~ /^\s*([0-9]+)\s*(H|D|M|Y)?$/i ) { - print STDERR "wrong format of the 'older' argumnet\n"; - exit(1); - } - my ($num,$unit) = ($1, uc($2 ||'D')); - my %factor = ( H => 60*60 ); - $factor{'D'} = $factor{'H'}*24; - $factor{'M'} = $factor{'D'}*31; - $factor{'Y'} = $factor{'D'}*365; - $opt{'older'} = $num * $factor{ $unit }; -} - -require RT; -RT::LoadConfig(); - -if( $opt{'debug'} ) { - RT->Config->Set( LogToScreen => 'debug' ); -} else { - RT->Config->Set( LogToScreen => undef ); -} - -RT::ConnectToDatabase(); -RT::InitLogging(); - -require RT::Interface::Web::Session; - -my $alogoff = int RT->Config->Get('AutoLogoff'); -if ( $opt{'older'} or $alogoff ) { - my $min; - foreach ($alogoff*60, $opt{'older'}) { - next unless $_; - $min = $_ unless $min; - $min = $_ if $_ < $min; - } - - RT::Interface::Web::Session->ClearOld( $min ); -} - -RT::Interface::Web::Session->ClearByUser - unless $opt{'skip-user'}; - -exit(0); - -__END__ - -=head1 NAME - -rt-clean-sessions - clean old and duplicate RT sessions - -=head1 SYNOPSIS - - rt-clean-sessions [--debug] [--older <NUM>[H|D|M|Y]] - - rt-clean-sessions - rt-clean-sessions --debug - rt-clean-sessions --older 10D - rt-clean-sessions --debug --older 1M - rt-clean-sessions --older 10D --skip-user - -=head1 DESCRIPTION - -Script cleans RT sessions from DB or dir with sessions data. -Leaves in DB only one session per RT user and sessions that aren't older -than specified(see options). - -Script is safe because data in the sessions is temporary and can be deleted. - -=head1 OPTIONS - -=over 4 - -=item older - -Date interval in the C<< <NUM>[<unit>] >> format. Default unit is D(ays), -H(our), M(onth) and Y(ear) are also supported. - -For example: C<rt-clean-sessions --older 1M> would delete all sessions that are -older than 1 month. - -=item skip-user - -By default only one session per user left in the DB, so users that have -sessions on multiple computers or in different browsers will be logged out. -Use this option to avoid this. - -=item debug - -Turn on debug output. - -=back - -=head1 NOTES - -Functionality similar to this is implemented in -html/Elements/SetupSessionCookie ; however, that does not guarantee -that a session will be removed from disk and database soon after the -timeout expires. This script, if run from a cron job, will ensure -that the timed out sessions are actually removed from disk; the Mason -component just ensures that the old sessions are not reusable before -the cron job gets to them. - -=cut diff --git a/rt/sbin/rt-dump-metadata b/rt/sbin/rt-dump-metadata deleted file mode 100755 index 193ea85f4..000000000 --- a/rt/sbin/rt-dump-metadata +++ /dev/null @@ -1,251 +0,0 @@ -#!/usr/bin/perl -w -# BEGIN BPS TAGGED BLOCK {{{ -# -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC -# <sales@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; - -# As we specify that XML is UTF-8 and we output it to STDOUT, we must be sure -# it is UTF-8 so further XMLin will not break -binmode( STDOUT, ":utf8" ); - -# fix lib paths, some may be relative -BEGIN { - require File::Spec; - my @libs = ( "/opt/rt3/lib", "/opt/rt3/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 Getopt::Long; -my %opt; -GetOptions( \%opt, "help|h" ); - -if ( $opt{help} ) { - require Pod::Usage; - Pod::Usage::pod2usage( { verbose => 2 } ); - exit; -} - -require RT; -require XML::Simple; - -RT::LoadConfig(); -RT::Init(); - -my $LocalOnly = @ARGV ? shift(@ARGV) : 1; - -my %RV; -my %Ignore = ( - All => [ - qw( - id Created Creator LastUpdated LastUpdatedBy - ) - ], - Templates => [ - qw( - TranslationOf - ) - ], -); - -my $SystemUserId = RT->SystemUser->Id; -my @classes = qw( - Users Groups Queues ScripActions ScripConditions - Templates Scrips ACL CustomFields - ); -foreach my $class (@classes) { - require "RT/$class.pm"; - my $objects = "RT::$class"->new( RT->SystemUser ); - $objects->{find_disabled_rows} = 1; - $objects->UnLimit; - - if ( $class eq 'CustomFields' ) { - $objects->OrderByCols( - { FIELD => 'LookupType' }, - { FIELD => 'SortOrder' }, - { FIELD => 'Id' }, - ); - } else { - $objects->OrderBy( FIELD => 'Id' ); - } - - if ($LocalOnly) { - next if $class eq 'ACL'; # XXX - would go into infinite loop - XXX - $objects->Limit( - FIELD => 'LastUpdatedBy', - OPERATOR => '!=', - VALUE => $SystemUserId - ) unless $class eq 'Groups'; - $objects->Limit( - FIELD => 'Id', - OPERATOR => '!=', - VALUE => $SystemUserId - ) if $class eq 'Users'; - $objects->Limit( - FIELD => 'Domain', - OPERATOR => '=', - VALUE => 'UserDefined' - ) if $class eq 'Groups'; - } - - my %fields; - while ( my $obj = $objects->Next ) { - next - if $obj->can('LastUpdatedBy') - and $obj->LastUpdatedBy == $SystemUserId; - - if ( !%fields ) { - %fields = map { $_ => 1 } keys %{ $obj->_ClassAccessible }; - delete @fields{ @{ $Ignore{$class} ||= [] }, - @{ $Ignore{All} ||= [] }, }; - } - - my $rv; - - # next if $obj-> # skip default names - foreach my $field ( sort keys %fields ) { - my $value = $obj->__Value($field); - $rv->{$field} = $value if ( defined($value) && length($value) ); - } - delete $rv->{Disabled} unless $rv->{Disabled}; - - foreach my $record ( map { /ACL/ ? 'ACE' : substr( $_, 0, -1 ) } - @classes ) - { - foreach my $key ( map "$record$_", ( '', 'Id' ) ) { - next unless exists $rv->{$key}; - my $id = $rv->{$key} or next; - my $obj = "RT::$record"->new( RT->SystemUser ); - $obj->LoadByCols( Id => $id ) or next; - $rv->{$key} = $obj->__Value('Name') || 0; - } - } - - if ( $class eq 'Users' and defined $obj->Privileged ) { - $rv->{Privileged} = int( $obj->Privileged ); - } elsif ( $class eq 'CustomFields' ) { - my $values = $obj->Values; - while ( my $value = $values->Next ) { - push @{ $rv->{Values} }, { - map { ( $_ => $value->__Value($_) ) } - qw( - Name Description SortOrder - ), - }; - } - } - - if ( eval { require RT::Attributes; 1 } ) { - my $attributes = $obj->Attributes; - while ( my $attribute = $attributes->Next ) { - my $content = $attribute->Content; - $rv->{Attributes}{ $attribute->Name } = $content - if length($content); - } - } - - push @{ $RV{$class} }, $rv; - } -} - -print(<< "."); -no strict; use XML::Simple; *_ = XMLin(do { local \$/; readline(DATA) }, ForceArray => [qw( - @classes Values -)], NoAttr => 1, SuppressEmpty => ''); *\$_ = (\$_{\$_} || []) for keys \%_; 1; # vim: ft=xml -__DATA__ -. - -print XML::Simple::XMLout( - { map { ( $_ => ( $RV{$_} || [] ) ) } @classes }, - RootName => 'InitialData', - NoAttr => 1, - SuppressEmpty => '', - XMLDecl => '<?xml version="1.0" encoding="UTF-8"?>', -); - -__END__ - -=head1 NAME - -rt-dump-metadata - dump configuration metadata from an RT database - -=head1 SYNOPSIS - - rt-dump-metdata [ 0 ] - -=head1 DESCRIPTION - -C<rt-dump-metadata> is a tool that dumps configuration metadata from the -Request Tracker database into XML format, suitable for feeding into -C<rt-setup-database>. To dump and load a full RT database, you should generally -use the native database tools instead, as well as performing any necessary -steps from UPGRADING. - -When run without arguments, the metadata dump will only include 'local' -configuration changes, i.e. those done manually in the web interface. - -When run with the argument '0', the dump will include all configuration -metadata. - -This is NOT a tool for backing up an RT database. - diff --git a/rt/sbin/rt-email-dashboards b/rt/sbin/rt-email-dashboards deleted file mode 100755 index 7acaa2354..000000000 --- a/rt/sbin/rt-email-dashboards +++ /dev/null @@ -1,173 +0,0 @@ -#!/usr/bin/perl -# BEGIN BPS TAGGED BLOCK {{{ -# -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC -# <sales@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 = ("/opt/rt3/lib", "/opt/rt3/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; - } - -} - -# Read in the options -my %opts; -use Getopt::Long; -GetOptions( \%opts, - "help|h", "dryrun", "time=i", "epoch=i", "all" -); - -if ($opts{'help'}) { - require Pod::Usage; - print Pod::Usage::pod2usage(-verbose => 2); - exit; -} - -require RT; -require RT::Interface::CLI; -RT::Interface::CLI->import(qw{ CleanEnv loc }); - -# Clean out all the nasties from the environment -CleanEnv(); - -# Load the config file -RT::LoadConfig(); - -# Connect to the database and get RT::SystemUser and RT::Nobody loaded -RT::Init(); - -require RT::Dashboard::Mailer; -RT::Dashboard::Mailer->MailDashboards( - All => $opts{all}, - DryRun => $opts{dryrun}, - Time => ($opts{time} || $opts{epoch} || time), # epoch is the old-style - Opts => \%opts, -); - -=head1 NAME - -rt-email-dashboards - Send email dashboards - -=head1 SYNOPSIS - - rt-email-dashboards [options] - -=head1 DESCRIPTION - -This tool will send users email based on how they have subscribed to -dashboards. A dashboard is a set of saved searches, the subscription controls -how often that dashboard is sent and how it's displayed. - -Each subscription has an hour, and possibly day of week or day of month. These -are taken to be in the user's timezone if available, UTC otherwise. - -=head1 SETUP - -You'll need to have cron run this script every hour. Here's an example crontab -entry to do this. - - 0 * * * * /usr/bin/perl /opt/rt4/local/sbin/rt-email-dashboards - -This will run the script every hour on the hour. This may need some further -tweaking to be run as the correct user. - -=head1 OPTIONS - -This tool supports a few options. Most are for debugging. - -=over 8 - -=item -h - -=item --help - -Display this documentation - -=item --dryrun - -Figure out which dashboards would be sent, but don't actually generate or email -any of them - -=item --time SECONDS - -Instead of using the current time to figure out which dashboards should be -sent, use SECONDS (usually since midnight Jan 1st, 1970, so C<1192216018> would -be Oct 12 19:06:58 GMT 2007). - -=item --epoch SECONDS - -Back-compat for --time SECONDS. - -=item --all - -Ignore subscription frequency when considering each dashboard (should only be -used with --dryrun for testing and debugging) - -=back - -=cut - diff --git a/rt/sbin/rt-email-digest b/rt/sbin/rt-email-digest deleted file mode 100755 index 201cfd691..000000000 --- a/rt/sbin/rt-email-digest +++ /dev/null @@ -1,376 +0,0 @@ -#!/usr/bin/perl -# BEGIN BPS TAGGED BLOCK {{{ -# -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC -# <sales@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 warnings; -use strict; - -BEGIN { - require File::Spec; - my @libs = ("/opt/rt3/lib", "/opt/rt3/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 Date::Format qw( strftime ); -use Getopt::Long; -use RT; -use RT::Interface::CLI qw( CleanEnv loc ); -use RT::Interface::Email; - -CleanEnv(); -RT::LoadConfig(); -RT::Init(); - -sub usage { - my ($error) = @_; - print loc("Usage:") . " $0 -m (daily|weekly) [--print] [--help]\n"; - print loc( - "[_1] is a utility, meant to be run from cron, that dispatches all deferred RT notifications as a per-user digest.", - $0 - ) . "\n"; - print "\n\t-m, --mode\t" - . loc("Specify whether this is a daily or weekly run.") . "\n"; - print "\t-p, --print\t" - . loc("Print the resulting digest messages to STDOUT; don't mail them. Do not mark them as sent") - . "\n"; - print "\t-h, --help\t" . loc("Print this message") . "\n"; - - if ( $error eq 'help' ) { - exit 0; - } else { - print loc("Error") . ": " . loc($error) . "\n"; - exit 1; - } -} - -my ( $frequency, $print, $help ) = ( '', '', '' ); -GetOptions( - 'mode=s' => \$frequency, - 'print' => \$print, - 'help' => \$help, -); - -usage('help') if $help; -usage("Mode argument must be 'daily' or 'weekly'") - unless $frequency =~ /^(daily|weekly)$/; - -run( $frequency, $print ); - -sub run { - my $frequency = shift; - my $print = shift; - -## Find all the tickets that have been modified within the time frame -## described by $frequency. - - my ( $all_digest, $sent_transactions ) = find_transactions($frequency); - -## Iterate through our huge hash constructing the digest message -## for each user and sending it. - - foreach my $user ( keys %$all_digest ) { - my ( $contents_list, $contents_body ) = build_digest_for_user( $user, $all_digest->{$user} ); - # Now we have a content head and a content body. We can send a message. - if ( send_digest( $user, $contents_list, $contents_body ) ) { - print "Sent message to $user\n"; - mark_transactions_sent( $frequency, $user, values %{$sent_transactions->{$user}} ) unless ($print); - } else { - print "Failed to send message to $user\n"; - } - } -} -exit 0; - -# Subroutines. - -sub send_digest { - my ( $to, $index, $messages ) = @_; - - # Combine the index and the messages. - - my $body = "============== Tickets with activity in the last " - . ( $frequency eq 'daily' ? "day" : "seven days" ) . "\n\n"; - - $body .= $index; - $body .= "\n\n============== Messages recorded in the last " - . ( $frequency eq 'daily' ? "day" : "seven days" ) . "\n\n"; - $body .= $messages; - - # Load our template. If we cannot load the template, abort - # immediately rather than failing through many loops. - my $digest_template = RT::Template->new( RT->SystemUser ); - my ( $ret, $msg ) = $digest_template->Load('Email Digest'); - unless ($ret) { - print loc("Failed to load template") - . " 'Email Digest': " - . $msg - . ". Cannot continue.\n"; - exit 1; - } - ( $ret, $msg ) = $digest_template->Parse( Argument => $body ); - unless ($ret) { - print loc("Failed to parse template") - . " 'Email Digest'. Cannot continue.\n"; - exit 1; - } - - # Set our sender and recipient. - $digest_template->MIMEObj->head->replace( 'From', RT::Config->Get('CorrespondAddress') ); - $digest_template->MIMEObj->head->replace( 'To', $to ); - - if ($print) { - $digest_template->MIMEObj->print; - return 1; - } else { - return RT::Interface::Email::SendEmail( Entity => $digest_template->MIMEObj) - } -} - -# =item mark_transactions_sent( $frequency, $user, @txn_list ); -# -# Takes a frequency string (either 'daily' or 'weekly'), a user and one or more -# transaction objects as its arguments. Marks the given deferred -# notifications as sent. -# -# =cut - -sub mark_transactions_sent { - my ( $freq, $user, @txns ) = @_; - return unless $freq =~ /(daily|weekly)/; - return unless @txns; - foreach my $txn (@txns) { - - # Grab the attribute, mark the "sent" as true, and store the new - # value. - if ( my $attr = $txn->FirstAttribute('DeferredRecipients') ) { - my $deferred = $attr->Content; - $deferred->{$freq}->{$user}->{'_sent'} = 1; - $txn->SetAttribute( - Name => 'DeferredRecipients', - Description => 'Deferred recipients for this message', - Content => $deferred, - ); - } - } -} - -sub since_date { - my $frequency = shift; - - # Specify a short time for digest overlap, in case we aren't starting - # this process exactly on time. - my $OVERLAP_HEDGE = -30; - - my $since_date = RT::Date->new( RT->SystemUser ); - $since_date->Set( Format => 'unix', Value => time() ); - if ( $frequency eq 'daily' ) { - $since_date->AddDays(-1); - } else { - $since_date->AddDays(-7); - } - - $since_date->AddSeconds($OVERLAP_HEDGE); - - return $since_date; -} - -sub find_transactions { - my $frequency = shift; - my $since_date = since_date($frequency); - - my $txns = RT::Transactions->new( RT->SystemUser ); - - # First limit to recent transactions. - $txns->Limit( - FIELD => 'Created', - OPERATOR => '>', - VALUE => $since_date->ISO - ); - - # Next limit to ticket transactions. - $txns->Limit( - FIELD => 'ObjectType', - OPERATOR => '=', - VALUE => 'RT::Ticket', - ENTRYAGGREGATOR => 'AND' - ); - my $all_digest = {}; - my $sent_transactions = {}; - - while ( my $txn = $txns->Next ) { - my $ticket = $txn->Ticket; - my $queue = $txn->TicketObj->QueueObj->Name; - # Xxx todo - may clobber if two queues have the same name - foreach my $user ( $txn->DeferredRecipients($frequency) ) { - $all_digest->{$user}->{$queue}->{$ticket}->{ $txn->id } = $txn->ContentObj; - $sent_transactions->{$user}->{ $txn->id } = $txn; - } - } - - return ( $all_digest, $sent_transactions ); -} - -sub build_digest_for_user { - my $user = shift; - my $user_digest = shift; - - my $contents_list = ''; # Holds the digest index. - my $contents_body = ''; # Holds the digest body. - - # Has the user been disabled since a message was deferred on his/her - # behalf? - my $user_obj = RT::User->new( RT->SystemUser ); - $user_obj->LoadByEmail($user); - if ( $user_obj->PrincipalObj->Disabled ) { - print STDERR loc("Skipping disabled user") . " $user\n"; - next; - } - - print loc("Message for user") . " $user:\n\n" if $print; - foreach my $queue ( keys %$user_digest ) { - $contents_list .= "Queue $queue:\n"; - $contents_body .= "Queue $queue:\n"; - foreach my $ticket ( sort keys %{ $user_digest->{$queue} } ) { - my $tkt_txns = $user_digest->{$queue}->{$ticket}; - my $ticket_obj = RT::Ticket->new( RT->SystemUser ); - $ticket_obj->Load($ticket); - - # Spit out the index entry for this ticket. - my $ticket_title = sprintf( - "#%d %s [%s]\t%s\n", - $ticket, $ticket_obj->Status, $ticket_obj->OwnerObj->Name, - $ticket_obj->Subject - ); - $contents_list .= $ticket_title; - - # Spit out the messages for the transactions on this ticket. - $contents_body .= "\n== $ticket_title\n"; - foreach my $txn ( sort keys %$tkt_txns ) { - my $msg = $tkt_txns->{$txn}; - - # $msg contains an RT::Attachment with our outgoing - # message. Print a few headers for clarity's sake. - $contents_body .= "From: " . $msg->GetHeader('From') . "\n"; - my $date = $msg->GetHeader('Date '); - unless ($date) { - my $txn_obj = RT::Transaction->new( RT->SystemUser ); - $txn_obj->Load($txn); - my $date_obj = RT::Date->new( RT->SystemUser ); - $date_obj->Set( - Format => 'sql', - Value => $txn_obj->Created - ); - $date = strftime( '%a, %d %b %Y %H:%M:%S %z', - @{ [ localtime( $date_obj->Unix ) ] } ); - } - $contents_body .= "Date: $date\n\n"; - $contents_body .= $msg->Content . "\n"; - $contents_body .= "-------\n"; - } # foreach transaction - } # foreach ticket - } # foreach queue - - return ( $contents_list, $contents_body ); - -} - -__END__ - -=head1 NAME - -rt-email-digest - dispatch deferred notifications as a per-user digest - -=head1 SYNOPSIS - - rt-email-digest -m (daily|weekly) [--print] [--help] - -=head1 DESCRIPTION - -This script is a tool to dispatch all deferred RT notifications as a per-user -object. - -=head1 OPTIONS - -=over - -=item mode - -Specify whether this is a daily or weekly run. - ---mode is equal to -m - -=item print - -Print the resulting digest messages to STDOUT; don't mail them. Do not mark them as sent - ---print is equal to -p - -=item help - -Print this message - ---help is equal to -h - -=back diff --git a/rt/sbin/rt-email-group-admin b/rt/sbin/rt-email-group-admin deleted file mode 100755 index 372a90f27..000000000 --- a/rt/sbin/rt-email-group-admin +++ /dev/null @@ -1,509 +0,0 @@ -#!/usr/bin/perl -# BEGIN BPS TAGGED BLOCK {{{ -# -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC -# <sales@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 }}} -=head1 NAME - -rt-email-group-admin - Command line tool for administrating NotifyGroup actions - -=head1 SYNOPSIS - - rt-email-group-admin --list - rt-email-group-admin --create 'Notify foo team' --group Foo - rt-email-group-admin --create 'Notify foo team as comment' --comment --group Foo - rt-email-group-admin --create 'Notify group Foo and Bar' --group Foo --group Bar - rt-email-group-admin --create 'Notify user foo@bar.com' --user foo@bar.com - rt-email-group-admin --create 'Notify VIPs' --user vip1@bar.com - rt-email-group-admin --add 'Notify VIPs' --user vip2@bar.com --group vip1 --user vip3@foo.com - rt-email-group-admin --rename 'Notify VIPs' --newname 'Inform VIPs' - rt-email-group-admin --switch 'Notify VIPs' - rt-email-group-admin --delete 'Notify user foo@bar.com' - -=head1 DESCRIPTION - -This script list, create, modify or delete scrip actions in the RT DB. Once -you've created an action you can use it in a scrip. - -For example you can create the following action using this script: - - rt-email-group-admin --create 'Notify developers' --group 'Development Team' - -Then you can add the followoing scrip to your Bugs queue: - - Condition: On Create - Action: Notify developers - Template: Transaction - Stage: TransactionCreate - -Your development team will be notified on every new ticket in the queue. - -=cut - -use warnings; -use strict; - -# fix lib paths, some may be relative -BEGIN { - require File::Spec; - my @libs = ("/opt/rt3/lib", "/opt/rt3/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 Getopt::Long qw(GetOptions); -Getopt::Long::Configure( "pass_through" ); - -our $cmd = 'usage'; -our $opts = {}; - -sub parse_args { - my $tmp; - if ( GetOptions( 'list' => \$tmp ) && $tmp ) { - $cmd = 'list'; - } - elsif ( GetOptions( 'create=s' => \$tmp ) && $tmp ) { - $cmd = 'create'; - $opts->{'name'} = $tmp; - $opts->{'groups'} = []; - $opts->{'users'} = []; - GetOptions( 'comment' => \$opts->{'comment'} ); - GetOptions( 'group:s@' => $opts->{'groups'} ); - GetOptions( 'user:s@' => $opts->{'users'} ); - unless ( @{ $opts->{'users'} } + @{ $opts->{'groups'} } ) { - usage(); - exit(-1); - } - } - elsif ( GetOptions( 'add=s' => \$tmp ) && $tmp ) { - $cmd = 'add'; - $opts->{'name'} = $tmp; - $opts->{'groups'} = []; - $opts->{'users'} = []; - GetOptions( 'group:s@' => $opts->{'groups'} ); - GetOptions( 'user:s@' => $opts->{'users'} ); - unless ( @{ $opts->{'users'} } + @{ $opts->{'groups'} } ) { - usage(); - exit(-1); - } - } - elsif ( GetOptions( 'switch=s' => \$tmp ) && $tmp ) { - $cmd = 'switch'; - $opts->{'name'} = $tmp; - } - elsif ( GetOptions( 'rename=s' => \$tmp ) && $tmp ) { - $cmd = 'rename'; - $opts->{'name'} = $tmp; - GetOptions( 'newname=s' => \$opts->{'newname'} ); - unless ( $opts->{'newname'} ) { - usage(); - exit(-1); - } - } - elsif ( GetOptions( 'delete=s' => \$tmp ) && $tmp) { - $cmd = 'delete'; - $opts->{'name'} = $tmp; - } else { - $cmd = 'usage'; - } - - return; -} - -sub usage { - require Pod::Usage; - Pod::Usage::pod2usage({ verbose => 2 }); -} - -my $help; -if ( GetOptions( 'help|h' => \$help ) && $help ) { - usage(); - exit; -} - -parse_args(); - -require RT; -RT->LoadConfig; -RT->Init; - -require RT::Principal; -require RT::User; -require RT::Group; -require RT::ScripActions; - - -{ - eval "main::$cmd()"; - if ( $@ ) { - print STDERR $@ ."\n"; - } -} - -exit(0); - -=head1 USAGE - -rt-email-group-admin --COMMAND ARGS - -=head1 COMMANDS - -=head2 list - -Lists actions and its descriptions. - -=cut - -sub list { - my $actions = _get_our_actions(); - while( my $a = $actions->Next ) { - _list( $a ); - } - return; -} - -sub _list { - my $action = shift; - - print "Name: ". $action->Name() ."\n"; - print "Module: ". $action->ExecModule() ."\n"; - - my @princ = argument_to_list( $action ); - - print "Members: \n"; - foreach( @princ ) { - my $obj = RT::Principal->new( RT->SystemUser ); - $obj->Load( $_ ); - next unless $obj->id; - - print "\t". $obj->PrincipalType; - print "\t=> ". $obj->Object->Name; - print "(Disabled!!!)" if $obj->Disabled; - print "\n"; - } - print "\n"; - return; -} - -=head2 create NAME [--comment] [--group GNAME] [--user UNAME] - -Creates new action with NAME and adds users and/or groups to its -recipient list. Would be notify as comment if --comment specified. - -=cut - -sub create { - my $actions = RT::ScripActions->new( RT->SystemUser ); - $actions->Limit( - FIELD => 'Name', - VALUE => $opts->{'name'}, - ); - if ( $actions->Count ) { - print STDERR "ScripAction '". $opts->{'name'} ."' allready exists\n"; - exit(-1); - } - - my @groups = _check_groups( @{ $opts->{'groups'} } ); - my @users = _check_users( @{ $opts->{'users'} } ); - unless ( @users + @groups ) { - print STDERR "List of groups and users is empty\n"; - exit(-1); - } - - my $action = __create_empty( $opts->{'name'}, $opts->{'comment'} ); - - __add( $action, $_ ) foreach( @users ); - __add( $action, $_ ) foreach( @groups ); - - return; -} - -sub __create_empty { - my $name = shift; - my $as_comment = shift || 0; - require RT::ScripAction; - my $action = RT::ScripAction->new( RT->SystemUser ); - $action->Create( - Name => $name, - Description => "Created with rt-email-group-admin script", - ExecModule => $as_comment? 'NotifyGroupAsComment': 'NotifyGroup', - Argument => '', - ); - - return $action; -} - -sub _check_groups -{ - return grep { $_ ? 1: do { print STDERR "Group '$_' skipped, doesn't exist\n"; 0; } } - map { __check_group($_) } @_; -} - -sub __check_group -{ - my $instance = shift; - require RT::Group; - my $obj = RT::Group->new( RT->SystemUser ); - $obj->LoadUserDefinedGroup( $instance ); - return $obj->id ? $obj : undef; -} - -sub _check_users -{ - return grep { $_ ? 1: do { print STDERR "User '$_' skipped, doesn't exist\n"; 0; } } - map { __check_user($_) } @_; -} - -sub __check_user -{ - my $instance = shift; - require RT::User; - my $obj = RT::User->new( RT->SystemUser ); - $obj->Load( $instance ); - return $obj->id ? $obj : undef; -} - -=head2 add NAME [--group GNAME] [--user UNAME] - -Adds groups and/or users to recipients of the action NAME. - -=cut - -sub add { - my $action = _get_action_by_name( $opts->{'name'} ); - unless ( $action ) { - print STDERR "ScripAction '". $opts->{'name'} ."' doesn't exist\n"; - exit(-1); - } - - my @groups = _check_groups( @{ $opts->{'groups'} } ); - my @users = _check_users( @{ $opts->{'users'} } ); - - unless ( @users + @groups ) { - print STDERR "List of groups and users is empty\n"; - exit(-1); - } - - __add( $action, $_ ) foreach @users; - __add( $action, $_ ) foreach @groups; - - return; -} - -sub __add -{ - my $action = shift; - my $obj = shift; - - my @cur = argument_to_list( $action ); - - my $id = $obj->id; - return if grep $_ == $id, @cur; - - push @cur, $id; - - return $action->__Set( Field => 'Argument', Value => join(',', @cur) ); -} - -=head2 delete NAME - -Deletes action NAME if scrips doesn't use it. - -=cut - -sub delete { - my $action = _get_action_by_name( $opts->{'name'} ); - unless ( $action ) { - print STDERR "ScripAction '". $opts->{'name'} ."' doesn't exist\n"; - exit(-1); - } - - require RT::Scrips; - my $scrips = RT::Scrips->new( RT->SystemUser ); - $scrips->Limit( FIELD => 'ScripAction', VALUE => $action->id ); - if ( $scrips->Count ) { - my @sid; - while( my $s = $scrips->Next ) { - push @sid, $s->id; - } - print STDERR "ScripAction '". $opts->{'name'} ."'" - . " is in use by Scrip(s) ". join( ", ", map "#$_", @sid ) - . "\n"; - exit(-1); - } - - return __delete( $action ); -} - -sub __delete { - require DBIx::SearchBuilder::Record; - return DBIx::SearchBuilder::Record::Delete( shift ); -} - -sub _get_action_by_name { - my $name = shift; - my $actions = _get_our_actions(); - $actions->Limit( - FIELD => 'Name', - VALUE => $name - ); - - if ( $actions->Count > 1 ) { - print STDERR "More then one ScripAction with name '$name'\n"; - } - - return $actions->First; -} - -=head2 switch NAME - -Switch action NAME from notify as correspondence to comment and back. - -=cut - -sub switch { - my $action = _get_action_by_name( $opts->{'name'} ); - unless ( $action ) { - print STDERR "ScripAction '". $opts->{'name'} ."' doesn't exist\n"; - exit(-1); - } - - my %h = ( - NotifyGroup => 'NotifyGroupAsComment', - NotifyGroupAsComment => 'NotifyGroup' - ); - - return $action->__Set( - Field => 'ExecModule', - Value => $h{ $action->ExecModule } - ); -} - -=head2 rename NAME --newname NEWNAME - -Renames action NAME to NEWNAME. - -=cut - -sub rename { - my $action = _get_action_by_name( $opts->{'name'} ); - unless ( $action ) { - print STDERR "ScripAction '". $opts->{'name'} ."' doesn't exist\n"; - exit(-1); - } - - my $actions = RT::ScripActions->new( RT->SystemUser ); - $actions->Limit( FIELD => 'Name', VALUE => $opts->{'newname'} ); - if ( $actions->Count ) { - print STDERR "ScripAction '". $opts->{'newname'} ."' allready exists\n"; - exit(-1); - } - - return $action->__Set( - Field => 'Name', - Value => $opts->{'newname'}, - ); -} - -=head2 NOTES - -If command has option --group or --user then you can use it more then once, -if other is not specified. - -=cut - -############### -#### Utils #### -############### - -sub argument_to_list { - my $action = shift; - require RT::Action::NotifyGroup; - return RT::Action::NotifyGroup->__SplitArg( $action->Argument ); -} - -sub _get_our_actions { - my $actions = RT::ScripActions->new( RT->SystemUser ); - $actions->Limit( - FIELD => 'ExecModule', - VALUE => 'NotifyGroup', - ENTRYAGGREGATOR => 'OR', - ); - $actions->Limit( - FIELD => 'ExecModule', - VALUE => 'NotifyGroupAsComment', - ENTRYAGGREGATOR => 'OR', - ); - - return $actions; -} - -=head1 AUTHOR - -Ruslan U. Zakirov E<lt>ruz@bestpractical.comE<gt> - -=head1 SEE ALSO - -L<RT::Action::NotifyGroup>, L<RT::Action::NotifyGroupAsComment> - -=cut diff --git a/rt/sbin/rt-preferences-viewer b/rt/sbin/rt-preferences-viewer deleted file mode 100755 index 69a65a8bb..000000000 --- a/rt/sbin/rt-preferences-viewer +++ /dev/null @@ -1,149 +0,0 @@ -#!/usr/bin/perl -# BEGIN BPS TAGGED BLOCK {{{ -# -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC -# <sales@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 = ("/opt/rt3/lib", "/opt/rt3/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 Getopt::Long; -my %opt; -GetOptions( \%opt, 'help|h', 'user|u=s', 'option|o=s' ); - -if ( $opt{help} ) { - require Pod::Usage; - Pod::Usage::pod2usage({ verbose => 2 }); - exit; -} - -require RT; -RT::LoadConfig(); -RT::Init(); - -require RT::Attributes; -my $attrs = RT::Attributes->new( RT->SystemUser ); -$attrs->Limit( FIELD => 'Name', VALUE => 'Pref-RT::System-1' ); -$attrs->Limit( FIELD => 'ObjectType', VALUE => 'RT::User' ); - -if ($opt{user}) { - my $user = RT::User->new( RT->SystemUser ); - my ($val, $msg) = $user->Load($opt{user}); - unless ($val) { - RT->Logger->error("Unable to load $opt{user}: $msg"); - exit(1); - } - $attrs->Limit( FIELD => 'ObjectId', VALUE => $user->Id ); -} - -use Data::Dumper; -$Data::Dumper::Terse = 1; - -while (my $attr = $attrs->Next ) { - my $user = RT::User->new( RT->SystemUser ); - my ($val, $msg) = $user->Load($attr->ObjectId); - unless ($val) { - RT->Logger->warn("Unable to load User ".$attr->ObjectId." $msg"); - next; - } - next if $user->Disabled; - - my $content = $attr->Content; - if ( my $config_name = $opt{option} ) { - if ( exists $content->{$config_name} ) { - my $setting = $content->{$config_name}; - print $user->Name, "\t$config_name: $setting\n"; - } - } else { - print $user->Name, " => ", Dumper($content); - } - -} - -__END__ - -=head1 NAME - -rt-preferences-viewer - show user defined preferences - -=head1 SYNOPSIS - - rt-preferences-viewer - - rt-preferences-viewer --user=falcone - show only the falcone user's preferences - - rt-preferences-viewer --option=EmailFrequency - show users who have set the EmailFrequence config option - -=head1 DESCRIPTION - -This script shows user settings of preferences. If a user is using the system -default, it will not be listed. You can limit to a user name or id or to users -with a particular option set. diff --git a/rt/sbin/rt-server b/rt/sbin/rt-server deleted file mode 100755 index 78533c6e5..000000000 --- a/rt/sbin/rt-server +++ /dev/null @@ -1,282 +0,0 @@ -#!/usr/bin/perl -w -# BEGIN BPS TAGGED BLOCK {{{ -# -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC -# <sales@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 warnings; -use strict; - -# fix lib paths, some may be relative -BEGIN { - die <<EOT if ${^TAINT}; -RT does not run under Perl's "taint mode". Remove -T from the command -line, or remove the PerlTaintCheck parameter from your mod_perl -configuration. -EOT - - require File::Spec; - my @libs = ("/opt/rt3/lib", "/opt/rt3/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 Getopt::Long; -no warnings 'once'; - -if (grep { m/help/ } @ARGV) { - require Pod::Usage; - print Pod::Usage::pod2usage( { verbose => 2 } ); - exit; -} - -require RT; -RT->LoadConfig(); -require Module::Refresh if RT->Config->Get('DevelMode'); - -require RT::Handle; -my ($integrity, $state, $msg) = RT::Handle->CheckIntegrity; - -unless ( $integrity ) { - print STDERR <<EOF; - -RT couldn't connect to the database where tickets are stored. -If this is a new installation of RT, you should visit the URL below -to configure RT and initialize your database. - -If this is an existing RT installation, this may indicate a database -connectivity problem. - -The error RT got back when trying to connect to your database was: - -$msg - -EOF - - require RT::Installer; - # don't enter install mode if the file exists but is unwritable - if (-e RT::Installer->ConfigFile && !-w _) { - die 'Since your configuration exists (' - . RT::Installer->ConfigFile - . ") but is not writable, I'm refusing to do anything.\n"; - } - - RT->Config->Set( 'LexiconLanguages' => '*' ); - RT::I18N->Init; - - RT->InstallMode(1); -} else { - RT->Init(); - - my ($status, $msg) = RT::Handle->CheckCompatibility( $RT::Handle->dbh, 'post'); - unless ( $status ) { - print STDERR $msg, "\n\n"; - exit -1; - } -} - -# we must disconnect DB before fork -if ($RT::Handle) { - $RT::Handle->dbh(undef); - undef $RT::Handle; -} - -require RT::Interface::Web::Handler; -my $app = RT::Interface::Web::Handler->PSGIApp; - -if ($ENV{RT_TESTING}) { - my $screen_logger = $RT::Logger->remove('screen'); - require Log::Dispatch::Perl; - $RT::Logger->add( - Log::Dispatch::Perl->new( - name => 'rttest', - min_level => $screen_logger->min_level, - action => { - error => 'warn', - critical => 'warn' - } - ) - ); - require Plack::Middleware::Test::StashWarnings; - $app = Plack::Middleware::Test::StashWarnings->wrap($app); -} - -# when used as a psgi file -if (caller) { - return $app; -} - - -# load appropriate server - -require Plack::Runner; - -my $is_fastcgi = $0 =~ m/fcgi$/; -my $r = Plack::Runner->new( $0 =~ 'standalone' ? ( server => 'Standalone' ) : - $is_fastcgi ? ( server => 'FCGI' ) - : (), - env => 'deployment' ); - -# figure out the port -my $port; - -# handle "rt-server 8888" for back-compat, but complain about it -if ($ARGV[0] && $ARGV[0] =~ m/^\d+$/) { - warn "Deprecated: please run $0 --port $ARGV[0] instead\n"; - unshift @ARGV, '--port'; -} - -my @args = @ARGV; - -use List::MoreUtils 'last_index'; -my $last_index = last_index { $_ eq '--port' } @args; - -my $explicit_port; - -if ( $last_index != -1 && $args[$last_index+1] =~ /^\d+$/ ) { - $explicit_port = $args[$last_index+1]; - $port = $explicit_port; - - # inform the rest of the system what port we manually chose - my $old_app = $app; - $app = sub { - my $env = shift; - - $env->{'rt.explicit_port'} = $port; - - $old_app->($env, @_); - }; -} -else { - # default to the configured WebPort and inform Plack::Runner - $port = RT->Config->Get('WebPort') || '8080'; - push @args, '--port', $port; -} - -push @args, '--server', 'Standalone' if RT->InstallMode; -push @args, '--server', 'Starlet' unless $r->{server} || grep { m/--server/ } @args; - -$r->parse_options(@args); - -delete $r->{options} if $is_fastcgi; ### mangle_host_port_socket ruins everything - -unless ($r->{env} eq 'development') { - push @{$r->{options}}, server_ready => sub { - my($args) = @_; - my $name = $args->{server_software} || ref($args); # $args is $server - my $host = $args->{host} || 0; - my $proto = $args->{proto} || 'http'; - print STDERR "$name: Accepting connections at $proto://$host:$args->{port}/\n"; - }; -} -eval { $r->run($app) }; -if (my $err = $@) { - handle_startup_error($err); -} - -exit 0; - -sub handle_startup_error { - my $err = shift; - if ( $err =~ /listen/ ) { - handle_bind_error(); - } else { - die - "Something went wrong while trying to run RT's standalone web server:\n\t" - . $err; - } -} - - -sub handle_bind_error { - - print STDERR <<EOF; -WARNING: RT couldn't start up a web server on port @{[$port]}. -This is often the case if the port is already in use or you're running @{[$0]} -as someone other than your system's "root" user. You may also specify a -temporary port with: $0 --port <port> -EOF - - if ($explicit_port) { - print STDERR - "Please check your system configuration or choose another port\n\n"; - } -} - -__END__ - -=head1 NAME - -rt-server - RT standalone server - -=head1 SYNOPSIS - - # runs prefork server listening on port 8080, requires Starlet - rt-server --port 8080 - - # runs server listening on port 8080 - rt-server --server Standalone --port 8080 - # or - standalone_httpd --port 8080 - - # runs other PSGI server on port 8080 - rt-server --server Starman --port 8080 diff --git a/rt/sbin/rt-server.fcgi b/rt/sbin/rt-server.fcgi deleted file mode 100755 index 78533c6e5..000000000 --- a/rt/sbin/rt-server.fcgi +++ /dev/null @@ -1,282 +0,0 @@ -#!/usr/bin/perl -w -# BEGIN BPS TAGGED BLOCK {{{ -# -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC -# <sales@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 warnings; -use strict; - -# fix lib paths, some may be relative -BEGIN { - die <<EOT if ${^TAINT}; -RT does not run under Perl's "taint mode". Remove -T from the command -line, or remove the PerlTaintCheck parameter from your mod_perl -configuration. -EOT - - require File::Spec; - my @libs = ("/opt/rt3/lib", "/opt/rt3/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 Getopt::Long; -no warnings 'once'; - -if (grep { m/help/ } @ARGV) { - require Pod::Usage; - print Pod::Usage::pod2usage( { verbose => 2 } ); - exit; -} - -require RT; -RT->LoadConfig(); -require Module::Refresh if RT->Config->Get('DevelMode'); - -require RT::Handle; -my ($integrity, $state, $msg) = RT::Handle->CheckIntegrity; - -unless ( $integrity ) { - print STDERR <<EOF; - -RT couldn't connect to the database where tickets are stored. -If this is a new installation of RT, you should visit the URL below -to configure RT and initialize your database. - -If this is an existing RT installation, this may indicate a database -connectivity problem. - -The error RT got back when trying to connect to your database was: - -$msg - -EOF - - require RT::Installer; - # don't enter install mode if the file exists but is unwritable - if (-e RT::Installer->ConfigFile && !-w _) { - die 'Since your configuration exists (' - . RT::Installer->ConfigFile - . ") but is not writable, I'm refusing to do anything.\n"; - } - - RT->Config->Set( 'LexiconLanguages' => '*' ); - RT::I18N->Init; - - RT->InstallMode(1); -} else { - RT->Init(); - - my ($status, $msg) = RT::Handle->CheckCompatibility( $RT::Handle->dbh, 'post'); - unless ( $status ) { - print STDERR $msg, "\n\n"; - exit -1; - } -} - -# we must disconnect DB before fork -if ($RT::Handle) { - $RT::Handle->dbh(undef); - undef $RT::Handle; -} - -require RT::Interface::Web::Handler; -my $app = RT::Interface::Web::Handler->PSGIApp; - -if ($ENV{RT_TESTING}) { - my $screen_logger = $RT::Logger->remove('screen'); - require Log::Dispatch::Perl; - $RT::Logger->add( - Log::Dispatch::Perl->new( - name => 'rttest', - min_level => $screen_logger->min_level, - action => { - error => 'warn', - critical => 'warn' - } - ) - ); - require Plack::Middleware::Test::StashWarnings; - $app = Plack::Middleware::Test::StashWarnings->wrap($app); -} - -# when used as a psgi file -if (caller) { - return $app; -} - - -# load appropriate server - -require Plack::Runner; - -my $is_fastcgi = $0 =~ m/fcgi$/; -my $r = Plack::Runner->new( $0 =~ 'standalone' ? ( server => 'Standalone' ) : - $is_fastcgi ? ( server => 'FCGI' ) - : (), - env => 'deployment' ); - -# figure out the port -my $port; - -# handle "rt-server 8888" for back-compat, but complain about it -if ($ARGV[0] && $ARGV[0] =~ m/^\d+$/) { - warn "Deprecated: please run $0 --port $ARGV[0] instead\n"; - unshift @ARGV, '--port'; -} - -my @args = @ARGV; - -use List::MoreUtils 'last_index'; -my $last_index = last_index { $_ eq '--port' } @args; - -my $explicit_port; - -if ( $last_index != -1 && $args[$last_index+1] =~ /^\d+$/ ) { - $explicit_port = $args[$last_index+1]; - $port = $explicit_port; - - # inform the rest of the system what port we manually chose - my $old_app = $app; - $app = sub { - my $env = shift; - - $env->{'rt.explicit_port'} = $port; - - $old_app->($env, @_); - }; -} -else { - # default to the configured WebPort and inform Plack::Runner - $port = RT->Config->Get('WebPort') || '8080'; - push @args, '--port', $port; -} - -push @args, '--server', 'Standalone' if RT->InstallMode; -push @args, '--server', 'Starlet' unless $r->{server} || grep { m/--server/ } @args; - -$r->parse_options(@args); - -delete $r->{options} if $is_fastcgi; ### mangle_host_port_socket ruins everything - -unless ($r->{env} eq 'development') { - push @{$r->{options}}, server_ready => sub { - my($args) = @_; - my $name = $args->{server_software} || ref($args); # $args is $server - my $host = $args->{host} || 0; - my $proto = $args->{proto} || 'http'; - print STDERR "$name: Accepting connections at $proto://$host:$args->{port}/\n"; - }; -} -eval { $r->run($app) }; -if (my $err = $@) { - handle_startup_error($err); -} - -exit 0; - -sub handle_startup_error { - my $err = shift; - if ( $err =~ /listen/ ) { - handle_bind_error(); - } else { - die - "Something went wrong while trying to run RT's standalone web server:\n\t" - . $err; - } -} - - -sub handle_bind_error { - - print STDERR <<EOF; -WARNING: RT couldn't start up a web server on port @{[$port]}. -This is often the case if the port is already in use or you're running @{[$0]} -as someone other than your system's "root" user. You may also specify a -temporary port with: $0 --port <port> -EOF - - if ($explicit_port) { - print STDERR - "Please check your system configuration or choose another port\n\n"; - } -} - -__END__ - -=head1 NAME - -rt-server - RT standalone server - -=head1 SYNOPSIS - - # runs prefork server listening on port 8080, requires Starlet - rt-server --port 8080 - - # runs server listening on port 8080 - rt-server --server Standalone --port 8080 - # or - standalone_httpd --port 8080 - - # runs other PSGI server on port 8080 - rt-server --server Starman --port 8080 diff --git a/rt/sbin/rt-setup-database b/rt/sbin/rt-setup-database deleted file mode 100755 index d0b149b4c..000000000 --- a/rt/sbin/rt-setup-database +++ /dev/null @@ -1,590 +0,0 @@ -#!/usr/bin/perl -# BEGIN BPS TAGGED BLOCK {{{ -# -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC -# <sales@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; - -use vars qw($Nobody $SystemUser $item); - -# fix lib paths, some may be relative -BEGIN { - require File::Spec; - my @libs = ("/opt/rt3/lib", "/opt/rt3/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 Term::ReadKey; -use Getopt::Long; - -$| = 1; # unbuffer all output. - -my %args = ( - dba => 'freeside', -); -GetOptions( - \%args, - 'action=s', - 'force', 'debug', - 'dba=s', 'dba-password=s', 'prompt-for-dba-password', - 'datafile=s', 'datadir=s', 'skip-create', 'root-password-file=s', - 'help|h', -); - -no warnings 'once'; -if ( $args{help} || ! $args{'action'} ) { - require Pod::Usage; - Pod::Usage::pod2usage({ verbose => 2 }); - exit; -} - -require RT; -RT->LoadConfig(); -RT->InitClasses(); - -# Force warnings to be output to STDERR if we're not already logging -# them at a higher level -RT->Config->Set( LogToScreen => 'warning') - unless ( RT->Config->Get( 'LogToScreen' ) - && RT->Config->Get( 'LogToScreen' ) =~ /^(debug|info|notice)$/ ); - -# get customized root password -my $root_password; -if ( $args{'root-password-file'} ) { - open( my $fh, '<', $args{'root-password-file'} ) - or die "Couldn't open 'args{'root-password-file'}' for reading: $!"; - $root_password = <$fh>; - chomp $root_password; - my $min_length = RT->Config->Get('MinimumPasswordLength'); - if ($min_length) { - die -"password needs to be at least $min_length long, please check file '$args{'root-password-file'}'" - if length $root_password < $min_length; - } - close $fh; -} - - -# check and setup @actions -my @actions = grep $_, split /,/, $args{'action'}; -if ( @actions > 1 && $args{'datafile'} ) { - print STDERR "You can not use --datafile option with multiple actions.\n"; - exit(-1); -} -foreach ( @actions ) { - unless ( /^(?:init|create|drop|schema|acl|coredata|insert|upgrade)$/ ) { - print STDERR "$0 called with an invalid --action parameter.\n"; - exit(-1); - } - if ( /^(?:init|drop|upgrade)$/ && @actions > 1 ) { - print STDERR "You can not mix init, drop or upgrade action with any action.\n"; - exit(-1); - } -} - -# convert init to multiple actions -my $init = 0; -if ( $actions[0] eq 'init' ) { - if ($args{'skip-create'}) { - @actions = qw(schema coredata insert); - } else { - @actions = qw(create schema acl coredata insert); - } - $init = 1; -} - -# set options from environment -foreach my $key(qw(Type Host Name User Password)) { - next unless exists $ENV{ 'RT_DB_'. uc $key }; - print "Using Database$key from RT_DB_". uc($key) ." environment variable.\n"; - RT->Config->Set( "Database$key", $ENV{ 'RT_DB_'. uc $key }); -} - -my $db_type = RT->Config->Get('DatabaseType') || ''; -my $db_host = RT->Config->Get('DatabaseHost') || ''; -my $db_name = RT->Config->Get('DatabaseName') || ''; -my $db_user = RT->Config->Get('DatabaseUser') || ''; -my $db_pass = RT->Config->Get('DatabasePassword') || ''; - -# load it here to get error immidiatly if DB type is not supported -require RT::Handle; - -if ( $db_type eq 'SQLite' && !File::Spec->file_name_is_absolute($db_name) ) { - $db_name = File::Spec->catfile($RT::VarPath, $db_name); - RT->Config->Set( DatabaseName => $db_name ); -} - -my $dba_user = $args{'dba'} || $ENV{'RT_DBA_USER'} || $db_user || ''; -my $dba_pass = exists($args{'dba-password'}) - ? $args{'dba-password'} - : $ENV{'RT_DBA_PASSWORD'}; - -if ($args{'skip-create'}) { - $dba_user = $db_user; - $dba_pass = $db_pass; -} else { - if ( !$args{force} && ( !defined $dba_pass || $args{'prompt-for-dba-password'} ) ) { - $dba_pass = get_dba_password(); - chomp $dba_pass if defined($dba_pass); - } -} - -print "Working with:\n" - ."Type:\t$db_type\nHost:\t$db_host\nName:\t$db_name\n" - ."User:\t$db_user\nDBA:\t$dba_user" . ($args{'skip-create'} ? ' (No DBA)' : '') . "\n"; - -foreach my $action ( @actions ) { - no strict 'refs'; - my ($status, $msg) = *{ 'action_'. $action }{'CODE'}->( %args ); - error($action, $msg) unless $status; - print $msg .".\n" if $msg; - print "Done.\n"; -} - -sub action_create { - my %args = @_; - my $dbh = get_system_dbh(); - my ($status, $msg) = RT::Handle->CheckCompatibility( $dbh, 'pre' ); - return ($status, $msg) unless $status; - - print "Now creating a $db_type database $db_name for RT.\n"; - return RT::Handle->CreateDatabase( $dbh ); -} - -sub action_drop { - my %args = @_; - - print "Dropping $db_type database $db_name.\n"; - unless ( $args{'force'} ) { - print <<END; - -About to drop $db_type database $db_name on $db_host. -WARNING: This will erase all data in $db_name. - -END - exit(-2) unless _yesno(); - } - - my $dbh = get_system_dbh(); - return RT::Handle->DropDatabase( $dbh ); -} - -sub action_schema { - my %args = @_; - my $dbh = get_admin_dbh(); - my ($status, $msg) = RT::Handle->CheckCompatibility( $dbh, 'pre' ); - return ($status, $msg) unless $status; - - print "Now populating database schema.\n"; - return RT::Handle->InsertSchema( $dbh, $args{'datafile'} || $args{'datadir'} ); -} - -sub action_acl { - my %args = @_; - my $dbh = get_admin_dbh(); - my ($status, $msg) = RT::Handle->CheckCompatibility( $dbh, 'pre' ); - return ($status, $msg) unless $status; - - print "Now inserting database ACLs.\n"; - return RT::Handle->InsertACL( $dbh, $args{'datafile'} || $args{'datadir'} ); -} - -sub action_coredata { - my %args = @_; - $RT::Handle = RT::Handle->new; - $RT::Handle->dbh( undef ); - RT::ConnectToDatabase(); - RT::InitLogging(); - my ($status, $msg) = RT::Handle->CheckCompatibility( $RT::Handle->dbh, 'pre' ); - return ($status, $msg) unless $status; - - print "Now inserting RT core system objects.\n"; - return $RT::Handle->InsertInitialData; -} - -sub action_insert { - my %args = @_; - $RT::Handle = RT::Handle->new; - RT::Init(); - my ($status, $msg) = RT::Handle->CheckCompatibility( $RT::Handle->dbh, 'pre' ); - return ($status, $msg) unless $status; - - print "Now inserting data.\n"; - my $file = $args{'datafile'}; - $file = $RT::EtcPath . "/initialdata" if $init && !$file; - $file ||= $args{'datadir'}."/content"; - - # Slurp in backcompat - my %removed; - my @back = @{$args{backcompat} || []}; - if (@back) { - my @lines = do {local @ARGV = @back; <>}; - for (@lines) { - s/\#.*//; - next unless /\S/; - my ($class, @fields) = split; - $class->_BuildTableAttributes; - $RT::Logger->debug("Temporarily removing @fields from $class"); - $removed{$class}{$_} = delete $RT::Record::_TABLE_ATTR->{$class}{$_} - for @fields; - } - } - - my @ret = $RT::Handle->InsertData( $file, $root_password ); - - # Put back the fields we chopped off - for my $class (keys %removed) { - $RT::Record::_TABLE_ATTR->{$class}{$_} = $removed{$class}{$_} - for keys %{$removed{$class}}; - } - return @ret; -} - -sub action_upgrade { - my %args = @_; - my $base_dir = $args{'datadir'} || "./etc/upgrade"; - return (0, "Couldn't read dir '$base_dir' with upgrade data") - unless -d $base_dir || -r _; - - my $upgrading_from = undef; - do { - if ( defined $upgrading_from ) { - print "Doesn't match #.#.#: "; - } else { - print "Enter RT version you're upgrading from: "; - } - $upgrading_from = scalar <STDIN>; - chomp $upgrading_from; - $upgrading_from =~ s/\s+//g; - } while $upgrading_from !~ /^\d+\.\d+\.\w+$/; - - my $upgrading_to = $RT::VERSION; - return (0, "The current version $upgrading_to is lower than $upgrading_from") - if RT::Handle::cmp_version( $upgrading_from, $upgrading_to ) > 0; - - return (1, "The version $upgrading_to you're upgrading to is up to date") - if RT::Handle::cmp_version( $upgrading_from, $upgrading_to ) == 0; - - my @versions = get_versions_from_to($base_dir, $upgrading_from, undef); - return (1, "No DB changes since $upgrading_from") - unless @versions; - - if (RT::Handle::cmp_version($versions[-1], $upgrading_to) > 0) { - print "\n***** There are upgrades for $versions[-1], which is later than $upgrading_to,\n"; - print "***** which you are nominally upgrading to. Upgrading to $versions[-1] instead.\n"; - $upgrading_to = $versions[-1]; - } - - print "\nGoing to apply following upgrades:\n"; - print map "* $_\n", @versions; - - { - my $custom_upgrading_to = undef; - do { - if ( defined $custom_upgrading_to ) { - print "Doesn't match #.#.#: "; - } else { - print "\nEnter RT version if you want to stop upgrade at some point,\n"; - print " or leave it blank if you want apply above upgrades: "; - } - $custom_upgrading_to = scalar <STDIN>; - chomp $custom_upgrading_to; - $custom_upgrading_to =~ s/\s+//g; - last unless $custom_upgrading_to; - } while $custom_upgrading_to !~ /^\d+\.\d+\.\w+$/; - - if ( $custom_upgrading_to ) { - return ( - 0, "The version you entered ($custom_upgrading_to) is lower than\n" - ."version you're upgrading from ($upgrading_from)" - ) if RT::Handle::cmp_version( $upgrading_from, $custom_upgrading_to ) > 0; - - return (1, "The version you're upgrading to is up to date") - if RT::Handle::cmp_version( $upgrading_from, $custom_upgrading_to ) == 0; - - if ( RT::Handle::cmp_version( $RT::VERSION, $custom_upgrading_to ) < 0 ) { - print "Version you entered is greater than installed ($RT::VERSION).\n"; - _yesno() or exit(-2); - } - # ok, checked everything no let's refresh list - $upgrading_to = $custom_upgrading_to; - @versions = get_versions_from_to($base_dir, $upgrading_from, $upgrading_to); - - return (1, "No DB changes between $upgrading_from and $upgrading_to") - unless @versions; - - print "\nGoing to apply following upgrades:\n"; - print map "* $_\n", @versions; - } - } - - print "\nIT'S VERY IMPORTANT TO BACK UP BEFORE THIS STEP\n\n"; - _yesno() or exit(-2) unless $args{'force'}; - - my ( $ret, $msg ); - foreach my $n ( 0..$#versions ) { - my $v = $versions[$n]; - my @back = grep {-e $_} map {"$base_dir/$versions[$_]/backcompat"} $n+1..$#versions; - print "Processing $v\n"; - my %tmp = (%args, datadir => "$base_dir/$v", datafile => undef, backcompat => \@back); - if ( -e "$base_dir/$v/schema.$db_type" ) { - ( $ret, $msg ) = action_schema( %tmp ); - return ( $ret, $msg ) unless $ret; - } - if ( -e "$base_dir/$v/acl.$db_type" ) { - ( $ret, $msg ) = action_acl( %tmp ); - return ( $ret, $msg ) unless $ret; - } - if ( -e "$base_dir/$v/content" ) { - ( $ret, $msg ) = action_insert( %tmp ); - return ( $ret, $msg ) unless $ret; - } - } - return 1; -} - -sub get_versions_from_to { - my ($base_dir, $from, $to) = @_; - - opendir( my $dh, $base_dir ) or die "couldn't open dir: $!"; - my @versions = grep -d "$base_dir/$_" && /\d+\.\d+\.\d+/, readdir $dh; - closedir $dh; - - return - grep defined $to ? RT::Handle::cmp_version($_, $to) <= 0 : 1, - grep RT::Handle::cmp_version($_, $from) > 0, - sort RT::Handle::cmp_version @versions; -} - -sub error { - my ($action, $msg) = @_; - print STDERR "Couldn't finish '$action' step.\n\n"; - print STDERR "ERROR: $msg\n\n"; - exit(-1); -} - -sub get_dba_password { - print "In order to create or update your RT database," - . " this script needs to connect to your " - . " $db_type instance on $db_host as $dba_user\n"; - print "Please specify that user's database password below. If the user has no database\n"; - print "password, just press return.\n\n"; - print "Password: "; - ReadMode('noecho'); - my $password = ReadLine(0); - ReadMode('normal'); - print "\n"; - return ($password); -} - -# get_system_dbh -# Returns L<DBI> database handle connected to B<system> with DBA credentials. -# See also L<RT::Handle/SystemDSN>. - - -sub get_system_dbh { - return _get_dbh( RT::Handle->SystemDSN, $dba_user, $dba_pass ); -} - -sub get_admin_dbh { - return _get_dbh( RT::Handle->DSN, $dba_user, $dba_pass ); -} - -# get_rt_dbh [USER, PASSWORD] - -# Returns L<DBI> database handle connected to RT database, -# you may specify credentials(USER and PASSWORD) to connect -# with. By default connects with credentials from RT config. - -sub get_rt_dbh { - return _get_dbh( RT::Handle->DSN, $db_user, $db_pass ); -} - -sub _get_dbh { - my ($dsn, $user, $pass) = @_; - my $dbh = DBI->connect( - $dsn, $user, $pass, - { RaiseError => 0, PrintError => 0 }, - ); - unless ( $dbh ) { - my $msg = "Failed to connect to $dsn as user '$user': ". $DBI::errstr; - if ( $args{'debug'} ) { - require Carp; Carp::confess( $msg ); - } else { - print STDERR $msg; exit -1; - } - } - return $dbh; -} - -sub _yesno { - print "Proceed [y/N]:"; - my $x = scalar(<STDIN>); - $x =~ /^y/i; -} - -1; - -__END__ - -=head1 NAME - -rt-setup-database - Set up RT's database - -=head1 SYNOPSIS - - rt-setup-database --action ... - -=head1 OPTIONS - -=over - -=item action - -Several actions can be combined using comma separated list. - -=over - -=item init - -Initialize the database. This is combination of multiple actions listed below. -Create DB, schema, setup acl, insert core data and initial data. - -=item upgrade - -Apply all needed schema/acl/content updates (will ask for version to upgrade -from) - -=item create - -Create the database. - -=item drop - -Drop the database. This will B<ERASE ALL YOUR DATA>. - -=item schema - -Initialize only the database schema - -To use a local or supplementary datafile, specify it using the '--datadir' -option below. - -=item acl - -Initialize only the database ACLs - -To use a local or supplementary datafile, specify it using the '--datadir' -option below. - -=item coredata - -Insert data into RT's database. This data is required for normal functioning of -any RT instance. - -=item insert - -Insert data into RT's database. By default, will use RT's installation data. -To use a local or supplementary datafile, specify it using the '--datafile' -option below. - -=back - -=item datafile - -file path of the data you want to action on - -e.g. C<--datafile /path/to/datafile> - -=item datadir - -Used to specify a path to find the local database schema and acls to be -installed. - -e.g. C<--datadir /path/to/> - -=item dba - -dba's username - -=item dba-password - -dba's password - -=item prompt-for-dba-password - -Ask for the database administrator's password interactively - -=item skip-create - -for 'init': skip creating the database and the user account, so we don't need -administrator privileges - -=item root-password-file - -for 'init' and 'insert': rather than using the default administrative password -for RT's "root" user, use the password in this file. - -=back diff --git a/rt/sbin/rt-shredder b/rt/sbin/rt-shredder deleted file mode 100755 index 7c577bfa9..000000000 --- a/rt/sbin/rt-shredder +++ /dev/null @@ -1,323 +0,0 @@ -#!/usr/bin/perl -# BEGIN BPS TAGGED BLOCK {{{ -# -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC -# <sales@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 }}} -=head1 NAME - -rt-shredder - Script which wipe out tickets from RT DB - -=head1 SYNOPSIS - - rt-shredder --plugin list - rt-shredder --plugin help-Tickets - rt-shredder --plugin 'Tickets=query,Queue="general" and Status="deleted"' - - rt-shredder --sqldump unshred.sql --plugin ... - rt-shredder --force --plugin ... - -=head1 DESCRIPTION - -rt-shredder - is script that allow you to wipe out objects -from RT DB. This script uses API that L<RT::Shredder> module adds to RT. -Script can be used as example of usage of the shredder API. - -=head1 USAGE - -You can use several options to control which objects script -should wipeout. - -=head1 OPTIONS - -=head2 --sqldump <filename> - -Outputs INSERT queiries into file. This dump can be used to restore data -after wiping out. - -By default creates files -F<< <RT_home>/var/data/RT-Shredder/<ISO_date>-XXXX.sql >> - -=head2 --object (DEPRECATED) - -Option has been deprecated, use plugin C<Objects> instead. - -=head2 --plugin '<plugin name>[=<arg>,<val>[;<arg>,<val>]...]' - -You can use plugins to select RT objects with various conditions. -See also --plugin list and --plugin help options. - -=head2 --plugin list - -Output list of the available plugins. - -=head2 --plugin help-<plugin name> - -Outputs help for specified plugin. - -=head2 --force - -Script doesn't ask any questions. - -=head1 SEE ALSO - -L<RT::Shredder> - -=cut - -use strict; -use warnings FATAL => 'all'; - -# fix lib paths, some may be relative -BEGIN { - require File::Spec; - my @libs = ("/opt/rt3/lib", "/opt/rt3/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::Shredder (); -use Getopt::Long qw(GetOptions); -use File::Spec (); - -use RT::Shredder::Plugin (); -# prefetch list of plugins -our %plugins = RT::Shredder::Plugin->List; - -our %opt; -parse_args(); - -RT::Shredder::Init( %opt ); -my $shredder = RT::Shredder->new; - -{ - my $plugin = eval { $shredder->AddDumpPlugin( Arguments => { - file_name => $opt{'sqldump'}, - from_storage => 0, - } ) }; - if( $@ ) { - print STDERR "ERROR: Couldn't open SQL dump file: $@\n"; - exit 1 if $opt{'sqldump'}; - - print STDERR "WARNING: It's strongly recommended to use '--sqldump <filename>' option\n"; - unless( $opt{'force'} ) { - exit 0 unless prompt_yN( "Do you want to proceed?" ); - } - } else { - print "SQL dump file is '". $plugin->FileName ."'\n"; - } -} - -my @objs = process_plugins( $shredder ); -prompt_delete_objs( \@objs ) unless $opt{'force'}; - -$shredder->PutObjects( Objects => $_ ) foreach @objs; -eval { $shredder->WipeoutAll }; -if( $@ ) { - require RT::Shredder::Exceptions; - if( my $e = RT::Shredder::Exception::Info->caught ) { - print "\nERROR: $e\n\n"; - exit 1; - } - die $@; -} - -sub prompt_delete_objs -{ - my( $objs ) = @_; - unless( @$objs ) { - print "Objects list is empty, try refine search options\n"; - exit 0; - } - my $list = "Next ". scalar( @$objs ) ." objects would be deleted:\n"; - foreach my $o( @$objs ) { - $list .= "\t". $o->_AsString ." object\n"; - } - print $list; - exit(0) unless prompt_yN( "Do you want to proceed?" ); -} - -sub prompt_yN -{ - my $text = shift; - print "$text [y/N] "; - unless( <STDIN> =~ /^(?:y|yes)$/i ) { - return 0; - } - return 1; -} - -sub usage -{ - require RT::Shredder::POD; - RT::Shredder::POD::shredder_cli( $0, \*STDOUT ); - exit 1; -} - -sub parse_args -{ - my $tmp; - Getopt::Long::Configure( "pass_through" ); - my @objs = (); - if( GetOptions( 'object=s' => \@objs ) && @objs ) { - print STDERR "Option --object had been deprecated, use plugin 'Objects' instead\n"; - exit(1); - } - - my @plugins = (); - if( GetOptions( 'plugin=s' => \@plugins ) && @plugins ) { - $opt{'plugin'} = \@plugins; - foreach my $str( @plugins ) { - if( $str =~ /^\s*list\s*$/ ) { - show_plugin_list(); - } elsif( $str =~ /^\s*help-(\w+)\s*$/ ) { - show_plugin_help( $1 ); - } elsif( $str =~ /^(\w+)(=.*)?$/ && !$plugins{$1} ) { - print "Couldn't find plugin '$1'\n"; - show_plugin_list(); - } - } - } - - # other options make no sense without previouse - usage() unless keys %opt; - - if( GetOptions( 'force' => \$tmp ) && $tmp ) { - $opt{'force'}++; - } - $tmp = undef; - if( GetOptions( 'sqldump=s' => \$tmp ) && $tmp ) { - $opt{'sqldump'} = $tmp; - } - return; -} - -sub process_plugins -{ - my $shredder = shift; - - my @res; - foreach my $str( @{ $opt{'plugin'} } ) { - my $plugin = RT::Shredder::Plugin->new; - my( $status, $msg ) = $plugin->LoadByString( $str ); - unless( $status ) { - print STDERR "Couldn't load plugin\n"; - print STDERR "Error: $msg\n"; - exit(1); - } - if ( lc $plugin->Type eq 'search' ) { - push @res, _process_search_plugin( $shredder, $plugin ); - } - elsif ( lc $plugin->Type eq 'dump' ) { - _process_dump_plugin( $shredder, $plugin ); - } - } - return RT::Shredder->CastObjectsToRecords( Objects => \@res ); -} - -sub _process_search_plugin { - my ($shredder, $plugin) = @_; - my ($status, @objs) = $plugin->Run; - unless( $status ) { - print STDERR "Couldn't run plugin\n"; - print STDERR "Error: $objs[1]\n"; - exit(1); - } - - my $msg; - ($status, $msg) = $plugin->SetResolvers( Shredder => $shredder ); - unless( $status ) { - print STDERR "Couldn't set conflicts resolver\n"; - print STDERR "Error: $msg\n"; - exit(1); - } - return @objs; -} - -sub _process_dump_plugin { - my ($shredder, $plugin) = @_; - $shredder->AddDumpPlugin( - Object => $plugin, - ); -} - -sub show_plugin_list -{ - print "Plugins list:\n"; - print "\t$_\n" foreach( grep !/^Base$/, keys %plugins ); - exit(1); -} - -sub show_plugin_help -{ - my( $name ) = @_; - require RT::Shredder::POD; - unless( $plugins{ $name } ) { - print "Couldn't find plugin '$name'\n"; - show_plugin_list(); - } - RT::Shredder::POD::plugin_cli( $plugins{'Base'}, \*STDOUT, 1 ); - RT::Shredder::POD::plugin_cli( $plugins{ $name }, \*STDOUT ); - exit(1); -} - -exit(0); diff --git a/rt/sbin/rt-test-dependencies b/rt/sbin/rt-test-dependencies deleted file mode 100755 index f5eb584a3..000000000 --- a/rt/sbin/rt-test-dependencies +++ /dev/null @@ -1,661 +0,0 @@ -#!/usr/bin/perl -# BEGIN BPS TAGGED BLOCK {{{ -# -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC -# <sales@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 }}} -# -# This is just a basic script that checks to make sure that all -# the modules needed by RT before you can install it. -# - -use strict; -no warnings qw(numeric redefine); -use Getopt::Long; -my %args; -my %deps; -GetOptions( - \%args, 'v|verbose', - 'install', 'with-MYSQL', - 'with-POSTGRESQL|with-pg|with-pgsql', 'with-SQLITE', - 'with-ORACLE', 'with-FASTCGI', - 'with-MODPERL1', 'with-MODPERL2', - 'with-STANDALONE', - - 'with-DEV', - - 'with-GPG', - 'with-ICAL', - 'with-SMTP', - 'with-GRAPHVIZ', - 'with-GD', - 'with-DASHBOARDS', - 'with-USERLOGO', - 'with-SSL-MAILGATE', - - 'download=s', - 'repository=s', - 'list-deps', - 'help|h', -); - -if ( $args{help} ) { - require Pod::Usage; - Pod::Usage::pod2usage( { verbose => 2 } ); - exit; -} - -# Set up defaults -my %default = ( - 'with-MASON' => 1, - 'with-PSGI' => 0, - 'with-CORE' => 1, - 'with-CLI' => 1, - 'with-MAILGATE' => 1, - 'with-DEV' => 0, - 'with-GPG' => 1, - 'with-ICAL' => 1, - 'with-SMTP' => 1, - 'with-GRAPHVIZ' => 0, - 'with-GD' => 0, - 'with-DASHBOARDS' => 1, - 'with-USERLOGO' => 1, - 'with-SSL-MAILGATE' => 0, -); -$args{$_} = $default{$_} foreach grep !exists $args{$_}, keys %default; - -{ - my $section; - my %always_show_sections = ( - perl => 1, - users => 1, - ); - - sub section { - my $s = shift; - $section = $s; - print "$s:\n" unless $args{'list-deps'}; - } - - sub print_found { - my $msg = shift; - my $test = shift; - my $extra = shift; - - unless ( $args{'list-deps'} ) { - if ( $args{'v'} or not $test or $always_show_sections{$section} ) { - print "\t$msg ..."; - print $test ? "found" : "MISSING"; - print "\n"; - } - - print "\t\t$extra\n" if defined $extra; - } - } -} - -sub conclude { - my %missing_by_type = @_; - - unless ( $args{'list-deps'} ) { - unless ( keys %missing_by_type ) { - print "\nAll dependencies have been found.\n"; - return; - } - - print "\nSOME DEPENDENCIES WERE MISSING.\n"; - - for my $type ( keys %missing_by_type ) { - my $missing = $missing_by_type{$type}; - - print "$type missing dependencies:\n"; - for my $name ( keys %$missing ) { - my $module = $missing->{$name}; - my $version = $module->{version}; - my $error = $module->{error}; - print_found( $name . ( $version && !$error ? " >= $version" : "" ), - 0, $module->{error} ); - } - } - exit 1; - } -} - -sub text_to_hash { - my %hash; - for my $line ( split /\n/, $_[0] ) { - my($key, $value) = $line =~ /(\S+)\s*(\S*)/; - $value ||= ''; - $hash{$key} = $value; - } - - return %hash; -} - -$deps{'CORE'} = [ text_to_hash( << '.') ]; -Class::Accessor 0.34 -DateTime 0.44 -DateTime::Locale 0.40 -Digest::base -Digest::MD5 2.27 -Digest::SHA -DBI 1.37 -Class::ReturnValue 0.40 -DBIx::SearchBuilder 1.59 -Text::Template 1.44 -File::ShareDir -File::Spec 0.8 -HTML::Quoted -HTML::Scrubber 0.08 -Log::Dispatch 2.23 -Sys::Syslog 0.16 -Locale::Maketext 1.06 -Locale::Maketext::Lexicon 0.32 -Locale::Maketext::Fuzzy -MIME::Entity 5.425 -Mail::Mailer 1.57 -Email::Address -Text::Wrapper -Time::ParseDate -Time::HiRes -File::Temp 0.19 -Text::Quoted 2.02 -Tree::Simple 1.04 -UNIVERSAL::require -Regexp::Common -Scalar::Util -Module::Versions::Report 1.05 -Cache::Simple::TimedExpiry -Encode 2.39 -CSS::Squish 0.06 -File::Glob -Devel::StackTrace 1.19 -Text::Password::Pronounceable -Devel::GlobalDestruction -List::MoreUtils -Net::CIDR -Regexp::Common::net::CIDR -Regexp::IPv6 -. - -$deps{'MASON'} = [ text_to_hash( << '.') ]; -HTML::Mason 1.43 -Errno -Digest::MD5 2.27 -CGI::Cookie 1.20 -Storable 2.08 -Apache::Session 1.53 -XML::RSS 1.05 -Text::WikiFormat 0.76 -CSS::Squish 0.06 -Devel::StackTrace 1.19 -JSON -IPC::Run3 -. - -$deps{'PSGI'} = [ text_to_hash( << '.') ]; -CGI 3.38 -CGI::PSGI 0.12 -HTML::Mason::PSGIHandler 0.52 -Plack 0.9971 -Plack::Handler::Starlet -CGI::Emulate::PSGI -. - -$deps{'MAILGATE'} = [ text_to_hash( << '.') ]; -HTML::TreeBuilder -HTML::FormatText -Getopt::Long -LWP::UserAgent -Pod::Usage -. - -$deps{'SSL-MAILGATE'} = [ text_to_hash( << '.') ]; -Crypt::SSLeay -Net::SSL -LWP::UserAgent 6.0 -LWP::Protocol::https -Mozilla::CA -. - -$deps{'CLI'} = [ text_to_hash( << '.') ]; -Getopt::Long 2.24 -LWP -HTTP::Request::Common -Text::ParseWords -Term::ReadLine -Term::ReadKey -. - -$deps{'DEV'} = [ text_to_hash( << '.') ]; -Email::Abstract -Test::Email -HTML::Form -HTML::TokeParser -WWW::Mechanize 1.52 -Test::WWW::Mechanize 1.30 -Module::Refresh 0.03 -Test::Expect 0.31 -XML::Simple -File::Find -Test::Deep 0 # needed for shredder tests -String::ShellQuote 0 # needed for gnupg-incoming.t -Log::Dispatch::Perl -Test::Warn -Test::Builder 0.90 # needed for is_passing -Test::MockTime -Log::Dispatch::Perl -Test::WWW::Mechanize::PSGI -Plack::Middleware::Test::StashWarnings -Test::LongString -. - -$deps{'FASTCGI'} = [ text_to_hash( << '.') ]; -FCGI -FCGI::ProcManager -. - -$deps{'MODPERL1'} = [ text_to_hash( << '.') ]; -Apache::Request -Apache::DBI 0.92 -. - -$deps{'MODPERL2'} = [ text_to_hash( << '.') ]; -Apache::DBI -HTML::Mason 1.36 -. - -$deps{'MYSQL'} = [ text_to_hash( << '.') ]; -DBD::mysql 2.1018 -. - -$deps{'ORACLE'} = [ text_to_hash( << '.') ]; -DBD::Oracle -. - -$deps{'POSTGRESQL'} = [ text_to_hash( << '.') ]; -DBD::Pg 1.43 -. - -$deps{'SQLITE'} = [ text_to_hash( << '.') ]; -DBD::SQLite 1.00 -. - -$deps{'GPG'} = [ text_to_hash( << '.') ]; -GnuPG::Interface -PerlIO::eol -. - -$deps{'ICAL'} = [ text_to_hash( << '.') ]; -Data::ICal -. - -$deps{'SMTP'} = [ text_to_hash( << '.') ]; -Net::SMTP -. - -$deps{'DASHBOARDS'} = [ text_to_hash( << '.') ]; -HTML::RewriteAttributes 0.04 -MIME::Types -. - -$deps{'GRAPHVIZ'} = [ text_to_hash( << '.') ]; -GraphViz -IPC::Run -. - -$deps{'GD'} = [ text_to_hash( << '.') ]; -GD -GD::Graph -GD::Text -. - -$deps{'USERLOGO'} = [ text_to_hash( << '.') ]; -Convert::Color -. - -my %AVOID = ( - 'DBD::Oracle' => [qw(1.23)], -); - -if ($args{'download'}) { - download_mods(); -} - - -check_perl_version(); - -check_users(); - -my %Missing_By_Type = (); -foreach my $type (sort grep $args{$_}, keys %args) { - next unless ($type =~ /^with-(.*?)$/) and $deps{$1}; - - $type = $1; - section("$type dependencies"); - - my @missing; - my @deps = @{ $deps{$type} }; - - my %missing = test_deps(@deps); - - if ( $args{'install'} ) { - for my $module (keys %missing) { - resolve_dep($module, $missing{$module}{version}); - my $m = $module . '.pm'; - $m =~ s!::!/!g; - if ( delete $INC{$m} ) { - my $symtab = $module . '::'; - no strict 'refs'; - for my $symbol ( keys %{$symtab} ) { - next if substr( $symbol, -2, 2 ) eq '::'; - delete $symtab->{$symbol}; - } - } - delete $missing{$module} - if test_dep($module, $missing{$module}{version}, $AVOID{$module}); - } - } - - $Missing_By_Type{$type} = \%missing if keys %missing; -} - -conclude(%Missing_By_Type); - -sub test_deps { - my @deps = @_; - - my %missing; - while(@deps) { - my $module = shift @deps; - my $version = shift @deps; - my($test, $error) = test_dep($module, $version, $AVOID{$module}); - my $msg = $module . ($version && !$error ? " >= $version" : ''); - print_found($msg, $test, $error); - - $missing{$module} = { version => $version, error => $error } unless $test; - } - - return %missing; -} - -sub test_dep { - my $module = shift; - my $version = shift; - my $avoid = shift; - - if ( $args{'list-deps'} ) { - print $module, ': ', $version || 0, "\n"; - } - else { - eval "use $module $version ()"; - if ( my $error = $@ ) { - return 0 unless wantarray; - - $error =~ s/\n(.*)$//s; - $error =~ s/at \(eval \d+\) line \d+\.$//; - undef $error if $error =~ /this is only/; - - return ( 0, $error ); - } - - if ( $avoid ) { - my $version = $module->VERSION; - if ( grep $version eq $_, @$avoid ) { - return 0 unless wantarray; - return (0, "It's known that there are problems with RT and version '$version' of '$module' module. If it's the latest available version of the module then you have to downgrade manually."); - } - } - - return 1; - } -} - -sub resolve_dep { - my $module = shift; - my $version = shift; - - print "\nInstall module $module\n"; - - my $ext = $ENV{'RT_FIX_DEPS_CMD'} || $ENV{'PERL_PREFER_CPAN_CLIENT'}; - unless( $ext ) { - my $configured = 1; - { - local @INC = @INC; - if ( $ENV{'HOME'} ) { - unshift @INC, "$ENV{'HOME'}/.cpan"; - } - $configured = eval { require CPAN::MyConfig } || eval { require CPAN::Config }; - } - unless ( $configured ) { - print <<END; -You haven't configured the CPAN shell yet. -Please run `/usr/bin/perl -MCPAN -e shell` to configure it. -END - exit(1); - } - my $rv = eval { require CPAN; CPAN::Shell->install($module) }; - return $rv unless $@; - - print <<END; -Failed to load module CPAN. - --------- Error --------- -$@ ------------------------- - -When we tried to start installing RT's perl dependencies, -we were unable to load the CPAN client. This module is usually distributed -with Perl. This usually indicates that your vendor has shipped an unconfigured -or incorrectly configured CPAN client. -The error above may (or may not) give you a hint about what went wrong - -You have several choices about how to install dependencies in -this situatation: - -1) use a different tool to install dependencies by running setting the following - shell environment variable and rerunning this tool: - RT_FIX_DEPS_CMD='/usr/bin/perl -MCPAN -e"install %s"' -2) Attempt to configure CPAN by running: - `/usr/bin/perl -MCPAN -e shell` program from shell. - If this fails, you may have to manually upgrade CPAN (see below) -3) Try to update the CPAN client. Download it from: - http://search.cpan.org/dist/CPAN and try again -4) Install each dependency manually by downloading them one by one from - http://search.cpan.org - -END - exit(1); - } - - if( $ext =~ /\%s/) { - $ext =~ s/\%s/$module/g; # sprintf( $ext, $module ); - } else { - $ext .= " $module"; - } - print "\t\tcommand: '$ext'\n"; - return scalar `$ext 1>&2`; -} - -sub download_mods { - my %modules; - use CPAN; - - foreach my $key (keys %deps) { - my @deps = (@{$deps{$key}}); - while (@deps) { - my $mod = shift @deps; - my $ver = shift @deps; - next if ($mod =~ /^(DBD-|Apache-Request)/); - $modules{$mod} = $ver; - } - } - my @mods = keys %modules; - CPAN::get(); - my $moddir = $args{'download'}; - foreach my $mod (@mods) { - $CPAN::Config->{'build_dir'} = $moddir; - CPAN::get($mod); - } - - opendir(DIR, $moddir); - while ( my $dir = readdir(DIR)) { - print "Dir is $dir\n"; - next if ( $dir =~ /^\.\.?$/); - - # Skip things we've previously tagged - my $out = `svn ls $args{'repository'}/tags/$dir`; - next if ($out); - - if ($dir =~ /^(.*)-(.*?)$/) { - `svn_load_dirs -no_user_input -t tags/$dir -v $args{'repository'} dists/$1 $moddir/$dir`; - `rm -rf $moddir/$dir`; - - } - - } - closedir(DIR); - exit; -} - -sub check_perl_version { - section("perl"); - eval {require 5.008003}; - if ($@) { - print_found("5.8.3", 0,"RT is known to be non-functional on versions of perl older than 5.8.3. Please upgrade to 5.8.3 or newer."); - exit(1); - } else { - print_found( sprintf(">=5.8.3(%vd)", $^V), 1 ); - } -} - -sub check_users { - section("users"); - print_found("rt group (freeside)", defined getgrnam("freeside")); - print_found("bin owner (root)", defined getpwnam("root")); - print_found("libs owner (root)", defined getpwnam("root")); - print_found("libs group (bin)", defined getgrnam("bin")); - print_found("web owner (freeside)", defined getpwnam("freeside")); - print_found("web group (freeside)", defined getgrnam("freeside")); -} - -1; - -__END__ - -=head1 NAME - -rt-test-dependencies - test rt's dependencies - -=head1 SYNOPSIS - - rt-test-dependencies - rt-test-dependencies --install - rt-test-dependencies --with-mysql --with-fastcgi - -=head1 DESCRIPTION - -by default, C<rt-test-dependencies> determines whether you have installed all -the perl modules RT needs to run. - -the "RT_FIX_DEPS_CMD" environment variable, if set, will be used instead of -the standard CPAN shell by --install to install any required modules. it will -be called with the module name, or, if "RT_FIX_DEPS_CMD" contains a "%s", will -replace the "%s" with the module name before calling the program. - -=head1 OPTIONS - -=over - -=item install - - install missing modules - -=item verbose - -list the status of all dependencies, rather than just the missing ones. - --v is equal to --verbose - -=item specify dependencies - -=over - -=item --with-mysql - - database interface for mysql - -=item --with-postgresql - - database interface for postgresql - -=item with-oracle - - database interface for oracle - -=item with-sqlite - - database interface and driver for sqlite (unsupported) - -=item with-fastcgi - - libraries needed to support the fastcgi handler - -=item with-modperl1 - - libraries needed to support the modperl 1 handler - -=item with-modperl2 - - libraries needed to support the modperl 2 handler - -=item with-dev - - tools needed for RT development - -=back - -=back - diff --git a/rt/sbin/rt-validator b/rt/sbin/rt-validator deleted file mode 100755 index 9ef191cbe..000000000 --- a/rt/sbin/rt-validator +++ /dev/null @@ -1,1182 +0,0 @@ -#!/usr/bin/perl -# BEGIN BPS TAGGED BLOCK {{{ -# -# COPYRIGHT: -# -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC -# <sales@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 = ("/opt/rt3/lib", "/opt/rt3/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 Getopt::Long; -my %opt = (); -GetOptions( - \%opt, - 'check|c', - 'resolve', - 'force', - 'verbose|v', - 'help|h', -); - -if ( $opt{help} || !$opt{check} ) { - require Pod::Usage; - print Pod::Usage::pod2usage( { verbose => 2 } ); - exit; -} - -usage_warning() if $opt{'resolve'} && !$opt{'force'}; - - -sub usage_warning { - print <<END; -This utility can fix some issues with DB by creating or updating. In some -cases there is no enough data to resurect a missing record, but records which -refers to a missing can be deleted. It's up to you to decide what to do. - -In any case it's highly recommended to have a backup before resolving anything. - -Press enter to continue. -END -# Read a line of text, any line of text - <STDIN>; -} - -use RT; -RT::LoadConfig(); -RT::Init(); - -my $dbh = $RT::Handle->dbh; -my $db_type = RT->Config->Get('DatabaseType'); - -my %TYPE = ( - 'Transactions.Field' => 'text', - 'Transactions.OldValue' => 'text', - 'Transactions.NewValue' => 'text', -); - -my @models = qw( - ACE - Attachment - Attribute - CachedGroupMember - CustomField - CustomFieldValue - GroupMember - Group - Link - ObjectCustomField - ObjectCustomFieldValue - Principal - Queue - ScripAction - ScripCondition - Scrip - Template - Ticket - Transaction - User -); - -my %redo_on; -$redo_on{'Delete'} = { - ACL => [], - - Attributes => [], - - Links => [], - - CustomFields => [], - CustomFieldValues => [], - ObjectCustomFields => [], - ObjectCustomFieldValues => [], - - Queues => [], - - Scrips => [], - ScripActions => [], - ScripConditions => [], - Templates => [], - - Tickets => [ 'Tickets -> other', 'Tickets <-> Role Groups' ], - Transactions => [ 'Attachments -> other' ], - - Principals => ['User <-> ACL equivalence group', 'GMs -> Groups, Members' ], - Users => ['User <-> ACL equivalence group', 'GMs -> Groups, Members', 'Principals -> Users' ], - Groups => ['User <-> ACL equivalence group', 'GMs -> Groups, Members', 'CGM vs. GM', 'Principals -> Groups' ], - - GroupMembers => [ 'CGM vs. GM' ], - CachedGroupMembers => [ 'CGM vs. GM' ], -}; -$redo_on{'Create'} = { - Principals => ['User <-> ACL equivalence group', 'GMs -> Groups, Members' ], - Groups => ['User <-> ACL equivalence group', 'GMs -> Groups, Members', 'CGM vs. GM' ], - GroupMembers => [ 'CGM vs. GM' ], - CachedGroupMembers => [ 'CGM vs. GM' ], -}; -$redo_on{'Update'} = { - Groups => ['User Defined Group Name uniqueness'], -}; - -my %describe_cb; -%describe_cb = ( - Attachments => sub { - my $row = shift; - my $txn_id = $row->{transactionid}; - my $res = 'Attachment #'. $row->{id} .' -> Txn #'. $txn_id; - return $res .', '. describe( 'Transactions', $txn_id ); - }, - Transactions => sub { - my $row = shift; - return 'Transaction #'. $row->{id} .' -> object '. $row->{objecttype} .' #'. $row->{objectid}; - }, -); - -{ my %cache = (); -sub m2t($) { - my $model = shift; - return $cache{$model} if $cache{$model}; - my $class = "RT::$model"; - my $object = $class->new( RT->SystemUser ); - return $cache{$model} = $object->Table; -} } - -my (@do_check, %redo_check); - -my @CHECKS; -foreach my $table ( qw(Users Groups) ) { - push @CHECKS, "$table -> Principals" => sub { - my $msg = "A record in $table refers to a nonexistent record in Principals." - ." The script can either create the missing record in Principals" - ." or delete the record in $table."; - my ($type) = ($table =~ /^(.*)s$/); - check_integrity( - $table, 'id' => 'Principals', 'id', - join_condition => 't.PrincipalType = ?', - bind_values => [ $type ], - action => sub { - my $id = shift; - return unless my $a = prompt_action( ['Delete', 'create'], $msg ); - - if ( $a eq 'd' ) { - delete_record( $table, $id ); - } - elsif ( $a eq 'c' ) { - my $principal_id = create_record( 'Principals', - id => $id, PrincipalType => $type, ObjectId => $id, Disabled => 0 - ); - } - else { - die "Unknown action '$a'"; - } - }, - ); - }; - - push @CHECKS, "Principals -> $table" => sub { - my $msg = "A record in Principals refers to a nonexistent record in $table." - ." In some cases it's possible to manually resurrect such records," - ." but this utility can only delete records."; - - check_integrity( - 'Principals', 'id' => $table, 'id', - condition => 's.PrincipalType = ?', - bind_values => [ $table =~ /^(.*)s$/ ], - action => sub { - my $id = shift; - return unless prompt( 'Delete', $msg ); - - delete_record( 'Principals', $id ); - }, - ); - }; -} - -push @CHECKS, 'User <-> ACL equivalence group' => sub { - # from user to group - check_integrity( - 'Users', 'id' => 'Groups', 'Instance', - join_condition => 't.Domain = ? AND t.Type = ?', - bind_values => [ 'ACLEquivalence', 'UserEquiv' ], - action => sub { - my $id = shift; - return unless prompt( - 'Create', "Found an user that has no ACL equivalence group." - ); - - my $gid = create_record( 'Groups', - Domain => 'ACLEquivalence', Type => 'UserEquiv', Instance => $id, - ); - }, - ); - # from group to user - check_integrity( - 'Groups', 'Instance' => 'Users', 'id', - condition => 's.Domain = ? AND s.Type = ?', - bind_values => [ 'ACLEquivalence', 'UserEquiv' ], - action => sub { - my $id = shift; - return unless prompt( - 'Delete', "Found an user ACL equivalence group, but there is no user." - ); - - delete_record( 'Groups', $id ); - }, - ); - # one ACL equiv group for each user - check_uniqueness( - 'Groups', - columns => ['Instance'], - condition => '.Domain = ? AND .Type = ?', - bind_values => [ 'ACLEquivalence', 'UserEquiv' ], - ); -}; - -# check integrity of Queue role groups -push @CHECKS, 'Queues <-> Role Groups' => sub { - # XXX: we check only that there is at least one group for a queue - # from queue to group - check_integrity( - 'Queues', 'id' => 'Groups', 'Instance', - join_condition => 't.Domain = ?', - bind_values => [ 'RT::Queue-Role' ], - ); - # from group to queue - check_integrity( - 'Groups', 'Instance' => 'Queues', 'id', - condition => 's.Domain = ?', - bind_values => [ 'RT::Queue-Role' ], - action => sub { - my $id = shift; - return unless prompt( - 'Delete', "Found a role group of a nonexistent queue." - ); - - delete_record( 'Groups', $id ); - }, - ); -}; - -# check integrity of Ticket role groups -push @CHECKS, 'Tickets <-> Role Groups' => sub { - # XXX: we check only that there is at least one group for a queue - # from queue to group - check_integrity( - 'Tickets', 'id' => 'Groups', 'Instance', - join_condition => 't.Domain = ?', - bind_values => [ 'RT::Ticket-Role' ], - ); - # from group to ticket - check_integrity( - 'Groups', 'Instance' => 'Tickets', 'id', - condition => 's.Domain = ?', - bind_values => [ 'RT::Ticket-Role' ], - action => sub { - my $id = shift; - return unless prompt( - 'Delete', "Found a role group of a nonexistent ticket." - ); - - delete_record( 'Groups', $id ); - }, - ); -}; - -# additional CHECKS on groups -push @CHECKS, 'Role Groups (Instance, Type) uniqueness' => sub { - # Check that Domain, Instance and Type are unique - check_uniqueness( - 'Groups', - columns => ['Domain', 'Instance', 'Type'], - condition => '.Domain LIKE ?', - bind_values => [ '%-Role' ], - ); -}; - -push @CHECKS, 'System internal group uniqueness' => sub { - check_uniqueness( - 'Groups', - columns => ['Instance', 'Type'], - condition => '.Domain = ?', - bind_values => [ 'SystemInternal' ], - ); -}; - -# CHECK that user defined group names are unique -push @CHECKS, 'User Defined Group Name uniqueness' => sub { - check_uniqueness( - 'Groups', - columns => ['Name'], - condition => '.Domain = ?', - bind_values => [ 'UserDefined' ], - extra_tables => ['Principals sp', 'Principals tp'], - extra_condition => join(" and ", map { "$_.id = ${_}p.ObjectId and ${_}p.PrincipalType = ? and ${_}p.Disabled != 1" } qw(s t)), - extra_values => ['Group', 'Group'], - action => sub { - return unless prompt( - 'Rename', "Found a user defined group with a non-unique Name." - ); - - my $id = shift; - my %cols = @_; - update_records('Groups', { id => $id }, { Name => join('-', $cols{'Name'}, $id) }); - }, - ); -}; - -push @CHECKS, 'GMs -> Groups, Members' => sub { - my $msg = "A record in GroupMembers references an object that doesn't exist." - ." Maybe you deleted a group or principal directly from the database?" - ." Usually it's OK to delete such records."; - check_integrity( - 'GroupMembers', 'GroupId' => 'Groups', 'id', - action => sub { - my $id = shift; - return unless prompt( 'Delete', $msg ); - - delete_record( 'GroupMembers', $id ); - }, - ); - check_integrity( - 'GroupMembers', 'MemberId' => 'Principals', 'id', - action => sub { - my $id = shift; - return unless prompt( 'Delete', $msg ); - - delete_record( 'GroupMembers', $id ); - }, - ); -}; - -# CGM and GM -push @CHECKS, 'CGM vs. GM' => sub { - # all GM record should be duplicated in CGM - check_integrity( - GroupMembers => ['GroupId', 'MemberId'], - CachedGroupMembers => ['GroupId', 'MemberId'], - join_condition => 't.ImmediateParentId = t.GroupId AND t.Via = t.id', - action => sub { - my $id = shift; - return unless prompt( - 'Create', - "Found a record in GroupMembers that has no direct duplicate in CachedGroupMembers table." - ); - - my $gm = RT::GroupMember->new( RT->SystemUser ); - $gm->Load( $id ); - die "Couldn't load GM record #$id" unless $gm->id; - my $cgm = create_record( 'CachedGroupMembers', - GroupId => $gm->GroupId, MemberId => $gm->MemberId, - ImmediateParentId => $gm->GroupId, Via => undef, - Disabled => 0, # XXX: we should check integrity of Disabled field - ); - update_records( "CachedGroupMembers", { id => $cgm }, { Via => $cgm } ); - }, - ); - # all first level CGM records should have a GM record - check_integrity( - CachedGroupMembers => ['GroupId', 'MemberId'], - GroupMembers => ['GroupId', 'MemberId'], - condition => 's.ImmediateParentId = s.GroupId AND s.Via = s.id AND s.GroupId != s.MemberId', - action => sub { - my $id = shift; - return unless prompt( - 'Delete', - "Found a record in CachedGroupMembers for a (Group, Member) pair" - ." that doesn't exist in the GroupMembers table." - ); - - delete_record( 'CachedGroupMembers', $id ); - }, - ); - # each group should have a CGM record where MemberId == GroupId - check_integrity( - Groups => ['id', 'id'], - CachedGroupMembers => ['GroupId', 'MemberId'], - join_condition => 't.ImmediateParentId = t.GroupId AND t.Via = t.id', - action => sub { - my $id = shift; - return unless prompt( - 'Create', - "Found a record in Groups that has no direct" - ." duplicate in CachedGroupMembers table." - ); - - my $g = RT::Group->new( RT->SystemUser ); - $g->Load( $id ); - die "Couldn't load group #$id" unless $g->id; - die "Loaded group by $id has id ". $g->id unless $g->id == $id; - my $cgm = create_record( 'CachedGroupMembers', - GroupId => $id, MemberId => $id, - ImmediateParentId => $id, Via => undef, - Disabled => $g->Disabled, - ); - update_records( "CachedGroupMembers", { id => $cgm }, { Via => $cgm } ); - }, - ); - - # and back, each record in CGM with MemberId == GroupId without exceptions - # should reference a group - check_integrity( - CachedGroupMembers => ['GroupId', 'MemberId'], - Groups => ['id', 'id'], - condition => "s.GroupId = s.MemberId", - action => sub { - my $id = shift; - return unless prompt( - 'Delete', - "Found a record in CachedGroupMembers for a group that doesn't exist." - ); - - delete_record( 'CachedGroupMembers', $id ); - }, - ); - # Via - check_integrity( - CachedGroupMembers => 'Via', - CachedGroupMembers => 'id', - action => sub { - my $id = shift; - return unless prompt( - 'Delete', - "Found a record in CachedGroupMembers with Via that references a nonexistent record." - ); - - delete_record( 'CachedGroupMembers', $id ); - }, - ); - - # for every CGM where ImmediateParentId != GroupId there should be - # matching parent record (first level) - check_integrity( - CachedGroupMembers => ['ImmediateParentId', 'MemberId'], - CachedGroupMembers => ['GroupId', 'MemberId'], - join_condition => 't.Via = t.id', - condition => 's.ImmediateParentId != s.GroupId', - action => sub { - my $id = shift; - return unless prompt( - 'Delete', - "Found a record in CachedGroupMembers that references a nonexistent record in CachedGroupMembers table." - ); - - delete_record( 'CachedGroupMembers', $id ); - }, - ); - - # for every CGM where ImmediateParentId != GroupId there should be - # matching "grand" parent record - check_integrity( - CachedGroupMembers => ['GroupId', 'ImmediateParentId', 'Via'], - CachedGroupMembers => ['GroupId', 'MemberId', 'id'], - condition => 's.ImmediateParentId != s.GroupId', - action => sub { - my $id = shift; - return unless prompt( - 'Delete', - "Found a record in CachedGroupMembers that references a nonexistent record in CachedGroupMembers table." - ); - - delete_record( 'CachedGroupMembers', $id ); - }, - ); - - # CHECK recursive records: - # if we have CGM1 (G1,M1,V1,IP1) then for every GM2(G2, M2), where G2 == M1, - # we should have CGM3 where G3 = G1, M3 = M2, V3 = ID1, IP3 = M1 - { - my $query = <<END; -SELECT cgm1.GroupId, gm2.MemberId, cgm1.id AS Via, - cgm1.MemberId AS ImmediateParentId, cgm1.Disabled -FROM - CachedGroupMembers cgm1 - CROSS JOIN GroupMembers gm2 - LEFT JOIN CachedGroupMembers cgm3 ON ( - cgm3.GroupId = cgm1.GroupId - AND cgm3.MemberId = gm2.MemberId - AND cgm3.Via = cgm1.id - AND cgm3.ImmediateParentId = cgm1.MemberId ) -WHERE cgm1.GroupId != cgm1.MemberId -AND gm2.GroupId = cgm1.MemberId -AND cgm3.id IS NULL -END - - my $action = sub { - my %props = @_; - return unless prompt( - 'Create', - "Found records in CachedGroupMembers table without recursive duplicates." - ); - my $cgm = create_record( 'CachedGroupMembers', %props ); - }; - - my $sth = execute_query( $query ); - while ( my ($g, $m, $via, $ip, $dis) = $sth->fetchrow_array ) { - print STDERR "Principal #$m is member of #$ip when #$ip is member of #$g,"; - print STDERR " but there is no cached GM record that $m is member of #$g.\n"; - $action->( - GroupId => $g, MemberId => $m, Via => $via, - ImmediateParentId => $ip, Disabled => $dis, - ); - } - } -}; - -# Tickets -push @CHECKS, 'Tickets -> other' => sub { - check_integrity( - 'Tickets', 'EffectiveId' => 'Tickets', 'id', - action => sub { - my $id = shift; - return unless prompt( - 'Delete', - "Found a ticket that's been merged into a ticket that no longer exists." - ); - - delete_record( 'Tickets', $id ); - }, - ); - check_integrity( - 'Tickets', 'Queue' => 'Queues', 'id', - ); - check_integrity( - 'Tickets', 'Owner' => 'Users', 'id', - ); - # XXX: check that owner is only member of owner role group -}; - - -push @CHECKS, 'Transactions -> other' => sub { - foreach my $model ( @models ) { - check_integrity( - 'Transactions', 'ObjectId' => m2t($model), 'id', - condition => 's.ObjectType = ?', - bind_values => [ "RT::$model" ], - action => sub { - my $id = shift; - return unless prompt( - 'Delete', "Found a transaction without object." - ); - - delete_record( 'Transactions', $id ); - }, - ); - } - # type = CustomField - check_integrity( - 'Transactions', 'Field' => 'CustomFields', 'id', - condition => 's.Type = ?', - bind_values => [ 'CustomField' ], - ); - # type = Take, Untake, Force, Steal or Give - check_integrity( - 'Transactions', 'OldValue' => 'Users', 'id', - condition => 's.Type IN (?, ?, ?, ?, ?)', - bind_values => [ qw(Take Untake Force Steal Give) ], - action => sub { - my $id = shift; - return unless prompt( - 'Delete', "Found a transaction regarding Owner changes," - ." but the User with id stored in OldValue column doesn't exist anymore." - ); - - delete_record( 'Transactions', $id ); - }, - ); - check_integrity( - 'Transactions', 'NewValue' => 'Users', 'id', - condition => 's.Type IN (?, ?, ?, ?, ?)', - bind_values => [ qw(Take Untake Force Steal Give) ], - action => sub { - my $id = shift; - return unless prompt( - 'Delete', "Found a transaction regarding Owner changes," - ." but the User with id stored in NewValue column doesn't exist anymore." - ); - - delete_record( 'Transactions', $id ); - }, - ); - # type = DelWatcher - check_integrity( - 'Transactions', 'OldValue' => 'Principals', 'id', - condition => 's.Type = ?', - bind_values => [ 'DelWatcher' ], - action => sub { - my $id = shift; - return unless prompt( - 'Delete', "Found a transaction describing watcher changes," - ." but the User with id stored in OldValue column doesn't exist anymore." - ); - - delete_record( 'Transactions', $id ); - }, - ); - # type = AddWatcher - check_integrity( - 'Transactions', 'NewValue' => 'Principals', 'id', - condition => 's.Type = ?', - bind_values => [ 'AddWatcher' ], - action => sub { - my $id = shift; - return unless prompt( - 'Delete', "Found a transaction describing watcher changes," - ." but the User with id stored in NewValue column doesn't exist anymore." - ); - - delete_record( 'Transactions', $id ); - }, - ); - -# XXX: Links need more love, uri is stored instead of id -# # type = DeleteLink -# check_integrity( -# 'Transactions', 'OldValue' => 'Links', 'id', -# condition => 's.Type = ?', -# bind_values => [ 'DeleteLink' ], -# ); -# # type = AddLink -# check_integrity( -# 'Transactions', 'NewValue' => 'Links', 'id', -# condition => 's.Type = ?', -# bind_values => [ 'AddLink' ], -# ); - - # type = Set, Field = Queue - check_integrity( - 'Transactions', 'NewValue' => 'Queues', 'id', - condition => 's.Type = ? AND s.Field = ?', - bind_values => [ 'Set', 'Queue' ], - action => sub { - my $id = shift; - return unless prompt( - 'Delete', "Found a transaction describing a queue change," - ." but the Queue with id stored in the NewValue column doesn't exist anymore." - ); - - delete_record( 'Transactions', $id ); - }, - ); - check_integrity( - 'Transactions', 'OldValue' => 'Queues', 'id', - condition => 's.Type = ? AND s.Field = ?', - bind_values => [ 'Set', 'Queue' ], - action => sub { - my $id = shift; - return unless prompt( - 'Delete', "Found a transaction describing a queue change," - ." but the Queue with id stored in the OldValue column doesn't exist anymore." - ); - - delete_record( 'Transactions', $id ); - }, - ); - # Reminders - check_integrity( - 'Transactions', 'NewValue' => 'Tickets', 'id', - join_condition => 't.Type = ?', - condition => 's.Type IN (?, ?, ?)', - bind_values => [ 'reminder', 'AddReminder', 'OpenReminder', 'ResolveReminder' ], - ); -}; - -# Attachments -push @CHECKS, 'Attachments -> other' => sub { - check_integrity( - Attachments => 'TransactionId', Transactions => 'id', - action => sub { - my $id = shift; - return unless prompt( - 'Delete', "Found an attachment without a transaction." - ); - delete_record( 'Attachments', $id ); - }, - ); - check_integrity( - Attachments => 'Parent', Attachments => 'id', - action => sub { - my $id = shift; - return unless prompt( - 'Delete', "Found an sub-attachment without its parent attachment." - ); - delete_record( 'Attachments', $id ); - }, - ); - check_integrity( - Attachments => 'Parent', - Attachments => 'id', - join_condition => 's.TransactionId = t.TransactionId', - ); -}; - -push @CHECKS, 'CustomFields and friends' => sub { - #XXX: ObjectCustomFields needs more love - check_integrity( - 'CustomFieldValues', 'CustomField' => 'CustomFields', 'id', - ); - check_integrity( - 'ObjectCustomFieldValues', 'CustomField' => 'CustomFields', 'id', - ); - foreach my $model ( @models ) { - check_integrity( - 'ObjectCustomFieldValues', 'ObjectId' => m2t($model), 'id', - condition => 's.ObjectType = ?', - bind_values => [ "RT::$model" ], - ); - } -}; - -push @CHECKS, Templates => sub { - check_integrity( - 'Templates', 'Queue' => 'Queues', 'id', - ); -}; - -push @CHECKS, Scrips => sub { - check_integrity( - 'Scrips', 'Queue' => 'Queues', 'id', - ); - check_integrity( - 'Scrips', 'ScripCondition' => 'ScripConditions', 'id', - ); - check_integrity( - 'Scrips', 'ScripAction' => 'ScripActions', 'id', - ); - check_integrity( - 'Scrips', 'Template' => 'Templates', 'id', - ); -}; - -push @CHECKS, Attributes => sub { - foreach my $model ( @models ) { - check_integrity( - 'Attributes', 'ObjectId' => m2t($model), 'id', - condition => 's.ObjectType = ?', - bind_values => [ "RT::$model" ], - ); - } -}; - -# Fix situations when Creator or LastUpdatedBy references ACL equivalence -# group of a user instead of user -push @CHECKS, 'FIX: LastUpdatedBy and Creator' => sub { - my %fix = (); - foreach my $model ( @models ) { - my $class = "RT::$model"; - my $object = $class->new( RT->SystemUser ); - foreach my $column ( qw(LastUpdatedBy Creator) ) { - next unless $object->_Accessible( $column, 'auto' ); - - my $table = m2t($model); - my $query = <<END; -SELECT m.id, g.id, g.Instance -FROM - Groups g JOIN $table m ON g.id = m.$column -WHERE - g.Domain = ? - AND g.Type = ? -END - my $action = sub { - my ($gid, $uid) = @_; - return unless prompt( - 'Update', - "Looks like there were a bug in old versions of RT back in 2006\n" - ."that has been fixed. If other checks are ok then it's ok to update\n" - ."these records to point them to users instead of groups" - ); - $fix{ $table }{ $column }{ $gid } = $uid; - }; - - my $sth = execute_query( $query, 'ACLEquivalence', 'UserEquiv' ); - while ( my ($rid, $gid, $uid) = $sth->fetchrow_array ) { - print STDERR "Record #$rid in $table refers to ACL equivalence group #$gid of user #$uid"; - print STDERR " when must reference user.\n"; - $action->( $gid, $uid ); - if ( keys( %fix ) > 1000 ) { - $sth->finish; - last; - } - } - } - } - - if ( keys %fix ) { - foreach my $table ( keys %fix ) { - foreach my $column ( keys %{ $fix{ $table } } ) { - my $query = "UPDATE $table SET $column = ? WHERE $column = ?"; - while ( my ($gid, $uid) = each %{ $fix{ $table }{ $column } } ) { - update_records( $table, { $column => $gid }, { $column => $uid } ); - } - } - } - $redo_check{'FIX: LastUpdatedBy and Creator'} = 1; - } -}; - -push @CHECKS, 'LastUpdatedBy and Creator' => sub { - foreach my $model ( @models ) { - my $class = "RT::$model"; - my $object = $class->new( RT->SystemUser ); - my $table = $object->Table; - foreach my $column ( qw(LastUpdatedBy Creator) ) { - next unless $object->_Accessible( $column, 'auto' ); - check_integrity( - $table, $column => 'Users', 'id', - action => sub { - my ($id, %prop) = @_; - return unless my $replace_with = prompt_integer( - 'Replace', - "Column $column should point to a user, but there is record #$id in table $table\n" - ."where it's not true. It's ok to replace these wrong references with id of any user.\n" - ."Note that id you enter is not checked. You can peak any user from your DB, but it's\n" - ."may be better to create a special user for this, for example 'user_that_has_been_deleted'\n" - ."or something like that.", - "$table.$column -> user #$prop{$column}" - ); - update_records( $table, { id => $id, $column => $prop{$column} }, { $column => $replace_with } ); - }, - ); - } - } -}; -my %CHECKS = @CHECKS; - -@do_check = do { my $i = 1; grep $i++%2, @CHECKS }; - -while ( my $check = shift @do_check ) { - $CHECKS{ $check }->(); - - foreach my $redo ( keys %redo_check ) { - die "check $redo doesn't exist" unless $CHECKS{ $redo }; - delete $redo_check{ $redo }; - next if grep $_ eq $redo, @do_check; # don't do twice - push @do_check, $redo; - } -} - -sub check_integrity { - my ($stable, @scols) = (shift, shift); - my ($ttable, @tcols) = (shift, shift); - my %args = @_; - - @scols = @{ $scols[0] } if ref $scols[0]; - @tcols = @{ $tcols[0] } if ref $tcols[0]; - - print "Checking integrity of $stable.{". join(', ', @scols) ."} => $ttable.{". join(', ', @tcols) ."}\n" - if $opt{'verbose'}; - - my $query = "SELECT s.id, ". join(', ', map "s.$_", @scols) - ." FROM $stable s LEFT JOIN $ttable t" - ." ON (". join( - ' AND ', map columns_eq_cond('s', $stable, $scols[$_] => 't', $ttable, $tcols[$_]), (0..(@scols-1)) - ) .")" - . ($args{'join_condition'}? " AND ( $args{'join_condition'} )": "") - ." WHERE t.id IS NULL" - ." AND ". join(' AND ', map "s.$_ IS NOT NULL", @scols); - - $query .= " AND ( $args{'condition'} )" if $args{'condition'}; - - my @binds = @{ $args{'bind_values'} || [] }; - if ( $tcols[0] eq 'id' && @tcols == 1 ) { - my $type = $TYPE{"$stable.$scols[0]"} || 'number'; - if ( $type eq 'number' ) { - $query .= " AND s.$scols[0] != ?" - } - elsif ( $type eq 'text' ) { - $query .= " AND s.$scols[0] NOT LIKE ?" - } - push @binds, 0; - } - - my $sth = execute_query( $query, @binds ); - while ( my ($sid, @set) = $sth->fetchrow_array ) { - print STDERR "Record #$sid in $stable references a nonexistent record in $ttable\n"; - for ( my $i = 0; $i < @scols; $i++ ) { - print STDERR "\t$scols[$i] => '$set[$i]' => $tcols[$i]\n"; - } - print STDERR "\t". describe( $stable, $sid ) ."\n"; - $args{'action'}->( $sid, map { $scols[$_] => $set[$_] } (0 .. (@scols-1)) ) if $args{'action'}; - } -} - -sub describe { - my ($table, $id) = @_; - return '' unless my $cb = $describe_cb{ $table }; - - my $row = load_record( $table, $id ); - unless ( $row->{id} ) { - $table =~ s/s$//; - return "$table doesn't exist"; - } - return $cb->( $row ); -} - -sub columns_eq_cond { - my ($la, $lt, $lc, $ra, $rt, $rc) = @_; - my $ltype = $TYPE{"$lt.$lc"} || 'number'; - my $rtype = $TYPE{"$rt.$rc"} || 'number'; - return "$la.$lc = $ra.$rc" if $db_type ne 'Pg' || $ltype eq $rtype; - - if ( $rtype eq 'text' ) { - return "$ra.$rc LIKE CAST($la.$lc AS text)"; - } - elsif ( $ltype eq 'text' ) { - return "$la.$lc LIKE CAST($ra.$rc AS text)"; - } - else { die "don't know how to cast" } -} - -sub check_uniqueness { - my $on = shift; - my %args = @_; - - my @columns = @{ $args{'columns'} }; - - print "Checking uniqueness of ( ", join(', ', map "'$_'", @columns )," ) in table '$on'\n" - if $opt{'verbose'}; - - my ($scond, $tcond); - if ( $scond = $tcond = $args{'condition'} ) { - $scond =~ s/(\s|^)\./$1s./g; - $tcond =~ s/(\s|^)\./$1t./g; - } - - my $query = "SELECT s.id, t.id, ". join(', ', map "s.$_", @columns) - ." FROM $on s LEFT JOIN $on t " - ." ON s.id != t.id AND ". join(' AND ', map "s.$_ = t.$_", @columns) - . ($tcond? " AND ( $tcond )": "") - . ($args{'extra_tables'} ? join(", ", "", @{$args{'extra_tables'}}) : "") - ." WHERE t.id IS NOT NULL " - ." AND ". join(' AND ', map "s.$_ IS NOT NULL", @columns); - $query .= " AND ( $scond )" if $scond; - $query .= " AND ( $args{'extra_condition'} )" if $args{'extra_condition'}; - - my $sth = execute_query( - $query, - $args{'bind_values'}? (@{ $args{'bind_values'} }, @{ $args{'bind_values'} }): (), - $args{'extra_values'}? (@{ $args{'extra_values'} }): () - ); - while ( my ($sid, $tid, @set) = $sth->fetchrow_array ) { - print STDERR "Record #$tid in $on has the same set of values as $sid\n"; - for ( my $i = 0; $i < @columns; $i++ ) { - print STDERR "\t$columns[$i] => '$set[$i]'\n"; - } - $args{'action'}->( $tid, map { $columns[$_] => $set[$_] } (0 .. (@columns-1)) ) if $args{'action'}; - } -} - -sub load_record { - my ($table, $id) = @_; - my $sth = execute_query( "SELECT * FROM $table WHERE id = ?", $id ); - return $sth->fetchrow_hashref('NAME_lc'); -} - -sub delete_record { - my ($table, $id) = (@_); - print "Deleting record #$id in $table\n" if $opt{'verbose'}; - my $query = "DELETE FROM $table WHERE id = ?"; - $redo_check{ $_ } = 1 foreach @{ $redo_on{'Delete'}{ $table } || [] }; - return execute_query( $query, $id ); -} - -sub create_record { - print "Creating a record in $_[0]\n" if $opt{'verbose'}; - $redo_check{ $_ } = 1 foreach @{ $redo_on{'Create'}{ $_[0] } || [] }; - return $RT::Handle->Insert( @_ ); -} - -sub update_records { - my $table = shift; - my $where = shift; - my $what = shift; - - my (@where_cols, @where_binds); - while ( my ($k, $v) = each %$where ) { push @where_cols, $k; push @where_binds, $v; } - - my (@what_cols, @what_binds); - while ( my ($k, $v) = each %$what ) { push @what_cols, $k; push @what_binds, $v; } - - print "Updating record(s) in $table\n" if $opt{'verbose'}; - my $query = "UPDATE $table SET ". join(', ', map "$_ = ?", @what_cols) - ." WHERE ". join(' AND ', map "$_ = ?", @where_cols); - $redo_check{ $_ } = 1 foreach @{ $redo_on{'Update'}{ $table } || [] }; - return execute_query( $query, @what_binds, @where_binds ); -} - -sub execute_query { - my ($query, @binds) = @_; - - print "Executing query: $query\n\n" if $opt{'verbose'}; - - my $sth = $dbh->prepare( $query ) or die "couldn't prepare $query\n\tError: ". $dbh->errstr; - $sth->execute( @binds ) or die "couldn't execute $query\n\tError: ". $sth->errstr; - return $sth; -} - -{ my %cached_answer; -sub prompt { - my $action = shift; - my $msg = shift; - my $token = shift || join ':', caller; - - return 0 unless $opt{'resolve'}; - return 1 if $opt{'force'}; - - return $cached_answer{ $token } if exists $cached_answer{ $token }; - - print $msg, "\n"; - print "$action ALL records with the same defect? [N]: "; - my $a = <STDIN>; - return $cached_answer{ $token } = 1 if $a =~ /^(y|yes)$/i; - return $cached_answer{ $token } = 0; -} } - -{ my %cached_answer; -sub prompt_action { - my $actions = shift; - my $msg = shift; - my $token = shift || join ':', caller; - - return '' unless $opt{'resolve'}; - return '' if $opt{'force'}; - return $cached_answer{ $token } if exists $cached_answer{ $token }; - - print $msg, "\n"; - print join( ' or ', @$actions ) ." ALL records with the same defect? [do nothing]: "; - my $a = <STDIN>; - chomp $a; - return $cached_answer{ $token } = '' unless $a; - foreach ( grep rindex(lc $_, lc $a, 0) == 0, @$actions ) { - return $cached_answer{ $token } = lc substr $a, 0, 1; - } - return $cached_answer{ $token } = ''; -} } - -{ my %cached_answer; -sub prompt_integer { - my $action = shift; - my $msg = shift; - my $token = shift || join ':', caller; - - return 0 unless $opt{'resolve'}; - return 0 if $opt{'force'}; - - return $cached_answer{ $token } if exists $cached_answer{ $token }; - - print $msg, "\n"; - print "$action ALL records with the same defect? [0]: "; - my $a = <STDIN>; chomp $a; $a = int($a); - return $cached_answer{ $token } = $a; -} } - -1; - -__END__ - -=head1 NAME - -rt-validator - check and correct validity of records in RT's database - -=head1 SYNOPSIS - - rt-validator --check - rt-validator --check --verbose - rt-validator --check --verbose --resolve - rt-validator --check --verbose --resolve --force - -=head1 DESCRIPTION - -This script checks integrity of records in RT's DB. May delete some invalid -records or ressurect accidentally deleted. - -=head1 OPTIONS - -=over - -=item check - - mandatory. - - it's equall to -c - -=item verbose - - print additional info to STDOUT - it's equall to -v - -=item resolve - - enable resolver that can delete or create some records - -=item force - - resolve without asking questions - -=back - diff --git a/rt/t/data/configs/apache2.2+fastcgi.conf b/rt/t/data/configs/apache2.2+fastcgi.conf deleted file mode 100644 index a4016eb42..000000000 --- a/rt/t/data/configs/apache2.2+fastcgi.conf +++ /dev/null @@ -1,49 +0,0 @@ -ServerRoot %%SERVER_ROOT%% -PidFile %%PID_FILE%% -LockFile %%LOCK_FILE%% -ServerAdmin root@localhost - -%%LOAD_MODULES%% - -<IfModule !mpm_netware_module> -<IfModule !mpm_winnt_module> -User freeside -Group freeside -</IfModule> -</IfModule> - -Listen %%LISTEN%% - -ErrorLog "%%LOG_FILE%%" -LogLevel debug - -<Directory /> - Options FollowSymLinks - AllowOverride None - Order deny,allow - Deny from all -</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 - -Alias /NoAuth/images/ %%DOCUMENT_ROOT%%/NoAuth/images/ -ScriptAlias / %%RT_SBIN_PATH%%/rt-server.fcgi/ - -DocumentRoot "%%DOCUMENT_ROOT%%" -<Location /> - Order allow,deny - Allow from all - -%%BASIC_AUTH%% - - Options +ExecCGI - AddHandler fastcgi-script fcgi -</Location> - diff --git a/rt/t/data/configs/apache2.2+mod_perl.conf b/rt/t/data/configs/apache2.2+mod_perl.conf deleted file mode 100644 index a50e5b342..000000000 --- a/rt/t/data/configs/apache2.2+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%% -LockFile %%LOCK_FILE%% -ServerAdmin root@localhost - -%%LOAD_MODULES%% - -<IfModule !mpm_netware_module> -<IfModule !mpm_winnt_module> -User freeside -Group freeside -</IfModule> -</IfModule> - -Listen %%LISTEN%% - -ErrorLog "%%LOG_FILE%%" -LogLevel debug - -<Directory /> - Options FollowSymLinks - AllowOverride None - Order deny,allow - Deny from all -</Directory> - -AddDefaultCharset UTF-8 -PerlSetEnv RT_SITE_CONFIG %%RT_SITE_CONFIG%% - -DocumentRoot "%%DOCUMENT_ROOT%%" -<Location /> - Order allow,deny - Allow from all - -%%BASIC_AUTH%% - - 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> - |