r51591 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51590‎ | r51591 | r51592 >
Date:15:07, 8 June 2009
Author:werdna
Status:deferred
Tags:
Comment:
Fix logging for thread moves
Modified paths:
  • /trunk/extensions/LiquidThreads/LiquidThreads.php (modified) (history)
  • /trunk/extensions/LiquidThreads/Lqt.i18n.php (modified) (history)
  • /trunk/extensions/LiquidThreads/LqtFunctions.php (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/LqtThread.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/LqtFunctions.php
@@ -97,3 +97,8 @@
9898
9999 return true;
100100 }
 101+
 102+function lqtFormatMoveLogEntry( $type, $action, $title, $sk, $parameters ) {
 103+ return wfMsgExt( 'lqt-log-action-move', 'parseinline',
 104+ array( $title->getPrefixedText(), $parameters[0], $parameters[1] ) );
 105+}
Index: trunk/extensions/LiquidThreads/LiquidThreads.php
@@ -85,6 +85,12 @@
8686 $wgAutoloadClasses['NewUserMessagesView'] = $dir . 'pages/NewUserMessagesView.php';
8787 $wgAutoloadClasses['SpecialNewMessages'] = $dir . 'pages/SpecialNewMessages.php';
8888
 89+// Logging
 90+$wgLogTypes[] = 'liquidthreads';
 91+$wgLogNames['liquidthreads'] = 'lqt-log-name';
 92+$wgLogHeaders['liquidthreads'] = 'lqt-log-header';
 93+$wgLogActionsHandlers['liquidthreads/move'] = 'lqtFormatMoveLogEntry';
 94+
8995 /** CONFIGURATION SECTION */
9096
9197 /* Number of days a thread needs to have existed to be considered for summarizing and archival */
Index: trunk/extensions/LiquidThreads/classes/LqtThread.php
@@ -179,6 +179,9 @@
180180 function moveToPage( $title, $reason, $leave_trace ) {
181181 $dbr =& wfGetDB( DB_MASTER );
182182
 183+ $oldTitle = $this->article()->getTitle();
 184+ $newTitle = $title;
 185+
183186 $new_articleNamespace = $title->getNamespace();
184187 $new_articleTitle = $title->getDBkey();
185188
@@ -196,6 +199,10 @@
197200 $this->articleTitle = $new_articleTitle;
198201 $this->revisionNumber += 1;
199202 $this->commitRevision( Threads::CHANGE_MOVED_TALKPAGE, null, $reason );
 203+
 204+ # Log the move
 205+ $log = new LogPage( 'liquidthreads' );
 206+ $log->addEntry( 'move', $this->double->title(), $reason, array( $oldTitle, $newTitle ) );
200207
201208 if ( $leave_trace ) {
202209 $this->leaveTrace( $reason );
@@ -218,10 +225,6 @@
219226 $redirectRevision->insertOn( $dbw );
220227 $redirectArticle->updateRevisionOn( $dbw, $redirectRevision, 0 );
221228
222 - # Log the move
223 - $log = new LogPage( 'move' );
224 - $log->addEntry( 'move', $this->double->title(), $reason, array( 1 => $this->title()->getPrefixedText() ) );
225 -
226229 # Purge caches as per article creation
227230 Article::onArticleCreate( $redirectArticle->getTitle() );
228231
Index: trunk/extensions/LiquidThreads/Lqt.i18n.php
@@ -146,6 +146,11 @@
147147 'lqt_rc_ellipsis' => ' …',
148148 'lqt_rc_author_original' => '(original author)',
149149 'lqt_rc_author_others' => '(not the author)',
 150+
 151+ // Logging
 152+ 'lqt-log-name' => 'Threaded discussion log',
 153+ 'lqt-log-header' => 'This log details actions taken on discussion threads.',
 154+ 'lqt-log-action-move' => 'moved [[$1]] from [[$2]] to [[$3]].',
150155 );
151156
152157 /** Message documentation (Message documentation)

Status & tagging log