[Rt-commit] r15606 - in rt/branches/3.999-DANGEROUS: sbin
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Thu Aug 28 13:53:08 EDT 2008
Author: sunnavy
Date: Thu Aug 28 13:53:07 2008
New Revision: 15606
Modified:
rt/branches/3.999-DANGEROUS/ (props changed)
rt/branches/3.999-DANGEROUS/sbin/rt-clean-sessions
rt/branches/3.999-DANGEROUS/sbin/rt-email-dashboards
rt/branches/3.999-DANGEROUS/sbin/rt-email-group-admin
rt/branches/3.999-DANGEROUS/sbin/rt-shredder
rt/branches/3.999-DANGEROUS/sbin/rt-validator
Log:
r16270 at sunnavys-mb: sunnavy | 2008-08-29 01:50:44 +0800
clean sbin
Modified: rt/branches/3.999-DANGEROUS/sbin/rt-clean-sessions
==============================================================================
--- rt/branches/3.999-DANGEROUS/sbin/rt-clean-sessions (original)
+++ rt/branches/3.999-DANGEROUS/sbin/rt-clean-sessions Thu Aug 28 13:53:07 2008
@@ -49,30 +49,6 @@
use strict;
use warnings;
-# fix lib paths, some may be relative
-BEGIN {
- require File::Spec;
- 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;
- }
- }
- $lib = File::Spec->catfile( $bin_path, File::Spec->updir, $lib );
- }
- unshift @INC, $lib;
- }
-}
-
use Getopt::Long;
my %opt;
GetOptions( \%opt, "older=s", "debug", "help");
@@ -99,7 +75,9 @@
$opt{'older'} = $num * $factor{ $unit };
}
-require RT;
+use RT;
+BEGIN { RT->init_jifty }
+
RT::load_config();
if( $opt{'debug'} ) {
@@ -109,7 +87,6 @@
}
RT::connect_to_database();
-RT::InitLogging();
require RT::Interface::Web::Session;
Modified: rt/branches/3.999-DANGEROUS/sbin/rt-email-dashboards
==============================================================================
--- rt/branches/3.999-DANGEROUS/sbin/rt-email-dashboards (original)
+++ rt/branches/3.999-DANGEROUS/sbin/rt-email-dashboards Thu Aug 28 13:53:07 2008
@@ -1,4 +1,4 @@
-#!@PERL@
+#!/usr/bin/perl
# BEGIN BPS TAGGED BLOCK {{{
#
# COPYRIGHT:
@@ -49,36 +49,13 @@
use strict;
use warnings;
-# fix lib paths, some may be relative
-BEGIN {
- require File::Spec;
- 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;
- }
- }
- $lib = File::Spec->catfile( $bin_path, File::Spec->updir, $lib );
- }
- unshift @INC, $lib;
- }
-
-}
use RT;
+BEGIN { RT->init_jifty }
use RT::Interface::Web;
use RT::Interface::Web::Handler;
use RT::Dashboard;
-use RT::Interface::CLI qw{ CleanEnv };
+use RT::Interface::CLI qw{ clean_env };
use Getopt::Long;
use HTML::Mason;
@@ -88,13 +65,13 @@
use POSIX 'tzset';
# Clean out all the nasties from the environment
-CleanEnv();
+clean_env();
# Load the config file
-RT::LoadConfig();
+RT::load_config();
# Connect to the database and get RT->system_user and RT::nobody loaded
-RT::Init();
+RT::init();
$HTML::Mason::Commands::r = RT::Dashboard::FakeRequest->new;
@@ -126,7 +103,7 @@
debug "Sending email from %1", $from;
# look through each user for her subscriptions
-my $Users = RT::Model::UserCollection->new(RT->system_user);
+my $Users = RT::Model::UserCollection->new( current_user => RT->system_user);
$Users->limit_to_privileged;
while (defined(my $user = $Users->next)) {
@@ -149,29 +126,28 @@
debug "Checking %1's subscriptions: hour %2, dow %3, dom %4",
$user->name, $hour, $dow, $dom;
- my $currentuser = RT::CurrentUser->new;
- $currentuser->load_by_name($user->name);
+ my $currentuser = RT::CurrentUser->new( name => $user->name );
# look through this user's subscriptions, are any supposed to be generated
# right now?
- for my $subscription ($user->attributes->named('Subscription')) {
+ for my $subscription ($user->attributes->named('subscription')) {
if (!$opts{all}) {
- debug "Checking against subscription with frequency %1, hour %2, dow %3, dom %4", $subscription->sub_value('Frequency'), $subscription->sub_value('Hour'), $subscription->sub_value('Dow'), $subscription->sub_value('Dom');
+ debug "Checking against subscription with frequency %1, hour %2, dow %3, dom %4", $subscription->sub_value('Frequency'), $subscription->sub_value('hour'), $subscription->sub_value('Dow'), $subscription->sub_value('dom');
- next if $subscription->sub_value('Frequency') eq 'never';
+ next if $subscription->sub_value('frequency') eq 'never';
# correct hour?
- next if $subscription->sub_value('Hour') ne $hour;
+ next if $subscription->sub_value('hour') ne $hour;
# if weekly, correct day of week?
- if ($subscription->sub_value('Frequency') eq 'weekly') {
- next if $subscription->sub_value('Dow') ne $dow;
+ if ($subscription->sub_value('frequency') eq 'weekly') {
+ next if $subscription->sub_value('dow') ne $dow;
}
# if monthly, correct day of month?
- elsif ($subscription->sub_value('Frequency') eq 'monthly') {
- next if $subscription->sub_value('Dom') != $dom;
+ elsif ($subscription->sub_value('frequency') eq 'monthly') {
+ next if $subscription->sub_value('dom') != $dom;
}
}
@@ -183,26 +159,27 @@
sub send_dashboard {
my ($currentuser, $subscription) = @_;
- my $rows = $subscription->sub_value('Rows');
+ my $rows = $subscription->sub_value('rows');
- my $dashboard = RT::Dashboard->new($currentuser);
+ my $dashboard = RT::Dashboard->new(current_user => $currentuser);
- my ($ok, $msg) = $dashboard->load_by_id($subscription->sub_value('DashboardId'));
+ my ($ok, $msg) =
+ $dashboard->load_by_id($subscription->sub_value('dashboard_id'));
# failed to load dashboard. perhaps it was deleted or it changed privacy
if (!$ok) {
warning "Unable to load dashboard %1 of subscription %2 for user %3: %4",
- $subscription->sub_value('DashboardId'),
+ $subscription->sub_value('dashboard_id'),
$subscription->id,
$currentuser->name,
$msg;
- my $ok = RT::Interface::Email::SendEmailUsingTemplate(
- From => $from,
- To => email_of($currentuser),
- Template => 'Error: Missing dashboard',
- Arguments => {
- SubscriptionObj => $subscription,
+ my $ok = RT::Interface::Email::send_email_using_template(
+ from => $from,
+ to => email_of($currentuser),
+ template => 'Error: Missing dashboard',
+ arguments => {
+ subscription_obj => $subscription,
},
);
@@ -273,8 +250,8 @@
$content, $from, email_of($currentuser), $subject,
);
- my $ok = RT::Interface::Email::SendEmail(
- Entity => $entity,
+ my $ok = RT::Interface::Email::send_email(
+ entity => $entity,
);
debug "Done sending dashboard to %1 <%2>",
Modified: rt/branches/3.999-DANGEROUS/sbin/rt-email-group-admin
==============================================================================
--- rt/branches/3.999-DANGEROUS/sbin/rt-email-group-admin (original)
+++ rt/branches/3.999-DANGEROUS/sbin/rt-email-group-admin Thu Aug 28 13:53:07 2008
@@ -87,33 +87,11 @@
use strict;
# fix lib paths, some may be relative
-BEGIN {
- require File::Spec;
- 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;
- }
- }
- $lib = File::Spec->catfile( $bin_path, File::Spec->updir, $lib );
- }
- unshift @INC, $lib;
- }
-
-}
use RT;
-RT::LoadConfig;
-RT::Init;
+BEGIN { RT->init_jifty }
+RT::load_config;
+RT::init;
require RT::Principal;
require RT::Model::User;
Modified: rt/branches/3.999-DANGEROUS/sbin/rt-shredder
==============================================================================
--- rt/branches/3.999-DANGEROUS/sbin/rt-shredder (original)
+++ rt/branches/3.999-DANGEROUS/sbin/rt-shredder Thu Aug 28 13:53:07 2008
@@ -110,31 +110,8 @@
use strict;
use warnings FATAL => 'all';
-# fix lib paths, some may be relative
-BEGIN {
- require File::Spec;
- 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;
- }
- }
- $lib = File::Spec->catfile( $bin_path, File::Spec->updir, $lib );
- }
- unshift @INC, $lib;
- }
-
-}
-
+use RT;
+BEGIN { RT->init_jifty }
use RT::Shredder ();
use Getopt::Long qw(GetOptions);
use File::Spec ();
@@ -146,11 +123,11 @@
our %opt;
parse_args();
-RT::Shredder::Init( %opt );
+RT::Shredder::init( %opt );
my $shredder = RT::Shredder->new;
{
- my $plugin = eval { $shredder->add_dump_plugin( Arguments => {
+ my $plugin = eval { $shredder->add_dump_plugin( arguments => {
file_name => $opt{'sqldump'},
from_storage => 0,
} ) };
Modified: rt/branches/3.999-DANGEROUS/sbin/rt-validator
==============================================================================
--- rt/branches/3.999-DANGEROUS/sbin/rt-validator (original)
+++ rt/branches/3.999-DANGEROUS/sbin/rt-validator Thu Aug 28 13:53:07 2008
@@ -76,9 +76,11 @@
### after: use lib qw(/home/jesse/svk/3.999-DANGEROUS/lib);
use lib qw(/home/jesse/svk/3.999-DANGEROUS/local/lib /home/jesse/svk/3.999-DANGEROUS/lib);
+use RT;
+BEGIN { RT->init_jifty }
use RT::Shredder;
use RT::Shredder::Constants;
-RT::Shredder::Init();
+RT::Shredder::init();
our %opt;
parse_args();
More information about the Rt-commit
mailing list