Cleanup File::purgeEverything() to use JobQueueGroup::lazyPush() in one batch
authorAaron Schulz <aschulz@wikimedia.org>
Wed, 11 Sep 2019 22:09:07 +0000 (15:09 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Wed, 11 Sep 2019 22:09:07 +0000 (15:09 -0700)
Change-Id: I347de55ecca4d2779eba6a8627276b9afef48905

includes/filerepo/file/File.php

index 0d5776b..60d4e29 100644 (file)
@@ -1467,13 +1467,15 @@ abstract class File implements IDBAccessObject {
                // Delete thumbnails and refresh file metadata cache
                $this->purgeCache();
                $this->purgeDescription();
-
                // Purge cache of all pages using this file
                $title = $this->getTitle();
                if ( $title ) {
-                       DeferredUpdates::addUpdate(
-                               new HTMLCacheUpdate( $title, 'imagelinks', 'file-purge' )
+                       $job = HTMLCacheUpdateJob::newForBacklinks(
+                               $title,
+                               'imagelinks',
+                               [ 'causeAction' => 'file-purge' ]
                        );
+                       JobQueueGroup::singleton()->lazyPush( $job );
                }
        }