r113137 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113136‎ | r113137 | r113138 >
Date:14:00, 6 March 2012
Author:siebrand
Status:ok
Tags:i18nreview 
Comment:
No more duplicate log entries when page is reloaded.
Modified paths:
  • /trunk/extensions/Translate/tag/SpecialPageTranslation.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/tag/SpecialPageTranslation.php
@@ -84,15 +84,20 @@
8585 $logger = new LogPage( 'pagetranslation' );
8686 $params = array( 'user' => $wgUser->getName() );
8787
88 - if ( $action === 'encourage' ) {
 88+ $priority = MessageGroups::getPriority( $id );
 89+
 90+ // encouraged is default priority (''). Only do this if the priority is discouraged.
 91+ if ( $action === 'encourage' && $priority === 'discouraged' ) {
8992 $dbw->delete( $table, $row, __METHOD__ );
90 - // @todo Check if page is currently actually encouraged to prevent duplicate log entries.
9193 $logger->addEntry( 'encourage', $title, null, array( serialize( $params ) ) );
9294 } else {
9395 $index = array( 'tgr_group', 'tgr_lang' );
9496 $dbw->replace( $table, array( $index ), $row, __METHOD__ );
95 - // @todo Check if page is currently actually discouraged to prevent duplicate log entries.
96 - $logger->addEntry( 'discourage', $title, null, array( serialize( $params ) ) );
 97+
 98+ // Prevent duplicate log entries.
 99+ if( $priority !== 'discouraged' ) {
 100+ $logger->addEntry( 'discourage', $title, null, array( serialize( $params ) ) );
 101+ }
97102 }
98103
99104 $this->listPages();

Status & tagging log