Merge "Add attributes parameter to ShowSearchHitTitle"
[lhc/web/wiklou.git] / includes / jobqueue / jobs / HTMLCacheUpdateJob.php
index 0aa33ca..4d75cb3 100644 (file)
@@ -103,7 +103,7 @@ class HTMLCacheUpdateJob extends Job {
         * @param array $pages Map of (page ID => (namespace, DB key)) entries
         */
        protected function invalidateTitles( array $pages ) {
-               global $wgUpdateRowsPerQuery, $wgUseFileCache;
+               global $wgUpdateRowsPerQuery, $wgUseFileCache, $wgPageLanguageUseDB;
 
                // Get all page IDs in this query into an array
                $pageIds = array_keys( $pages );
@@ -145,7 +145,10 @@ class HTMLCacheUpdateJob extends Job {
                // Get the list of affected pages (races only mean something else did the purge)
                $titleArray = TitleArray::newFromResult( $dbw->select(
                        'page',
-                       [ 'page_namespace', 'page_title' ],
+                       array_merge(
+                               [ 'page_namespace', 'page_title' ],
+                               $wgPageLanguageUseDB ? [ 'page_lang' ] : []
+                       ),
                        [ 'page_id' => $pageIds, 'page_touched' => $dbw->timestamp( $touchTimestamp ) ],
                        __METHOD__
                ) );
@@ -166,6 +169,20 @@ class HTMLCacheUpdateJob extends Job {
                }
        }
 
+       public function getDeduplicationInfo() {
+               $info = parent::getDeduplicationInfo();
+               if ( is_array( $info['params'] ) ) {
+                       // For per-pages jobs, the job title is that of the template that changed
+                       // (or similar), so remove that since it ruins duplicate detection
+                       if ( isset( $info['params']['pages'] ) ) {
+                               unset( $info['namespace'] );
+                               unset( $info['title'] );
+                       }
+               }
+
+               return $info;
+       }
+
        public function workItemCount() {
                if ( !empty( $this->params['recursive'] ) ) {
                        return 0; // nothing actually purged