Jump to content
Wikipedia The Free Encyclopedia

Module:Purge

From Wikipedia, the free encyclopedia
Module documentation[view] [edit] [history] [purge]
This module is rated as ready for general use. It has reached a mature state, is considered relatively stable and bug-free, and may be used wherever appropriate. It can be mentioned on help pages and other Wikipedia resources as an option for new users. To minimise server load and avoid disruptive output, improvements should be developed through sandbox testing rather than repeated trial-and-error editing.
Page template-protected This module is currently protected from editing.
See the protection policy and protection log for more details. Please discuss any changes on the talk page; you may submit an edit request to ask an administrator to make an edit if it is uncontroversial or supported by consensus. You may also request that this page be unprotected.
[画像:Warning] This Lua module is used in system messages, and on approximately 563,000 pages.
Changes to it can cause immediate changes to the Wikipedia user interface.
To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Please discuss changes on the talk page before implementing them.

This module produces a link to purge a page's cache. This is usually the current page, but can be another page.

Usage

From wiktext

From wikitext, this module should be accessed via Template:Purge. Please see the template page for documentation.

From Lua

From Lua, first you need to load the module:

localmPurge=require('Module:Purge')

Then you can create purge links with the _main function:

mPurge._main(args)

args is a table of arguments, identical to the ones accepted by Template:Purge. Please see the template documentation for more details.

The above documentation is transcluded from Module:Purge/doc. (edit | history)
Editors can experiment in this module's sandbox (edit | diff) and testcases (create) pages.
Subpages of this module.

 -- This module implements [[Template:Purge]].

 localp={}

 localfunctionmakeUrlLink(url,display)
 returnstring.format('[%s %s]',url,display)
 end

 functionp._main(args)
 -- Make the URL
 localurl
 do
 localtitle
 ifargs.pagethen
 title=mw.title.new(args.page)
 ifnottitlethen
 error(string.format(
 "'%s' is not a valid page name",
 args.page
 ),2)
 end
 else
 title=mw.title.getCurrentTitle()
 end
 ifargs.anchorthen
 title.fragment=args.anchor
 end
 url=title:fullUrl{action='purge'}
 end

 -- Make the display
 localdisplay
 ifargs.pagethen
 display=args[1]or'Purge'
 else
 display=mw.html.create('span')
 display
 :attr('title','Purge this page')
 :wikitext(args[1]or'Purge')
 display=tostring(display)
 end

 -- Output the HTML
 localroot=mw.html.create('span')
 root
 :addClass('noprint')
 :addClass('plainlinks')
 :addClass('purgelink')
 :wikitext(makeUrlLink(url,display))

 returntostring(root)
 end

 functionp.main(frame)
 localargs=frame:getParent().args
 returnp._main(args)
 end

 returnp

AltStyle によって変換されたページ (->オリジナル) /