Meza/Ensuring users get the latest file

The problem
after you "Upload a new version of this file" for a file .. other pages in the wiki that link to that file do not automatically result in the latest version without some manual per-page coercing by the users .. how can admins guarantee that users will always see the "current version" of an image after it has been updated?

Possible Solutions
Which of these options and how to configure them is still a topic of discussion. If you have any specific solution that works for you.. please contribute to this page.

tools and solutions listed so far include;

MW update
https://gerrit.wikimedia.org/r/#/c/mediawiki/core/+/496705/

apache solution
https://httpd.apache.org/docs/current/mod/mod_expires.html

Stashbot
https://wikitech.wikimedia.org/wiki/Tool:Stashbot

Resolve Bug
https://phabricator.wikimedia.org/T19577

Header Modules
configure a for images, and use the headers module to add headers http://httpd.apache.org/docs/current/mod/mod_headers.html#header

Other
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control has other caching possibilities

Extension:WikiDexFileRepository
using: https://github.com/ciencia/mediawiki-extensions-WikiDexFileRepository In Localsettings: wfLoadExtension( 'WikiDexFileRepository' ); $wgLocalFileRepo = [ 'class' => 'LocalWikiDexRepo', 'name' => 'local', 'directory' => $wgUploadDirectory, 'url' => $wgUploadBaseUrl ? $wgUploadBaseUrl. $wgUploadPath : $wgUploadPath, 'hashLevels' => 2, 'thumbScriptUrl' => $wgThumbnailScriptPath, 'transformVia404' => true, 'deletedDir' => $wgDeletedDirectory, 'deletedHashLevels' => 3 ]; this extension adds extra "/latest/ " to the image/file path before the filename, which must be stripped out by rewrite rules in .htaccess

Such as the following for NGINX map $mwuploads_longcache $mwuploads_expire { default 5m; 1 30d; }

map $uri $images_thumbfallback { default @404; "~/mwuploads/wikidex/" @thumb; }

map $uri $images_mwinstallpath { default "/dev/null"; "~/mwuploads/wikidex/" "/home/www/www.wikidex.net/mediawiki-1.30"; }

map $request_uri $thumbfile { default "xx"; "~/mwuploads/[a-z0-9]+/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/latest/[0-9]+/(? [^/]+)/[0-9]+px-.*$" "$xthumbfile"; "~/mwuploads/[a-z0-9]+/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/(? [^/]+)/[0-9]+px-.*$" "$xthumbfile"; "~/mwuploads/[a-z0-9]+/thumb/archive/[0-9a-f]/[0-9a-f][0-9a-f]/(? [^/]+)/[0-9]+px-.*$" "$xthumbfile"; } server {

location /mwuploads/ { alias /data/mwuploads/public/; expires $mwuploads_expire;

# Imagen con /latest/timestamp/, se reescribe, expires largo location ~ "^/mwuploads/[a-z0-9]+/(?:thumb/)?[0-9a-f]/[0-9a-f][0-9a-f]/latest/[0-9]+/.*$" { set $mwuploads_longcache 1; expires $mwuploads_expire; rewrite "^/mwuploads/(? [a-z0-9]+/(?:thumb/)?[0-9a-f]/[0-9a-f][0-9a-f]/)latest/[0-9]+/(? .*)$" "/mwuploads/$startpath$endpath"; }

# Imagen directa en /archive, expires largo location ~ "^/mwuploads/[a-z0-9]+/archive" { set $mwuploads_longcache 1; expires $mwuploads_expire; }		# Imagen thumb # Ojo, las variables del regexp se usan en @thumb location ~ "^/mwuploads/[a-z0-9]+/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/[^/]+/(? [0-9]+)px-.*$" { set $thumbarchived 0; expires $mwuploads_expire; try_files $uri $images_thumbfallback; }		# Imagen thumb de archive location ~ "^/mwuploads/[a-z0-9]+/thumb/archive/[0-9a-f]/[0-9a-f][0-9a-f]/[^/]+/(? [0-9]+)px-.*$" { set $mwuploads_longcache 1; set $thumbarchived 1; expires $mwuploads_expire; try_files $uri $images_thumbfallback; }	}

location @thumb { expires $mwuploads_expire; # Run the thumb.php script include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME $images_mwinstallpath/thumb.php; fastcgi_param QUERY_STRING f=$thumbfile&width=$thumbwidth&archived=$thumbarchived; fastcgi_pass unix:/run/php/php-fpm-wikidex-images.sock; }

location @404 { return 404; }

location / { return 404; } }