Fix old regression in HTMLCacheUpdate de-duplication
[lhc/web/wiklou.git] / includes / jobqueue / jobs / HTMLCacheUpdateJob.php
index 07d68e7..4c16d7f 100644 (file)
@@ -113,6 +113,10 @@ class HTMLCacheUpdateJob extends Job {
                // before the link jobs, so using the current timestamp instead of the root timestamp is
                // not expected to invalidate these cache entries too often.
                $touchTimestamp = wfTimestampNow();
+               // If page_touched is higher than this, then something else already bumped it after enqueue
+               $condTimestamp = isset( $this->params['rootJobTimestamp'] )
+                       ? $this->params['rootJobTimestamp']
+                       : $touchTimestamp;
 
                $dbw = wfGetDB( DB_MASTER );
                $factory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
@@ -126,7 +130,7 @@ class HTMLCacheUpdateJob extends Job {
                                [ 'page_touched' => $dbw->timestamp( $touchTimestamp ) ],
                                [ 'page_id' => $batch,
                                        // don't invalidated pages that were already invalidated
-                                       "page_touched < " . $dbw->addQuotes( $dbw->timestamp( $touchTimestamp ) )
+                                       "page_touched < " . $dbw->addQuotes( $dbw->timestamp( $condTimestamp ) )
                                ],
                                __METHOD__
                        );
@@ -139,9 +143,13 @@ class HTMLCacheUpdateJob extends Job {
                        __METHOD__
                ) );
 
-               // Update CDN
-               $u = CdnCacheUpdate::newFromTitles( $titleArray );
-               $u->doUpdate();
+               // Update CDN; call purge() directly so as to not bother with secondary purges
+               $urls = [];
+               foreach ( $titleArray as $title ) {
+                       /** @var Title $title */
+                       $urls = array_merge( $urls, $title->getCdnUrls() );
+               }
+               CdnCacheUpdate::purge( $urls );
 
                // Update file cache
                if ( $wgUseFileCache ) {