[Rt-commit] rt branch 5.0/db-type-mariadb updated. rt-5.0.5-115-g2e7b8f0c56

BPS Git Server git at git.bestpractical.com
Fri Jan 19 15:55:17 UTC 2024


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, 5.0/db-type-mariadb has been updated
       via  2e7b8f0c56e2e3c7397d85a854057faf51c7c367 (commit)
      from  f57cbc0a258eb69150b9acc504101fed566ad8ca (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 2e7b8f0c56e2e3c7397d85a854057faf51c7c367
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Jan 19 06:57:18 2024 -0500

    No need to initialize RT if it's just to check syntax
    
    This is initially for DBD::MariaDB with which "perl -c -MRT=-init ..." would
    generate an annoying message like:
    
        (in cleanup) Can't call method "_should_log" on an undefined value
    
    It indicates that the DBI object was destroyed too late somehow with
    DBD::MariaDB.
    
    Test t/99-policy.t fails because of it. As -c runs all BEGIN blocks, here
    we convert related code in rt-setup-fulltext-index to "use RT '-init';"
    instead, which has proper handling of -c.

diff --git a/lib/RT.pm b/lib/RT.pm
index ede3393041..6481f22794 100644
--- a/lib/RT.pm
+++ b/lib/RT.pm
@@ -136,6 +136,9 @@ the config files and initializing the RT environment.
         my $class  = shift;
         my $action = shift || '';
 
+        # No need to initialize RT if it's just to check syntax.
+        return if $^C;
+
         if ($action eq "-init" and not $DID_IMPORT_INIT) {
             $class->LoadConfig;
             $class->Init;
diff --git a/sbin/rt-setup-fulltext-index.in b/sbin/rt-setup-fulltext-index.in
index 3da92fa39c..da3777f71b 100644
--- a/sbin/rt-setup-fulltext-index.in
+++ b/sbin/rt-setup-fulltext-index.in
@@ -68,11 +68,7 @@ BEGIN { # BEGIN RT CMD BOILERPLATE
 
 }
 
-BEGIN {
-    use RT;
-    RT::LoadConfig();
-    RT::Init();
-};
+use RT '-init';
 use RT::Interface::CLI ();
 
 my %DB = (

-----------------------------------------------------------------------

Summary of changes:
 lib/RT.pm                       | 3 +++
 sbin/rt-setup-fulltext-index.in | 6 +-----
 2 files changed, 4 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list