move helpers into RT::Test from a test file
validator: create Principal in force resolve mode

If principal is missing in {Group,User}->Principal relation then
user have two choices: delete pointing object or create
new principal record. It was decided to do nothing in auto-force
-resolve mode. However, absent principal means that $group->Disabled
returns undef and we use that call in other places. undef may cause
infinite loop while trying to restore other records, for example CGM.

prompt_action is only used in this place, so it's ok to change its
behavior.
test edge case in validator
Add a timeout to prevent failing inifite loop tests from hanging forever
Fix precedence errors found by perl 5.19.4 of return ... or ...
Cwd::realpath("/nonexistant") on 5.19.4 returns undef
Catch and warn about template compilation errors

RT warns when saving a template which fails to compile (for example, due
to improperly closed braces).  However, if this warning is ignored (or
the template was imported by hand from initialdata), the only hint as to
this came at the debug level:

    [debug]: Skipping Scrip #7 because it didn't Prepare

Make the template compilation error explicit, and show which template
contains the error.
Account for new compilation warning
Allow member addition in initialdata
Work around bugs in name resolution in SphinxSE on MySQL 5.5

No existant version of SphinxSE is currently capable of resolving
hostnames in CONNECTION= strings on MySQL 5.5.  As such, default to
127.0.0.1 when configuring the SphinxSE table on MySQL 5.5 or above.
See http://sphinxsearch.com/bugs/view.php?id=1815
Default to 127.0.0.1 in tests to work on MySQL 5.5
Stop leaking an extra dbh during server startup

RT::Handle->CheckIntegrity is called during rt-server startup, and its
return value is is stored in $integrity.  Additionally, $RT::Handle is
explicitly destroyed, to ensure that the database is disconnected before
forking.

Unfortunately, this replies on the dbh going out of scope, and
disconnecting during its DESTROY.  As the dbh is stored in the
$integrity variable in addition to $RT::Handle->dbh, it never goes out
of scope, and is thus never disconnected.  For fastcgi deployments, this
causes every fastcgi process to hold open an extra database handle;
standalone servers only ever gain one extra handle.

As no callsite of CheckIntegrity relies on the $dbh return value, simply
return true.  This allows the database handle to be disconnected using
$RT::Handle->dbh(undef).
Explicitly disconnect the dbh before forking, if it exists

This remoes the reliance on disconnect-on-DESTROY, and ensures that the
database handle is disconnected even if outstanding references to
$RT::Handle->dbh still exist.
Ensure that the query is re-run after a bulk update

While the CollectionList at the top of the Bulk Update re-runs the query
after an update (by dint of being passed the TicketSQL and not
$Tickets), the BulkLinks collection is not so lucky.  As such, it
contains the data from before the update was applied.

However, this can lead to internal inconsistency -- namely, if the
tickets were deleted, Count on $Tickets will return the old cached
value, while ->Next will skip the newly-deleted tickets.  This causes
BulkLinks to error out with "Can't call method "DependsOn" on an
undefined value", as it assumes ->Next will be true if ->Count was.

Ensure that the $Tickets collection is re-run if a bulk update was made.
Prevent race conditions under t/tmp/, and descending into .git dirs

The find() call in t/99-policy.y descends into t/, which includes
t/tmp/, which is a directory in active use by other test processes.
This allows a race condition between when find() lists the
subdirectories of t/tmp/, and when it later tries to open a subdirectory
within it.  In the intervening time, the test responsible for the
subdirectory may have removed it, causing:

    Can't opendir(t/tmp/api-attachment.t-MQmEJUkg): No such file or directory

Prune the t/tmp directory and its contents, to prevent this race
condition.  Also prune any .git repositories which may reside within it,
such as the security test repository.
upgrade script/doc for RT-Extension-CustomField-Checkbox

of which functionality is integrated into core
Avoid errors on inlined constant lists, used in 5.19.3 and up

Perl 5.19.3 (as of 15635cbf in perl.git) inlines list constants; that
is:

    use constant FOO => qw(bar baz);

...stores an array reference in the symbol table instead of a GLOB, so
long as there is no $FOO, @FOO, or so forth in the package as well.
This is not entirely new; perl 5.10.0 began inlining scalar values,
which led to aaf2bb34, followed shortly by 3d835f0d.

Inlined arrays appearing in the symbol table bypasses the existing ref()
check, and causes the following errors during tests:

    Not a GLOB reference at lib/RT/Config.pm line 1222.
    Compilation failed in require at li/RT/Config.pm line 899.
    BEGIN failed--compilation aborted [...]

The only case in which we can later de-reference $entry as a GLOB using
*{$entry} is if it _is_ a GLOB; GLOBs have ref($entry) eq '', which
makes them easy to distinguish from inlined constants, which are all
references of some form.  Rather than continue adding to the
laundry-list blacklist of ref types, simply skip _all_ non-globs found
in the symbol table.
Merge branch '4.0/perl-5.19.4-compat' into 4.0-trunk
Ignore the new upgrade script
Merge branch '4.0/rtx-customfield-checkbox-upgrade' into 4.0-trunk