https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113137

Revision: 113137
Author:   siebrand
Date:     2012-03-06 14:00:28 +0000 (Tue, 06 Mar 2012)
Log Message:
-----------
No more duplicate log entries when page is reloaded.

Modified Paths:
--------------
    trunk/extensions/Translate/tag/SpecialPageTranslation.php

Modified: trunk/extensions/Translate/tag/SpecialPageTranslation.php
===================================================================
--- trunk/extensions/Translate/tag/SpecialPageTranslation.php   2012-03-06 
13:49:37 UTC (rev 113136)
+++ trunk/extensions/Translate/tag/SpecialPageTranslation.php   2012-03-06 
14:00:28 UTC (rev 113137)
@@ -84,15 +84,20 @@
                        $logger = new LogPage( 'pagetranslation' );
                        $params = array( 'user' => $wgUser->getName() );
 
-                       if ( $action === 'encourage' ) {
+                       $priority = MessageGroups::getPriority( $id );
+
+                       // encouraged is default priority (''). Only do this if 
the priority is discouraged.
+                       if ( $action === 'encourage' && $priority === 
'discouraged' ) {
                                $dbw->delete( $table, $row, __METHOD__ );
-                               // @todo Check if page is currently actually 
encouraged to prevent duplicate log entries.
                                $logger->addEntry( 'encourage', $title, null, 
array( serialize( $params ) ) );
                        } else {
                                $index = array( 'tgr_group', 'tgr_lang' );
                                $dbw->replace( $table, array( $index ), $row, 
__METHOD__ );
-                               // @todo Check if page is currently actually 
discouraged to prevent duplicate log entries.
-                               $logger->addEntry( 'discourage', $title, null, 
array( serialize( $params ) ) );
+
+                               // Prevent duplicate log entries.
+                               if( $priority !== 'discouraged' ) {
+                                       $logger->addEntry( 'discourage', 
$title, null, array( serialize( $params ) ) );
+                               }
                        }
 
                        $this->listPages();


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to