Nikerabbit has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/218667

Change subject: Skip stats cache purges on no-op edits
......................................................................

Skip stats cache purges on no-op edits

Bug: T102229
Change-Id: I9e9e7a00af359f25d1d73f12ec9067a916e07e25
---
M TranslateEditAddons.php
1 file changed, 9 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate 
refs/changes/67/218667/1

diff --git a/TranslateEditAddons.php b/TranslateEditAddons.php
index e26a306..4cb5f34 100644
--- a/TranslateEditAddons.php
+++ b/TranslateEditAddons.php
@@ -176,8 +176,12 @@
                }
 
                $fuzzy = self::checkNeedsFuzzy( $handle, $text );
-               self::updateFuzzyTag( $title, $rev, $fuzzy );
-               wfRunHooks( 'TranslateEventTranslationEdit', array( $handle ) );
+               $fuzzyOp = self::updateFuzzyTag( $title, $rev, $fuzzy );
+
+               // Skip the hook if no change in status or content
+               if ( $revision || $fuzzyOp ) {
+                       wfRunHooks( 'TranslateEventTranslationEdit', array( 
$handle ) );
+               }
 
                if ( $fuzzy === false ) {
                        wfRunHooks( 'Translate:newTranslation', array( $handle, 
$rev, $text, $user ) );
@@ -228,6 +232,7 @@
         * @param Title $title
         * @param int $revision
         * @param bool $fuzzy
+        * @param bool Whether status changed
         */
        protected static function updateFuzzyTag( Title $title, $revision, 
$fuzzy ) {
                $dbw = wfGetDB( DB_MASTER );
@@ -245,6 +250,8 @@
                } else {
                        $dbw->delete( 'revtag', $conds, __METHOD__ );
                }
+
+               return (bool)$dbw->affectedRows();
        }
 
        /**

-- 
To view, visit https://gerrit.wikimedia.org/r/218667
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9e9e7a00af359f25d1d73f12ec9067a916e07e25
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <niklas.laxst...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to