aboutsummaryrefslogtreecommitdiff
path: root/www/rt36/files/multiple-lib-RT_pm_in
blob: dbabff75b1f45539c0e56a57c070e31442a4fc10 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
Index: lib/RT.pm.in
--- rt-3.4.2-pristine/lib/RT.pm.in      2005-05-11 20:36:48.098851448 -0400
+++ rt-3.4.2/lib/RT.pm.in       2005-05-11 20:41:52.026647400 -0400
@@ -98,6 +98,60 @@
 # via the web interface)
 $MasonSessionDir = '@MASON_SESSION_PATH@';

+=item import
+
+Allow override of various internal paths.
+
+    RT->import (
+            RT_INSTANCE_PATH => '/usr/local/rt/stuff',
+            SITE_CONFIG_FILE => '/etc/stuff.pm',
+              ...
+    );
+
+If RT_INSTANCE_PATH is set in the arguments (or in %ENV)
+then it replaces the old value of $BasePath in the following
+variables:
+  $SITE_CONFIG_FILE
+  $LocalPath
+  $LocalEtcPath
+  $LocalLexiconPath
+  $MasonLocalComponentRoot
+  $MasonDataDir
+  $MasonSessionDir
+
+Beyond that, those individual values can be set explicitly
+by arguments.
+
+=cut
+
+sub import {
+no strict 'refs';
+    shift;
+    my %args = @_;
+    return unless ( scalar (keys %args) || $ENV{RT_INSTANCE_PATH} );
+
+    my @variables = qw (
+        SITE_CONFIG_FILE
+        LocalPath
+        LocalEtcPath
+        LocalLexiconPath
+        MasonLocalComponentRoot
+        MasonDataDir
+        MasonSessionDir
+    );
+
+    my $RT_INSTANCE_PATH = $args{RT_INSTANCE_PATH} || $ENV{RT_INSTANCE_PATH};
+    if ($RT_INSTANCE_PATH) {
+        foreach my $vref (@variables) {
+            $$vref =~ s/^\Q$BasePath\E/$RT_INSTANCE_PATH/;
+        }
+    }
+    foreach my $vref (@variables) {
+        $$vref = $args{$vref} if defined ( $args{$vref} );
+    }
+
+use strict 'refs';
+}