Wikipedia:Purge
This help page is a how-to guide. It details processes or procedures of some aspect(s) of Wikipedia's norms and practices. It is not one of Wikipedia's policies or guidelines, and may reflect varying levels of consensus and vetting. |
Purge is a function that is sometimes necessary to use to update a wiki page whenever template- or subpage-transclusions are involved. Purging clears the page's server cache, and the page is rebuilt. Before purging, you may want to try first to refresh the page using your web browser.
For updating a page display, any purge methods do the job, but for categories and backlinks a null edit explained below is required, and other methods don't work. Update of images is explained in a section below.
The page to purge is the one that transcludes, not the page that gets transcluded. Purge consumes a small amount of additional processing power to rebuild the page.
How to purge
By clicking a link
Sometimes already provided
Some pages already provide a link to purge the page, such as the Wikipedia:Templates for discussion page (WP:TFD). Simply click on the link to purge the page. (WP:TFD transcludes subpages like Wikipedia:Templates for discussion/Log/2021 March 26, and updates from these subpages are not always reflected in WP:TFD. By purging, you will see the most recent version.)
{{purge}}
The {{purge}} template may be used to place a purge link on a page.
Gadgets
There are also two gadgets that can add a purge tab or link to every page. These may be found in the Gadgets section of your Wikipedia Preferences, under "Appearance":
- The "Purgetab" gadget ("Add a "Purge" option to the top of the page, which purges the page's cache"), and
- The "UTCLiveClock" gadget ("Add a clock to the personal toolbar that displays the current time in UTC and provides a link to purge the current page (documentation)").
The "purge" option of the former can also be found in the Vector skin by navigating to the drop-down menu to the left of the Search box. In the MonoBook skin, it is in a separate tab.
To change the text shown on the "Purgetab" gadget's menu, add the following to your common.js file (or create the file using it):
/* Customise purge tab's text */
$( document ).ready( function() {
$( 'a', '#ca-purge' ).text( 'p' );
});
In this case, the 'p'
in the third line sets the text shown on the tab to the lowercase letter p. You can change this to whatever you prefer ('purge'
, 'purge page'
, etc).
Purge request to server
You can also request the MediaWiki server to purge using a special URL. The URL should be in the format //en.wikipedia.org/w/index.php?title=page_title&action=purge
(it can be prefixed with http:
, https:
, or with nothing).
Note that this will not work with URLs of the form //en.wikipedia.org/wiki/page_title
, for which a slightly different form is required: //en.wikipedia.org/wiki/page_title?action=purge
.
It may be easiest to make the URL by clicking "edit" or "view source" tab of the page, and changing the last portion of the URL's query string from action=edit
to action=purge
(anything in the URL that appears after action=edit
can be deleted).
This kind of URL is used to make the links and templates outlined in the Just by clicking a link section above.
Null edit
If a category or backlink page isn't showing linked articles known to exist, the page may be null-edited (refreshed) and will then show all properly linked articles.
A null edit purges the target page (including category and backlink pages) if the page can be edited:
- Click the "Edit" tab at the top of the page.
- Click "Publish changes" at the bottom of the edit box without making any changes.
With a null edit, nothing is saved, and no edit is recorded. If you leave text in the edit summary, it will be discarded. Adding new blank lines only to the end of the page is also usually a null edit. Trailing blank lines are largely ignored. Section edits, however, sometimes result in changes, and get saved.
A page move or protection counts as a null edit as well, although an edit is recorded in the page history.
- Advantage
- None of the other purge methods apply to categorisation nor to "what links here" changes from template edits.
- Disadvantage
- If you can't edit the page, you can't do a null edit, obviously. If what you want is category or backlink updates but you can't null edit, just wait. Changes in category links are put into the job queue, and re-cached when the server load is low. Depending on how busy the server is, the page may take days, or even months, to be updated.
Do not confuse null edit with dummy edit. A dummy edit does modify the source, even though slightly.
If you have access to use the AutoWikiBrowser and need to purge a large number of pages (e.g. after changing a transcluded template), one way to do this is to append {{subst:void}}
to the page and submitting it. No changes will be made, but the page will be purged. When doing this, make sure you set the use X newlines option to 0 newlines; otherwise, saving a newline with {{subst:void}}
will cause an edit to be recorded (see phab:T184586).
Purge local browser cache
Google Chrome | Ctrl+F5 or ⇧ Shift+F5 |
Mozilla Firefox | Microsoft Windows and Linux: Ctrl+F5 or Ctrl+⇧ Shift+R[1] Mac OS X:: |
Edge | F5 or Ctrl+R |
Internet Explorer | Ctrl+F5[2] |
Opera | Ctrl+F5 or ⇧ Shift+F5 |
Safari | Mac OS X: ⌘+⌥+E (clearing browsercache) or ⌘+R (update) Microsoft Windows: |
Konqueror | Ctrl+R |
Camino | Ctrl+R |
forcerecursivelinkupdate
The behaviour of null edits changed around July 2013. Null edits previously added all pages which transcluded the page to the job queue to be reparsed. Now a null edit will reparse the page edited just as it always has (and therefore fix category membership and such), but it will no longer queue every transcluding page for reparse too.
A new "forcerecursivelinkupdate" parameter was added to the API's action=purge to get the old behavior if necessary. So action=purge&forcerecursivelinkupdate=1
in the URL (see above) will get the old behaviour. Only use this responsibly.
These changes do not affect normal edits that change the content of a page.
User preference
Logged-in users have some options in their Special:Preferences to help purging and bypassing browser caches. See also Special:Gadgets. For purge gadgets in Commons, see commons:Help:purge.
Automating the confirmation screen
Logged in users may automate the "OK" confirmation by modifying their custom common.js file. An example script is below:
/* Automate purge confirmation dialog */
if ( mw.config.get( 'wgAction' ) === 'purge' ) {
$('form[action*="action=purge"]').submit();
}
Server cache
When a change is made to a page, the MediaWiki software saves the change to the main database. Thereafter a copy of that page is made to a "server cache" on secondary servers, and until the page is changed again, that cached page will be shown. A change in a template puts updates of articles that use the template into a waiting list, called the Job queue, and the page is updated once it has reached it's turn. Smaller changes to the cache are done when pages are deleted or restored, in that case only the links are updated. Similarly when an image is updated, thumbnails on all pages that use that image are updated.[3]
In templates, the #time parser function and the formatDate function in Modules will update server cache once the the resulting time is up.[4] If none of the previous conditions are met, then the page will be updated 30 days after the last edit.[5] Some pages are updated more frequently, like the Main page, which is updated every hour.
For images
To refresh thumbnails, you may have to purge either or both of the image page and/or the page that loads the image.
First go to the image description page by clicking the image. You should go further to Commons if the image is from Commons. Then purge. (Purge gadgets seem to work consistently. See commons:Help:Purge for Commons gadgets.) It may take a while for MediaWiki to complete rescaling, especially for an animated GIF. It depends on how busy the MediaWiki software is.
After a while, go back to the page with thumbnails and reload, bypassing your browser cache (Ctrl-F5 on Firefox). If the page still shows the old thumbnails, then purge this page.
If an image thumbnail will not yet regenerate successfully, it is probably because the server has cached an error page with the URL of a thumbnail, but the page is not purged because the actual thumbnail does not exist. The solution is to request the thumbnail with an unusual URL, say by appending "?1
" to the end, then do a usual purge. If there is still a problem, ask for help at Wikipedia:Village pump (technical).
See also
- Wikipedia:Transclusion
- mw:Manual:Purge, mw:Manual:Cache, mw:Manual:Job queue
- Wikipedia:Bypass your cache, related but different concept of clearing a cache locally
References
- ^ Mozilla Hilfe und Support: Firefox – Wie Sie den Cache leeren können, Tastaturkürzel, auf mozillaZine: Auswirkungen der Cache-Einstellungen (engl.)
- ^ Microsoft Hilfe und Support: Internet Explorer – Tastenkombinationen, Einfluss der Cache-Einstellungen auf das Browsen
- ^ mw:Manual:Job_queue#HTML_cache_invalidation
- ^ gerrit:c/mediawiki/core/+/135887/
- ^ gerrit:c/operations/puppet/+/230808/2/modules/role/manifests/cache/text.pp