Mobrovac has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/380805 )

Change subject: Add the FlaggedRevsStableRevisionUpdate hook
......................................................................

Add the FlaggedRevsStableRevisionUpdate hook

There are various ways and code paths that can cause a page's stable
revision to change (add/remove/update). Tracking this externally can be
rather tricky. Alas, the extension can determine exactly if/when
something changes, so have a hook that allows other parts of the system
to react to it.

The first use-case will be leveraging the hook to emit events in the
EventBus system that will enable RESTBase to track changes in flagged
revisions for titles and invalidate its caches accordingly.

Bug: T169116
Change-Id: I23f86a291e0dba9e81c03997b236c7fddd7c376f
---
M backend/FlaggedRevs.class.php
M docs/hooks.txt
2 files changed, 11 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FlaggedRevs 
refs/changes/05/380805/1

diff --git a/backend/FlaggedRevs.class.php b/backend/FlaggedRevs.class.php
index 36ef149..cfb0b8e 100644
--- a/backend/FlaggedRevs.class.php
+++ b/backend/FlaggedRevs.class.php
@@ -676,6 +676,10 @@
                        self::purgeSquid( $title );
                }
 
+               if ( $changed ) {
+                       Hooks::run( 'FlaggedRevsStableRevisionUpdate', [ 
&$article, &$sv, &$oldSv ] );
+               }
+
                return $changed;
        }
 
diff --git a/docs/hooks.txt b/docs/hooks.txt
index f7c3b1f..fc7af3d 100644
--- a/docs/hooks.txt
+++ b/docs/hooks.txt
@@ -15,3 +15,10 @@
 $status: the status value generated from RevisionReviewForm::doSubmit. This is
 not a Status object but string or boolean value! 'true' on success, error
 message key on failure.
+
+'FlaggedRevsStableRevisionUpdate': When the stable revision of a page has been
+changed.
+$article: the FlaggableWikiPage for which the stable revision has changed
+$sv: the FlaggedRevision object that holds the current stable revision (can be
+null)
+$oldSv: the old FlaggedRevision object being replaced (can be null)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I23f86a291e0dba9e81c03997b236c7fddd7c376f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/FlaggedRevs
Gerrit-Branch: master
Gerrit-Owner: Mobrovac <mobro...@wikimedia.org>

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

Reply via email to