r100696 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100695‎ | r100696 | r100697 >
Date:14:10, 25 October 2011
Author:hashar
Status:ok (Comments)
Tags:
Comment:
maint script dumping email message

This script format the 4 different type of email notification and show
them to the user with parameters filled up. This might help tweaking
the mail notification message.

TODO: allow language selection. For now messages use the default wiki
language.
Modified paths:
  • /trunk/extensions/CodeReview/show_emails.php (added) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/show_emails.php
@@ -0,0 +1,107 @@
 2+<?php
 3+
 4+$IP = getenv( 'MW_INSTALL_PATH' );
 5+if( $IP === false ) {
 6+ $IP = dirname( __FILE__ ) . '/../..';
 7+}
 8+require( "$IP/maintenance/Maintenance.php" );
 9+
 10+class CodeReviewShowEmails extends Maintenance {
 11+ private $EmailData = array(
 12+ 'author' => 'Author',
 13+ 'repo' => 'Repository',
 14+ 'rev' => 'r88888',
 15+ 'URL' => 'http://www.example.org/CR/repo/r88888',
 16+ 'prevrev' => 'r52100',
 17+ 'prevURL' => 'http://www.example.org/CR/repo/r52100',
 18+ 'summary' => 'This is a patch to fix a nasty bug
 19+This is not the best commit summary but should be enough to:
 20+* display something
 21+* get a rough idea of message formatting
 22+* some other thing
 23+Follow up r52100
 24+',
 25+ 'follow-up-summary' => 'Fix up r52100',
 26+ 'comment' => 'My comment is that this revision is obviously wrong.
 27+You missed a lot of points there and need to revert or fix your code
 28+',
 29+ 'oldstatus' => 'new',
 30+ 'newstatus' => 'fixme',
 31+ );
 32+
 33+ public function __construct() {
 34+ parent::__construct();
 35+ $this->mDescription = "Show example emails for CodeReview";
 36+ }
 37+
 38+ public function execute() {
 39+ $this->printSubject( '' );
 40+ print wfMsg( 'codereview-email-body'
 41+ , $this->EmailData['author']
 42+ , $this->EmailData['URL']
 43+ , $this->EmailData['rev']
 44+ , $this->EmailData['comment']
 45+ , $this->EmailData['summary']
 46+ ) . "\n" ;
 47+ $this->printRule();
 48+
 49+ $this->printSubject( 2 );
 50+ print wfMsg( 'codereview-email-body2'
 51+ , $this->EmailData['author']
 52+ , $this->EmailData['prevrev']
 53+ , $this->EmailData['URL']
 54+ , $this->EmailData['follow-up-summary']
 55+ , $this->EmailData['prevURL']
 56+ , $this->EmailData['summary']
 57+ ). "\n";
 58+ $this->printRule();
 59+
 60+ $this->printSubject( 3 );
 61+ print wfMsg( 'codereview-email-body3'
 62+ , $this->EmailData['author']
 63+ , $this->EmailData['rev']
 64+ , $this->EmailData['oldstatus']
 65+ , $this->EmailData['newstatus']
 66+ , $this->EmailData['URL']
 67+ , $this->EmailData['summary']
 68+ ). "\n";
 69+ $this->printRule();
 70+
 71+ $this->printSubject( 4 );
 72+ print wfMsg( 'codereview-email-body4'
 73+ , $this->EmailData['author']
 74+ , $this->EmailData['rev']
 75+ , $this->EmailData['oldstatus']
 76+ , $this->EmailData['newstatus']
 77+ , $this->EmailData['URL']
 78+ , $this->EmailData['summary']
 79+ , $this->EmailData['follow-up-summary']
 80+ ). "\n";
 81+ $this->printRule();
 82+ }
 83+
 84+ /**
 85+ * Print the subject line.
 86+ * @param $type Either '', 2, 3 or 4
 87+ */
 88+ function printSubject( $type ) {
 89+ $repo = $this->EmailData['repo'];
 90+ if( $type == 2 ) {
 91+ $rev = $this->EmailData['prevrev'];
 92+ } else {
 93+ $rev = $this->EmailData['rev'];
 94+ }
 95+ printf( "Subject: %s\n\n",
 96+ wfMsg( 'codereview-email-subj'.$type
 97+ , $repo
 98+ , $rev
 99+ )
 100+ );
 101+ }
 102+ function printRule() {
 103+ print "===============================================\n";
 104+ }
 105+}
 106+
 107+$maintClass = 'CodeReviewShowEmails';
 108+require_once( DO_MAINTENANCE );

Comments

#Comment by Reedy (talk | contribs)   21:04, 25 October 2011

svn:eol-style native!!!

#Comment by Hashar (talk | contribs)   16:38, 26 October 2011

Fixed by Ialex with r100706 .

That changes come from git svn, I am not sure I can commit a svn property this way.

I have fixed my svn configuration for trunk.

Status & tagging log