[Rt-devel] RT 3.6 PATCH Added Once option to /Elements/Callback

Todd Chapman todd at chaka.net
Fri Jun 23 02:55:35 EDT 2006


Added Once option to /Elements/Callback so that callbacks
that don't need to run for each request don't run for
each request. :)

-Todd
-------------- next part --------------
==== Patch <callback> level 1
Source: [No source]
Target: e417ac7c-1bcc-0310-8ffa-8f5827389a85:/rt/branches/3.6-RELEASE/html/Elements:5408
        (svn://svn.bestpractical.com)
Log:
Added Once option to /Elements/Callback so that callbacks
that don't need to run for each request don't run for
each request. :)
=== Callback
==================================================================
--- Callback	(revision 5408)
+++ Callback	(patch callback level 1)
@@ -45,6 +45,7 @@
 %# END BPS TAGGED BLOCK }}}
 <%once>
 my %cache;
+my %call_cache;
 </%once>
 <%init>
 $Page = $m->callers(1)->path unless ($Page);
@@ -80,11 +81,14 @@
 
 my @rv;
 foreach my $comp (sort @$callbacks) {
-    push @rv, $m->comp($comp, %ARGS);
+    push @rv, $m->comp($comp, %ARGS)
+        if $RT::DevelMode or ( !$call_cache{$comp} and $Once );
+    $call_cache{$comp} = 1 if $Once;
 }
 return @rv;
 </%init>
 <%args>
 $_CallbackName => 'Default'
 $Page => undef
+$Once => 0
 </%args>

==== BEGIN SVK PATCH BLOCK ====
Version: svk 1.07 (linux)

eJxtUztv2zAQ9iygQ5duBViARprB0YOSJdmJ4KBxlzZpkKRdBZo8xUJl0qUoo0EYoBkzZW3/bSna
LjJUA4Hj99Dpu9NHdTOdhaYoAoPDwFx/+zSZXFLNlkNb4bEBXmupcGIa2ECDiWnkLY6NoCuwqKbq
FnRRhFacbcVzJ9ibxL3HgmopWpw7s1IrAByaaEbMLDL2tEVoQbkGUSoptbVPwySxYNm3xBrZQtlL
e3rS06M9vaobwJn5QJtmQdl357RTk16d7NS8VsBsW3c9Y2vjULpeN3elhp+aQ6OpsyaRqSClQPNx
EtCARgkJoQoCnoeQkZDRnOCI9FFdDAa/zZ/7V4/ng+e3g6fB0+vnN78ez1Z3aMhsR6WHdk9dIXx1
M5mc9RmeSw5IKvQevcOOxihbwj1mcrV+QFRwhL8IBuhw6vT/4Zyg0Fn2tKn34CnQnRJopjZT79gf
1qLWhXc8tLNpCw+X+3Qu7MzQSYEOzqCiXaMPPHxJb91VJzhU3va9tgx6m618Fr+cgst7F9KCMUh4
HKVpvqjSNCUsWYxZFkMcA0/GuRtGGGXmlHPgyHnLta6lQFoif97ACoRu/X17qJVIL6lGbHfReq7k
UhxoJMB6WJ3qBKpsemADQQp+dNDuKTvIewkdocmhXZC9ZVFEBkfRdlNv3PJOJl9FvQHV0mY4NnZ7
1lQv7Z4r2Nii62qOSWZ8pf2FosJOofXJ0Xh0Nf88P72e+0u9av59ixUkcZBhYv+bOEwpS9kotDmN
AhIGo6yqqD2SLEpJltMs+QtS8Byo
==== END SVK PATCH BLOCK ====


More information about the Rt-devel mailing list