Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git] / rt / sbin / rt-email-dashboards.in
index 6b7dd2d..1daba86 100644 (file)
@@ -50,23 +50,15 @@ use strict;
 use warnings;
 
 # fix lib paths, some may be relative
-BEGIN {
+BEGIN { # BEGIN RT CMD BOILERPLATE
     require File::Spec;
+    require Cwd;
     my @libs = ("@RT_LIB_PATH@", "@LOCAL_LIB_PATH@");
     my $bin_path;
 
     for my $lib (@libs) {
         unless ( File::Spec->file_name_is_absolute($lib) ) {
-            unless ($bin_path) {
-                if ( File::Spec->file_name_is_absolute(__FILE__) ) {
-                    $bin_path = ( File::Spec->splitpath(__FILE__) )[1];
-                }
-                else {
-                    require FindBin;
-                    no warnings "once";
-                    $bin_path = $FindBin::Bin;
-                }
-            }
+            $bin_path ||= ( File::Spec->splitpath(Cwd::abs_path(__FILE__)) )[1];
             $lib = File::Spec->catfile( $bin_path, File::Spec->updir, $lib );
         }
         unshift @INC, $lib;
@@ -89,10 +81,7 @@ if ($opts{'help'}) {
 
 require RT;
 require RT::Interface::CLI;
-RT::Interface::CLI->import(qw{ CleanEnv loc });
-
-# Clean out all the nasties from the environment
-CleanEnv();
+RT::Interface::CLI->import(qw{ loc });
 
 # Load the config file
 RT::LoadConfig();
@@ -130,7 +119,7 @@ are taken to be in the user's timezone if available, UTC otherwise.
 You'll need to have cron run this script every hour. Here's an example crontab
 entry to do this.
 
-    0 * * * * @PERL@ /opt/rt4/local/sbin/rt-email-dashboards
+    0 * * * * @RT_SBIN_PATH_R@/rt-email-dashboards
 
 This will run the script every hour on the hour. This may need some further
 tweaking to be run as the correct user.