DeferredUpdates::addUpdate( new CdnCacheUpdate( $urls ), DeferredUpdates::PRESEND );
}
+ /**
+ * Prerenders a configurable set of thumbnails
+ *
+ * @since 1.28
+ */
+ public function prerenderThumbnails() {
+ global $wgUploadThumbnailRenderMap;
+
+ $jobs = [];
+
+ $sizes = $wgUploadThumbnailRenderMap;
+ rsort( $sizes );
+
+ foreach ( $sizes as $size ) {
+ if ( $this->isVectorized() || $this->getWidth() > $size ) {
+ $jobs[] = new ThumbnailRenderJob(
+ $this->getTitle(),
+ [ 'transformParams' => [ 'width' => $size ] ]
+ );
+ }
+ }
+
+ if ( $jobs ) {
+ JobQueueGroup::singleton()->lazyPush( $jobs );
+ }
+ }
+
/**
* Delete a list of thumbnails visible at urls
* @param string $dir Base dir of the files.
# Update backlink pages pointing to this title if created
LinksUpdate::queueRecursiveJobsForTable( $this->getTitle(), 'imagelinks' );
}
+
+ $this->prerenderThumbnails();
}
),
DeferredUpdates::PRESEND
* @since 1.25
*/
public function postProcessUpload() {
- global $wgUploadThumbnailRenderMap;
-
- $jobs = [];
-
- $sizes = $wgUploadThumbnailRenderMap;
- rsort( $sizes );
-
- $file = $this->getLocalFile();
-
- foreach ( $sizes as $size ) {
- if ( $file->isVectorized() || $file->getWidth() > $size ) {
- $jobs[] = new ThumbnailRenderJob(
- $file->getTitle(),
- [ 'transformParams' => [ 'width' => $size ] ]
- );
- }
- }
-
- if ( $jobs ) {
- JobQueueGroup::singleton()->push( $jobs );
- }
}
/**