r112639 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112638‎ | r112639 | r112640 >
Date:21:08, 28 February 2012
Author:reedy
Status:ok (Comments)
Tags:
Comment:
Modified paths:
  • /branches/REL1_19/phase3 (modified) (history)
  • /branches/REL1_19/phase3/includes (modified) (history)
  • /branches/REL1_19/phase3/includes/logging/LogEntry.php (modified) (history)
  • /branches/REL1_19/phase3/includes/logging/LogFormatter.php (modified) (history)
  • /branches/REL1_19/phase3/languages (modified) (history)
  • /branches/REL1_19/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: branches/REL1_19/phase3/includes/logging/LogEntry.php
@@ -461,7 +461,7 @@
462462 $this->getTimestamp(),
463463 $logpage,
464464 $user,
465 - $formatter->getPlainActionText(), // Used for IRC feeds
 465+ $formatter->getIRCActionText(), // Used for IRC feeds
466466 $user->isAnon() ? $user->getName() : '',
467467 $this->getType(),
468468 $this->getSubtype(),
Index: branches/REL1_19/phase3/includes/logging/LogFormatter.php
@@ -77,6 +77,8 @@
7878 */
7979 protected $plaintext = false;
8080
 81+ protected $irctext = false;
 82+
8183 protected function __construct( LogEntry $entry ) {
8284 $this->entry = $entry;
8385 $this->context = RequestContext::getMain();
@@ -141,6 +143,105 @@
142144 }
143145
144146 /**
 147+ * Even uglier hack to maintain backwards compatibilty with IRC bots
 148+ * (bug 34508).
 149+ * @see getActionText()
 150+ * @return string text
 151+ */
 152+ public function getIRCActionText() {
 153+ $this->plaintext = true;
 154+ $text = $this->getActionText();
 155+
 156+ $entry = $this->entry;
 157+ $parameters = $entry->getParameters();
 158+ // @see LogPage::actionText()
 159+ $msgOpts = array( 'parsemag', 'escape', 'replaceafter', 'content' );
 160+ // Text of title the action is aimed at.
 161+ $target = $entry->getTarget()->getPrefixedText() ;
 162+ $text = null;
 163+ switch( $entry->getType() ) {
 164+ case 'move':
 165+ switch( $entry->getSubtype() ) {
 166+ case 'move':
 167+ $movesource = $parameters['4::target'];
 168+ $text = wfMsgExt( '1movedto2', $msgOpts, $target, $movesource );
 169+ break;
 170+ case 'move_redir':
 171+ $movesource = $parameters['4::target'];
 172+ $text = wfMsgExt( '1movedto2_redir', $msgOpts, $target, $movesource );
 173+ break;
 174+ case 'move-noredirect':
 175+ break;
 176+ case 'move_redir-noredirect':
 177+ break;
 178+ }
 179+ break;
 180+
 181+ case 'delete':
 182+ switch( $entry->getSubtype() ) {
 183+ case 'delete':
 184+ $text = wfMsgExt( 'deletedarticle', $msgOpts, $target );
 185+ break;
 186+ case 'restore':
 187+ $text = wfMsgExt( 'undeletedarticle', $msgOpts, $target );
 188+ break;
 189+ //case 'revision': // Revision deletion
 190+ //case 'event': // Log deletion
 191+ // see https://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/LogPage.php?&pathrev=97044&r1=97043&r2=97044
 192+ //default:
 193+ }
 194+ break;
 195+
 196+ case 'patrol':
 197+ // https://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/PatrolLog.php?&pathrev=97495&r1=97494&r2=97495
 198+ // Create a diff link to the patrolled revision
 199+ if ( $entry->getSubtype() === 'patrol' ) {
 200+ $diffLink = htmlspecialchars(
 201+ wfMsgForContent( 'patrol-log-diff', $parameters['4::curid'] ) );
 202+ $text = wfMsgForContent( 'patrol-log-line', $diffLink, "[[$target]]", "" );
 203+ } else {
 204+ // broken??
 205+ }
 206+ break;
 207+
 208+ case 'newusers':
 209+ switch( $entry->getSubtype() ) {
 210+ case 'newusers':
 211+ case 'create':
 212+ $text = wfMsgExt( 'newuserlog-create-entry', $msgOpts /* no params */ );
 213+ break;
 214+ case 'create2':
 215+ $text = wfMsgExt( 'newuserlog-create2-entry', $msgOpts, $target );
 216+ break;
 217+ case 'autocreate':
 218+ $text = wfMsgExt( 'newuserlog-autocreate-entry', $msgOpts /* no params */ );
 219+ break;
 220+ }
 221+ break;
 222+
 223+ case 'upload':
 224+ switch( $entry->getSubtype() ) {
 225+ case 'upload':
 226+ $text = wfMsgExt( 'uploadedimage', $msgOpts, $target );
 227+ break;
 228+ case 'overwrite':
 229+ $text = wfMsgExt( 'overwroteimage', $msgOpts, $target );
 230+ break;
 231+ }
 232+ break;
 233+
 234+ // case 'suppress' --private log -- aaron (sign your messages so we know who to blame in a few years :-D)
 235+ // default:
 236+ }
 237+ if( is_null( $text ) ) {
 238+ $text = $this->getPlainActionText();
 239+ }
 240+
 241+ $this->plaintext = false;
 242+ return $text;
 243+ }
 244+
 245+ /**
145246 * Gets the log action, including username.
146247 * @return string HTML
147248 */
@@ -183,8 +284,8 @@
184285 protected function getMessageKey() {
185286 $type = $this->entry->getType();
186287 $subtype = $this->entry->getSubtype();
187 - $key = "logentry-$type-$subtype";
188 - return $key;
 288+
 289+ return "logentry-$type-$subtype";
189290 }
190291
191292 /**
Property changes on: branches/REL1_19/phase3/includes
___________________________________________________________________
Modified: svn:mergeinfo
192293 Merged /trunk/phase3/includes:r112045-112046,112049,112061,112066,112079,112128
Index: branches/REL1_19/phase3/languages/messages/MessagesEn.php
@@ -4708,6 +4708,34 @@
47094709 'logentry-newusers-autocreate' => 'Account $1 was created automatically',
47104710 'newuserlog-byemail' => 'password sent by e-mail',
47114711
 4712+# For IRC, see bug 34508. Do not change
 4713+'revdelete-logentry' => 'changed revision visibility of "[[$1]]"',
 4714+'logdelete-logentry' => 'changed event visibility of "[[$1]]"',
 4715+'revdelete-content' => 'content',
 4716+'revdelete-summary' => 'edit summary',
 4717+'revdelete-uname' => 'username',
 4718+'revdelete-hid' => 'hid $1',
 4719+'revdelete-unhid' => 'unhid $1',
 4720+'revdelete-log-message' => '$1 for $2 {{PLURAL:$2|revision|revisions}}',
 4721+'logdelete-log-message' => '$1 for $2 {{PLURAL:$2|event|events}}',
 4722+'deletedarticle' => 'deleted "[[$1]]"',
 4723+'suppressedarticle' => 'suppressed "[[$1]]"',
 4724+'undeletedarticle' => 'restored "[[$1]]"',
 4725+'patrol-log-line' => 'marked $1 of $2 patrolled $3',
 4726+'patrol-log-auto' => '(automatic)',
 4727+'patrol-log-diff' => 'revision $1',
 4728+'1movedto2' => 'moved [[$1]] to [[$2]]',
 4729+'1movedto2_redir' => 'moved [[$1]] to [[$2]] over redirect',
 4730+'move-redirect-suppressed' => 'redirect suppressed',
 4731+'newuserlog-byemail' => 'password sent by e-mail',
 4732+'newuserlog-create-entry' => 'New user account',
 4733+'newuserlog-create2-entry' => 'created new account $1',
 4734+'newuserlog-autocreate-entry' => 'Account created automatically',
 4735+'suppressedarticle' => 'suppressed "[[$1]]"',
 4736+'deletedarticle' => 'deleted "[[$1]]"',
 4737+'uploadedimage' => 'uploaded "[[$1]]"',
 4738+'overwroteimage' => 'uploaded a new version of "[[$1]]"',
 4739+
47124740 # Feedback
47134741 'feedback-bugornote' => 'If you are ready to describe a technical problem in detail please [$1 report a bug].
47144742 Otherwise, you can use the easy form below. Your comment will be added to the page "[$3 $2]", along with your username and what browser you are using.',
@@ -4761,5 +4789,4 @@
47624790 'api-error-unknownerror' => 'Unknown error: "$1".',
47634791 'api-error-uploaddisabled' => 'Uploading is disabled on this wiki.',
47644792 'api-error-verification-error' => 'This file might be corrupt, or have the wrong extension.',
4765 -
47664793 );
Property changes on: branches/REL1_19/phase3/languages
___________________________________________________________________
Modified: svn:mergeinfo
47674794 Merged /trunk/phase3/languages:r112049,112061,112066,112079,112128
Property changes on: branches/REL1_19/phase3
___________________________________________________________________
Modified: svn:mergeinfo
47684795 Merged /trunk/phase3:r112045-112046,112049,112061,112066,112079,112128

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r112045First merge of the rest of the code from bug 34508 patch 1 and patch 3reedy21:26, 21 February 2012
r112046consistently use $entryreedy21:27, 21 February 2012
r112049Effectively revert r112042...reedy21:54, 21 February 2012
r112061Bug 34508 - [Regression] IRC string output for log messages no longer compatible...reedy23:38, 21 February 2012
r112066Move parameters were backwards...reedy00:00, 22 February 2012
r112079* General log formatting fixes, like using the content language, for IRC feed...aaron02:28, 22 February 2012
r112128r112045/bug 34508: Make upload/upload and overwrite match old IRC formatrobla18:29, 22 February 2012

Comments

#Comment by Nikerabbit (talk | contribs)   07:43, 29 February 2012

I thought this was for WMF branch only?

#Comment by Reedy (talk | contribs)   13:43, 29 February 2012

As did I originally... I suppose we should check and back this out ASAP if we need to

Status & tagging log