[Bps-public-commit] rt-extension-articletemplates branch, update-for-rt5, created. 1.02-1-gb4f9e63

Dianne Skoll dianne at bestpractical.com
Tue Feb 9 10:15:24 EST 2021


The branch, update-for-rt5 has been created
        at  b4f9e6350b91701fabc90c8476aa62b3fd3fc156 (commit)

- Log -----------------------------------------------------------------
commit b4f9e6350b91701fabc90c8476aa62b3fd3fc156
Author: Dianne Skoll <dianne at bestpractical.com>
Date:   Tue Feb 9 10:15:06 2021 -0500

    Update for RT5

diff --git a/README b/README
index 044e910..1b3be66 100644
--- a/README
+++ b/README
@@ -2,7 +2,8 @@ NAME
     RT::Extension::ArticleTemplates - Turns Articles into dynamic templates
 
 RT VERSION
-    Works with RT 4.0, 4.2 and 4.4.
+    Works with RT 4.0, 4.2, 4.4 and 5.0. RT 5.0.0 and 5.0.1 require patching
+    (see the "Patch RT" section below.)
 
 DESCRIPTION
     When this extension is installed, RT parses the content of Articles as a
@@ -19,12 +20,12 @@ VERY IMPORTANT
     installed -- even if it is not a valid template.
 
 INSTALLATION
-    perl Makefile.PL
-    make
-    make install
+    "perl Makefile.PL"
+    "make"
+    "make install"
         May need root permissions
 
-    Edit your /opt/rt4/etc/RT_SiteConfig.pm
+    Edit your /opt/rt5/etc/RT_SiteConfig.pm
         If you are using RT 4.2 or greater, add this line:
 
             Plugin('RT::Extension::ArticleTemplates');
@@ -33,11 +34,17 @@ INSTALLATION
 
             Set(@Plugins, qw(RT::Extension::ArticleTemplates));
 
-        or add RT::Extension::ArticleTemplates to your existing @Plugins
+        or add "RT::Extension::ArticleTemplates" to your existing @Plugins
         line.
 
+    Patch RT
+        This step is required only for RT versions 5.0.0 and 5.0.1. Apply
+        the patch as follows:
+
+            patch -p1 -d /path/to/rt < etc/restore-ticket-object-to-arguments-passed-to-preformatted.patch
+
     Clear your mason cache
-            rm -rf /opt/rt4/var/mason_data/obj
+            rm -rf /opt/rt5/var/mason_data/obj
 
     Restart your webserver
 
diff --git a/etc/restore-ticket-object-to-arguments-passed-to-preformatted.patch b/etc/restore-ticket-object-to-arguments-passed-to-preformatted.patch
new file mode 100644
index 0000000..e9bcfb8
--- /dev/null
+++ b/etc/restore-ticket-object-to-arguments-passed-to-preformatted.patch
@@ -0,0 +1,15 @@
+diff --git a/share/html/Articles/Elements/IncludeArticle b/share/html/Articles/Elements/IncludeArticle
+index a64684c86..ce75ffb21 100644
+--- a/share/html/Articles/Elements/IncludeArticle
++++ b/share/html/Articles/Elements/IncludeArticle
+@@ -78,8 +78,9 @@ if ( $ret && $article->Id ){
+         return;
+     }
+ 
++    # $Ticket below is used by RT::Extension::ArticleTemplates
+     my $formatted_article = $m->scomp('/Articles/Article/Elements/Preformatted',
+-        Article => $article
++        Article => $article, Ticket => $Ticket
+     );
+ 
+     $m->callback( Article => $article, Ticket => $Ticket, formatted_article => \$formatted_article, ARGSRef => \%ARGS );
diff --git a/inc/Module/Install/RTx.pm b/inc/Module/Install/RTx.pm
index 7cad529..a483a01 100644
--- a/inc/Module/Install/RTx.pm
+++ b/inc/Module/Install/RTx.pm
@@ -53,7 +53,7 @@ sub RTx {
         my @look = @INC;
         unshift @look, grep {defined and -d $_} @try;
         push @look, grep {defined and -d $_}
-            map { ( "$_/rt4/lib", "$_/lib/rt4", "$_/lib" ) } @prefixes;
+            map { ( "$_/rt5/lib", "$_/lib/rt5", "$_/lib" ) } @prefixes;
         last if eval {local @INC = @look; require RT; $RT::LocalLibPath};
 
         warn
diff --git a/lib/RT/Extension/ArticleTemplates.pm b/lib/RT/Extension/ArticleTemplates.pm
index e768c0c..9a98fb6 100644
--- a/lib/RT/Extension/ArticleTemplates.pm
+++ b/lib/RT/Extension/ArticleTemplates.pm
@@ -11,7 +11,8 @@ RT::Extension::ArticleTemplates - Turns Articles into dynamic templates
  
 =head1 RT VERSION
 
-Works with RT 4.0, 4.2 and 4.4.
+Works with RT 4.0, 4.2, 4.4 and 5.0.  RT 5.0.0 and 5.0.1 require patching
+(see the "Patch RT" section below.)
 
 =head1 DESCRIPTION
 
@@ -41,7 +42,7 @@ is installed -- even if it is not a valid template.
 
 May need root permissions
 
-=item Edit your F</opt/rt4/etc/RT_SiteConfig.pm>
+=item Edit your F</opt/rt5/etc/RT_SiteConfig.pm>
 
 If you are using RT 4.2 or greater, add this line:
 
@@ -53,9 +54,16 @@ For RT 4.0, add this line:
 
 or add C<RT::Extension::ArticleTemplates> to your existing C<@Plugins> line.
 
+=item Patch RT
+
+This step is required B<only> for RT versions 5.0.0 and 5.0.1.  Apply
+the patch as follows:
+
+    patch -p1 -d /path/to/rt < etc/restore-ticket-object-to-arguments-passed-to-preformatted.patch
+
 =item Clear your mason cache
 
-    rm -rf /opt/rt4/var/mason_data/obj
+    rm -rf /opt/rt5/var/mason_data/obj
 
 =item Restart your webserver
 

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


More information about the Bps-public-commit mailing list