From: <Cra...@nt...> - 2005-04-27 17:50:16
|
Author: CrawfordCurrie Date: 2005-04-27 10:48:42 -0700 (Wed, 27 Apr 2005) New Revision: 4140 Added: twiki/branches/DEVELOP/bin/mailnotify Removed: twiki/branches/DEVELOP/bin/mailnotifier Modified: twiki/branches/DEVELOP/data/TWiki/MailerContrib.txt Log: MailerContrib: at LynnwoodBrown's request, changed name of mailnotifier to mailnotify for compatibility with cairo release. Changed parameters to be the same as the old script. One less thing for the upgrader to worry about. Deleted: twiki/branches/DEVELOP/bin/mailnotifier =================================================================== --- twiki/branches/DEVELOP/bin/mailnotifier 2005-04-27 17:25:34 UTC (rev 4139) +++ twiki/branches/DEVELOP/bin/mailnotifier 2005-04-27 17:48:42 UTC (rev 4140) @@ -1,65 +0,0 @@ -#!/usr/bin/perl -w -# -# TWiki Collaboration Platform, http://TWiki.org/ -# -# Copyright (C) 2004 Wind River Systems Inc. -# -# For licensing info read license.txt file in the TWiki root. -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details, published at -# http://www.gnu.org/copyleft/gpl.html - -# Must be run from twiki/bin, as it uses setlib.cfg - -BEGIN { - # Set default current working directory (needed for mod_perl) - if( $ENV{"SCRIPT_FILENAME"} && - $ENV{"SCRIPT_FILENAME"} =~ /^(.+)\/[^\/]+$/ ) { - chdir $1; - } elsif ( $0 =~ /^(.*)\/.*?$/ ) { - chdir $1; - } - # Set library paths in @INC, at compile time - unshift @INC, '.'; - require 'setlib.cfg'; -} - -my $sendmail = 0; -my $verbose = 1; - -my @webs = (); - -if( $ENV{'DOCUMENT_ROOT'} ) { - # Called from browser. - # CODE_SMELL: Is this really a reliable way of detecting - # a browser environment? - use CGI; - $query = new CGI; - $sendmail = $query->param( 'sendmail' ) || 0; - $verbose = $query->param( 'verbose' ) || 1; - my $webz = $query->param( 'webs' ) || ""; - @webs = split( /[, ]+/, $webz); - - print "Content-type: text/plain\n\n"; -} else { - # Called from the command line - foreach $arg ( @ARGV ) { - if( $arg eq "-m" ) { - $sendmail = 1; - } elsif ( $arg eq "-q" ) { - $verbose = 0; - } else { - push( @webs, $arg ); - } - } -} - -use TWiki::Contrib::Mailer; -print TWiki::Contrib::Mailer::mailNotify( $sendmail, $verbose, \@webs ); Copied: twiki/branches/DEVELOP/bin/mailnotify (from rev 4138, twiki/branches/DEVELOP/bin/mailnotifier) =================================================================== --- twiki/branches/DEVELOP/bin/mailnotifier 2005-04-27 11:27:39 UTC (rev 4138) +++ twiki/branches/DEVELOP/bin/mailnotify 2005-04-27 17:48:42 UTC (rev 4140) @@ -0,0 +1,65 @@ +#!/usr/bin/perl -w +# +# TWiki Collaboration Platform, http://TWiki.org/ +# +# Copyright (C) 2004 Wind River Systems Inc. +# +# For licensing info read license.txt file in the TWiki root. +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details, published at +# http://www.gnu.org/copyleft/gpl.html + +# Must be run from twiki/bin, as it uses setlib.cfg + +BEGIN { + # Set default current working directory (needed for mod_perl) + if( $ENV{"SCRIPT_FILENAME"} && + $ENV{"SCRIPT_FILENAME"} =~ /^(.+)\/[^\/]+$/ ) { + chdir $1; + } elsif ( $0 =~ /^(.*)\/.*?$/ ) { + chdir $1; + } + # Set library paths in @INC, at compile time + unshift @INC, '.'; + require 'setlib.cfg'; +} + +my $sendmail = 1; +my $verbose = 1; + +my @webs = (); + +if( $ENV{'DOCUMENT_ROOT'} ) { + # Called from browser. + # CODE_SMELL: Is this really a reliable way of detecting + # a browser environment? + use CGI; + $query = new CGI; + $sendmail = $query->param( 'sendmail' ) || 0; + $verbose = $query->param( 'verbose' ) || 1; + my $webz = $query->param( 'webs' ) || ""; + @webs = split( /[, ]+/, $webz); + + print "Content-type: text/plain\n\n"; +} else { + # Called from the command line + foreach $arg ( @ARGV ) { + if( $arg eq "-d" ) { + $sendmail = 0; + } elsif ( $arg eq "-q" ) { + $verbose = 0; + } else { + push( @webs, $arg ); + } + } +} + +use TWiki::Contrib::Mailer; +print TWiki::Contrib::Mailer::mailNotify( $sendmail, $verbose, \@webs ); Modified: twiki/branches/DEVELOP/data/TWiki/MailerContrib.txt =================================================================== --- twiki/branches/DEVELOP/data/TWiki/MailerContrib.txt 2005-04-27 17:25:34 UTC (rev 4139) +++ twiki/branches/DEVELOP/data/TWiki/MailerContrib.txt 2005-04-27 17:48:42 UTC (rev 4140) @@ -5,8 +5,8 @@ %TOC% ---+ Summary of Contents ----++ <code>bin/mailnotifier</code> -The main part of the mailer module is a script, =bin/mailnotifier=. This script is designed to be run from 'cron' (or an equivalent offline job scheduler), and processes the contents of the standard <nop>%NOTIFYTOPIC% topic. As well as providing the usual notification service, it also provides per-topic notification services. The script may be run from the command line, a cron job, or from the browser. +---++ <code>bin/mailnotify</code> +The main part of the mailer module is a script, =bin/mailnotify=. This script is designed to be run from 'cron' (or an equivalent offline job scheduler), and processes the contents of the standard <nop>%NOTIFYTOPIC% topic. As well as providing the usual notification service, it also provides per-topic notification services. The script may be run from the command line, a cron job, or from the browser. %STARTINCLUDE% Subscribers are listed <nop>%NOTIFYTOPIC% in "bullet lists" following one of the following formats: @@ -36,35 +36,35 @@ If a _TWiki group_ is listed for notification, the group will be recursively expanded to the email addresses of all members. %STOPINCLUDE% -In the future it is intended that individual users will be able to control the frequency with which they are notified of topic changes, by changing a schedule specification in their home topic. However at present, the notification schedule is controlled by the frequency of activation of the =cron= job that runs the =bin/mailnotifier= script. +In the future it is intended that individual users will be able to control the frequency with which they are notified of topic changes, by changing a schedule specification in their home topic. However at present, the notification schedule is controlled by the frequency of activation of the =cron= job that runs the =bin/mailnotify= script. -%RED% __Note__ the =mailnotifier= ignores permissions in webs. It is entirely possible for a user to get added to a <nop>%NOTIFYTOPIC% topic in a web, when they are not authorised to view the topics in that web. This could result in them having limited access to sensitive information (the topic summaries). %ENDCOLOR% +%RED% __Note__ =mailnotify= ignores permissions in webs. It is entirely possible for a user to get added to a <nop>%NOTIFYTOPIC% topic in a web, when they are not authorised to view the topics in that web. This could result in them having limited access to sensitive information (the topic summaries). %ENDCOLOR% ---++ <code>TWiki/Contrib/MailerContrib</code> code library The second part of the module is a code library that provides the services for other applications to modify <nop>%NOTIFYTOPIC% through a clean, well documented interface. This allows (for example) plugin developers to add a "Register me for notification" button to their pages. The main interface is the =Web<nop>Notify= package described below. ---++ <code>bin/remove_obsolete_locks</code> -The old =mailnotify= script had a side-effect; it would remove obsolete topic locks as it ran. This has not been implemented in =mailnotifier=. Instead, a separate side script is provided in this module that performs this function, called =bin/remove_obsolete_locks. For full compatibility with =mailnotify= this script should be run (from =bin=) on the same schedule as =mailnotifier=. +The old =mailnotify= script had a side-effect; it would remove obsolete topic locks as it ran. This has not been implemented in =mailnotify=, as it is not required in the Dakar release of TWiki. ---+ Installation Instructions This Contrib is pre-installed as part of the TWiki release package, and should only have to be re-installed if an upgrade is required. * Download the ZIP file from the Plugin web (see below) * Unzip ==%TOPIC%.zip== in your twiki installation directory. * Run the installer script =MailContrib_intaller.pl= or alternatively resolve all dependencies manually. - * To make sure the installation was successful, run the =bin/mailnotifier= script from the command line, with no parameters. In this case it will print out what it would have done to STDOUT. + * To make sure the installation was successful, run the =bin/mailnotify= script from the command line, with no parameters. In this case it will print out what it would have done to STDOUT. ---+ Setting up your cron job -You need to set up a =cron= (or equivalent) job to run =bin/mailnotifier=. +You need to set up a =cron= (or equivalent) job to run =bin/mailnotify=. -<code>Usage: bin/mailnotifier [-q] [-m] [ <i>web1 web2 ... webN</i> ]</code> +<code>Usage: bin/mailnotify [-q] [-d] [ <i>web1 web2 ... webN</i> ]</code> | =-q= | Don't print progress information | -| =-m= | Send mail. Default behaviour is to print out plain text of mails that would be sent to STDOUT | +| =-d= | Don't send mail. Print out plain text of mails that would be sent to STDOUT instead. | | <code><i>web1 web2 ... webN</i></code> | List of webs to process, separated by spaces or commas. Default is to process all legal TWiki webs. Wildcards (*) are supported. | The script can also be used from the browser. The following CGI parameters are supported: | =verbose= | set to 0 to get the same effect as -q | -| =sendmail= | Set to 1 to actually send mail | +| =sendmail= | Set to 1 to actually send mail; default is 0 | | =webs= | Space or comma-separated list of webs to process | ---+ Settings |