Changeset 5821


Ignore:
Timestamp:
12/18/09 11:14:24 (2 years ago)
Author:
CrawfordCurrie
Message:

Item2511: make the new plugin into a micro-module. This allows us to init the plugin without loading the rest of the MailerContrib, which would be an unreasonable thing to do unless we were really going to use it. Note that this approach may not work with pre-1.1 code if it is run with ASSERTs enabled, because of a wayward assert in Plugins.pm

Location:
trunk/MailerContrib
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MailerContrib/data/System/MailerContrib.txt

    r5752 r5821  
    250250|  Release: | %$RELEASE% | 
    251251|  Change History: | | 
     252|  18 Dec 2009 | Foswikitask:Item2511: make a new tiny plugin module, to reduce load time for when the mailer isn't used in a request | 
    252253|  8 Dec 2009 | Foswikitask:Item8316: Added REST handler, Foswikitask:Item2473: Foswikitask:Item2480: doc & dead code tidy-ups | 
    253254|  4 Dec 2009 | Foswikitask:Item8354: Martin Rowe fixed a problem with STARTPUBLISH in newsletters corrupting the template | 
  • trunk/MailerContrib/lib/Foswiki/Contrib/MailerContrib.pm

    r5752 r5821  
    2727 
    2828our $VERSION = '$Rev$'; 
    29 our $RELEASE = '8 Dec 2009'; 
     29our $RELEASE = '18 Dec 2009'; 
    3030our $SHORTDESCRIPTION = 'Supports e-mail notification of changes'; 
    3131 
     
    3838    $Foswiki::cfg{MailerContrib}{EmailFilterIn} ||= 
    3939      $Foswiki::regex{emailAddrRegex}; 
    40 } 
    41  
    42 # Plugin init method, used to initialise handlers 
    43 sub initPlugin { 
    44     Foswiki::Func::registerRESTHandler('notify', \&_restNotify); 
    45     return 1; 
    46 } 
    47  
    48 # Run mailnotify using a rest handler 
    49 sub _restNotify { 
    50     my ( $session, $plugin, $verb, $response ) = @_; 
    51  
    52     if (!Foswiki::Func::isAnAdmin()) { 
    53         $response->header( -status  => 403, -type => 'text/plain' ); 
    54         $response->print("Only administrators can do that"); 
    55     } else { 
    56         # Don't use the $response; we want to see things happening 
    57         local $| = 1; # autoflush on 
    58         require CGI; 
    59         print CGI::header( -status => 200, -type => 'text/plain' ); 
    60         my $query = Foswiki::Func::getCgiQuery(); 
    61         my $nonews = $query->param('nonews'); 
    62         my $nochanges = $query->param('nochanges'); 
    63         my @exwebs = split(',', $query->param('excludewebs') || ''); 
    64         my @webs = split(',', $query->param('webs') || ''); 
    65         $verbose = 1; # watchen das blinken lights 
    66         mailNotify( \@webs, $verbose, \@exwebs, $nonews, $nochanges ); 
    67     } 
    68     return undef; 
    6940} 
    7041 
  • trunk/MailerContrib/lib/Foswiki/Contrib/MailerContrib/Config.spec

    r5752 r5821  
    1313# **STRING EXPERT** 
    1414# Plugin module path for handler registration 
    15 $Foswiki::cfg{Plugins}{MailerContrib}{Module} = 'Foswiki::Contrib::MailerContrib'; 
     15$Foswiki::cfg{Plugins}{MailerContribPlugin}{Module} = 'Foswiki::Contrib::MailerContribPlugin'; 
    1616# **BOOLEAN** 
    1717# Enable plugin module for handler registration. You can disable the plugin 
    1818# if you don't want to invoke mail notification from the web. 
    19 $Foswiki::cfg{Plugins}{MailerContrib}{Enabled} = 1; 
     19$Foswiki::cfg{Plugins}{MailerContribPlugin}{Enabled} = 1; 
  • trunk/MailerContrib/lib/Foswiki/Contrib/MailerContrib/MANIFEST

    r5752 r5821  
    77lib/Foswiki/Contrib/MailerContrib/UpData.pm 0444 
    88lib/Foswiki/Contrib/MailerContrib.pm 0444 
     9lib/Foswiki/Contrib/MailerContribPlugin.pm 0444 
    910data/System/MailerContrib.txt 0644 
    1011tools/mailnotify 0555 
Note: See TracChangeset for help on using the changeset viewer.