Manybubbles has uploaded a new change for review.

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


Change subject: Create a hook for bulk html cache invalidation.
......................................................................

Create a hook for bulk html cache invalidation.

We'd like to subvert the html cache invalidation logic to schedule
search index updates after template changes.

Change-Id: Ia51fe586bf9b5646505bcb8667a3f4107ce7689c
---
M docs/hooks.txt
M includes/job/jobs/HTMLCacheUpdateJob.php
2 files changed, 16 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/31/75131/1

diff --git a/docs/hooks.txt b/docs/hooks.txt
index fb9a528..0ff850a 100644
--- a/docs/hooks.txt
+++ b/docs/hooks.txt
@@ -758,6 +758,11 @@
 $isbn: ISBN to show information for
 $output: OutputPage object in use
 
+'BulkInvalidateHTMLCache': Called when we need to invalidate the HTML cache for
+a list of title.  Not triggered for a single page.
+$title: the title that changed that forced the invalidation
+$titles: array (or iterator) of Title objects that need invalidation
+
 'CanonicalNamespaces': For extensions adding their own namespaces or altering
 the defaults.
 &$namespaces: Array of namespace numbers with corresponding canonical names
diff --git a/includes/job/jobs/HTMLCacheUpdateJob.php 
b/includes/job/jobs/HTMLCacheUpdateJob.php
index 44c240b..ae3c9a1 100644
--- a/includes/job/jobs/HTMLCacheUpdateJob.php
+++ b/includes/job/jobs/HTMLCacheUpdateJob.php
@@ -247,16 +247,18 @@
                        );
                }
 
-               # Update squid
-               if ( $wgUseSquid ) {
-                       $u = SquidUpdate::newFromTitles( $titleArray );
-                       $u->doUpdate();
-               }
+               if ( wfRunHooks('BulkInvalidateHTMLCache', array( 
$this->getTitle(), $titleArray ) ) ) {
+                       # Update squid
+                       if ( $wgUseSquid ) {
+                               $u = SquidUpdate::newFromTitles( $titleArray );
+                               $u->doUpdate();
+                       }
 
-               # Update file cache
-               if ( $wgUseFileCache ) {
-                       foreach ( $titleArray as $title ) {
-                               HTMLFileCache::clearFileCache( $title );
+                       # Update file cache
+                       if ( $wgUseFileCache ) {
+                               foreach ( $titleArray as $title ) {
+                                       HTMLFileCache::clearFileCache( $title );
+                               }
                        }
                }
        }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia51fe586bf9b5646505bcb8667a3f4107ce7689c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Manybubbles <[email protected]>

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

Reply via email to