Fix highlight display for enhanced mode
[lhc/web/wiklou.git] / includes / jobqueue / jobs / HTMLCacheUpdateJob.php
index 2d816f9..9d0f87c 100644 (file)
@@ -139,9 +139,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 ) {
@@ -152,6 +156,12 @@ class HTMLCacheUpdateJob extends Job {
        }
 
        public function workItemCount() {
-               return isset( $this->params['pages'] ) ? count( $this->params['pages'] ) : 1;
+               if ( !empty( $this->params['recursive'] ) ) {
+                       return 0; // nothing actually purged
+               } elseif ( isset( $this->params['pages'] ) ) {
+                       return count( $this->params['pages'] );
+               }
+
+               return 1; // one title
        }
 }