hooks.txt 174 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970
  1. hooks.txt
  2. This document describes how event hooks work in MediaWiki; how to add hooks for
  3. an event; and how to run hooks for an event.
  4. ==Glossary==
  5. event
  6. Something that happens with the wiki. For example: a user logs in. A wiki
  7. page is saved. A wiki page is deleted. Often there are two events
  8. associated with a single action: one before the code is run to make the
  9. event happen, and one after. Each event has a name, preferably in
  10. CamelCase. For example, 'UserLogin', 'PageContentSave',
  11. 'PageContentSaveComplete', 'ArticleDelete'.
  12. hook
  13. A clump of code and data that should be run when an event happens. This can
  14. be either a function and a chunk of data, or an object and a method.
  15. hook function
  16. The function part of a hook.
  17. ==Rationale==
  18. Hooks allow us to decouple optionally-run code from code that is run for
  19. everyone. It allows MediaWiki hackers, third-party developers and local
  20. administrators to define code that will be run at certain points in the mainline
  21. code, and to modify the data run by that mainline code. Hooks can keep mainline
  22. code simple, and make it easier to write extensions. Hooks are a principled
  23. alternative to local patches.
  24. Consider, for example, two options in MediaWiki. One reverses the order of a
  25. title before displaying the article; the other converts the title to all
  26. uppercase letters. Currently, in MediaWiki code, we would handle this as follows
  27. (note: not real code, here):
  28. function showAnArticle( $article ) {
  29. global $wgReverseTitle, $wgCapitalizeTitle;
  30. if ( $wgReverseTitle ) {
  31. wfReverseTitle( $article );
  32. }
  33. if ( $wgCapitalizeTitle ) {
  34. wfCapitalizeTitle( $article );
  35. }
  36. # code to actually show the article goes here
  37. }
  38. An extension writer, or a local admin, will often add custom code to the
  39. function -- with or without a global variable. For example, someone wanting
  40. email notification when an article is shown may add:
  41. function showAnArticle( $article ) {
  42. global $wgReverseTitle, $wgCapitalizeTitle, $wgNotifyArticle;
  43. if ( $wgReverseTitle ) {
  44. wfReverseTitle( $article );
  45. }
  46. if ( $wgCapitalizeTitle ) {
  47. wfCapitalizeTitle( $article );
  48. }
  49. # code to actually show the article goes here
  50. if ( $wgNotifyArticle ) {
  51. wfNotifyArticleShow( $article );
  52. }
  53. }
  54. Using a hook-running strategy, we can avoid having all this option-specific
  55. stuff in our mainline code. Using hooks, the function becomes:
  56. function showAnArticle( $article ) {
  57. if ( Hooks::run( 'ArticleShow', array( &$article ) ) ) {
  58. # code to actually show the article goes here
  59. Hooks::run( 'ArticleShowComplete', array( &$article ) );
  60. }
  61. }
  62. We've cleaned up the code here by removing clumps of weird, infrequently used
  63. code and moving them off somewhere else. It's much easier for someone working
  64. with this code to see what's _really_ going on, and make changes or fix bugs.
  65. In addition, we can take all the code that deals with the little-used
  66. title-reversing options (say) and put it in one place. Instead of having little
  67. title-reversing if-blocks spread all over the codebase in showAnArticle,
  68. deleteAnArticle, exportArticle, etc., we can concentrate it all in an extension
  69. file:
  70. function reverseArticleTitle( $article ) {
  71. # ...
  72. }
  73. function reverseForExport( $article ) {
  74. # ...
  75. }
  76. The setup function for the extension just has to add its hook functions to the
  77. appropriate events:
  78. setupTitleReversingExtension() {
  79. global $wgHooks;
  80. $wgHooks['ArticleShow'][] = 'reverseArticleTitle';
  81. $wgHooks['ArticleDelete'][] = 'reverseArticleTitle';
  82. $wgHooks['ArticleExport'][] = 'reverseForExport';
  83. }
  84. Having all this code related to the title-reversion option in one place means
  85. that it's easier to read and understand; you don't have to do a grep-find to see
  86. where the $wgReverseTitle variable is used, say.
  87. If the code is well enough isolated, it can even be excluded when not used --
  88. making for some slight savings in memory and load-up performance at runtime.
  89. Admins who want to have all the reversed titles can add:
  90. require_once 'extensions/ReverseTitle.php';
  91. ...to their LocalSettings.php file; those of us who don't want or need it can
  92. just leave it out.
  93. The extensions don't even have to be shipped with MediaWiki; they could be
  94. provided by a third-party developer or written by the admin him/herself.
  95. ==Writing hooks==
  96. A hook is a chunk of code run at some particular event. It consists of:
  97. * a function with some optional accompanying data, or
  98. * an object with a method and some optional accompanying data.
  99. Hooks are registered by adding them to the global $wgHooks array for a given
  100. event. All the following are valid ways to define hooks:
  101. $wgHooks['EventName'][] = 'someFunction'; # function, no data
  102. $wgHooks['EventName'][] = array( 'someFunction', $someData );
  103. $wgHooks['EventName'][] = array( 'someFunction' ); # weird, but OK
  104. $wgHooks['EventName'][] = $object; # object only
  105. $wgHooks['EventName'][] = array( $object, 'someMethod' );
  106. $wgHooks['EventName'][] = array( $object, 'someMethod', $someData );
  107. $wgHooks['EventName'][] = array( $object ); # weird but OK
  108. When an event occurs, the function (or object method) will be called with the
  109. optional data provided as well as event-specific parameters. The above examples
  110. would result in the following code being executed when 'EventName' happened:
  111. # function, no data
  112. someFunction( $param1, $param2 )
  113. # function with data
  114. someFunction( $someData, $param1, $param2 )
  115. # object only
  116. $object->onEventName( $param1, $param2 )
  117. # object with method
  118. $object->someMethod( $param1, $param2 )
  119. # object with method and data
  120. $object->someMethod( $someData, $param1, $param2 )
  121. Note that when an object is the hook, and there's no specified method, the
  122. default method called is 'onEventName'. For different events this would be
  123. different: 'onArticleSave', 'onUserLogin', etc.
  124. The extra data is useful if we want to use the same function or object for
  125. different purposes. For example:
  126. $wgHooks['PageContentSaveComplete'][] = array( 'ircNotify', 'TimStarling' );
  127. $wgHooks['PageContentSaveComplete'][] = array( 'ircNotify', 'brion' );
  128. This code would result in ircNotify being run twice when an article is saved:
  129. once for 'TimStarling', and once for 'brion'.
  130. Hooks can return three possible values:
  131. * No return value (or null): the hook has operated successfully. Previously,
  132. true was required. This is the default since MediaWiki 1.23.
  133. * "some string": an error occurred; processing should stop and the error
  134. should be shown to the user
  135. * false: the hook has successfully done the work necessary and the calling
  136. function should skip
  137. The last result would be for cases where the hook function replaces the main
  138. functionality. For example, if you wanted to authenticate users to a custom
  139. system (LDAP, another PHP program, whatever), you could do:
  140. $wgHooks['UserLogin'][] = array( 'ldapLogin', $ldapServer );
  141. function ldapLogin( $username, $password ) {
  142. # log user into LDAP
  143. return false;
  144. }
  145. Returning false makes less sense for events where the action is complete, and
  146. will normally be ignored.
  147. Note that none of the examples made use of create_function() as a way to
  148. attach a function to a hook. This is known to cause problems (notably with
  149. Special:Version), and should be avoided when at all possible.
  150. ==Using hooks==
  151. A calling function or method uses the Hooks::run() function to run the hooks
  152. related to a particular event, like so:
  153. class Article {
  154. # ...
  155. function protect() {
  156. global $wgUser;
  157. // Avoid PHP 7.1 warning from passing $this by reference
  158. $article = $this;
  159. if ( Hooks::run( 'ArticleProtect', [ &$article, &$wgUser ] ) ) {
  160. # protect the article
  161. Hooks::run( 'ArticleProtectComplete', [ &$article, &$wgUser ] );
  162. }
  163. }
  164. }
  165. Hooks::run() returns true if the calling function should continue processing
  166. (the hooks ran OK, or there are no hooks to run), or false if it shouldn't (an
  167. error occurred, or one of the hooks handled the action already). Checking the
  168. return value matters more for "before" hooks than for "complete" hooks.
  169. Hooks::run() was added in MediaWiki 1.18, before that the global function
  170. wfRunHooks must be used, which was deprecated in MediaWiki 1.25.
  171. Note that hook parameters are passed in an array; this is a necessary
  172. inconvenience to make it possible to pass reference values (that can be changed)
  173. into the hook code. Also note that earlier versions of wfRunHooks took a
  174. variable number of arguments; the array() calling protocol came about after
  175. MediaWiki 1.4rc1.
  176. ==Events and parameters==
  177. This is a list of known events and parameters; please add to it if you're going
  178. to add events to the MediaWiki code.
  179. 'AbortAutoAccount': DEPRECATED! Create a PreAuthenticationProvider instead.
  180. Return false to cancel automated local account creation, where normally
  181. authentication against an external auth plugin would be creating a local
  182. account.
  183. $user: the User object about to be created (read-only, incomplete)
  184. &$abortMsg: out parameter: name of error message to be displayed to user
  185. 'AbortAutoblock': Return false to cancel an autoblock.
  186. $autoblockip: The IP going to be autoblocked.
  187. &$block: The block from which the autoblock is coming.
  188. 'AbortDiffCache': Can be used to cancel the caching of a diff.
  189. &$diffEngine: DifferenceEngine object
  190. 'AbortEmailNotification': Can be used to cancel email notifications for an edit.
  191. $editor: The User who made the change.
  192. $title: The Title of the page that was edited.
  193. $rc: The current RecentChange object.
  194. 'AbortLogin': DEPRECATED! Create a PreAuthenticationProvider instead.
  195. Return false to cancel account login.
  196. $user: the User object being authenticated against
  197. $password: the password being submitted, not yet checked for validity
  198. &$retval: a LoginForm class constant to return from authenticateUserData();
  199. default is LoginForm::ABORTED. Note that the client may be using a machine
  200. API rather than the HTML user interface.
  201. &$msg: the message identifier for abort reason (new in 1.18, not available
  202. before 1.18)
  203. 'AbortNewAccount': DEPRECATED! Create a PreAuthenticationProvider instead.
  204. Return false to cancel explicit account creation.
  205. $user: the User object about to be created (read-only, incomplete)
  206. &$msg: out parameter: HTML to display on abort
  207. &$status: out parameter: Status object to return, replaces the older $msg param
  208. (added in 1.23)
  209. Create the object with Status::newFatal() to ensure proper API error
  210. messages are returned when creating account through API clients.
  211. 'AbortTalkPageEmailNotification': Return false to cancel talk page email
  212. notification
  213. $targetUser: the user whom to send talk page email notification
  214. $title: the page title
  215. 'ActionBeforeFormDisplay': Before executing the HTMLForm object.
  216. $name: name of the action
  217. &$form: HTMLForm object
  218. $article: Article object
  219. 'ActionModifyFormFields': Before creating an HTMLForm object for a page action;
  220. Allows to change the fields on the form that will be generated.
  221. $name: name of the action
  222. &$fields: HTMLForm descriptor array
  223. $article: Article object
  224. 'AddNewAccount': DEPRECATED! Use LocalUserCreated.
  225. After a user account is created.
  226. $user: the User object that was created. (Parameter added in 1.7)
  227. $byEmail: true when account was created "by email" (added in 1.12)
  228. 'AfterBuildFeedLinks': Executed in OutputPage.php after all feed links (atom, rss,...)
  229. are created. Can be used to omit specific feeds from being outputted. You must not use
  230. this hook to add feeds, use OutputPage::addFeedLink() instead.
  231. &$feedLinks: Array of created feed links
  232. 'AfterFinalPageOutput': Nearly at the end of OutputPage::output() but
  233. before OutputPage::sendCacheControl() and final ob_end_flush() which
  234. will send the buffered output to the client. This allows for last-minute
  235. modification of the output within the buffer by using ob_get_clean().
  236. $output: The OutputPage object where output() was called
  237. 'AfterImportPage': When a page import is completed.
  238. $title: Title under which the revisions were imported
  239. $foreignTitle: ForeignTitle object based on data provided by the XML file
  240. $revCount: Number of revisions in the XML file
  241. $sRevCount: Number of successfully imported revisions
  242. $pageInfo: associative array of page information
  243. 'AfterParserFetchFileAndTitle': After an image gallery is formed by Parser,
  244. just before adding its HTML to parser output.
  245. $parser: Parser object that called the hook
  246. $ig: Gallery, an object of one of the gallery classes (inheriting from
  247. ImageGalleryBase)
  248. &$html: HTML generated by the gallery
  249. 'AlternateEdit': Before checking if a user can edit a page and before showing
  250. the edit form ( EditPage::edit() ). This is triggered on &action=edit.
  251. $editPage: the EditPage object
  252. 'AlternateEditPreview': Before generating the preview of the page when editing
  253. ( EditPage::getPreviewText() ).
  254. Return false and set $previewHTML and $parserOutput to output custom page
  255. preview HTML.
  256. $editPage: the EditPage object
  257. &$content: the Content object for the text field from the edit page
  258. &$previewHTML: Text to be placed into the page for the preview
  259. &$parserOutput: the ParserOutput object for the preview
  260. 'AlternateUserMailer': Called before mail is sent so that mail could be logged
  261. (or something else) instead of using PEAR or PHP's mail(). Return false to skip
  262. the regular method of sending mail. Return a string to return a php-mail-error
  263. message containing the error. Returning true will continue with sending email
  264. in the regular way.
  265. $headers: Associative array of headers for the email
  266. $to: MailAddress object or array
  267. $from: From address
  268. $subject: Subject of the email
  269. $body: Body of the message
  270. 'APIAfterExecute': After calling the execute() method of an API module. Use
  271. this to extend core API modules.
  272. &$module: Module object
  273. 'ApiBeforeMain': Before calling ApiMain's execute() method in api.php.
  274. &$main: ApiMain object
  275. 'ApiCheckCanExecute': Called during ApiMain::checkCanExecute. Use to further
  276. authenticate and authorize API clients before executing the module. Return
  277. false and set a message to cancel the request.
  278. $module: Module object
  279. $user: Current user
  280. &$message: API message to die with. Specific values accepted depend on the
  281. MediaWiki version:
  282. * 1.29+: IApiMessage, Message, string message key, or key+parameters array to
  283. pass to ApiBase::dieWithError().
  284. * 1.27+: IApiMessage, or a key or key+parameters in ApiBase::$messageMap.
  285. * Earlier: A key or key+parameters in ApiBase::$messageMap.
  286. 'ApiDeprecationHelp': Add messages to the 'deprecation-help' warning generated
  287. from ApiBase::addDeprecation().
  288. &$msgs: Message[] Messages to include in the help. Multiple messages will be
  289. joined with spaces.
  290. 'APIEditBeforeSave': DEPRECATED! Use EditFilterMergedContent instead.
  291. Before saving a page with api.php?action=edit, after
  292. processing request parameters. Return false to let the request fail, returning
  293. an error message or an <edit result="Failure"> tag if $resultArr was filled.
  294. Unlike for example 'EditFilterMergedContent' this also being run on undo.
  295. Since MediaWiki 1.25, 'EditFilterMergedContent' can also return error details
  296. for the API and it's recommended to use it instead of this hook.
  297. $editPage: the EditPage object
  298. $text: the text passed to the API. Note that this includes only the single
  299. section for section edit, and is not necessarily the final text in case of
  300. automatically resolved edit conflicts.
  301. &$resultArr: data in this array will be added to the API result
  302. 'ApiFeedContributions::feedItem': Called to convert the result of ContribsPager
  303. into a FeedItem instance that ApiFeedContributions can consume. Implementors of
  304. this hook may cancel the hook to signal that the item is not viewable in the
  305. provided context.
  306. $row: A row of data from ContribsPager. The set of data returned by
  307. ContribsPager can be adjusted by handling the ContribsPager::reallyDoQuery
  308. hook.
  309. $context: An IContextSource implementation.
  310. &$feedItem: Set this to a FeedItem instance if the callback can handle the
  311. provided row. This is provided to the hook as a null, if it is non null then
  312. another callback has already handled the hook.
  313. 'ApiFormatHighlight': Use to syntax-highlight API pretty-printed output. When
  314. highlighting, add output to $context->getOutput() and return false.
  315. $context: An IContextSource.
  316. $text: Text to be highlighted.
  317. $mime: MIME type of $text.
  318. $format: API format code for $text.
  319. 'APIGetAllowedParams': Use this hook to modify a module's parameters.
  320. &$module: ApiBase Module object
  321. &$params: Array of parameters
  322. $flags: int zero or OR-ed flags like ApiBase::GET_VALUES_FOR_HELP
  323. 'APIGetDescription': DEPRECATED! Use APIGetDescriptionMessages instead.
  324. Use this hook to modify a module's description.
  325. &$module: ApiBase Module object
  326. &$desc: String description, or array of description strings
  327. 'APIGetDescriptionMessages': Use this hook to modify a module's help message.
  328. $module: ApiBase Module object
  329. &$msg: Array of Message objects
  330. 'APIGetParamDescription': DEPRECATED! Use APIGetParamDescriptionMessages
  331. instead.
  332. Use this hook to modify a module's parameter descriptions.
  333. &$module: ApiBase Module object
  334. &$desc: Array of parameter descriptions
  335. 'APIGetParamDescriptionMessages': Use this hook to modify a module's parameter
  336. descriptions.
  337. $module: ApiBase Module object
  338. &$msg: Array of arrays of Message objects
  339. 'APIHelpModifyOutput': Use this hook to modify an API module's help output.
  340. $module: ApiBase Module object
  341. &$help: Array of HTML strings to be joined for the output.
  342. $options: Array Options passed to ApiHelp::getHelp
  343. &$tocData: Array If a TOC is being generated, this array has keys as anchors in
  344. the page and values as for Linker::generateTOC().
  345. 'ApiMain::moduleManager': Called when ApiMain has finished initializing its
  346. module manager. Can be used to conditionally register API modules.
  347. $moduleManager: ApiModuleManager Module manager instance
  348. 'ApiMain::onException': Called by ApiMain::executeActionWithErrorHandling() when
  349. an exception is thrown during API action execution.
  350. $apiMain: Calling ApiMain instance.
  351. $e: Exception object.
  352. 'ApiMakeParserOptions': Called from ApiParse and ApiExpandTemplates to allow
  353. extensions to adjust the ParserOptions before parsing.
  354. $options: ParserOptions object
  355. $title: Title to be parsed
  356. $params: Parameter array for the API module
  357. $module: API module (which is also a ContextSource)
  358. &$reset: Set to a ScopedCallback used to reset any hooks after the parse is done.
  359. &$suppressCache: Set true if cache should be suppressed.
  360. 'ApiOpenSearchSuggest': Called when constructing the OpenSearch results. Hooks
  361. can alter or append to the array.
  362. &$results: array with integer keys to associative arrays. Keys in associative
  363. array:
  364. - title: Title object.
  365. - redirect from: Title or null.
  366. - extract: Description for this result.
  367. - extract trimmed: If truthy, the extract will not be trimmed to
  368. $wgOpenSearchDescriptionLength.
  369. - image: Thumbnail for this result. Value is an array with subkeys 'source'
  370. (url), 'width', 'height', 'alt', 'align'.
  371. - url: Url for the given title.
  372. 'ApiQuery::moduleManager': Called when ApiQuery has finished initializing its
  373. module manager. Can be used to conditionally register API query modules.
  374. $moduleManager: ApiModuleManager Module manager instance
  375. 'APIQueryAfterExecute': After calling the execute() method of an
  376. action=query submodule. Use this to extend core API modules.
  377. &$module: Module object
  378. 'ApiQueryBaseAfterQuery': Called for (some) API query modules after the
  379. database query has returned. An API query module wanting to use this hook
  380. should see the ApiQueryBase::select() and ApiQueryBase::processRow()
  381. documentation.
  382. $module: ApiQueryBase module in question
  383. $result: ResultWrapper|bool returned from the IDatabase::select()
  384. &$hookData: array that was passed to the 'ApiQueryBaseBeforeQuery' hook and
  385. will be passed to the 'ApiQueryBaseProcessRow' hook, intended for inter-hook
  386. communication.
  387. 'ApiQueryBaseBeforeQuery': Called for (some) API query modules before a
  388. database query is made. WARNING: It would be very easy to misuse this hook and
  389. break the module! Any joins added *must* join on a unique key of the target
  390. table unless you really know what you're doing. An API query module wanting to
  391. use this hook should see the ApiQueryBase::select() and
  392. ApiQueryBase::processRow() documentation.
  393. $module: ApiQueryBase module in question
  394. &$tables: array of tables to be queried
  395. &$fields: array of columns to select
  396. &$conds: array of WHERE conditionals for query
  397. &$query_options: array of options for the database request
  398. &$join_conds: join conditions for the tables
  399. &$hookData: array that will be passed to the 'ApiQueryBaseAfterQuery' and
  400. 'ApiQueryBaseProcessRow' hooks, intended for inter-hook communication.
  401. 'ApiQueryBaseProcessRow': Called for (some) API query modules as each row of
  402. the database result is processed. Return false to stop processing the result
  403. set. An API query module wanting to use this hook should see the
  404. ApiQueryBase::select() and ApiQueryBase::processRow() documentation.
  405. $module: ApiQueryBase module in question
  406. $row: stdClass Database result row
  407. &$data: array to be included in the ApiResult.
  408. &$hookData: array that was be passed to the 'ApiQueryBaseBeforeQuery' and
  409. 'ApiQueryBaseAfterQuery' hooks, intended for inter-hook communication.
  410. 'APIQueryGeneratorAfterExecute': After calling the executeGenerator() method of
  411. an action=query submodule. Use this to extend core API modules.
  412. &$module: Module object
  413. &$resultPageSet: ApiPageSet object
  414. 'APIQueryInfoTokens': DEPRECATED! Use ApiQueryTokensRegisterTypes instead.
  415. Use this hook to add custom tokens to prop=info. Every token has an action,
  416. which will be used in the intoken parameter and in the output
  417. (actiontoken="..."), and a callback function which should return the token, or
  418. false if the user isn't allowed to obtain it. The prototype of the callback
  419. function is func($pageid, $title), where $pageid is the page ID of the page the
  420. token is requested for and $title is the associated Title object. In the hook,
  421. just add your callback to the $tokenFunctions array and return true (returning
  422. false makes no sense).
  423. &$tokenFunctions: array(action => callback)
  424. 'APIQueryRecentChangesTokens': DEPRECATED! Use ApiQueryTokensRegisterTypes
  425. instead.
  426. Use this hook to add custom tokens to list=recentchanges. Every token has an
  427. action, which will be used in the rctoken parameter and in the output
  428. (actiontoken="..."), and a callback function which should return the token, or
  429. false if the user isn't allowed to obtain it. The prototype of the callback
  430. function is func($pageid, $title, $rc), where $pageid is the page ID of the
  431. page associated to the revision the token is requested for, $title the
  432. associated Title object and $rc the associated RecentChange object. In the
  433. hook, just add your callback to the $tokenFunctions array and return true
  434. (returning false makes no sense).
  435. &$tokenFunctions: array(action => callback)
  436. 'APIQueryRevisionsTokens': DEPRECATED! Use ApiQueryTokensRegisterTypes instead.
  437. Use this hook to add custom tokens to prop=revisions. Every token has an
  438. action, which will be used in the rvtoken parameter and in the output
  439. (actiontoken="..."), and a callback function which should return the token, or
  440. false if the user isn't allowed to obtain it. The prototype of the callback
  441. function is func($pageid, $title, $rev), where $pageid is the page ID of the
  442. page associated to the revision the token is requested for, $title the
  443. associated Title object and $rev the associated Revision object. In the hook,
  444. just add your callback to the $tokenFunctions array and return true (returning
  445. false makes no sense).
  446. &$tokenFunctions: array(action => callback)
  447. 'APIQuerySiteInfoGeneralInfo': Use this hook to add extra information to the
  448. sites general information.
  449. $module: the current ApiQuerySiteInfo module
  450. &$results: array of results, add things here
  451. 'APIQuerySiteInfoStatisticsInfo': Use this hook to add extra information to the
  452. sites statistics information.
  453. &$results: array of results, add things here
  454. 'ApiQueryTokensRegisterTypes': Use this hook to add additional token types to
  455. action=query&meta=tokens. Note that most modules will probably be able to use
  456. the 'csrf' token instead of creating their own token types.
  457. &$salts: array( type => salt to pass to User::getEditToken() or array of salt
  458. and key to pass to Session::getToken() )
  459. 'APIQueryUsersTokens': DEPRECATED! Use ApiQueryTokensRegisterTypes instead.
  460. Use this hook to add custom token to list=users. Every token has an action,
  461. which will be used in the ustoken parameter and in the output
  462. (actiontoken="..."), and a callback function which should return the token, or
  463. false if the user isn't allowed to obtain it. The prototype of the callback
  464. function is func($user) where $user is the User object. In the hook, just add
  465. your callback to the $tokenFunctions array and return true (returning false
  466. makes no sense).
  467. &$tokenFunctions: array(action => callback)
  468. 'ApiQueryWatchlistExtractOutputData': Extract row data for ApiQueryWatchlist.
  469. $module: ApiQueryWatchlist instance
  470. $watchedItem: WatchedItem instance
  471. $recentChangeInfo: Array of recent change info data
  472. &$vals: Associative array of data to be output for the row
  473. 'ApiQueryWatchlistPrepareWatchedItemQueryServiceOptions': Populate the options
  474. to be passed from ApiQueryWatchlist to WatchedItemQueryService.
  475. $module: ApiQueryWatchlist instance
  476. $params: Array of parameters, as would be returned by $module->extractRequestParams()
  477. &$options: Array of options for WatchedItemQueryService::getWatchedItemsWithRecentChangeInfo()
  478. 'ApiRsdServiceApis': Add or remove APIs from the RSD services list. Each service
  479. should have its own entry in the $apis array and have a unique name, passed as
  480. key for the array that represents the service data. In this data array, the
  481. key-value-pair identified by the apiLink key is required.
  482. &$apis: array of services
  483. 'ApiTokensGetTokenTypes': DEPRECATED! Use ApiQueryTokensRegisterTypes instead.
  484. Use this hook to extend action=tokens with new token types.
  485. &$tokenTypes: supported token types in format 'type' => callback function
  486. used to retrieve this type of tokens.
  487. 'ApiValidatePassword': Called from ApiValidatePassword.
  488. $module: ApiValidatePassword instance.
  489. &$r: Result array.
  490. 'Article::MissingArticleConditions': Before fetching deletion & move log entries
  491. to display a message of a non-existing page being deleted/moved, give extensions
  492. a chance to hide their (unrelated) log entries.
  493. &$conds: Array of query conditions (all of which have to be met; conditions will
  494. AND in the final query)
  495. $logTypes: Array of log types being queried
  496. 'ArticleAfterFetchContentObject': After fetching content of an article from the
  497. database.
  498. &$article: the article (object) being loaded from the database
  499. &$content: the content of the article, as a Content object
  500. 'ArticleConfirmDelete': Before writing the confirmation form for article
  501. deletion.
  502. $article: the article (object) being deleted
  503. $output: the OutputPage object
  504. &$reason: the reason (string) the article is being deleted
  505. 'ArticleContentOnDiff': Before showing the article content below a diff. Use
  506. this to change the content in this area or how it is loaded.
  507. $diffEngine: the DifferenceEngine
  508. $output: the OutputPage object
  509. 'ArticleContentViewCustom': Allows to output the text of the article in a
  510. different format than wikitext. Note that it is preferable to implement proper
  511. handing for a custom data type using the ContentHandler facility.
  512. $content: content of the page, as a Content object
  513. $title: title of the page
  514. $output: reference to $wgOut
  515. 'ArticleDelete': Before an article is deleted.
  516. &$wikiPage: the WikiPage (object) being deleted
  517. &$user: the user (object) deleting the article
  518. &$reason: the reason (string) the article is being deleted
  519. &$error: if the deletion was prohibited, the (raw HTML) error message to display
  520. (added in 1.13)
  521. &$status: Status object, modify this to throw an error. Overridden by $error
  522. (added in 1.20)
  523. $suppress: Whether this is a suppression deletion or not (added in 1.27)
  524. 'ArticleDeleteAfterSuccess': Output after an article has been deleted.
  525. $title: Title of the article that has been deleted.
  526. $outputPage: OutputPage that can be used to append the output.
  527. 'ArticleDeleteComplete': After an article is deleted.
  528. &$wikiPage: the WikiPage that was deleted
  529. &$user: the user that deleted the article
  530. $reason: the reason the article was deleted
  531. $id: id of the article that was deleted
  532. $content: the Content of the deleted page (or null, when deleting a broken page)
  533. $logEntry: the ManualLogEntry used to record the deletion
  534. $archivedRevisionCount: the number of revisions archived during the deletion
  535. 'ArticleEditUpdateNewTalk': Before updating user_newtalk when a user talk page
  536. was changed.
  537. &$wikiPage: WikiPage (object) of the user talk page
  538. $recipient: User (object) who's talk page was edited
  539. 'ArticleEditUpdates': When edit updates (mainly link tracking) are made when an
  540. article has been changed.
  541. &$wikiPage: the WikiPage (object)
  542. &$editInfo: data holder that includes the parser output ($editInfo->output) for
  543. that page after the change
  544. $changed: bool for if the page was changed
  545. 'ArticleEditUpdatesDeleteFromRecentchanges': Before deleting old entries from
  546. recentchanges table, return false to not delete old entries.
  547. &$wikiPage: WikiPage (object) being modified
  548. 'ArticleFromTitle': when creating an article object from a title object using
  549. Wiki::articleFromTitle().
  550. &$title: Title (object) used to create the article object
  551. &$article: Article (object) that will be returned
  552. $context: IContextSource (object)
  553. 'ArticleMergeComplete': After merging to article using Special:Mergehistory.
  554. $targetTitle: target title (object)
  555. $destTitle: destination title (object)
  556. 'ArticlePageDataAfter': After loading data of an article from the database.
  557. &$wikiPage: WikiPage (object) whose data were loaded
  558. &$row: row (object) returned from the database server
  559. 'ArticlePageDataBefore': Before loading data of an article from the database.
  560. &$wikiPage: WikiPage (object) that data will be loaded
  561. &$fields: fields (array) to load from the database
  562. &$tables: tables (array) to load from the database
  563. &$joinConds: join conditions (array) to load from the database
  564. 'ArticlePrepareTextForEdit': Called when preparing text to be saved.
  565. $wikiPage: the WikiPage being saved
  566. $popts: parser options to be used for pre-save transformation
  567. 'ArticleProtect': Before an article is protected.
  568. &$wikiPage: the WikiPage being protected
  569. &$user: the user doing the protection
  570. $protect: Set of restriction keys
  571. $reason: Reason for protect
  572. 'ArticleProtectComplete': After an article is protected.
  573. &$wikiPage: the WikiPage that was protected
  574. &$user: the user who did the protection
  575. $protect: Set of restriction keys
  576. $reason: Reason for protect
  577. 'ArticlePurge': Before executing "&action=purge".
  578. &$wikiPage: WikiPage (object) to purge
  579. 'ArticleRevisionUndeleted': After an article revision is restored.
  580. &$title: the article title
  581. $revision: the revision
  582. $oldPageID: the page ID of the revision when archived (may be null)
  583. 'ArticleRevisionVisibilitySet': Called when changing visibility of one or more
  584. revisions of an article.
  585. $title: Title object of the article
  586. $ids: Ids to set the visibility for
  587. $visibilityChangeMap: Map of revision id to oldBits and newBits. This array can be
  588. examined to determine exactly what visibility bits have changed for each
  589. revision. This array is of the form
  590. [id => ['oldBits' => $oldBits, 'newBits' => $newBits], ... ]
  591. 'ArticleRollbackComplete': After an article rollback is completed.
  592. $wikiPage: the WikiPage that was edited
  593. $user: the user who did the rollback
  594. $revision: the revision the page was reverted back to
  595. $current: the reverted revision
  596. 'ArticleUndelete': When one or more revisions of an article are restored.
  597. &$title: Title corresponding to the article restored
  598. $create: Whether or not the restoration caused the page to be created (i.e. it
  599. didn't exist before).
  600. $comment: The comment associated with the undeletion.
  601. $oldPageId: ID of page previously deleted (from archive table). This ID will be used
  602. for the restored page.
  603. $restoredPages: Set of page IDs that have revisions restored for this undelete,
  604. with keys being page IDs and values are 'true'.
  605. 'ArticleUndeleteLogEntry': When a log entry is generated but not yet saved.
  606. $pageArchive: the PageArchive object
  607. &$logEntry: ManualLogEntry object
  608. $user: User who is performing the log action
  609. 'ArticleUpdateBeforeRedirect': After a page is updated (usually on save), before
  610. the user is redirected back to the page.
  611. $article: the article
  612. &$sectionanchor: The section anchor link (e.g. "#overview" )
  613. &$extraq: Extra query parameters which can be added via hooked functions
  614. 'ArticleViewFooter': After showing the footer section of an ordinary page view
  615. $article: Article object
  616. $patrolFooterShown: boolean whether patrol footer is shown
  617. 'ArticleViewHeader': Before the parser cache is about to be tried for article
  618. viewing.
  619. &$article: the article
  620. &$pcache: whether to try the parser cache or not
  621. &$outputDone: whether the output for this page finished or not. Set to
  622. a ParserOutput object to both indicate that the output is done and what
  623. parser output was used.
  624. 'ArticleViewRedirect': Before setting "Redirected from ..." subtitle when a
  625. redirect was followed.
  626. &$article: target article (object)
  627. 'AuthChangeFormFields': After converting a field information array obtained
  628. from a set of AuthenticationRequest classes into a form descriptor; hooks
  629. can tweak the array to change how login etc. forms should look.
  630. $requests: array of AuthenticationRequests the fields are created from
  631. $fieldInfo: field information array (union of all AuthenticationRequest::getFieldInfo() responses).
  632. &$formDescriptor: HTMLForm descriptor. The special key 'weight' can be set
  633. to change the order of the fields.
  634. $action: one of the AuthManager::ACTION_* constants.
  635. 'AuthManagerLoginAuthenticateAudit': A login attempt either succeeded or failed
  636. for a reason other than misconfiguration or session loss. No return data is
  637. accepted; this hook is for auditing only.
  638. $response: The MediaWiki\Auth\AuthenticationResponse in either a PASS or FAIL state.
  639. $user: The User object being authenticated against, or null if authentication
  640. failed before getting that far.
  641. $username: A guess at the user name being authenticated, or null if we can't
  642. even determine that.
  643. 'AuthPluginAutoCreate': DEPRECATED! Use the 'LocalUserCreated' hook instead.
  644. Called when creating a local account for an user logged in from an external
  645. authentication method.
  646. $user: User object created locally
  647. 'AuthPluginSetup': DEPRECATED! Extensions should be updated to use AuthManager.
  648. Update or replace authentication plugin object ($wgAuth). Gives a chance for an
  649. extension to set it programmatically to a variable class.
  650. &$auth: the $wgAuth object, probably a stub
  651. 'AutopromoteCondition': Check autopromote condition for user.
  652. $type: condition type
  653. $args: arguments
  654. $user: user
  655. &$result: result of checking autopromote condition
  656. 'BacklinkCacheGetConditions': Allows to set conditions for query when links to
  657. certain title are fetched.
  658. $table: table name
  659. $title: title of the page to which backlinks are sought
  660. &$conds: query conditions
  661. 'BacklinkCacheGetPrefix': Allows to set prefix for a specific link table.
  662. $table: table name
  663. &$prefix: prefix
  664. 'BadImage': When checking against the bad image list. Change $bad and return
  665. false to override. If an image is "bad", it is not rendered inline in wiki
  666. pages or galleries in category pages.
  667. $name: Image name being checked
  668. &$bad: Whether or not the image is "bad"
  669. 'BaseTemplateAfterPortlet': After output of portlets, allow injecting
  670. custom HTML after the section. Any uses of the hook need to handle escaping.
  671. $template: BaseTemplate
  672. $portlet: string portlet name
  673. &$html: string
  674. 'BaseTemplateToolbox': Called by BaseTemplate when building the $toolbox array
  675. and returning it for the skin to output. You can add items to the toolbox while
  676. still letting the skin make final decisions on skin-specific markup conventions
  677. using this hook.
  678. &$sk: The BaseTemplate base skin template
  679. &$toolbox: An array of toolbox items, see BaseTemplate::getToolbox and
  680. BaseTemplate::makeListItem for details on the format of individual items
  681. inside of this array.
  682. 'BeforeDisplayNoArticleText': Before displaying message key "noarticletext" or
  683. "noarticletext-nopermission" at Article::showMissingArticle().
  684. $article: article object
  685. 'BeforeHttpsRedirect': Prior to forcing HTTP->HTTPS redirect. Gives a chance to
  686. override how the redirect is output by modifying, or by returning false, and
  687. letting standard HTTP rendering take place.
  688. ATTENTION: This hook is likely to be removed soon due to overall design of the
  689. system.
  690. $context: IContextSource object
  691. &$redirect: string URL, modifiable
  692. 'BeforeInitialize': Before anything is initialized in
  693. MediaWiki::performRequest().
  694. &$title: Title being used for request
  695. &$unused: null
  696. &$output: OutputPage object
  697. &$user: User
  698. $request: WebRequest object
  699. $mediaWiki: Mediawiki object
  700. 'BeforePageDisplay': Prior to outputting a page.
  701. &$out: OutputPage object
  702. &$skin: Skin object
  703. 'BeforePageRedirect': Prior to sending an HTTP redirect. Gives a chance to
  704. override how the redirect is output by modifying, or by returning false and
  705. taking over the output.
  706. $out: OutputPage object
  707. &$redirect: URL, modifiable
  708. &$code: HTTP code (eg '301' or '302'), modifiable
  709. 'BeforeParserFetchFileAndTitle': Before an image is rendered by Parser.
  710. $parser: Parser object
  711. $nt: the image title
  712. &$options: array of options to RepoGroup::findFile. If it contains 'broken'
  713. as a key then the file will appear as a broken thumbnail.
  714. &$descQuery: query string to add to thumbnail URL
  715. 'BeforeParserFetchTemplateAndtitle': Before a template is fetched by Parser.
  716. $parser: Parser object
  717. $title: title of the template
  718. &$skip: skip this template and link it?
  719. &$id: the id of the revision being parsed
  720. 'BeforeParserrenderImageGallery': Before an image gallery is rendered by Parser.
  721. &$parser: Parser object
  722. &$ig: ImageGallery object
  723. 'BeforeWelcomeCreation': Before the welcomecreation message is displayed to a
  724. newly created user.
  725. &$welcome_creation_msg: MediaWiki message name to display on the welcome screen
  726. to a newly created user account.
  727. &$injected_html: Any HTML to inject after the "logged in" message of a newly
  728. created user account
  729. 'BitmapHandlerCheckImageArea': By BitmapHandler::normaliseParams, after all
  730. normalizations have been performed, except for the $wgMaxImageArea check.
  731. $image: File
  732. &$params: Array of parameters
  733. &$checkImageAreaHookResult: null, set to true or false to override the
  734. $wgMaxImageArea check result.
  735. 'BitmapHandlerTransform': before a file is transformed, gives extension the
  736. possibility to transform it themselves
  737. $handler: BitmapHandler
  738. $image: File
  739. &$scalerParams: Array with scaler parameters
  740. &$mto: null, set to a MediaTransformOutput
  741. 'BlockIp': Before an IP address or user is blocked.
  742. &$block: the Block object about to be saved
  743. &$user: the user _doing_ the block (not the one being blocked)
  744. &$reason: if the hook is aborted, the error message to be returned in an array
  745. 'BlockIpComplete': After an IP address or user is blocked.
  746. $block: the Block object that was saved
  747. $user: the user who did the block (not the one being blocked)
  748. $priorBlock: the Block object for the prior block or null if there was none
  749. 'BookInformation': Before information output on Special:Booksources.
  750. $isbn: ISBN to show information for
  751. $output: OutputPage object in use
  752. 'CanIPUseHTTPS': Determine whether the client at a given source IP is likely
  753. to be able to access the wiki via HTTPS.
  754. $ip: The IP address in human-readable form
  755. &$canDo: This reference should be set to false if the client may not be able
  756. to use HTTPS
  757. 'CanonicalNamespaces': For extensions adding their own namespaces or altering
  758. the defaults.
  759. Note that if you need to specify namespace protection or content model for
  760. a namespace that is added in a CanonicalNamespaces hook handler, you
  761. should do so by altering $wgNamespaceProtection and
  762. $wgNamespaceContentModels outside the handler, in top-level scope. The
  763. point at which the CanonicalNamespaces hook fires is too late for altering
  764. these variables. This applies even if the namespace addition is
  765. conditional; it is permissible to declare a content model and protection
  766. for a namespace and then decline to actually register it.
  767. &$namespaces: Array of namespace numbers with corresponding canonical names
  768. 'CategoryAfterPageAdded': After a page is added to a category.
  769. $category: Category that page was added to
  770. $wikiPage: WikiPage that was added
  771. 'CategoryAfterPageRemoved': After a page is removed from a category.
  772. $category: Category that page was removed from
  773. $wikiPage: WikiPage that was removed
  774. $id: the page ID (original ID in case of page deletions)
  775. 'CategoryPageView': Before viewing a categorypage in CategoryPage::view.
  776. &$catpage: CategoryPage instance
  777. 'CategoryViewer::doCategoryQuery': After querying for pages to be displayed
  778. in a Category page. Gives extensions the opportunity to batch load any
  779. related data about the pages.
  780. $type: The category type. Either 'page', 'file' or 'subcat'
  781. $res: Query result from Wikimedia\Rdbms\IDatabase::select()
  782. 'CategoryViewer::generateLink': Before generating an output link allow
  783. extensions opportunity to generate a more specific or relevant link.
  784. $type: The category type. Either 'page', 'img' or 'subcat'
  785. $title: Title object for the categorized page
  786. $html: Requested html content of anchor
  787. &$link: Returned value. When set to a non-null value by a hook subscriber
  788. this value will be used as the anchor instead of Linker::link
  789. 'ChangeAuthenticationDataAudit': Called when user changes his password.
  790. No return data is accepted; this hook is for auditing only.
  791. $req: AuthenticationRequest object describing the change (and target user)
  792. $status: StatusValue with the result of the action
  793. 'ChangePasswordForm': DEPRECATED! Use AuthChangeFormFields or security levels.
  794. For extensions that need to add a field to the ChangePassword form via the
  795. Preferences form.
  796. &$extraFields: An array of arrays that hold fields like would be passed to the
  797. pretty function.
  798. 'ChangesListInitRows': Batch process change list rows prior to rendering.
  799. $changesList: ChangesList instance
  800. $rows: The data that will be rendered. May be a ResultWrapper instance or
  801. an array.
  802. 'ChangesListInsertArticleLink': Override or augment link to article in RC list.
  803. &$changesList: ChangesList instance.
  804. &$articlelink: HTML of link to article (already filled-in).
  805. &$s: HTML of row that is being constructed.
  806. &$rc: RecentChange instance.
  807. $unpatrolled: Whether or not we are showing unpatrolled changes.
  808. $watched: Whether or not the change is watched by the user.
  809. 'ChangesListSpecialPageFilters': DEPRECATED! Use 'ChangesListSpecialPageStructuredFilters'
  810. instead.
  811. Called after building form options on pages
  812. inheriting from ChangesListSpecialPage (in core: RecentChanges,
  813. RecentChangesLinked and Watchlist).
  814. $special: ChangesListSpecialPage instance
  815. &$filters: associative array of filter definitions. The keys are the HTML
  816. name/URL parameters. Each key maps to an associative array with a 'msg'
  817. (message key) and a 'default' value.
  818. 'ChangesListSpecialPageQuery': Called when building SQL query on pages
  819. inheriting from ChangesListSpecialPage (in core: RecentChanges,
  820. RecentChangesLinked and Watchlist).
  821. Do not use this to implement individual filters if they are compatible with the
  822. ChangesListFilter and ChangesListFilterGroup structure.
  823. Instead, use sub-classes of those classes, in conjunction with the
  824. ChangesListSpecialPageStructuredFilters hook.
  825. This hook can be used to implement filters that do not implement that structure,
  826. or custom behavior that is not an individual filter.
  827. $name: name of the special page, e.g. 'Watchlist'
  828. &$tables: array of tables to be queried
  829. &$fields: array of columns to select
  830. &$conds: array of WHERE conditionals for query
  831. &$query_options: array of options for the database request
  832. &$join_conds: join conditions for the tables
  833. $opts: FormOptions for this request
  834. 'ChangesListSpecialPageStructuredFilters': Called to allow extensions to register
  835. filters for pages inheriting from ChangesListSpecialPage (in core: RecentChanges,
  836. RecentChangesLinked, and Watchlist). Generally, you will want to construct
  837. new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects.
  838. When constructing them, you specify which group they belong to. You can reuse
  839. existing groups (accessed through $special->getFilterGroup), or create your own
  840. (ChangesListBooleanFilterGroup or ChangesListStringOptionsFilterGroup).
  841. If you create new groups, you must register them with $special->registerFilterGroup.
  842. Note that this is called regardless of whether the user is currently using
  843. the new (structured) or old (unstructured) filter UI. If you want your boolean
  844. filter to show on both the new and old UI, specify all the supported fields.
  845. These include showHide, label, and description.
  846. See the constructor of each ChangesList* class for documentation of supported
  847. fields.
  848. $special: ChangesListSpecialPage instance
  849. 'ChangeTagAfterDelete': Called after a change tag has been deleted (that is,
  850. removed from all revisions and log entries to which it was applied). This gives
  851. extensions a chance to take it off their books.
  852. $tag: name of the tag
  853. &$status: Status object. Add warnings to this as required. There is no point
  854. setting errors, as the deletion has already been partly carried out by this
  855. point.
  856. 'ChangeTagCanCreate': Tell whether a change tag should be able to be created
  857. from the UI (Special:Tags) or via the API. You could use this hook if you want
  858. to reserve a specific "namespace" of tags, or something similar.
  859. $tag: name of the tag
  860. $user: user initiating the action
  861. &$status: Status object. Add your errors using `$status->fatal()` or warnings
  862. using `$status->warning()`. Errors and warnings will be relayed to the user.
  863. If you set an error, the user will be unable to create the tag.
  864. 'ChangeTagCanDelete': Tell whether a change tag should be able to be
  865. deleted from the UI (Special:Tags) or via the API. The default is that tags
  866. defined using the ListDefinedTags hook are not allowed to be deleted unless
  867. specifically allowed. If you wish to allow deletion of the tag, set
  868. `$status = Status::newGood()` to allow deletion, and then `return false` from
  869. the hook function. Ensure you consume the 'ChangeTagAfterDelete' hook to carry
  870. out custom deletion actions.
  871. $tag: name of the tag
  872. $user: user initiating the action
  873. &$status: Status object. See above.
  874. 'ChangeTagsListActive': Allows you to nominate which of the tags your extension
  875. uses are in active use.
  876. &$tags: list of all active tags. Append to this array.
  877. 'ChangeTagsAfterUpdateTags': Called after tags have been updated with the
  878. ChangeTags::updateTags function. Params:
  879. $addedTags: tags effectively added in the update
  880. $removedTags: tags effectively removed in the update
  881. $prevTags: tags that were present prior to the update
  882. $rc_id: recentchanges table id
  883. $rev_id: revision table id
  884. $log_id: logging table id
  885. $params: tag params
  886. $rc: RecentChange being tagged when the tagging accompanies the action or null
  887. $user: User who performed the tagging when the tagging is subsequent to the action or null
  888. 'ChangeTagsAllowedAdd': Called when checking if a user can add tags to a change.
  889. &$allowedTags: List of all the tags the user is allowed to add. Any tags the
  890. user wants to add ($addTags) that are not in this array will cause it to fail.
  891. You may add or remove tags to this array as required.
  892. $addTags: List of tags user intends to add.
  893. $user: User who is adding the tags.
  894. 'ChangeUserGroups': Called before user groups are changed.
  895. $performer: The User who will perform the change
  896. $user: The User whose groups will be changed
  897. &$add: The groups that will be added
  898. &$remove: The groups that will be removed
  899. 'Collation::factory': Called if $wgCategoryCollation is an unknown collation.
  900. $collationName: Name of the collation in question
  901. &$collationObject: Null. Replace with a subclass of the Collation class that
  902. implements the collation given in $collationName.
  903. 'ConfirmEmailComplete': Called after a user's email has been confirmed
  904. successfully.
  905. $user: user (object) whose email is being confirmed
  906. 'ContentAlterParserOutput': Modify parser output for a given content object.
  907. Called by Content::getParserOutput after parsing has finished. Can be used
  908. for changes that depend on the result of the parsing but have to be done
  909. before LinksUpdate is called (such as adding tracking categories based on
  910. the rendered HTML).
  911. $content: The Content to render
  912. $title: Title of the page, as context
  913. $parserOutput: ParserOutput to manipulate
  914. 'ContentGetParserOutput': Customize parser output for a given content object,
  915. called by AbstractContent::getParserOutput. May be used to override the normal
  916. model-specific rendering of page content.
  917. $content: The Content to render
  918. $title: Title of the page, as context
  919. $revId: The revision ID, as context
  920. $options: ParserOptions for rendering. To avoid confusing the parser cache,
  921. the output can only depend on parameters provided to this hook function, not
  922. on global state.
  923. $generateHtml: boolean, indicating whether full HTML should be generated. If
  924. false, generation of HTML may be skipped, but other information should still
  925. be present in the ParserOutput object.
  926. &$output: ParserOutput, to manipulate or replace
  927. 'ContentHandlerDefaultModelFor': Called when the default content model is
  928. determined for a given title. May be used to assign a different model for that
  929. title.
  930. $title: the Title in question
  931. &$model: the model name. Use with CONTENT_MODEL_XXX constants.
  932. 'ContentHandlerForModelID': Called when a ContentHandler is requested for
  933. a given content model name, but no entry for that model exists in
  934. $wgContentHandlers.
  935. Note: if your extension implements additional models via this hook, please
  936. use GetContentModels hook to make them known to core.
  937. $modeName: the requested content model name
  938. &$handler: set this to a ContentHandler object, if desired.
  939. 'ContentModelCanBeUsedOn': Called to determine whether that content model can
  940. be used on a given page. This is especially useful to prevent some content
  941. models to be used in some special location.
  942. $contentModel: ID of the content model in question
  943. $title: the Title in question.
  944. &$ok: Output parameter, whether it is OK to use $contentModel on $title.
  945. Handler functions that modify $ok should generally return false to prevent
  946. further hooks from further modifying $ok.
  947. 'ContribsPager::getQueryInfo': Before the contributions query is about to run
  948. &$pager: Pager object for contributions
  949. &$queryInfo: The query for the contribs Pager
  950. 'ContribsPager::reallyDoQuery': Called before really executing the query for My
  951. Contributions
  952. &$data: an array of results of all contribs queries
  953. $pager: The ContribsPager object hooked into
  954. $offset: Index offset, inclusive
  955. $limit: Exact query limit
  956. $descending: Query direction, false for ascending, true for descending
  957. 'ContributionsLineEnding': Called before a contributions HTML line is finished
  958. $page: SpecialPage object for contributions
  959. &$ret: the HTML line
  960. $row: the DB row for this line
  961. &$classes: the classes to add to the surrounding <li>
  962. &$attribs: associative array of other HTML attributes for the <li> element.
  963. Currently only data attributes reserved to MediaWiki are allowed
  964. (see Sanitizer::isReservedDataAttribute).
  965. 'ContributionsToolLinks': Change tool links above Special:Contributions
  966. $id: User identifier
  967. $title: User page title
  968. &$tools: Array of tool links
  969. $specialPage: SpecialPage instance for context and services. Can be either
  970. SpecialContributions or DeletedContributionsPage. Extensions should type
  971. hint against a generic SpecialPage though.
  972. 'ConvertContent': Called by AbstractContent::convert when a conversion to
  973. another content model is requested.
  974. Handler functions that modify $result should generally return false to disable
  975. further attempts at conversion.
  976. $content: The Content object to be converted.
  977. $toModel: The ID of the content model to convert to.
  978. $lossy: boolean indicating whether lossy conversion is allowed.
  979. &$result: Output parameter, in case the handler function wants to provide a
  980. converted Content object. Note that $result->getContentModel() must return
  981. $toModel.
  982. 'CustomEditor': When invoking the page editor
  983. Return true to allow the normal editor to be used, or false if implementing
  984. a custom editor, e.g. for a special namespace, etc.
  985. $article: Article being edited
  986. $user: User performing the edit
  987. 'DatabaseOraclePostInit': Called after initialising an Oracle database
  988. $db: the DatabaseOracle object
  989. 'DeletedContribsPager::reallyDoQuery': Called before really executing the query
  990. for Special:DeletedContributions
  991. Similar to ContribsPager::reallyDoQuery
  992. &$data: an array of results of all contribs queries
  993. $pager: The DeletedContribsPager object hooked into
  994. $offset: Index offset, inclusive
  995. $limit: Exact query limit
  996. $descending: Query direction, false for ascending, true for descending
  997. 'DeletedContributionsLineEnding': Called before a DeletedContributions HTML line
  998. is finished.
  999. Similar to ContributionsLineEnding
  1000. $page: SpecialPage object for DeletedContributions
  1001. &$ret: the HTML line
  1002. $row: the DB row for this line
  1003. &$classes: the classes to add to the surrounding <li>
  1004. &$attribs: associative array of other HTML attributes for the <li> element.
  1005. Currently only data attributes reserved to MediaWiki are allowed
  1006. (see Sanitizer::isReservedDataAttribute).
  1007. 'DeleteUnknownPreferences': Called by the cleanupPreferences.php maintenance script to build a WHERE clause with which
  1008. to delete preferences that are not known about. This hook is used by extensions that have dynamically-named preferences
  1009. that should not be deleted in the usual cleanup process. For example, the Gadgets extension creates preferences prefixed
  1010. with 'gadget-', and so anything with that prefix is excluded from the deletion.
  1011. &where: An array that will be passed as the $cond parameter to IDatabase::select() to determine what will be deleted
  1012. from the user_properties table.
  1013. $db: The IDatabase object, useful for accessing $db->buildLike() etc.
  1014. 'DifferenceEngineAfterLoadNewText': called in DifferenceEngine::loadNewText()
  1015. after the new revision's content has been loaded into the class member variable
  1016. $differenceEngine->mNewContent but before returning true from this function.
  1017. $differenceEngine: DifferenceEngine object
  1018. 'DifferenceEngineLoadTextAfterNewContentIsLoaded': called in
  1019. DifferenceEngine::loadText() after the new revision's content has been loaded
  1020. into the class member variable $differenceEngine->mNewContent but before
  1021. checking if the variable's value is null.
  1022. This hook can be used to inject content into said class member variable.
  1023. $differenceEngine: DifferenceEngine object
  1024. 'DifferenceEngineMarkPatrolledLink': Allows extensions to change the "mark as patrolled" link
  1025. which is shown both on the diff header as well as on the bottom of a page, usually
  1026. wrapped in a span element which has class="patrollink".
  1027. $differenceEngine: DifferenceEngine object
  1028. &$markAsPatrolledLink: The "mark as patrolled" link HTML (string)
  1029. $rcid: Recent change ID (rc_id) for this change (int)
  1030. 'DifferenceEngineMarkPatrolledRCID': Allows extensions to possibly change the rcid parameter.
  1031. For example the rcid might be set to zero due to the user being the same as the
  1032. performer of the change but an extension might still want to show it under certain
  1033. conditions.
  1034. &$rcid: rc_id (int) of the change or 0
  1035. $differenceEngine: DifferenceEngine object
  1036. $change: RecentChange object
  1037. $user: User object representing the current user
  1038. 'DifferenceEngineNewHeader': Allows extensions to change the $newHeader variable, which
  1039. contains information about the new revision, such as the revision's author, whether
  1040. the revision was marked as a minor edit or not, etc.
  1041. $differenceEngine: DifferenceEngine object
  1042. &$newHeader: The string containing the various #mw-diff-otitle[1-5] divs, which
  1043. include things like revision author info, revision comment, RevisionDelete link and more
  1044. $formattedRevisionTools: Array containing revision tools, some of which may have
  1045. been injected with the DiffRevisionTools hook
  1046. $nextlink: String containing the link to the next revision (if any); also included in $newHeader
  1047. $rollback: Rollback link (string) to roll this revision back to the previous one, if any
  1048. $newminor: String indicating if the new revision was marked as a minor edit
  1049. $diffOnly: Boolean parameter passed to DifferenceEngine#showDiffPage, indicating
  1050. whether we should show just the diff; passed in as a query string parameter to the
  1051. various URLs constructed here (i.e. $nextlink)
  1052. $rdel: RevisionDelete link for the new revision, if the current user is allowed
  1053. to use the RevisionDelete feature
  1054. $unhide: Boolean parameter indicating whether to show RevisionDeleted revisions
  1055. 'DifferenceEngineOldHeader': Allows extensions to change the $oldHeader variable, which
  1056. contains information about the old revision, such as the revision's author, whether
  1057. the revision was marked as a minor edit or not, etc.
  1058. $differenceEngine: DifferenceEngine object
  1059. &$oldHeader: The string containing the various #mw-diff-otitle[1-5] divs, which
  1060. include things like revision author info, revision comment, RevisionDelete link and more
  1061. $prevlink: String containing the link to the previous revision (if any); also included in $oldHeader
  1062. $oldminor: String indicating if the old revision was marked as a minor edit
  1063. $diffOnly: Boolean parameter passed to DifferenceEngine#showDiffPage, indicating
  1064. whether we should show just the diff; passed in as a query string parameter to the
  1065. various URLs constructed here (i.e. $prevlink)
  1066. $ldel: RevisionDelete link for the old revision, if the current user is allowed
  1067. to use the RevisionDelete feature
  1068. $unhide: Boolean parameter indicating whether to show RevisionDeleted revisions
  1069. 'DifferenceEngineOldHeaderNoOldRev': Change the $oldHeader variable in cases when
  1070. there is no old revision
  1071. &$oldHeader: empty string by default
  1072. 'DifferenceEngineRenderRevisionAddParserOutput': Allows extensions to change the parser output.
  1073. Return false to not add parser output via OutputPage's addParserOutput method.
  1074. $differenceEngine: DifferenceEngine object
  1075. $out: OutputPage object
  1076. $parserOutput: ParserOutput object
  1077. $wikiPage: WikiPage object
  1078. 'DifferenceEngineRenderRevisionShowFinalPatrolLink': An extension can hook into this hook
  1079. point and return false to not show the final "mark as patrolled" link on the bottom
  1080. of a page.
  1081. This hook has no arguments.
  1082. 'DifferenceEngineShowDiff': Allows extensions to affect the diff text which
  1083. eventually gets sent to the OutputPage object.
  1084. $differenceEngine: DifferenceEngine object
  1085. 'DifferenceEngineShowEmptyOldContent': Allows extensions to change the diff table
  1086. body (without header) in cases when there is no old revision or the old and new
  1087. revisions are identical.
  1088. $differenceEngine: DifferenceEngine object
  1089. 'DifferenceEngineShowDiffPage': Add additional output via the available OutputPage
  1090. object into the diff view
  1091. $out: OutputPage object
  1092. 'DifferenceEngineShowDiffPageMaybeShowMissingRevision': called in
  1093. DifferenceEngine::showDiffPage() when revision data cannot be loaded.
  1094. Return false in order to prevent displaying the missing revision message
  1095. (i.e. to prevent DifferenceEngine::showMissingRevision() from being called).
  1096. $differenceEngine: DifferenceEngine object
  1097. 'DiffRevisionTools': Override or extend the revision tools available from the
  1098. diff view, i.e. undo, etc.
  1099. $newRev: Revision object of the "new" revision
  1100. &$links: Array of HTML links
  1101. $oldRev: Revision object of the "old" revision (may be null)
  1102. $user: Current user object
  1103. 'DiffViewHeader': Called before diff display
  1104. $diff: DifferenceEngine object that's calling
  1105. $oldRev: Revision object of the "old" revision (may be null/invalid)
  1106. $newRev: Revision object of the "new" revision
  1107. 'DisplayOldSubtitle': before creating subtitle when browsing old versions of
  1108. an article
  1109. &$article: article (object) being viewed
  1110. &$oldid: oldid (int) being viewed
  1111. 'DoEditSectionLink': DEPRECATED! Use SkinEditSectionLinks instead.
  1112. Override the HTML generated for section edit links
  1113. $skin: Skin object rendering the UI
  1114. $title: Title object for the title being linked to (may not be the same as
  1115. the page title, if the section is included from a template)
  1116. $section: The designation of the section being pointed to, to be included in
  1117. the link, like "&section=$section"
  1118. $tooltip: The default tooltip. Escape before using.
  1119. By default, this is wrapped in the 'editsectionhint' message.
  1120. &$result: The HTML to return, prefilled with the default plus whatever other
  1121. changes earlier hooks have made
  1122. $lang: The language code to use for the link in the wfMessage function
  1123. 'EditFilter': Perform checks on an edit
  1124. $editor: EditPage instance (object). The edit form (see includes/EditPage.php)
  1125. $text: Contents of the edit box
  1126. $section: Section being edited
  1127. &$error: Error message to return
  1128. $summary: Edit summary for page
  1129. 'EditFilterMergedContent': Post-section-merge edit filter.
  1130. This may be triggered by the EditPage or any other facility that modifies page
  1131. content. Use the $status object to indicate whether the edit should be allowed,
  1132. and to provide a reason for disallowing it. Return false to abort the edit, and
  1133. true to continue. Returning true if $status->isOK() returns false means "don't
  1134. save but continue user interaction", e.g. show the edit form.
  1135. $status->apiHookResult can be set to an array to be returned by api.php
  1136. action=edit. This is used to deliver captchas.
  1137. $context: object implementing the IContextSource interface.
  1138. $content: content of the edit box, as a Content object.
  1139. $status: Status object to represent errors, etc.
  1140. $summary: Edit summary for page
  1141. $user: the User object representing the user whois performing the edit.
  1142. $minoredit: whether the edit was marked as minor by the user.
  1143. 'EditFormInitialText': Allows modifying the edit form when editing existing
  1144. pages
  1145. $editPage: EditPage object
  1146. 'EditFormPreloadText': Allows population of the edit form when creating
  1147. new pages
  1148. &$text: Text to preload with
  1149. &$title: Title object representing the page being created
  1150. 'EditPage::attemptSave': Called before an article is
  1151. saved, that is before WikiPage::doEditContent() is called
  1152. $editpage_Obj: the current EditPage object
  1153. 'EditPage::attemptSave:after': Called after an article save attempt
  1154. $editpage_Obj: the current EditPage object
  1155. $status: the resulting Status object
  1156. $resultDetails: Result details array
  1157. 'EditPage::importFormData': allow extensions to read additional data
  1158. posted in the form
  1159. $editpage: EditPage instance
  1160. $request: Webrequest
  1161. return value is ignored (should always return true)
  1162. 'EditPage::showEditForm:fields': allows injection of form field into edit form
  1163. Return value is ignored (should always return true)
  1164. &$editor: the EditPage instance for reference
  1165. &$out: an OutputPage instance to write to
  1166. 'EditPage::showEditForm:initial': before showing the edit form
  1167. Return false to halt editing; you'll need to handle error messages, etc.
  1168. yourself. Alternatively, modifying $error and returning true will cause the
  1169. contents of $error to be echoed at the top of the edit form as wikitext.
  1170. Return true without altering $error to allow the edit to proceed.
  1171. &$editor: EditPage instance (object)
  1172. &$out: an OutputPage instance to write to
  1173. 'EditPage::showReadOnlyForm:initial': similar to EditPage::showEditForm:initial
  1174. but for the read-only 'view source' variant of the edit form.
  1175. Return value is ignored (should always return true)
  1176. $editor: EditPage instance (object)
  1177. &$out: an OutputPage instance to write to
  1178. 'EditPage::showStandardInputs:options': allows injection of form fields into
  1179. the editOptions area
  1180. Return value is ignored (should always be true)
  1181. $editor: EditPage instance (object)
  1182. $out: an OutputPage instance to write to
  1183. &$tabindex: HTML tabindex of the last edit check/button
  1184. 'EditPageBeforeConflictDiff': allows modifying the EditPage object and output
  1185. when there's an edit conflict. Return false to halt normal diff output; in
  1186. this case you're responsible for computing and outputting the entire "conflict"
  1187. part, i.e., the "difference between revisions" and "your text" headers and
  1188. sections.
  1189. &$editor: EditPage instance
  1190. &$out: OutputPage instance
  1191. 'EditPageBeforeEditButtons': Allows modifying the edit buttons below the
  1192. textarea in the edit form.
  1193. &$editpage: The current EditPage object
  1194. &$buttons: Array of edit buttons "Save", "Preview", "Live", and "Diff"
  1195. &$tabindex: HTML tabindex of the last edit check/button
  1196. 'EditPageBeforeEditChecks': DEPRECATED! Use 'EditPageGetCheckboxesDefinition' instead,
  1197. or 'EditPage::showStandardInputs:options' if you don't actually care about checkboxes
  1198. and just want to add some HTML to the page.
  1199. Allows modifying the edit checks below the textarea in the edit form.
  1200. &$editpage: The current EditPage object
  1201. &$checks: Array of the HTML for edit checks like "watch this page"/"minor edit"
  1202. &$tabindex: HTML tabindex of the last edit check/button
  1203. 'EditPageBeforeEditToolbar': Allows modifying the edit toolbar above the
  1204. textarea in the edit form.
  1205. &$toolbar: The toolbar HTML
  1206. Hook subscribers can return false to avoid the default toolbar code being loaded.
  1207. 'EditPageCopyrightWarning': Allow for site and per-namespace customization of
  1208. contribution/copyright notice.
  1209. $title: title of page being edited
  1210. &$msg: localization message name, overridable. Default is either
  1211. 'copyrightwarning' or 'copyrightwarning2'.
  1212. 'EditPageGetCheckboxesDefinition': Allows modifying the edit checkboxes
  1213. below the textarea in the edit form.
  1214. $editpage: The current EditPage object
  1215. &$checkboxes: Array of checkbox definitions. See EditPage::getCheckboxesDefinition()
  1216. for the format.
  1217. 'EditPageGetDiffContent': Allow modifying the wikitext that will be used in
  1218. "Show changes". Note that it is preferable to implement diff handling for
  1219. different data types using the ContentHandler facility.
  1220. $editPage: EditPage object
  1221. &$newtext: wikitext that will be used as "your version"
  1222. 'EditPageGetPreviewContent': Allow modifying the wikitext that will be
  1223. previewed. Note that it is preferable to implement previews for different data
  1224. types using the ContentHandler facility.
  1225. $editPage: EditPage object
  1226. &$content: Content object to be previewed (may be replaced by hook function)
  1227. 'EditPageNoSuchSection': When a section edit request is given for an
  1228. non-existent section
  1229. &$editpage: The current EditPage object
  1230. &$res: the HTML of the error text
  1231. 'EditPageTosSummary': Give a chance for site and per-namespace customizations
  1232. of terms of service summary link that might exist separately from the copyright
  1233. notice.
  1234. $title: title of page being edited
  1235. &$msg: localization message name, overridable. Default is 'editpage-tos-summary'
  1236. 'EmailConfirmed': When checking that the user's email address is "confirmed".
  1237. This runs before the other checks, such as anonymity and the real check; return
  1238. true to allow those checks to occur, and false if checking is done.
  1239. &$user: User being checked
  1240. &$confirmed: Whether or not the email address is confirmed
  1241. 'EmailUser': Before sending email from one user to another.
  1242. &$to: MailAddress object of receiving user
  1243. &$from: MailAddress object of sending user
  1244. &$subject: subject of the mail
  1245. &$text: text of the mail
  1246. &$error: Out-param for an error. Should be set to a Status object or boolean false.
  1247. 'EmailUserCC': Before sending the copy of the email to the author.
  1248. &$to: MailAddress object of receiving user
  1249. &$from: MailAddress object of sending user
  1250. &$subject: subject of the mail
  1251. &$text: text of the mail
  1252. 'EmailUserComplete': After sending email from one user to another.
  1253. $to: MailAddress object of receiving user
  1254. $from: MailAddress object of sending user
  1255. $subject: subject of the mail
  1256. $text: text of the mail
  1257. 'EmailUserForm': After building the email user form object.
  1258. &$form: HTMLForm object
  1259. 'EmailUserPermissionsErrors': to retrieve permissions errors for emailing a
  1260. user.
  1261. $user: The user who is trying to email another user.
  1262. $editToken: The user's edit token.
  1263. &$hookErr: Out-param for the error. Passed as the parameters to
  1264. OutputPage::showErrorPage.
  1265. 'EnhancedChangesList::getLogText': to alter, remove or add to the links of a
  1266. group of changes in EnhancedChangesList.
  1267. Hook subscribers can return false to omit this line from recentchanges.
  1268. $changesList: EnhancedChangesList object
  1269. &$links: The links that were generated by EnhancedChangesList
  1270. $block: The RecentChanges objects in that block
  1271. 'EnhancedChangesListModifyLineData': to alter data used to build
  1272. a grouped recent change inner line in EnhancedChangesList.
  1273. Hook subscribers can return false to omit this line from recentchanges.
  1274. $changesList: EnhancedChangesList object
  1275. &$data: An array with all the components that will be joined in order to create the line
  1276. $block: An array of RecentChange objects in that block
  1277. $rc: The RecentChange object for this line
  1278. &$classes: An array of classes to change
  1279. &$attribs: associative array of other HTML attributes for the <tr> element.
  1280. Currently only data attributes reserved to MediaWiki are allowed
  1281. (see Sanitizer::isReservedDataAttribute).
  1282. 'EnhancedChangesListModifyBlockLineData': to alter data used to build
  1283. a non-grouped recent change line in EnhancedChangesList.
  1284. $changesList: EnhancedChangesList object
  1285. &$data: An array with all the components that will be joined in order to create the line
  1286. $rc: The RecentChange object for this line
  1287. 'ExemptFromAccountCreationThrottle': Exemption from the account creation
  1288. throttle.
  1289. $ip: The ip address of the user
  1290. 'ExtensionTypes': Called when generating the extensions credits, use this to
  1291. change the tables headers.
  1292. &$extTypes: associative array of extensions types
  1293. 'FetchChangesList': When fetching the ChangesList derivative for a particular
  1294. user.
  1295. $user: User the list is being fetched for
  1296. &$skin: Skin object to be used with the list
  1297. &$list: List object (defaults to NULL, change it to an object instance and
  1298. return false override the list derivative used)
  1299. 'FileDeleteComplete': When a file is deleted.
  1300. &$file: reference to the deleted file
  1301. &$oldimage: in case of the deletion of an old image, the name of the old file
  1302. &$article: in case all revisions of the file are deleted a reference to the
  1303. WikiFilePage associated with the file.
  1304. &$user: user who performed the deletion
  1305. &$reason: reason
  1306. 'FileTransformed': When a file is transformed and moved into storage.
  1307. $file: reference to the File object
  1308. $thumb: the MediaTransformOutput object
  1309. $tmpThumbPath: The temporary file system path of the transformed file
  1310. $thumbPath: The permanent storage path of the transformed file
  1311. 'FileUndeleteComplete': When a file is undeleted
  1312. $title: title object to the file
  1313. $fileVersions: array of undeleted versions. Empty if all versions were restored
  1314. $user: user who performed the undeletion
  1315. $reason: reason
  1316. 'FileUpload': When a file upload occurs.
  1317. $file: Image object representing the file that was uploaded
  1318. $reupload: Boolean indicating if there was a previously another image there or
  1319. not (since 1.17)
  1320. $hasDescription: Boolean indicating that there was already a description page
  1321. and a new one from the comment wasn't created (since 1.17)
  1322. 'FormatAutocomments': When an autocomment is formatted by the Linker.
  1323. &$comment: Reference to the accumulated comment. Initially null, when set the
  1324. default code will be skipped.
  1325. $pre: Boolean, true if there is text before this autocomment
  1326. $auto: The extracted part of the parsed comment before the call to the hook.
  1327. $post: Boolean, true if there is text after this autocomment
  1328. $title: An optional title object used to links to sections. Can be null.
  1329. $local: Boolean indicating whether section links should refer to local page.
  1330. $wikiId: String containing the ID (as used by WikiMap) of the wiki from which the
  1331. autocomment originated; null for the local wiki. Added in 1.26, should default
  1332. to null in handler functions, for backwards compatibility.
  1333. 'GalleryGetModes': Get list of classes that can render different modes of a
  1334. gallery.
  1335. &$modeArray: An associative array mapping mode names to classes that implement
  1336. that mode. It is expected all registered classes are a subclass of
  1337. ImageGalleryBase.
  1338. 'GetAutoPromoteGroups': When determining which autopromote groups a user is
  1339. entitled to be in.
  1340. $user: user to promote.
  1341. &$promote: groups that will be added.
  1342. 'GetBlockedStatus': after loading blocking status of an user from the database
  1343. &$user: user (object) being checked
  1344. 'GetCacheVaryCookies': Get cookies that should vary cache options.
  1345. $out: OutputPage object
  1346. &$cookies: array of cookies name, add a value to it if you want to add a cookie
  1347. that have to vary cache options
  1348. 'GetCanonicalURL': Modify fully-qualified URLs used for IRC and e-mail
  1349. notifications.
  1350. &$title: Title object of page
  1351. &$url: string value as output (out parameter, can modify)
  1352. $query: query options passed to Title::getCanonicalURL()
  1353. 'GetContentModels': Add content models to the list of available models.
  1354. &$models: array containing current model list, as strings. Extensions should add to this list.
  1355. 'GetDefaultSortkey': Override the default sortkey for a page.
  1356. $title: Title object that we need to get a sortkey for
  1357. &$sortkey: Sortkey to use.
  1358. 'GetDifferenceEngine': Called when getting a new difference engine interface
  1359. object Return false for valid object in $differenceEngine or true for the
  1360. default difference engine.
  1361. $context: IContextSource context to be used for diff
  1362. $old: Revision ID to show and diff with
  1363. $new: Either a revision ID or one of the strings 'cur', 'prev' or 'next'
  1364. $refreshCache: If set, refreshes the diff cache
  1365. $unhide: If set, allow viewing deleted revs
  1366. &$differenceEngine: output parameter, difference engine object to be used for
  1367. diff
  1368. 'GetDoubleUnderscoreIDs': Modify the list of behavior switch (double
  1369. underscore) magic words. Called by MagicWord.
  1370. &$doubleUnderscoreIDs: array of strings
  1371. 'GetExtendedMetadata': Get extended file metadata for the API
  1372. &$combinedMeta: Array of the form:
  1373. 'MetadataPropName' => array(
  1374. value' => prop value,
  1375. 'source' => 'name of hook'
  1376. ).
  1377. $file: File object of file in question
  1378. $context: RequestContext (including language to use)
  1379. $single: Only extract the current language; if false, the prop value should
  1380. be in the metadata multi-language array format:
  1381. mediawiki.org/wiki/Manual:File_metadata_handling#Multi-language_array_format
  1382. &$maxCacheTime: how long the results can be cached
  1383. 'GetFullURL': Modify fully-qualified URLs used in redirects/export/offsite data.
  1384. &$title: Title object of page
  1385. &$url: string value as output (out parameter, can modify)
  1386. $query: query options passed to Title::getFullURL()
  1387. 'GetHumanTimestamp': Pre-emptively override the human-readable timestamp
  1388. generated by MWTimestamp::getHumanTimestamp(). Return false in this hook to use
  1389. the custom output.
  1390. &$output: string for the output timestamp
  1391. $timestamp: MWTimestamp object of the current (user-adjusted) timestamp
  1392. $relativeTo: MWTimestamp object of the relative (user-adjusted) timestamp
  1393. $user: User whose preferences are being used to make timestamp
  1394. $lang: Language that will be used to render the timestamp
  1395. 'GetInternalURL': Modify fully-qualified URLs used for squid cache purging.
  1396. &$title: Title object of page
  1397. &$url: string value as output (out parameter, can modify)
  1398. $query: query options passed to Title::getInternalURL()
  1399. 'GetIP': modify the ip of the current user (called only once).
  1400. &$ip: string holding the ip as determined so far
  1401. 'GetLangPreferredVariant': Called in LanguageConverter#getPreferredVariant() to
  1402. allow fetching the language variant code from cookies or other such
  1403. alternative storage.
  1404. &$req: language variant from the URL (string) or boolean false if no variant
  1405. was specified in the URL; the value of this variable comes from
  1406. LanguageConverter#getURLVariant()
  1407. 'GetLinkColours': modify the CSS class of an array of page links.
  1408. $linkcolour_ids: array of prefixed DB keys of the pages linked to,
  1409. indexed by page_id.
  1410. &$colours: (output) array of CSS classes, indexed by prefixed DB keys
  1411. 'GetLocalURL': Modify local URLs as output into page links. Note that if you are
  1412. working with internal urls (non-interwiki) then it may be preferable to work
  1413. with the GetLocalURL::Internal or GetLocalURL::Article hooks as GetLocalURL can
  1414. be buggy for internal urls on render if you do not re-implement the horrible
  1415. hack that Title::getLocalURL uses in your own extension.
  1416. &$title: Title object of page
  1417. &$url: string value as output (out parameter, can modify)
  1418. $query: query options passed to Title::getLocalURL()
  1419. 'GetLocalURL::Article': Modify local URLs specifically pointing to article paths
  1420. without any fancy queries or variants.
  1421. &$title: Title object of page
  1422. &$url: string value as output (out parameter, can modify)
  1423. 'GetLocalURL::Internal': Modify local URLs to internal pages.
  1424. &$title: Title object of page
  1425. &$url: string value as output (out parameter, can modify)
  1426. $query: query options passed to Title::getLocalURL()
  1427. 'GetLogTypesOnUser': Add log types where the target is a userpage
  1428. &$types: Array of log types
  1429. 'GetMetadataVersion': Modify the image metadata version currently in use. This
  1430. is used when requesting image metadata from a ForeignApiRepo. Media handlers
  1431. that need to have versioned metadata should add an element to the end of the
  1432. version array of the form 'handler_name=version'. Most media handlers won't need
  1433. to do this unless they broke backwards compatibility with a previous version of
  1434. the media handler metadata output.
  1435. &$version: Array of version strings
  1436. 'GetNewMessagesAlert': Disable or modify the new messages alert
  1437. &$newMessagesAlert: An empty string by default. If the user has new talk page
  1438. messages, this should be populated with an alert message to that effect
  1439. $newtalks: An empty array if the user has no new messages or an array
  1440. containing links and revisions if there are new messages (See
  1441. User::getNewMessageLinks)
  1442. $user: The user object of the user who is loading the page
  1443. $out: OutputPage object (to check what type of page the user is on)
  1444. 'GetPreferences': Modify user preferences.
  1445. $user: User whose preferences are being modified.
  1446. &$preferences: Preferences description array, to be fed to an HTMLForm object
  1447. 'GetRelativeTimestamp': Pre-emptively override the relative timestamp generated
  1448. by MWTimestamp::getRelativeTimestamp(). Return false in this hook to use the
  1449. custom output.
  1450. &$output: string for the output timestamp
  1451. &$diff: DateInterval representing the difference between the timestamps
  1452. $timestamp: MWTimestamp object of the current (user-adjusted) timestamp
  1453. $relativeTo: MWTimestamp object of the relative (user-adjusted) timestamp
  1454. $user: User whose preferences are being used to make timestamp
  1455. $lang: Language that will be used to render the timestamp
  1456. 'getUserPermissionsErrors': Add a permissions error when permissions errors are
  1457. checked for. Use instead of userCan for most cases. Return false if the user
  1458. can't do it, and populate $result with the reason in the form of
  1459. array( messagename, param1, param2, ... ) or a MessageSpecifier instance (you
  1460. might want to use ApiMessage to provide machine-readable details for the API).
  1461. For consistency, error messages
  1462. should be plain text with no special coloring, bolding, etc. to show that
  1463. they're errors; presenting them properly to the user as errors is done by the
  1464. caller.
  1465. &$title: Title object being checked against
  1466. &$user: Current user object
  1467. $action: Action being checked
  1468. &$result: User permissions error to add. If none, return true.
  1469. 'getUserPermissionsErrorsExpensive': Equal to getUserPermissionsErrors, but is
  1470. called only if expensive checks are enabled. Add a permissions error when
  1471. permissions errors are checked for. Return false if the user can't do it, and
  1472. populate $result with the reason in the form of array( messagename, param1,
  1473. param2, ... ) or a MessageSpecifier instance (you might want to use ApiMessage
  1474. to provide machine-readable details for the API). For consistency, error
  1475. messages should be plain text with no
  1476. special coloring, bolding, etc. to show that they're errors; presenting them
  1477. properly to the user as errors is done by the caller.
  1478. &$title: Title object being checked against
  1479. &$user: Current user object
  1480. $action: Action being checked
  1481. &$result: User permissions error to add. If none, return true.
  1482. 'GitViewers': Called when generating the list of git viewers for
  1483. Special:Version, use this to change the list.
  1484. &$extTypes: associative array of repo URLS to viewer URLs.
  1485. 'HistoryRevisionTools': Override or extend the revision tools available from the
  1486. page history view, i.e. undo, rollback, etc.
  1487. $rev: Revision object
  1488. &$links: Array of HTML links
  1489. $prevRev: Revision object, next in line in page history, or null
  1490. $user: Current user object
  1491. 'HTMLFileCache::useFileCache': Override whether a page should be cached in file
  1492. cache.
  1493. $context: An IContextSource object with information about the request being
  1494. served.
  1495. 'ImageBeforeProduceHTML': Called before producing the HTML created by a wiki
  1496. image insertion. You can skip the default logic entirely by returning false, or
  1497. just modify a few things using call-by-reference.
  1498. &$skin: Skin object
  1499. &$title: Title object of the image
  1500. &$file: File object, or false if it doesn't exist
  1501. &$frameParams: Various parameters with special meanings; see documentation in
  1502. includes/Linker.php for Linker::makeImageLink
  1503. &$handlerParams: Various parameters with special meanings; see documentation in
  1504. includes/Linker.php for Linker::makeImageLink
  1505. &$time: Timestamp of file in 'YYYYMMDDHHIISS' string form, or false for current
  1506. &$res: Final HTML output, used if you return false
  1507. 'ImageOpenShowImageInlineBefore': Call potential extension just before showing
  1508. the image on an image page.
  1509. &$imagePage: ImagePage object ($this)
  1510. &$output: $wgOut
  1511. 'ImagePageAfterImageLinks': Called after the image links section on an image
  1512. page is built.
  1513. $imagePage: ImagePage object ($this)
  1514. &$html: HTML for the hook to add
  1515. 'ImagePageFileHistoryLine': Called when a file history line is constructed.
  1516. $imagePage: ImagePage object ($this)
  1517. $file: the file
  1518. &$line: the HTML of the history line
  1519. &$css: the line CSS class
  1520. 'ImagePageFindFile': Called when fetching the file associated with an image
  1521. page.
  1522. $page: ImagePage object
  1523. &$file: File object
  1524. &$displayFile: displayed File object
  1525. 'ImagePageShowTOC': Called when the file toc on an image page is generated.
  1526. $page: ImagePage object
  1527. &$toc: Array of <li> strings
  1528. 'ImgAuthBeforeStream': executed before file is streamed to user, but only when
  1529. using img_auth.php.
  1530. &$title: the Title object of the file as it would appear for the upload page
  1531. &$path: the original file and path name when img_auth was invoked by the web
  1532. server
  1533. &$name: the name only component of the file
  1534. &$result: The location to pass back results of the hook routine (only used if
  1535. failed)
  1536. $result[0]=The index of the header message
  1537. $result[1]=The index of the body text message
  1538. $result[2 through n]=Parameters passed to body text message. Please note the
  1539. header message cannot receive/use parameters.
  1540. 'ImportHandleLogItemXMLTag': When parsing a XML tag in a log item.
  1541. Return false to stop further processing of the tag
  1542. $reader: XMLReader object
  1543. $logInfo: Array of information
  1544. 'ImportHandlePageXMLTag': When parsing a XML tag in a page.
  1545. Return false to stop further processing of the tag
  1546. $reader: XMLReader object
  1547. &$pageInfo: Array of information
  1548. 'ImportHandleRevisionXMLTag': When parsing a XML tag in a page revision.
  1549. Return false to stop further processing of the tag
  1550. $reader: XMLReader object
  1551. $pageInfo: Array of page information
  1552. $revisionInfo: Array of revision information
  1553. 'ImportHandleToplevelXMLTag': When parsing a top level XML tag.
  1554. Return false to stop further processing of the tag
  1555. $reader: XMLReader object
  1556. 'ImportHandleUnknownUser': When a user doesn't exist locally, this hook is called
  1557. to give extensions an opportunity to auto-create it. If the auto-creation is
  1558. successful, return false.
  1559. $name: User name
  1560. 'ImportHandleUploadXMLTag': When parsing a XML tag in a file upload.
  1561. Return false to stop further processing of the tag
  1562. $reader: XMLReader object
  1563. $revisionInfo: Array of information
  1564. 'ImportLogInterwikiLink': Hook to change the interwiki link used in log entries
  1565. and edit summaries for transwiki imports.
  1566. &$fullInterwikiPrefix: Interwiki prefix, may contain colons.
  1567. &$pageTitle: String that contains page title.
  1568. 'ImportSources': Called when reading from the $wgImportSources configuration
  1569. variable. Can be used to lazy-load the import sources list.
  1570. &$importSources: The value of $wgImportSources. Modify as necessary. See the
  1571. comment in DefaultSettings.php for the detail of how to structure this array.
  1572. 'InfoAction': When building information to display on the action=info page.
  1573. $context: IContextSource object
  1574. &$pageInfo: Array of information
  1575. 'InitializeArticleMaybeRedirect': MediaWiki check to see if title is a redirect.
  1576. &$title: Title object for the current page
  1577. &$request: WebRequest
  1578. &$ignoreRedirect: boolean to skip redirect check
  1579. &$target: Title/string of redirect target
  1580. &$article: Article object
  1581. 'InternalParseBeforeLinks': during Parser's internalParse method before links
  1582. but after nowiki/noinclude/includeonly/onlyinclude and other processings.
  1583. &$parser: Parser object
  1584. &$text: string containing partially parsed text
  1585. &$stripState: Parser's internal StripState object
  1586. 'InternalParseBeforeSanitize': during Parser's internalParse method just before
  1587. the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/
  1588. includeonly/onlyinclude and other processings. Ideal for syntax-extensions after
  1589. template/parser function execution which respect nowiki and HTML-comments.
  1590. &$parser: Parser object
  1591. &$text: string containing partially parsed text
  1592. &$stripState: Parser's internal StripState object
  1593. 'InterwikiLoadPrefix': When resolving if a given prefix is an interwiki or not.
  1594. Return true without providing an interwiki to continue interwiki search.
  1595. $prefix: interwiki prefix we are looking for.
  1596. &$iwData: output array describing the interwiki with keys iw_url, iw_local,
  1597. iw_trans and optionally iw_api and iw_wikiid.
  1598. 'InvalidateEmailComplete': Called after a user's email has been invalidated
  1599. successfully.
  1600. $user: user (object) whose email is being invalidated
  1601. 'IRCLineURL': When constructing the URL to use in an IRC notification.
  1602. Callee may modify $url and $query, URL will be constructed as $url . $query
  1603. &$url: URL to index.php
  1604. &$query: Query string
  1605. $rc: RecentChange object that triggered url generation
  1606. 'IsFileCacheable': Override the result of Article::isFileCacheable() (if true)
  1607. &$article: article (object) being checked
  1608. 'IsTrustedProxy': Override the result of IP::isTrustedProxy()
  1609. &$ip: IP being check
  1610. &$result: Change this value to override the result of IP::isTrustedProxy()
  1611. 'IsUploadAllowedFromUrl': Override the result of UploadFromUrl::isAllowedUrl()
  1612. $url: URL used to upload from
  1613. &$allowed: Boolean indicating if uploading is allowed for given URL
  1614. 'isValidEmailAddr': Override the result of Sanitizer::validateEmail(), for
  1615. instance to return false if the domain name doesn't match your organization.
  1616. $addr: The e-mail address entered by the user
  1617. &$result: Set this and return false to override the internal checks
  1618. 'isValidPassword': Override the result of User::isValidPassword()
  1619. $password: The password entered by the user
  1620. &$result: Set this and return false to override the internal checks
  1621. $user: User the password is being validated for
  1622. 'Language::getMessagesFileName':
  1623. $code: The language code or the language we're looking for a messages file for
  1624. &$file: The messages file path, you can override this to change the location.
  1625. 'LanguageGetMagic': DEPRECATED! Use $magicWords in a file listed in
  1626. $wgExtensionMessagesFiles instead.
  1627. Use this to define synonyms of magic words depending of the language
  1628. &$magicExtensions: associative array of magic words synonyms
  1629. $lang: language code (string)
  1630. 'LanguageGetNamespaces': Provide custom ordering for namespaces or
  1631. remove namespaces. Do not use this hook to add namespaces. Use
  1632. CanonicalNamespaces for that.
  1633. &$namespaces: Array of namespaces indexed by their numbers
  1634. 'LanguageGetSpecialPageAliases': DEPRECATED! Use $specialPageAliases in a file
  1635. listed in $wgExtensionMessagesFiles instead.
  1636. Use to define aliases of special pages names depending of the language
  1637. &$specialPageAliases: associative array of magic words synonyms
  1638. $lang: language code (string)
  1639. 'LanguageGetTranslatedLanguageNames': Provide translated language names.
  1640. &$names: array of language code => language name
  1641. $code: language of the preferred translations
  1642. 'LanguageLinks': Manipulate a page's language links. This is called
  1643. in various places to allow extensions to define the effective language
  1644. links for a page.
  1645. $title: The page's Title.
  1646. &$links: Array with elements of the form "language:title" in the order
  1647. that they will be output.
  1648. &$linkFlags: Associative array mapping prefixed links to arrays of flags.
  1649. Currently unused, but planned to provide support for marking individual
  1650. language links in the UI, e.g. for featured articles.
  1651. 'LanguageSelector': Hook to change the language selector available on a page.
  1652. $out: The output page.
  1653. $cssClassName: CSS class name of the language selector.
  1654. 'LinkBegin': DEPRECATED! Use HtmlPageLinkRendererBegin instead.
  1655. Used when generating internal and interwiki links in
  1656. Linker::link(), before processing starts. Return false to skip default
  1657. processing and return $ret. See documentation for Linker::link() for details on
  1658. the expected meanings of parameters.
  1659. $skin: the Skin object
  1660. $target: the Title that the link is pointing to
  1661. &$html: the contents that the <a> tag should have (raw HTML); null means
  1662. "default".
  1663. &$customAttribs: the HTML attributes that the <a> tag should have, in
  1664. associative array form, with keys and values unescaped. Should be merged
  1665. with default values, with a value of false meaning to suppress the
  1666. attribute.
  1667. &$query: the query string to add to the generated URL (the bit after the "?"),
  1668. in associative array form, with keys and values unescaped.
  1669. &$options: array of options. Can include 'known', 'broken', 'noclasses'.
  1670. &$ret: the value to return if your hook returns false.
  1671. 'LinkEnd': DEPRECATED! Use HtmlPageLinkRendererEnd hook instead
  1672. Used when generating internal and interwiki links in Linker::link(),
  1673. just before the function returns a value. If you return true, an <a> element
  1674. with HTML attributes $attribs and contents $html will be returned. If you
  1675. return false, $ret will be returned.
  1676. $skin: the Skin object
  1677. $target: the Title object that the link is pointing to
  1678. $options: the options. Will always include either 'known' or 'broken', and may
  1679. include 'noclasses'.
  1680. &$html: the final (raw HTML) contents of the <a> tag, after processing.
  1681. &$attribs: the final HTML attributes of the <a> tag, after processing, in
  1682. associative array form.
  1683. &$ret: the value to return if your hook returns false.
  1684. 'LinkerMakeExternalImage': At the end of Linker::makeExternalImage() just
  1685. before the return.
  1686. &$url: the image url
  1687. &$alt: the image's alt text
  1688. &$img: the new image HTML (if returning false)
  1689. 'LinkerMakeExternalLink': At the end of Linker::makeExternalLink() just
  1690. before the return.
  1691. &$url: the link url
  1692. &$text: the link text
  1693. &$link: the new link HTML (if returning false)
  1694. &$attribs: the attributes to be applied.
  1695. $linkType: The external link type
  1696. 'LinkerMakeMediaLinkFile': At the end of Linker::makeMediaLinkFile() just
  1697. before the return.
  1698. $title: the Title object that the link is pointing to
  1699. $file: the File object or false if broken link
  1700. &$html: the link text
  1701. &$attribs: the attributes to be applied
  1702. &$ret: the value to return if your hook returns false
  1703. 'LogEventsListLineEnding': Called before a Special:Log line is finished
  1704. $page: the LogEventsList object
  1705. &$ret: the HTML line
  1706. $entry: the DatabaseLogEntry object for this row
  1707. &$classes: the classes to add to the surrounding <li>
  1708. &$attribs: associative array of other HTML attributes for the <li> element.
  1709. Currently only data attributes reserved to MediaWiki are allowed
  1710. (see Sanitizer::isReservedDataAttribute).
  1711. 'HtmlPageLinkRendererBegin':
  1712. Used when generating internal and interwiki links in
  1713. LinkRenderer, before processing starts. Return false to skip default
  1714. processing and return $ret.
  1715. $linkRenderer: the LinkRenderer object
  1716. $target: the LinkTarget that the link is pointing to
  1717. &$text: the contents that the <a> tag should have; either a plain, unescaped
  1718. string or a HtmlArmor object; null means "default".
  1719. &$customAttribs: the HTML attributes that the <a> tag should have, in
  1720. associative array form, with keys and values unescaped. Should be merged
  1721. with default values, with a value of false meaning to suppress the
  1722. attribute.
  1723. &$query: the query string to add to the generated URL (the bit after the "?"),
  1724. in associative array form, with keys and values unescaped.
  1725. &$ret: the value to return if your hook returns false.
  1726. 'HtmlPageLinkRendererEnd':
  1727. Used when generating internal and interwiki links in LinkRenderer,
  1728. just before the function returns a value. If you return true, an <a> element
  1729. with HTML attributes $attribs and contents $html will be returned. If you
  1730. return false, $ret will be returned.
  1731. $linkRenderer: the LinkRenderer object
  1732. $target: the LinkTarget object that the link is pointing to
  1733. $isKnown: boolean indicating whether the page is known or not
  1734. &$text: the contents that the <a> tag should have; either a plain, unescaped
  1735. string or a HtmlArmor object.
  1736. &$attribs: the final HTML attributes of the <a> tag, after processing, in
  1737. associative array form.
  1738. &$ret: the value to return if your hook returns false.
  1739. 'LinksUpdate': At the beginning of LinksUpdate::doUpdate() just before the
  1740. actual update.
  1741. &$linksUpdate: the LinksUpdate object
  1742. 'LinksUpdateAfterInsert': At the end of LinksUpdate::incrTableUpdate() after
  1743. each link table insert. For example, pagelinks, imagelinks, externallinks.
  1744. $linksUpdate: LinksUpdate object
  1745. $table: the table to insert links to
  1746. $insertions: an array of links to insert
  1747. 'LinksUpdateComplete': At the end of LinksUpdate::doUpdate() when updating,
  1748. including delete and insert, has completed for all link tables
  1749. &$linksUpdate: the LinksUpdate object
  1750. $ticket: prior result of LBFactory::getEmptyTransactionTicket()
  1751. 'LinksUpdateConstructed': At the end of LinksUpdate() is construction.
  1752. &$linksUpdate: the LinksUpdate object
  1753. 'ListDefinedTags': When trying to find all defined tags.
  1754. &$tags: The list of tags.
  1755. 'LoadExtensionSchemaUpdates': Called during database installation and updates.
  1756. $updater: A DatabaseUpdater subclass
  1757. 'LocalFile::getHistory': Called before file history query performed.
  1758. &$file: the File object
  1759. &$tables: tables
  1760. &$fields: select fields
  1761. &$conds: conditions
  1762. &$opts: query options
  1763. &$join_conds: JOIN conditions
  1764. 'LocalFilePurgeThumbnails': Called before thumbnails for a local file a purged.
  1765. $file: the File object
  1766. $archiveName: name of an old file version or false if it's the current one
  1767. 'LocalisationCacheRecache': Called when loading the localisation data into
  1768. cache.
  1769. $cache: The LocalisationCache object
  1770. $code: language code
  1771. &$alldata: The localisation data from core and extensions
  1772. &$purgeBlobs: whether to purge/update the message blobs via
  1773. MessageBlobStore::clear()
  1774. 'LocalisationCacheRecacheFallback': Called for each language when merging
  1775. fallback data into the cache.
  1776. $cache: The LocalisationCache object
  1777. $code: language code
  1778. &$alldata: The localisation data from core and extensions. Note some keys may
  1779. be omitted if they won't be merged into the final result.
  1780. 'LocalisationChecksBlacklist': When fetching the blacklist of
  1781. localisation checks.
  1782. &$blacklist: array of checks to blacklist. See the bottom of
  1783. maintenance/language/checkLanguage.inc for the format of this variable.
  1784. 'LocalisationIgnoredOptionalMessages': When fetching the list of ignored and
  1785. optional localisation messages
  1786. &$ignored: Array of ignored message keys
  1787. &$optional: Array of optional message keys
  1788. 'LocalUserCreated': Called when a local user has been created
  1789. $user: User object for the created user
  1790. $autocreated: Boolean, whether this was an auto-creation
  1791. 'LogEventsListGetExtraInputs': When getting extra inputs to display on
  1792. Special:Log for a specific log type
  1793. $type: String of log type being displayed
  1794. $logEventsList: LogEventsList object for context and access to the WebRequest
  1795. &$input: string HTML of an input element
  1796. 'LogEventsListShowLogExtract': Called before the string is added to OutputPage.
  1797. Returning false will prevent the string from being added to the OutputPage.
  1798. &$s: html string to show for the log extract
  1799. $types: String or Array Log types to show
  1800. $page: String or Title The page title to show log entries for
  1801. $user: String The user who made the log entries
  1802. $param: Associative Array with the following additional options:
  1803. - lim Integer Limit of items to show, default is 50
  1804. - conds Array Extra conditions for the query (e.g. "log_action != 'revision'")
  1805. - showIfEmpty boolean Set to false if you don't want any output in case the
  1806. loglist is empty if set to true (default), "No matching items in log" is
  1807. displayed if loglist is empty
  1808. - msgKey Array If you want a nice box with a message, set this to the key of
  1809. the message. First element is the message key, additional optional elements
  1810. are parameters for the key that are processed with
  1811. wfMessage()->params()->parseAsBlock()
  1812. - offset Set to overwrite offset parameter in $wgRequest set to '' to unset
  1813. offset
  1814. - wrap String Wrap the message in html (usually something like
  1815. "&lt;div ...>$1&lt;/div>").
  1816. - flags Integer display flags (NO_ACTION_LINK,NO_EXTRA_USER_LINKS)
  1817. 'LogException': Called before an exception (or PHP error) is logged. This is
  1818. meant for integration with external error aggregation services; returning false
  1819. will NOT prevent logging.
  1820. $e: The exception (in case of a plain old PHP error, a wrapping ErrorException)
  1821. $suppressed: true if the error was suppressed via
  1822. error_reporting()/wfSuppressWarnings()
  1823. 'LoginFormValidErrorMessages': Called in LoginForm when a function gets valid
  1824. error messages. Allows to add additional error messages (except messages already
  1825. in LoginForm::$validErrorMessages).
  1826. &$messages: Already added messages (inclusive messages from
  1827. LoginForm::$validErrorMessages)
  1828. 'LoginUserMigrated': DEPRECATED! Create a PreAuthenticationProvider instead.
  1829. Called during login to allow extensions the opportunity to inform a user that
  1830. their username doesn't exist for a specific reason, instead of letting the
  1831. login form give the generic error message that the account does not exist. For
  1832. example, when the account has been renamed or deleted.
  1833. $user: the User object being authenticated against.
  1834. &$msg: the message identifier for abort reason, or an array to pass a message
  1835. key and parameters.
  1836. 'LogLine': Processes a single log entry on Special:Log.
  1837. $log_type: string for the type of log entry (e.g. 'move'). Corresponds to
  1838. logging.log_type database field.
  1839. $log_action: string for the type of log action (e.g. 'delete', 'block',
  1840. 'create2'). Corresponds to logging.log_action database field.
  1841. $title: Title object that corresponds to logging.log_namespace and
  1842. logging.log_title database fields.
  1843. $paramArray: Array of parameters that corresponds to logging.log_params field.
  1844. Note that only $paramArray[0] appears to contain anything.
  1845. &$comment: string that corresponds to logging.log_comment database field, and
  1846. which is displayed in the UI.
  1847. &$revert: string that is displayed in the UI, similar to $comment.
  1848. $time: timestamp of the log entry (added in 1.12)
  1849. 'LonelyPagesQuery': Allow extensions to modify the query used by
  1850. Special:LonelyPages.
  1851. &$tables: tables to join in the query
  1852. &$conds: conditions for the query
  1853. &$joinConds: join conditions for the query
  1854. 'MagicWordwgVariableIDs': When defining new magic words IDs.
  1855. &$variableIDs: array of strings
  1856. 'MaintenanceRefreshLinksInit': before executing the refreshLinks.php maintenance
  1857. script.
  1858. $refreshLinks: RefreshLinks object
  1859. 'MakeGlobalVariablesScript': Called at end of OutputPage::getJSVars.
  1860. Ideally, this hook should only be used to add variables that depend on
  1861. the current page/request; static configuration should be added through
  1862. ResourceLoaderGetConfigVars instead.
  1863. &$vars: variable (or multiple variables) to be added into the output of
  1864. Skin::makeVariablesScript
  1865. $out: The OutputPage which called the hook, can be used to get the real title.
  1866. 'MarkPatrolled': Before an edit is marked patrolled.
  1867. $rcid: ID of the revision to be marked patrolled
  1868. &$user: the user (object) marking the revision as patrolled
  1869. $wcOnlySysopsCanPatrol: config setting indicating whether the user needs to be a
  1870. sysop in order to mark an edit patrolled.
  1871. $auto: true if the edit is being marked as patrolled automatically
  1872. 'MarkPatrolledComplete': After an edit is marked patrolled.
  1873. $rcid: ID of the revision marked as patrolled
  1874. &$user: user (object) who marked the edit patrolled
  1875. $wcOnlySysopsCanPatrol: config setting indicating whether the user must be a
  1876. sysop to patrol the edit.
  1877. $auto: true if the edit is being marked as patrolled automatically
  1878. 'MediaWikiPerformAction': Override MediaWiki::performAction(). Use this to do
  1879. something completely different, after the basic globals have been set up, but
  1880. before ordinary actions take place.
  1881. $output: $wgOut
  1882. $article: Article on which the action will be performed
  1883. $title: Title on which the action will be performed
  1884. $user: $wgUser
  1885. $request: $wgRequest
  1886. $mediaWiki: The $mediawiki object
  1887. 'MediaWikiServices': Called when a global MediaWikiServices instance is
  1888. initialized. Extensions may use this to define, replace, or wrap services.
  1889. However, the preferred way to define a new service is
  1890. the $wgServiceWiringFiles array.
  1891. $services: MediaWikiServices
  1892. 'MessageCache::get': When fetching a message. Can be used to override the key
  1893. for customisations. Given and returned message key must be in special format:
  1894. 1) first letter must be in lower case according to the content language.
  1895. 2) spaces must be replaced with underscores
  1896. &$key: message key (string)
  1897. 'MessageCacheReplace': When a message page is changed. Useful for updating
  1898. caches.
  1899. $title: name of the page changed.
  1900. $text: new contents of the page.
  1901. 'MessagesPreLoad': When loading a message from the database.
  1902. $title: title of the message (string)
  1903. &$message: value (string), change it to the message you want to define
  1904. $code: code (string) denoting the language to try.
  1905. 'MimeMagicGuessFromContent': Allows MW extensions guess the MIME by content.
  1906. $mimeMagic: Instance of MimeMagic.
  1907. &$head: First 1024 bytes of the file in a string (in - Do not alter!).
  1908. &$tail: More or equal than last 65558 bytes of the file in a string
  1909. (in - Do not alter!).
  1910. $file: File path.
  1911. &$mime: MIME type (out).
  1912. 'MimeMagicImproveFromExtension': Allows MW extensions to further improve the
  1913. MIME type detected by considering the file extension.
  1914. $mimeMagic: Instance of MimeMagic.
  1915. $ext: File extension.
  1916. &$mime: MIME type (in/out).
  1917. 'MimeMagicInit': Before processing the list mapping MIME types to media types
  1918. and the list mapping MIME types to file extensions.
  1919. As an extension author, you are encouraged to submit patches to MediaWiki's
  1920. core to add new MIME types to mime.types.
  1921. $mimeMagic: Instance of MimeMagic.
  1922. Use $mimeMagic->addExtraInfo( $stringOfInfo );
  1923. for adding new MIME info to the list.
  1924. Use $mimeMagic->addExtraTypes( $stringOfTypes );
  1925. for adding new MIME types to the list.
  1926. 'ModifyExportQuery': Modify the query used by the exporter.
  1927. $db: The database object to be queried.
  1928. &$tables: Tables in the query.
  1929. &$conds: Conditions in the query.
  1930. &$opts: Options for the query.
  1931. &$join_conds: Join conditions for the query.
  1932. 'MovePageCheckPermissions': Specify whether the user is allowed to move the
  1933. page.
  1934. $oldTitle: Title object of the current (old) location
  1935. $newTitle: Title object of the new location
  1936. $user: User making the move
  1937. $reason: string of the reason provided by the user
  1938. $status: Status object to pass error messages to
  1939. 'MovePageIsValidMove': Specify whether a page can be moved for technical
  1940. reasons.
  1941. $oldTitle: Title object of the current (old) location
  1942. $newTitle: Title object of the new location
  1943. $status: Status object to pass error messages to
  1944. 'NamespaceIsMovable': Called when determining if it is possible to pages in a
  1945. namespace.
  1946. $index: Integer; the index of the namespace being checked.
  1947. &$result: Boolean; whether MediaWiki currently thinks that pages in this
  1948. namespace are movable. Hooks may change this value to override the return
  1949. value of MWNamespace::isMovable().
  1950. 'NewDifferenceEngine': Called when a new DifferenceEngine object is made
  1951. $title: the diff page title (nullable)
  1952. &$oldId: the actual old Id to use in the diff
  1953. &$newId: the actual new Id to use in the diff (0 means current)
  1954. $old: the ?old= param value from the url
  1955. $new: the ?new= param value from the url
  1956. 'NewPagesLineEnding': Called before a NewPages line is finished.
  1957. $page: the SpecialNewPages object
  1958. &$ret: the HTML line
  1959. $row: the database row for this page (the recentchanges record and a few extras - see
  1960. NewPagesPager::getQueryInfo)
  1961. &$classes: the classes to add to the surrounding <li>
  1962. &$attribs: associative array of other HTML attributes for the <li> element.
  1963. Currently only data attributes reserved to MediaWiki are allowed
  1964. (see Sanitizer::isReservedDataAttribute).
  1965. 'NewRevisionFromEditComplete': Called when a revision was inserted due to an
  1966. edit.
  1967. $wikiPage: the WikiPage edited
  1968. $rev: the new revision
  1969. $baseID: the revision ID this was based off, if any
  1970. $user: the editing user
  1971. &$tags: tags to apply to the edit and recent change
  1972. 'OldChangesListRecentChangesLine': Customize entire recent changes line, or
  1973. return false to omit the line from RecentChanges and Watchlist special pages.
  1974. &$changeslist: The OldChangesList instance.
  1975. &$s: HTML of the form "<li>...</li>" containing one RC entry.
  1976. $rc: The RecentChange object.
  1977. &$classes: array of css classes for the <li> element.
  1978. &$attribs: associative array of other HTML attributes for the <li> element.
  1979. Currently only data attributes reserved to MediaWiki are allowed
  1980. (see Sanitizer::isReservedDataAttribute).
  1981. 'OpenSearchUrls': Called when constructing the OpenSearch description XML. Hooks
  1982. can alter or append to the array of URLs for search & suggestion formats.
  1983. &$urls: array of associative arrays with Url element attributes
  1984. 'OpportunisticLinksUpdate': Called by WikiPage::triggerOpportunisticLinksUpdate
  1985. when a page view triggers a re-rendering of the page. This may happen
  1986. particularly if the parser cache is split by user language, and no cached
  1987. rendering of the page exists in the user's language. The hook is called
  1988. before checking whether page_links_updated indicates that the links are up
  1989. to date. Returning false will cause triggerOpportunisticLinksUpdate() to abort
  1990. without triggering any updates.
  1991. $page: the Page that was rendered.
  1992. $title: the Title of the rendered page.
  1993. $parserOutput: ParserOutput resulting from rendering the page.
  1994. 'OtherAutoblockLogLink': Get links to the autoblock log from extensions which
  1995. autoblocks users and/or IP addresses too.
  1996. &$otherBlockLink: An array with links to other autoblock logs
  1997. 'OtherBlockLogLink': Get links to the block log from extensions which blocks
  1998. users and/or IP addresses too.
  1999. &$otherBlockLink: An array with links to other block logs
  2000. $ip: The requested IP address or username
  2001. 'OutputPageBeforeHTML': A page has been processed by the parser and the
  2002. resulting HTML is about to be displayed.
  2003. &$parserOutput: the parserOutput (object) that corresponds to the page
  2004. &$text: the text that will be displayed, in HTML (string)
  2005. 'OutputPageBodyAttributes': Called when OutputPage::headElement is creating the
  2006. body tag to allow for extensions to add attributes to the body of the page they
  2007. might need. Or to allow building extensions to add body classes that aren't of
  2008. high enough demand to be included in core.
  2009. $out: The OutputPage which called the hook, can be used to get the real title
  2010. $sk: The Skin that called OutputPage::headElement
  2011. &$bodyAttrs: An array of attributes for the body tag passed to Html::openElement
  2012. 'OutputPageCheckLastModified': when checking if the page has been modified
  2013. since the last visit.
  2014. &$modifiedTimes: array of timestamps.
  2015. The following keys are set: page, user, epoch
  2016. $out: OutputPage object (since 1.28)
  2017. 'OutputPageMakeCategoryLinks': Links are about to be generated for the page's
  2018. categories. Implementations should return false if they generate the category
  2019. links, so the default link generation is skipped.
  2020. &$out: OutputPage instance (object)
  2021. $categories: associative array, keys are category names, values are category
  2022. types ("normal" or "hidden")
  2023. &$links: array, intended to hold the result. Must be an associative array with
  2024. category types as keys and arrays of HTML links as values.
  2025. 'OutputPageParserOutput': after adding a parserOutput to $wgOut
  2026. &$out: OutputPage instance (object)
  2027. $parserOutput: parserOutput instance being added in $out
  2028. 'PageContentInsertComplete': After a new article is created.
  2029. $wikiPage: WikiPage created
  2030. $user: User creating the article
  2031. $content: New content as a Content object
  2032. $summary: Edit summary/comment
  2033. $isMinor: Whether or not the edit was marked as minor
  2034. $isWatch: (No longer used)
  2035. $section: (No longer used)
  2036. $flags: Flags passed to WikiPage::doEditContent()
  2037. $revision: New Revision of the article
  2038. 'PageContentLanguage': Allows changing the language in which the content of a
  2039. page is written. Defaults to the wiki content language ($wgContLang).
  2040. $title: Title object
  2041. &$pageLang: the page content language (either an object or a language code)
  2042. $wgLang: the user language
  2043. 'PageContentSave': Before an article is saved.
  2044. $wikiPage: the WikiPage (object) being saved
  2045. $user: the user (object) saving the article
  2046. $content: the new article content, as a Content object
  2047. $summary: the article summary (comment)
  2048. $isminor: minor flag
  2049. $iswatch: watch flag
  2050. $section: section #
  2051. 'PageContentSaveComplete': After an article has been updated.
  2052. $wikiPage: WikiPage modified
  2053. $user: User performing the modification
  2054. $content: New content, as a Content object
  2055. $summary: Edit summary/comment
  2056. $isMinor: Whether or not the edit was marked as minor
  2057. $isWatch: (No longer used)
  2058. $section: (No longer used)
  2059. $flags: Flags passed to WikiPage::doEditContent()
  2060. $revision: New Revision of the article (can be null for edits that change
  2061. nothing)
  2062. $status: Status object about to be returned by doEditContent()
  2063. $baseRevId: the rev ID (or false) this edit was based on
  2064. $undidRevId: the rev ID (or 0) this edit undid
  2065. 'PageHistoryBeforeList': When a history page list is about to be constructed.
  2066. &$article: the article that the history is loading for
  2067. $context: RequestContext object
  2068. 'PageHistoryLineEnding': Right before the end <li> is added to a history line.
  2069. $historyAction: the action object
  2070. &$row: the revision row for this line
  2071. &$s: the string representing this parsed line
  2072. &$classes: array containing the <li> element classes
  2073. &$attribs: associative array of other HTML attributes for the <li> element.
  2074. Currently only data attributes reserved to MediaWiki are allowed
  2075. (see Sanitizer::isReservedDataAttribute).
  2076. 'PageHistoryPager::doBatchLookups': Called after the pager query was run, before
  2077. any output is generated, to allow batch lookups for prefetching information
  2078. needed for display. If the hook handler returns false, the regular behavior of
  2079. doBatchLookups() is skipped.
  2080. $pager: the PageHistoryPager
  2081. $result: a ResultWrapper representing the query result
  2082. 'PageHistoryPager::getQueryInfo': when a history pager query parameter set is
  2083. constructed.
  2084. &$pager: the pager
  2085. &$queryInfo: the query parameters
  2086. 'PageRenderingHash': NOTE: Consider using ParserOptionsRegister instead.
  2087. Alter the parser cache option hash key. A parser extension
  2088. which depends on user options should install this hook and append its values to
  2089. the key.
  2090. &$confstr: reference to a hash key string which can be modified
  2091. $user: User (object) requesting the page
  2092. &$forOptions: array of options the hash is for
  2093. 'PageViewUpdates': Allow database (or other) changes to be made after a
  2094. page view is seen by MediaWiki. Note this does not capture views made
  2095. via external caches such as Squid.
  2096. $wikipage: WikiPage (object) for the page being viewed.
  2097. $user: User (object) for the user who is viewing.
  2098. 'ParserAfterParse': Called from Parser::parse() just after the call to
  2099. Parser::internalParse() returns.
  2100. &$parser: parser object
  2101. &$text: text being parsed
  2102. &$stripState: stripState used (object)
  2103. 'ParserAfterStrip': Called at end of parsing time.
  2104. TODO: No more strip, deprecated ?
  2105. &$parser: parser object
  2106. &$text: text being parsed
  2107. &$stripState: stripState used (object)
  2108. 'ParserAfterTidy': Called after Parser::tidy() in Parser::parse()
  2109. &$parser: Parser object being used
  2110. &$text: text that will be returned
  2111. 'ParserAfterUnstrip': Called after the first unstripGeneral() in
  2112. Parser::internalParseHalfParsed()
  2113. &$parser: Parser object being used
  2114. &$text: text that will be returned
  2115. 'ParserBeforeInternalParse': Called at the beginning of Parser::internalParse().
  2116. &$parser: Parser object
  2117. &$text: text to parse
  2118. &$stripState: StripState instance being used
  2119. 'ParserBeforeStrip': Called at start of parsing time.
  2120. TODO: No more strip, deprecated ?
  2121. &$parser: parser object
  2122. &$text: text being parsed
  2123. &$stripState: stripState used (object)
  2124. 'ParserBeforeTidy': Called before tidy and custom tags replacements.
  2125. &$parser: Parser object being used
  2126. &$text: actual text
  2127. 'ParserCacheSaveComplete': Called after a ParserOutput has been committed to
  2128. the parser cache.
  2129. $parserCache: ParserCache object $parserOutput was stored in
  2130. $parserOutput: ParserOutput object that was stored
  2131. $title: Title of the page that was parsed to generate $parserOutput
  2132. $popts: ParserOptions used for generating $parserOutput
  2133. $revId: ID of the revision that was parsed to create $parserOutput
  2134. 'ParserClearState': Called at the end of Parser::clearState().
  2135. &$parser: Parser object being cleared
  2136. 'ParserCloned': Called when the parser is cloned.
  2137. $parser: Newly-cloned Parser object
  2138. 'ParserFetchTemplate': Called when the parser fetches a template
  2139. $parser: Parser Parser object or false
  2140. $title: Title object of the template to be fetched
  2141. $rev: Revision object of the template
  2142. &$text: Transclusion text of the template or false or null
  2143. &$deps: Array of template dependencies with 'title', 'page_id', 'rev_id' keys
  2144. 'ParserFirstCallInit': Called when the parser initialises for the first time.
  2145. &$parser: Parser object being cleared
  2146. 'ParserGetVariableValueSwitch': Called when the parser need the value of a
  2147. custom magic word
  2148. &$parser: Parser object
  2149. &$varCache: array to store the value in case of multiples calls of the
  2150. same magic word
  2151. &$index: index (string) of the magic
  2152. &$ret: value of the magic word (the hook should set it)
  2153. &$frame: PPFrame object to use for expanding any template variables
  2154. 'ParserGetVariableValueTs': Use this to change the value of the time for the
  2155. {{LOCAL...}} magic word.
  2156. &$parser: Parser object
  2157. &$time: actual time (timestamp)
  2158. 'ParserGetVariableValueVarCache': use this to change the value of the variable
  2159. cache or return false to not use it.
  2160. &$parser: Parser object
  2161. &$varCache: variable cache (array)
  2162. 'ParserLimitReport': DEPRECATED! Use ParserLimitReportPrepare and
  2163. ParserLimitReportFormat instead.
  2164. Called at the end of Parser:parse() when the parser will
  2165. include comments about size of the text parsed.
  2166. $parser: Parser object
  2167. &$limitReport: text that will be included (without comment tags)
  2168. 'ParserLimitReportFormat': Called for each row in the parser limit report that
  2169. needs formatting. If nothing handles this hook, the default is to use "$key" to
  2170. get the label, and "$key-value" or "$key-value-text"/"$key-value-html" to
  2171. format the value.
  2172. $key: Key for the limit report item (string)
  2173. &$value: Value of the limit report item
  2174. &$report: String onto which to append the data
  2175. $isHTML: If true, $report is an HTML table with two columns; if false, it's
  2176. text intended for display in a monospaced font.
  2177. $localize: If false, $report should be output in English.
  2178. 'ParserLimitReportPrepare': Called at the end of Parser:parse() when the parser
  2179. will include comments about size of the text parsed. Hooks should use
  2180. $output->setLimitReportData() to populate data. Functions for this hook should
  2181. not use $wgLang; do that in ParserLimitReportFormat instead.
  2182. $parser: Parser object
  2183. $output: ParserOutput object
  2184. 'ParserMakeImageParams': Called before the parser make an image link, use this
  2185. to modify the parameters of the image.
  2186. $title: title object representing the file
  2187. $file: file object that will be used to create the image
  2188. &$params: 2-D array of parameters
  2189. $parser: Parser object that called the hook
  2190. 'ParserOptionsRegister': Register additional parser options. Note that if you
  2191. change the default value for an option, all existing parser cache entries will
  2192. be invalid. To avoid bugs, you'll need to handle that somehow (e.g. with the
  2193. RejectParserCacheValue hook) because MediaWiki won't do it for you.
  2194. &$defaults: Set the default value for your option here.
  2195. &$inCacheKey: To fragment the parser cache on your option, set a truthy value here.
  2196. &$lazyLoad: To lazy-initialize your option, set it null in $defaults and set a
  2197. callable here. The callable is passed the ParserOptions object and the option
  2198. name.
  2199. 'ParserOutputPostCacheTransform': Called from ParserOutput::getText() to do
  2200. post-cache transforms.
  2201. $parserOutput: The ParserOutput object.
  2202. &$text: The text being transformed, before core transformations are done.
  2203. &$options: The options array being used for the transformation.
  2204. 'ParserSectionCreate': Called each time the parser creates a document section
  2205. from wikitext. Use this to apply per-section modifications to HTML (like
  2206. wrapping the section in a DIV). Caveat: DIVs are valid wikitext, and a DIV
  2207. can begin in one section and end in another. Make sure your code can handle
  2208. that case gracefully. See the EditSectionClearerLink extension for an example.
  2209. $parser: the calling Parser instance
  2210. $section: the section number, zero-based, but section 0 is usually empty
  2211. &$sectionContent: ref to the content of the section. modify this.
  2212. $showEditLinks: boolean describing whether this section has an edit link
  2213. 'ParserTestGlobals': Allows to define globals for parser tests.
  2214. &$globals: Array with all the globals which should be set for parser tests.
  2215. The arrays keys serve as the globals names, its values are the globals values.
  2216. 'ParserTestTables': Alter the list of tables to duplicate when parser tests are
  2217. run. Use when page save hooks require the presence of custom tables to ensure
  2218. that tests continue to run properly.
  2219. &$tables: array of table names
  2220. 'ParserOutputStashForEdit': Called when an edit stash parse finishes, before the output is cached.
  2221. $page: the WikiPage of the candidate edit
  2222. $content: the Content object of the candidate edit
  2223. $output: the ParserOutput result of the candidate edit
  2224. $summary: the change summary of the candidate edit
  2225. $user: the User considering the edit
  2226. 'PasswordPoliciesForUser': Alter the effective password policy for a user.
  2227. $user: User object whose policy you are modifying
  2228. &$effectivePolicy: Array of policy statements that apply to this user
  2229. 'PerformRetroactiveAutoblock': Called before a retroactive autoblock is applied
  2230. to a user.
  2231. $block: Block object (which is set to be autoblocking)
  2232. &$blockIds: Array of block IDs of the autoblock
  2233. 'PersonalUrls': Alter the user-specific navigation links (e.g. "my page,
  2234. my talk page, my contributions" etc).
  2235. &$personal_urls: Array of link specifiers (see SkinTemplate.php)
  2236. &$title: Title object representing the current page
  2237. $skin: SkinTemplate object providing context (e.g. to check if the user is
  2238. logged in, etc.)
  2239. 'PingLimiter': Allows extensions to override the results of User::pingLimiter().
  2240. &$user: User performing the action
  2241. $action: Action being performed
  2242. &$result: Whether or not the action should be prevented
  2243. Change $result and return false to give a definitive answer, otherwise
  2244. the built-in rate limiting checks are used, if enabled.
  2245. $incrBy: Amount to increment counter by
  2246. 'PlaceNewSection': Override placement of new sections. Return false and put the
  2247. merged text into $text to override the default behavior.
  2248. $wikipage: WikiPage object
  2249. $oldtext: the text of the article before editing
  2250. $subject: subject of the new section
  2251. &$text: text of the new section
  2252. 'PostLoginRedirect': Modify the post login redirect behavior.
  2253. Occurs after signing up or logging in, allows for interception of redirect.
  2254. &$returnTo: The page name to return to, as a string
  2255. &$returnToQuery: array of url parameters, mapping parameter names to values
  2256. &$type: type of login redirect as string;
  2257. error: display a return to link ignoring $wgRedirectOnLogin
  2258. signup: display a return to link using $wgRedirectOnLogin if needed
  2259. success: display a return to link using $wgRedirectOnLogin if needed
  2260. successredirect: send an HTTP redirect using $wgRedirectOnLogin if needed
  2261. 'PreferencesFormPreSave': Override preferences being saved
  2262. $formData: array of user submitted data
  2263. $form: PreferencesForm object, also a ContextSource
  2264. $user: User object with preferences to be saved set
  2265. &$result: boolean indicating success
  2266. $oldUserOptions: array with user old options (before save)
  2267. 'PreferencesGetLegend': Override the text used for the <legend> of a
  2268. preferences section.
  2269. $form: the PreferencesForm object. This is a ContextSource as well
  2270. $key: the section name
  2271. &$legend: the legend text. Defaults to wfMessage( "prefs-$key" )->text() but may
  2272. be overridden
  2273. 'PrefixSearchBackend': DEPRECATED! Override SearchEngine::completionSearchBackend instead.
  2274. Override the title prefix search used for OpenSearch and
  2275. AJAX search suggestions. Put results into &$results outparam and return false.
  2276. $ns: array of int namespace keys to search in
  2277. $search: search term (not guaranteed to be conveniently normalized)
  2278. $limit: maximum number of results to return
  2279. &$results: out param: array of page names (strings)
  2280. $offset: number of results to offset from the beginning
  2281. 'PrefixSearchExtractNamespace': Called if core was not able to extract a
  2282. namespace from the search string so that extensions can attempt it.
  2283. &$namespaces: array of int namespace keys to search in (change this if you can
  2284. extract namespaces)
  2285. &$search: search term (replace this with term without the namespace if you can
  2286. extract one)
  2287. 'PrefsEmailAudit': Called when user changes their email address.
  2288. $user: User (object) changing his email address
  2289. $oldaddr: old email address (string)
  2290. $newaddr: new email address (string)
  2291. 'ProtectionForm::buildForm': Called after all protection type fieldsets are made
  2292. in the form.
  2293. $article: the title being (un)protected
  2294. &$output: a string of the form HTML so far
  2295. 'ProtectionForm::save': Called when a protection form is submitted.
  2296. $article: the Page being (un)protected
  2297. &$errorMsg: an html message string of an error or an array of message name and
  2298. its parameters
  2299. $reasonstr: a string describing the reason page protection level is altered
  2300. 'ProtectionForm::showLogExtract': Called after the protection log extract is
  2301. shown.
  2302. $article: the page the form is shown for
  2303. $out: OutputPage object
  2304. 'RandomPageQuery': Lets you modify the query used by Special:Random to select
  2305. random pages.
  2306. &$tables: Database tables to be used in the query
  2307. &$conds: Conditions to be applied in the query
  2308. &$joinConds: Join conditions to be applied in the query
  2309. 'RawPageViewBeforeOutput': Right before the text is blown out in action=raw.
  2310. &$obj: RawAction object
  2311. &$text: The text that's going to be the output
  2312. 'RecentChange_save': Called at the end of RecentChange::save().
  2313. &$recentChange: RecentChange object
  2314. 'RecentChangesPurgeRows': Called when old recentchanges rows are purged, after
  2315. deleting those rows but within the same transaction.
  2316. $rows: The deleted rows as an array of recentchanges row objects (with up to
  2317. $wgUpdateRowsPerQuery items).
  2318. 'RedirectSpecialArticleRedirectParams': Lets you alter the set of parameter
  2319. names such as "oldid" that are preserved when using redirecting special pages
  2320. such as Special:MyPage and Special:MyTalk.
  2321. &$redirectParams: An array of parameters preserved by redirecting special pages.
  2322. 'RejectParserCacheValue': Return false to reject an otherwise usable
  2323. cached value from the Parser cache. NOTE: CARELESS USE OF THIS HOOK CAN
  2324. HAVE CATASTROPHIC CONSEQUENCES FOR HIGH-TRAFFIC INSTALLATIONS. USE WITH
  2325. EXTREME CARE.
  2326. $parserOutput: ParserOutput value.
  2327. $wikiPage: WikiPage object.
  2328. $parserOptions: ParserOptions object.
  2329. 'RequestContextCreateSkin': Called when RequestContext::getSkin creates a skin
  2330. instance. Can be used by an extension override what skin is used in certain
  2331. contexts.
  2332. $context: (IContextSource) The RequestContext the skin is being created for.
  2333. &$skin: A variable reference you may set a Skin instance or string key on to
  2334. override the skin that will be used for the context.
  2335. 'RequestHasSameOriginSecurity': Called to determine if the request is somehow
  2336. flagged to lack same-origin security. Return false to indicate the lack. Note
  2337. if the "somehow" involves HTTP headers, you'll probably need to make sure
  2338. the header is varied on.
  2339. $request: The WebRequest object.
  2340. 'ResetPasswordExpiration': Allow extensions to set a default password expiration
  2341. $user: The user having their password expiration reset
  2342. &$newExpire: The new expiration date
  2343. 'ResourceLoaderForeignApiModules': Called from ResourceLoaderForeignApiModule.
  2344. Use this to add dependencies to 'mediawiki.ForeignApi' module when you wish
  2345. to override its behavior. See the module docs for more information.
  2346. &$dependencies: string[] List of modules that 'mediawiki.ForeignApi' should
  2347. depend on
  2348. $context: ResourceLoaderContext|null
  2349. 'ResourceLoaderGetConfigVars': Called at the end of
  2350. ResourceLoaderStartUpModule::getConfigSettings(). Use this to export static
  2351. configuration variables to JavaScript. Things that depend on the current page
  2352. or request state must be added through MakeGlobalVariablesScript instead.
  2353. &$vars: array( variable name => value )
  2354. 'ResourceLoaderJqueryMsgModuleMagicWords': Called in
  2355. ResourceLoaderJqueryMsgModule to allow adding magic words for jQueryMsg.
  2356. The value should be a string, and they can depend only on the
  2357. ResourceLoaderContext.
  2358. $context: ResourceLoaderContext
  2359. &$magicWords: Associative array mapping all-caps magic word to a string value
  2360. 'ResourceLoaderRegisterModules': Right before modules information is required,
  2361. such as when responding to a resource
  2362. loader request or generating HTML output.
  2363. &$resourceLoader: ResourceLoader object
  2364. 'ResourceLoaderTestModules': Let you add new JavaScript testing modules. This is
  2365. called after the addition of 'qunit' and MediaWiki testing resources.
  2366. &$testModules: array of JavaScript testing modules. The 'qunit' framework,
  2367. included in core, is fed using tests/qunit/QUnitTestResources.php.
  2368. To add a new qunit module named 'myext.tests':
  2369. $testModules['qunit']['myext.tests'] = array(
  2370. 'script' => 'extension/myext/tests.js',
  2371. 'dependencies' => <any module dependency you might have>
  2372. );
  2373. For QUnit framework, the mediawiki.tests.qunit.testrunner dependency will be
  2374. added to any module.
  2375. &$ResourceLoader: object
  2376. 'RevisionRecordInserted': Called after a revision is inserted into the database.
  2377. $revisionRecord: the RevisionRecord that has just been inserted.
  2378. 'RevisionInsertComplete': DEPRECATED! Use RevisionRecordInserted hook instead.
  2379. Called after a revision is inserted into the database.
  2380. $revision: the Revision
  2381. $data: DEPRECATED! Always null!
  2382. $flags: DEPRECATED! Always null!
  2383. 'SearchableNamespaces': An option to modify which namespaces are searchable.
  2384. &$arr: Array of namespaces ($nsId => $name) which will be used.
  2385. 'SearchAfterNoDirectMatch': If there was no match for the exact result. This
  2386. runs before lettercase variants are attempted, whereas 'SearchGetNearMatch'
  2387. runs after.
  2388. $term: Search term string
  2389. &$title: Outparam; set to $title object and return false for a match
  2390. 'SearchGetNearMatch': An extra chance for exact-title-matches in "go" searches
  2391. if nothing was found.
  2392. $term: Search term string
  2393. &$title: Outparam; set to $title object and return false for a match
  2394. 'SearchGetNearMatchBefore': Perform exact-title-matches in "go" searches before
  2395. the normal operations.
  2396. $allSearchTerms: Array of the search terms in all content languages
  2397. &$titleResult: Outparam; the value to return. A Title object or null.
  2398. 'SearchGetNearMatchComplete': A chance to modify exact-title-matches in "go"
  2399. searches.
  2400. $term: Search term string
  2401. &$title: Current Title object that is being returned (null if none found).
  2402. 'SearchResultInitFromTitle': Set the revision used when displaying a page in
  2403. search results.
  2404. $title: Current Title object being displayed in search results.
  2405. &$id: Revision ID (default is false, for latest)
  2406. 'SearchIndexFields': Add fields to search index mapping.
  2407. &$fields: Array of fields, all implement SearchIndexField
  2408. $engine: SearchEngine instance for which mapping is being built.
  2409. 'SearchDataForIndex': Add data to search document. Allows to add any data to
  2410. the field map used to index the document.
  2411. &$fields: Array of name => value pairs for fields
  2412. $handler: ContentHandler for the content being indexed
  2413. $page: WikiPage that is being indexed
  2414. $output: ParserOutput that is produced from the page
  2415. $engine: SearchEngine for which the indexing is intended
  2416. 'SearchResultsAugment': Allows extension to add its code to the list of search
  2417. result augmentors.
  2418. &$setAugmentors: List of whole-set augmentor objects, must implement ResultSetAugmentor
  2419. &$rowAugmentors: List of per-row augmentor objects, must implement ResultAugmentor.
  2420. Note that lists should be in the format name => object and the names in both lists should
  2421. be distinct.
  2422. 'SecondaryDataUpdates': Allows modification of the list of DataUpdates to
  2423. perform when page content is modified. Currently called by
  2424. AbstractContent::getSecondaryDataUpdates.
  2425. $title: Title of the page that is being edited.
  2426. $oldContent: Content object representing the page's content before the edit.
  2427. $recursive: bool indicating whether DataUpdates should trigger recursive
  2428. updates (relevant mostly for LinksUpdate).
  2429. $parserOutput: ParserOutput representing the rendered version of the page
  2430. after the edit.
  2431. &$updates: a list of DataUpdate objects, to be modified or replaced by
  2432. the hook handler.
  2433. 'SecuritySensitiveOperationStatus': Affect the return value from
  2434. MediaWiki\Auth\AuthManager::securitySensitiveOperationStatus().
  2435. &$status: (string) The status to be returned. One of the AuthManager::SEC_*
  2436. constants. SEC_REAUTH will be automatically changed to SEC_FAIL if
  2437. authentication isn't possible for the current session type.
  2438. $operation: (string) The operation being checked.
  2439. $session: (MediaWiki\Session\Session) The current session. The
  2440. currently-authenticated user may be retrieved as $session->getUser().
  2441. $timeSinceAuth: (int) The time since last authentication. PHP_INT_MAX if
  2442. the time of last auth is unknown, or -1 if authentication is not possible.
  2443. 'SelfLinkBegin': Called before a link to the current article is displayed to
  2444. allow the display of the link to be customized.
  2445. $nt: the Title object
  2446. &$html: html to display for the link
  2447. &$trail: optional text to display before $html
  2448. &$prefix: optional text to display after $html
  2449. &$ret: the value to return if your hook returns false
  2450. 'SendWatchlistEmailNotification': Return true to send watchlist email
  2451. notification
  2452. $targetUser: the user whom to send watchlist email notification
  2453. $title: the page title
  2454. $enotif: EmailNotification object
  2455. 'SessionCheckInfo': Validate a MediaWiki\Session\SessionInfo as it's being
  2456. loaded from storage. Return false to prevent it from being used.
  2457. &$reason: String rejection reason to be logged
  2458. $info: MediaWiki\Session\SessionInfo being validated
  2459. $request: WebRequest being loaded from
  2460. $metadata: Array|false Metadata array for the MediaWiki\Session\Session
  2461. $data: Array|false Data array for the MediaWiki\Session\Session
  2462. 'SessionMetadata': Add metadata to a session being saved.
  2463. $backend: MediaWiki\Session\SessionBackend being saved.
  2464. &$metadata: Array Metadata to be stored. Add new keys here.
  2465. $requests: Array of WebRequests potentially being saved to. Generally 0-1 real
  2466. request and 0+ FauxRequests.
  2467. 'SetupAfterCache': Called in Setup.php, after cache objects are set
  2468. 'ShortPagesQuery': Allow extensions to modify the query used by
  2469. Special:ShortPages.
  2470. &$tables: tables to join in the query
  2471. &$conds: conditions for the query
  2472. &$joinConds: join conditions for the query
  2473. &$options: options for the query
  2474. 'ShowMissingArticle': Called when generating the output for a non-existent page.
  2475. $article: The article object corresponding to the page
  2476. 'ShowSearchHit': Customize display of search hit.
  2477. $searchPage: The SpecialSearch instance.
  2478. $result: The SearchResult to show
  2479. $terms: Search terms, for highlighting
  2480. &$link: HTML of link to the matching page. May be modified.
  2481. &$redirect: HTML of redirect info. May be modified.
  2482. &$section: HTML of matching section. May be modified.
  2483. &$extract: HTML of content extract. May be modified.
  2484. &$score: HTML of score. May be modified.
  2485. &$size: HTML of page size. May be modified.
  2486. &$date: HTML of of page modification date. May be modified.
  2487. &$related: HTML of additional info for the matching page. May be modified.
  2488. &$html: May be set to the full HTML that should be used to represent the search
  2489. hit. Must include the <li> ... </li> tags. Will only be used if the hook
  2490. function returned false.
  2491. 'ShowSearchHitTitle': Customise display of search hit title/link.
  2492. &$title: Title to link to
  2493. &$titleSnippet: Label for the link representing the search result. Typically the article title.
  2494. $result: The SearchResult object
  2495. $terms: String of the search terms entered
  2496. $specialSearch: The SpecialSearch object
  2497. &$query: Array of query string parameters for the link representing the search result.
  2498. &$attributes: Array of title link attributes, can be modified by extension.
  2499. 'SidebarBeforeOutput': Allows to edit sidebar just before it is output by skins.
  2500. Warning: This hook is run on each display. You should consider to use
  2501. 'SkinBuildSidebar' that is aggressively cached.
  2502. $skin: Skin object
  2503. &$bar: Sidebar content
  2504. Modify $bar to add or modify sidebar portlets.
  2505. 'SiteNoticeAfter': After the sitenotice/anonnotice is composed.
  2506. &$siteNotice: HTML sitenotice. Alter the contents of $siteNotice to add to/alter
  2507. the sitenotice/anonnotice.
  2508. $skin: Skin object
  2509. 'SiteNoticeBefore': Before the sitenotice/anonnotice is composed. Return true to
  2510. allow the normal method of notice selection/rendering to work, or change the
  2511. value of $siteNotice and return false to alter it.
  2512. &$siteNotice: HTML returned as the sitenotice
  2513. $skin: Skin object
  2514. 'SkinAfterBottomScripts': At the end of Skin::bottomScripts().
  2515. $skin: Skin object
  2516. &$text: bottomScripts Text. Append to $text to add additional text/scripts after
  2517. the stock bottom scripts.
  2518. 'SkinAfterContent': Allows extensions to add text after the page content and
  2519. article metadata. This hook should work in all skins. Set the &$data variable to
  2520. the text you're going to add.
  2521. &$data: (string) Text to be printed out directly (without parsing)
  2522. $skin: Skin object
  2523. 'SkinBuildSidebar': At the end of Skin::buildSidebar().
  2524. $skin: Skin object
  2525. &$bar: Sidebar contents
  2526. Modify $bar to add or modify sidebar portlets.
  2527. 'SkinCopyrightFooter': Allow for site and per-namespace customization of
  2528. copyright notice.
  2529. $title: displayed page title
  2530. $type: 'normal' or 'history' for old/diff views
  2531. &$msg: overridable message; usually 'copyright' or 'history_copyright'. This
  2532. message must be in HTML format, not wikitext!
  2533. &$link: overridable HTML link to be passed into the message as $1
  2534. &$forContent: DEPRECATED! overridable flag if copyright footer is shown in
  2535. content language.
  2536. 'SkinEditSectionLinks': Modify the section edit links
  2537. $skin: Skin object rendering the UI
  2538. $title: Title object for the title being linked to (may not be the same as
  2539. the page title, if the section is included from a template)
  2540. $section: The designation of the section being pointed to, to be included in
  2541. the link, like "&section=$section"
  2542. $tooltip: The default tooltip. Escape before using.
  2543. By default, this is wrapped in the 'editsectionhint' message.
  2544. &$result: Array containing all link detail arrays. Each link detail array should
  2545. contain the following keys:
  2546. - targetTitle - Target Title object
  2547. - text - String for the text
  2548. - attribs - Array of attributes
  2549. - query - Array of query parameters to add to the URL
  2550. - options - Array of options for Linker::link
  2551. $lang: The language code to use for the link in the wfMessage function
  2552. 'SkinGetPoweredBy': TODO
  2553. &$text: additional 'powered by' icons in HTML. Note: Modern skin does not use
  2554. the MediaWiki icon but plain text instead.
  2555. $skin: Skin object
  2556. 'SkinPreloadExistence': Supply titles that should be added to link existence
  2557. cache before the page is rendered.
  2558. &$titles: Array of Title objects
  2559. $skin: Skin object
  2560. 'SkinSubPageSubtitle': At the beginning of Skin::subPageSubtitle().
  2561. If false is returned $subpages will be used instead of the HTML
  2562. subPageSubtitle() generates.
  2563. If true is returned, $subpages will be ignored and the rest of
  2564. subPageSubtitle() will run.
  2565. &$subpages: Subpage links HTML
  2566. $skin: Skin object
  2567. $out: OutputPage object
  2568. 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink': After creating the "permanent
  2569. link" tab.
  2570. &$sktemplate: SkinTemplate object
  2571. &$nav_urls: array of tabs
  2572. &$revid: The revision id of the permanent link
  2573. &$revid2: The revision id of the permanent link, second time
  2574. 'SkinTemplateGetLanguageLink': After building the data for a language link from
  2575. which the actual html is constructed.
  2576. &$languageLink: array containing data about the link. The following keys can be
  2577. modified: href, text, title, class, lang, hreflang. Each of them is a string.
  2578. $languageLinkTitle: Title object belonging to the external language link.
  2579. $title: Title object of the page the link belongs to.
  2580. $outputPage: The OutputPage object the links are built from.
  2581. 'SkinTemplateNavigation': Called on content pages after the tabs have been
  2582. added, but before variants have been added.
  2583. &$sktemplate: SkinTemplate object
  2584. &$links: Structured navigation links. This is used to alter the navigation for
  2585. skins which use buildNavigationUrls such as Vector.
  2586. 'SkinTemplateNavigation::SpecialPage': Called on special pages after the special
  2587. tab is added but before variants have been added.
  2588. &$sktemplate: SkinTemplate object
  2589. &$links: Structured navigation links. This is used to alter the navigation for
  2590. skins which use buildNavigationUrls such as Vector.
  2591. 'SkinTemplateNavigation::Universal': Called on both content and special pages
  2592. after variants have been added.
  2593. &$sktemplate: SkinTemplate object
  2594. &$links: Structured navigation links. This is used to alter the navigation for
  2595. skins which use buildNavigationUrls such as Vector.
  2596. 'SkinTemplateOutputPageBeforeExec': Before SkinTemplate::outputPage() starts
  2597. page output.
  2598. &$sktemplate: SkinTemplate object
  2599. &$tpl: QuickTemplate engine object
  2600. 'SkinTemplatePreventOtherActiveTabs': Use this to prevent showing active tabs.
  2601. &$sktemplate: SkinTemplate object
  2602. &$res: set to true to prevent active tabs
  2603. 'SkinTemplateTabAction': Override SkinTemplate::tabAction().
  2604. You can either create your own array, or alter the parameters for
  2605. the normal one.
  2606. &$sktemplate: The SkinTemplate instance.
  2607. $title: Title instance for the page.
  2608. $message: Visible label of tab.
  2609. $selected: Whether this is a selected tab.
  2610. $checkEdit: Whether or not the action=edit query should be added if appropriate.
  2611. &$classes: Array of CSS classes to apply.
  2612. &$query: Query string to add to link.
  2613. &$text: Link text.
  2614. &$result: Complete assoc. array if you want to return true.
  2615. 'SkinTemplateToolboxEnd': Called by SkinTemplate skins after toolbox links have
  2616. been rendered (useful for adding more).
  2617. &$sk: The QuickTemplate based skin template running the hook.
  2618. $dummy: Called when SkinTemplateToolboxEnd is used from a BaseTemplate skin,
  2619. extensions that add support for BaseTemplateToolbox should watch for this
  2620. dummy parameter with "$dummy=false" in their code and return without echoing
  2621. any HTML to avoid creating duplicate toolbox items.
  2622. 'SoftwareInfo': Called by Special:Version for returning information about the
  2623. software.
  2624. &$software: The array of software in format 'name' => 'version'. See
  2625. SpecialVersion::softwareInformation().
  2626. 'SpecialBlockModifyFormFields': Add more fields to Special:Block
  2627. $sp: SpecialPage object, for context
  2628. &$fields: Current HTMLForm fields
  2629. 'SpecialContributionsBeforeMainOutput': Before the form on Special:Contributions
  2630. $id: User id number, only provided for backwards-compatibility
  2631. $user: User object representing user contributions are being fetched for
  2632. $sp: SpecialPage instance, providing context
  2633. 'SpecialContributions::formatRow::flags': Called before rendering a
  2634. Special:Contributions row.
  2635. $context: IContextSource object
  2636. $row: Revision information from the database
  2637. &$flags: List of flags on this row
  2638. 'SpecialContributions::getForm::filters': Called with a list of filters to render
  2639. on Special:Contributions.
  2640. $sp: SpecialContributions object, for context
  2641. &$filters: List of filters rendered as HTML
  2642. 'SpecialListusersDefaultQuery': Called right before the end of
  2643. UsersPager::getDefaultQuery().
  2644. $pager: The UsersPager instance
  2645. &$query: The query array to be returned
  2646. 'SpecialListusersFormatRow': Called right before the end of
  2647. UsersPager::formatRow().
  2648. &$item: HTML to be returned. Will be wrapped in <li></li> after the hook finishes
  2649. $row: Database row object
  2650. 'SpecialListusersHeader': Called after adding the submit button in
  2651. UsersPager::getPageHeader().
  2652. $pager: The UsersPager instance
  2653. &$out: The header HTML
  2654. 'SpecialListusersHeaderForm': Called before adding the submit button in
  2655. UsersPager::getPageHeader().
  2656. $pager: The UsersPager instance
  2657. &$out: The header HTML
  2658. 'SpecialListusersQueryInfo': Called right before the end of.
  2659. UsersPager::getQueryInfo()
  2660. $pager: The UsersPager instance
  2661. &$query: The query array to be returned
  2662. 'SpecialLogAddLogSearchRelations': Add log relations to the current log
  2663. $type: String of the log type
  2664. $request: WebRequest object for getting the value provided by the current user
  2665. &$qc: Array for query conditions to add
  2666. 'SpecialMovepageAfterMove': Called after moving a page.
  2667. &$movePage: MovePageForm object
  2668. &$oldTitle: old title (object)
  2669. &$newTitle: new title (object)
  2670. 'SpecialNewpagesConditions': Called when building sql query for
  2671. Special:NewPages.
  2672. &$special: NewPagesPager object (subclass of ReverseChronologicalPager)
  2673. $opts: FormOptions object containing special page options
  2674. &$conds: array of WHERE conditionals for query
  2675. &$tables: array of tables to be queried
  2676. &$fields: array of columns to select
  2677. &$join_conds: join conditions for the tables
  2678. 'SpecialNewPagesFilters': Called after building form options at NewPages.
  2679. $special: the special page object
  2680. &$filters: associative array of filter definitions. The keys are the HTML
  2681. name/URL parameters. Each key maps to an associative array with a 'msg'
  2682. (message key) and a 'default' value.
  2683. 'SpecialPage_initList': Called when setting up SpecialPageFactory::$list, use
  2684. this hook to remove a core special page or conditionally register special pages.
  2685. &$list: list (array) of core special pages
  2686. 'SpecialPageAfterExecute': Called after SpecialPage::execute.
  2687. $special: the SpecialPage object
  2688. $subPage: the subpage string or null if no subpage was specified
  2689. 'SpecialPageBeforeExecute': Called before SpecialPage::execute.
  2690. Return false to prevent execution.
  2691. $special: the SpecialPage object
  2692. $subPage: the subpage string or null if no subpage was specified
  2693. 'SpecialPageBeforeFormDisplay': Before executing the HTMLForm object.
  2694. $name: name of the special page
  2695. &$form: HTMLForm object
  2696. 'SpecialPasswordResetOnSubmit': When executing a form submission on
  2697. Special:PasswordReset.
  2698. &$users: array of User objects.
  2699. $data: array of data submitted by the user
  2700. &$error: string, error code (message key) used to describe to error (out
  2701. parameter). The hook needs to return false when setting this, otherwise it
  2702. will have no effect.
  2703. 'SpecialRandomGetRandomTitle': Called during the execution of Special:Random,
  2704. use this to change some selection criteria or substitute a different title.
  2705. &$randstr: The random number from wfRandom()
  2706. &$isRedir: Boolean, whether to select a redirect or non-redirect
  2707. &$namespaces: An array of namespace indexes to get the title from
  2708. &$extra: An array of extra SQL statements
  2709. &$title: If the hook returns false, a Title object to use instead of the
  2710. result from the normal query
  2711. 'SpecialRecentChangesFilters': DEPRECATED! Use ChangesListSpecialPageStructuredFilters
  2712. instead.
  2713. Called after building form options at RecentChanges.
  2714. $special: the special page object
  2715. &$filters: associative array of filter definitions. The keys are the HTML
  2716. name/URL parameters. Each key maps to an associative array with a 'msg'
  2717. (message key) and a 'default' value.
  2718. 'SpecialRecentChangesPanel': Called when building form options in
  2719. SpecialRecentChanges.
  2720. &$extraOpts: array of added items, to which can be added
  2721. $opts: FormOptions for this request
  2722. 'SpecialRecentChangesQuery': DEPRECATED! Use ChangesListSpecialPageStructuredFilters
  2723. or ChangesListSpecialPageQuery instead.
  2724. Called when building SQL query for SpecialRecentChanges and
  2725. SpecialRecentChangesLinked.
  2726. &$conds: array of WHERE conditionals for query
  2727. &$tables: array of tables to be queried
  2728. &$join_conds: join conditions for the tables
  2729. $opts: FormOptions for this request
  2730. &$query_options: array of options for the database request
  2731. &$select: Array of columns to select
  2732. 'SpecialResetTokensTokens': Called when building token list for
  2733. SpecialResetTokens.
  2734. &$tokens: array of token information arrays in the format of
  2735. array(
  2736. 'preference' => '<preference-name>',
  2737. 'label-message' => '<message-key>',
  2738. )
  2739. 'SpecialSearchCreateLink': Called when making the message to create a page or
  2740. go to the existing page.
  2741. $t: title object searched for
  2742. &$params: an array of the default message name and page title (as parameter)
  2743. 'SpecialSearchGoResult': If a hook returns false the 'go' feature will be
  2744. canceled and a normal search will be performed. Returning true without setting
  2745. $url does a standard redirect to $title. Setting $url redirects to the
  2746. specified URL.
  2747. $term: The string the user searched for
  2748. $title: The title the 'go' feature has decided to forward the user to
  2749. &$url: Initially null, hook subscribers can set this to specify the final url to redirect to
  2750. 'SpecialSearchNogomatch': Called when the 'Go' feature is triggered (generally
  2751. from autocomplete search other than the main bar on Special:Search) and the
  2752. target doesn't exist. Full text search results are generated after this hook is
  2753. called.
  2754. &$title: title object generated from the text entered by the user
  2755. 'SpecialSearchPowerBox': The equivalent of SpecialSearchProfileForm for
  2756. the advanced form, a.k.a. power search box.
  2757. &$showSections: an array to add values with more options to
  2758. $term: the search term (not a title object)
  2759. $opts: an array of hidden options (containing 'redirs' and 'profile')
  2760. 'SpecialSearchProfileForm': Allows modification of search profile forms.
  2761. $search: special page object
  2762. &$form: String: form html
  2763. $profile: String: current search profile
  2764. $term: String: search term
  2765. $opts: Array: key => value of hidden options for inclusion in custom forms
  2766. 'SpecialSearchProfiles': Allows modification of search profiles.
  2767. &$profiles: profiles, which can be modified.
  2768. 'SpecialSearchResults': Called before search result display
  2769. $term: string of search term
  2770. &$titleMatches: empty or SearchResultSet object
  2771. &$textMatches: empty or SearchResultSet object
  2772. 'SpecialSearchResultsPrepend': Called immediately before returning HTML
  2773. on the search results page. Useful for including an external search
  2774. provider. To disable the output of MediaWiki search output, return
  2775. false.
  2776. $specialSearch: SpecialSearch object ($this)
  2777. $output: $wgOut
  2778. $term: Search term specified by the user
  2779. 'SpecialSearchResultsAppend': Called immediately before returning HTML
  2780. on the search results page. Useful for including a feedback link.
  2781. $specialSearch: SpecialSearch object ($this)
  2782. $output: $wgOut
  2783. $term: Search term specified by the user
  2784. 'SpecialSearchSetupEngine': Allows passing custom data to search engine.
  2785. $search: SpecialSearch special page object
  2786. $profile: String: current search profile
  2787. $engine: the search engine
  2788. 'SpecialStatsAddExtra': Add extra statistic at the end of Special:Statistics.
  2789. &$extraStats: Array to save the new stats
  2790. $extraStats['<name of statistic>'] => <value>;
  2791. <value> can be an array with the keys "name" and "number":
  2792. "name" is the HTML to be displayed in the name column
  2793. "number" is the number to be displayed.
  2794. or, <value> can be the number to be displayed and <name> is the
  2795. message key to use in the name column,
  2796. $context: IContextSource object
  2797. 'SpecialTrackingCategories::preprocess': Called after LinkBatch on Special:TrackingCategories
  2798. $specialPage: The SpecialTrackingCategories object
  2799. $trackingCategories: Array of data from Special:TrackingCategories with msg and cats
  2800. 'SpecialTrackingCategories::generateCatLink': Called for each cat link on Special:TrackingCategories
  2801. $specialPage: The SpecialTrackingCategories object
  2802. $catTitle: The Title object of the linked category
  2803. &$html: The Result html
  2804. 'SpecialUploadComplete': Called after successfully uploading a file from
  2805. Special:Upload.
  2806. &$form: The SpecialUpload object
  2807. 'SpecialVersionVersionUrl': Called when building the URL for Special:Version.
  2808. $wgVersion: Current $wgVersion for you to use
  2809. &$versionUrl: Raw url to link to (eg: release notes)
  2810. 'SpecialWatchlistFilters': DEPRECATED! Use ChangesListSpecialPageStructuredFilters
  2811. instead.
  2812. Called after building form options at Watchlist.
  2813. $special: the special page object
  2814. &$filters: associative array of filter definitions. The keys are the HTML
  2815. name/URL parameters. Each key maps to an associative array with a 'msg'
  2816. (message key) and a 'default' value.
  2817. 'SpecialWatchlistGetNonRevisionTypes': Called when building sql query for
  2818. SpecialWatchlist. Allows extensions to register custom values they have
  2819. inserted to rc_type so they can be returned as part of the watchlist.
  2820. &$nonRevisionTypes: array of values in the rc_type field of recentchanges table
  2821. 'SpecialWatchlistQuery': DEPRECATED! Use ChangesListSpecialPageStructuredFilters
  2822. or ChangesListSpecialPageQuery instead.
  2823. Called when building sql query for SpecialWatchlist.
  2824. &$conds: array of WHERE conditionals for query
  2825. &$tables: array of tables to be queried
  2826. &$join_conds: join conditions for the tables
  2827. &$fields: array of query fields
  2828. $opts: A FormOptions object with watchlist options for the current request
  2829. 'TestCanonicalRedirect': Called when about to force a redirect to a canonical
  2830. URL for a title when we have no other parameters on the URL. Gives a chance for
  2831. extensions that alter page view behavior radically to abort that redirect or
  2832. handle it manually.
  2833. $request: WebRequest
  2834. $title: Title of the currently found title obj
  2835. $output: OutputPage object
  2836. 'ThumbnailBeforeProduceHTML': Called before an image HTML is about to be
  2837. rendered (by ThumbnailImage:toHtml method).
  2838. $thumbnail: the ThumbnailImage object
  2839. &$attribs: image attribute array
  2840. &$linkAttribs: image link attribute array
  2841. 'TitleArrayFromResult': Called when creating an TitleArray object from a
  2842. database result.
  2843. &$titleArray: set this to an object to override the default object returned
  2844. $res: database result used to create the object
  2845. 'TitleExists': Called when determining whether a page exists at a given title.
  2846. $title: The title being tested.
  2847. &$exists: Whether the title exists.
  2848. 'TitleGetEditNotices': Allows extensions to add edit notices
  2849. $title: The Title object for the page the edit notices are for
  2850. $oldid: Revision ID that the edit notices are for (or 0 for latest)
  2851. &$notices: Array of notices. Keys are i18n message keys, values are
  2852. parseAsBlock()ed messages.
  2853. 'TitleGetRestrictionTypes': Allows extensions to modify the types of protection
  2854. that can be applied.
  2855. $title: The title in question.
  2856. &$types: The types of protection available.
  2857. 'TitleIsAlwaysKnown': Called when determining if a page exists. Allows
  2858. overriding default behavior for determining if a page exists. If $isKnown is
  2859. kept as null, regular checks happen. If it's a boolean, this value is returned
  2860. by the isKnown method.
  2861. $title: Title object that is being checked
  2862. &$isKnown: Boolean|null; whether MediaWiki currently thinks this page is known
  2863. 'TitleIsMovable': Called when determining if it is possible to move a page. Note
  2864. that this hook is not called for interwiki pages or pages in immovable
  2865. namespaces: for these, isMovable() always returns false.
  2866. $title: Title object that is being checked
  2867. &$result: Boolean; whether MediaWiki currently thinks this page is movable.
  2868. Hooks may change this value to override the return value of
  2869. Title::isMovable().
  2870. 'TitleMove': Before moving an article (title).
  2871. $old: old title
  2872. $nt: new title
  2873. $user: user who does the move
  2874. 'TitleMoveStarting': Before moving an article (title), but just after the atomic DB section starts.
  2875. $old: old title
  2876. $nt: new title
  2877. $user: user who does the move
  2878. 'TitleMoveComplete': After moving an article (title), post-commit.
  2879. &$old: old title
  2880. &$nt: new title
  2881. &$user: user who did the move
  2882. $pageid: database ID of the page that's been moved
  2883. $redirid: database ID of the created redirect
  2884. $reason: reason for the move
  2885. $revision: the Revision created by the move
  2886. 'TitleMoveCompleting': After moving an article (title), pre-commit.
  2887. $old: old title
  2888. $nt: new title
  2889. $user: user who did the move
  2890. $pageid: database ID of the page that's been moved
  2891. $redirid: database ID of the created redirect
  2892. $reason: reason for the move
  2893. $revision: the Revision created by the move
  2894. 'TitleQuickPermissions': Called from Title::checkQuickPermissions to add to
  2895. or override the quick permissions check.
  2896. $title: The Title object being accessed
  2897. $user: The User performing the action
  2898. $action: Action being performed
  2899. &$errors: Array of errors
  2900. $doExpensiveQueries: Whether to do expensive DB queries
  2901. $short: Whether to return immediately on first error
  2902. 'TitleReadWhitelist': Called at the end of read permissions checks, just before
  2903. adding the default error message if nothing allows the user to read the page. If
  2904. a handler wants a title to *not* be whitelisted, it should also return false.
  2905. $title: Title object being checked against
  2906. $user: Current user object
  2907. &$whitelisted: Boolean value of whether this title is whitelisted
  2908. 'TitleSquidURLs': Called to determine which URLs to purge from HTTP caches.
  2909. $title: Title object to purge
  2910. &$urls: An array of URLs to purge from the caches, to be manipulated.
  2911. 'UnblockUser': Before an IP address or user is unblocked.
  2912. &$block: The Block object about to be saved
  2913. &$user: The user performing the unblock (not the one being unblocked)
  2914. &$reason: If the hook is aborted, the error message to be returned in an array
  2915. 'UnblockUserComplete': After an IP address or user has been unblocked.
  2916. $block: The Block object that was saved
  2917. $user: The user who performed the unblock (not the one being unblocked)
  2918. 'UndeleteForm::showHistory': Called in UndeleteForm::showHistory, after a
  2919. PageArchive object has been created but before any further processing is done.
  2920. &$archive: PageArchive object
  2921. $title: Title object of the page that we're viewing
  2922. 'UndeleteForm::showRevision': Called in UndeleteForm::showRevision, after a
  2923. PageArchive object has been created but before any further processing is done.
  2924. &$archive: PageArchive object
  2925. $title: Title object of the page that we're viewing
  2926. 'UndeleteForm::undelete': Called in UndeleteForm::undelete, after checking that
  2927. the site is not in read-only mode, that the Title object is not null and after
  2928. a PageArchive object has been constructed but before performing any further
  2929. processing.
  2930. &$archive: PageArchive object
  2931. $title: Title object of the page that we're about to undelete
  2932. 'UndeleteShowRevision': Called when showing a revision in Special:Undelete.
  2933. $title: title object related to the revision
  2934. $rev: revision (object) that will be viewed
  2935. 'UnitTestsAfterDatabaseSetup': Called right after MediaWiki's test infrastructure
  2936. has finished creating/duplicating core tables for unit tests.
  2937. $database: Database in question
  2938. $prefix: Table prefix to be used in unit tests
  2939. 'UnitTestsBeforeDatabaseTeardown': Called right before MediaWiki tears down its
  2940. database infrastructure used for unit tests.
  2941. 'UnitTestsList': Called when building a list of paths containing PHPUnit tests.
  2942. Since 1.24: Paths pointing to a directory will be recursively scanned for
  2943. test case files matching the suffix "Test.php".
  2944. &$paths: list of test cases and directories to search.
  2945. 'UnknownAction': DEPRECATED! To add an action in an extension,
  2946. create a subclass of Action, and add a new key to $wgActions.
  2947. An unknown "action" has occurred (useful for defining your own actions).
  2948. $action: action name
  2949. $article: article "acted on"
  2950. 'UnwatchArticle': Before a watch is removed from an article.
  2951. &$user: user watching
  2952. &$page: WikiPage object to be removed
  2953. &$status: Status object to be returned if the hook returns false
  2954. 'UnwatchArticleComplete': After a watch is removed from an article.
  2955. $user: user that watched
  2956. &$page: WikiPage object that was watched
  2957. 'UpdateUserMailerFormattedPageStatus': Before notification email gets sent.
  2958. &$formattedPageStatus: list of valid page states
  2959. 'UploadComplete': Upon completion of a file upload.
  2960. &$uploadBase: UploadBase (or subclass) object. File can be accessed by
  2961. $uploadBase->getLocalFile().
  2962. 'UploadCreateFromRequest': When UploadBase::createFromRequest has been called.
  2963. $type: (string) the requested upload type
  2964. &$className: the class name of the Upload instance to be created
  2965. 'UploadForm:BeforeProcessing': At the beginning of processUpload(). Lets you
  2966. poke at member variables like $mUploadDescription before the file is saved. Do
  2967. not use this hook to break upload processing. This will return the user to a
  2968. blank form with no error message; use UploadVerification and UploadVerifyFile
  2969. instead.
  2970. &$form: UploadForm object
  2971. 'UploadForm:getInitialPageText': After the initial page text for file uploads
  2972. is generated, to allow it to be altered.
  2973. &$pageText: the page text
  2974. $msg: array of header messages
  2975. $config: Config object
  2976. 'UploadForm:initial': Before the upload form is generated. You might set the
  2977. member-variables $uploadFormTextTop and $uploadFormTextAfterSummary to inject
  2978. text (HTML) either before or after the editform.
  2979. &$form: UploadForm object
  2980. 'UploadFormInitDescriptor': After the descriptor for the upload form as been
  2981. assembled.
  2982. &$descriptor: (array) the HTMLForm descriptor
  2983. 'UploadFormSourceDescriptors': after the standard source inputs have been
  2984. added to the descriptor
  2985. &$descriptor: (array) the HTMLForm descriptor
  2986. &$radio: Boolean, if source type should be shown as radio button
  2987. $selectedSourceType: The selected source type
  2988. 'UploadStashFile': Before a file is stashed (uploaded to stash).
  2989. Note that code which has not been updated for MediaWiki 1.28 may not call this
  2990. hook. If your extension absolutely, positively must prevent some files from
  2991. being uploaded, use UploadVerifyFile or UploadVerifyUpload.
  2992. $upload: (object) An instance of UploadBase, with all info about the upload
  2993. $user: (object) An instance of User, the user uploading this file
  2994. $props: (array) File properties, as returned by FSFile::getPropsFromPath()
  2995. &$error: output: If the file stashing should be prevented, set this to the reason
  2996. in the form of array( messagename, param1, param2, ... ) or a MessageSpecifier
  2997. instance (you might want to use ApiMessage to provide machine-readable details
  2998. for the API).
  2999. 'UploadVerification': DEPRECATED! Use UploadVerifyFile instead.
  3000. Additional chances to reject an uploaded file.
  3001. $saveName: (string) destination file name
  3002. $tempName: (string) filesystem path to the temporary file for checks
  3003. &$error: (string) output: message key for message to show if upload canceled by
  3004. returning false. May also be an array, where the first element is the message
  3005. key and the remaining elements are used as parameters to the message.
  3006. 'UploadVerifyFile': extra file verification, based on MIME type, etc. Preferred
  3007. in most cases over UploadVerification.
  3008. $upload: (object) an instance of UploadBase, with all info about the upload
  3009. $mime: (string) The uploaded file's MIME type, as detected by MediaWiki.
  3010. Handlers will typically only apply for specific MIME types.
  3011. &$error: (object) output: true if the file is valid. Otherwise, set this to the reason
  3012. in the form of array( messagename, param1, param2, ... ) or a MessageSpecifier
  3013. instance (you might want to use ApiMessage to provide machine-readable details
  3014. for the API).
  3015. 'UploadVerifyUpload': Upload verification, based on both file properties like
  3016. MIME type (same as UploadVerifyFile) and the information entered by the user
  3017. (upload comment, file page contents etc.).
  3018. $upload: (object) An instance of UploadBase, with all info about the upload
  3019. $user: (object) An instance of User, the user uploading this file
  3020. $props: (array) File properties, as returned by FSFile::getPropsFromPath()
  3021. $comment: (string) Upload log comment (also used as edit summary)
  3022. $pageText: (string) File description page text (only used for new uploads)
  3023. &$error: output: If the file upload should be prevented, set this to the reason
  3024. in the form of array( messagename, param1, param2, ... ) or a MessageSpecifier
  3025. instance (you might want to use ApiMessage to provide machine-readable details
  3026. for the API).
  3027. 'UserIsBot': when determining whether a user is a bot account
  3028. $user: the user
  3029. &$isBot: whether this is user a bot or not (boolean)
  3030. 'User::mailPasswordInternal': before creation and mailing of a user's new
  3031. temporary password
  3032. &$user: the user who sent the message out
  3033. &$ip: IP of the user who sent the message out
  3034. &$u: the account whose new password will be set
  3035. 'UserAddGroup': Called when adding a group or changing a group's expiry; return
  3036. false to override stock group addition.
  3037. $user: the user object that is to have a group added
  3038. &$group: the group to add; can be modified
  3039. &$expiry: the expiry time in TS_MW format, or null if the group is not to
  3040. expire; can be modified
  3041. 'UserArrayFromResult': Called when creating an UserArray object from a database
  3042. result.
  3043. &$userArray: set this to an object to override the default object returned
  3044. $res: database result used to create the object
  3045. 'userCan': To interrupt/advise the "user can do X to Y article" check. If you
  3046. want to display an error message, try getUserPermissionsErrors.
  3047. &$title: Title object being checked against
  3048. &$user: Current user object
  3049. $action: Action being checked
  3050. &$result: Pointer to result returned if hook returns false. If null is returned,
  3051. userCan checks are continued by internal code.
  3052. 'UserCanSendEmail': To override User::canSendEmail() permission check.
  3053. &$user: User (object) whose permission is being checked
  3054. &$canSend: bool set on input, can override on output
  3055. 'UserClearNewTalkNotification': Called when clearing the "You have new
  3056. messages!" message, return false to not delete it.
  3057. &$user: User (object) that will clear the message
  3058. $oldid: ID of the talk page revision being viewed (0 means the most recent one)
  3059. 'UserCreateForm': DEPRECATED! Create an AuthenticationProvider instead.
  3060. Manipulate the login form.
  3061. &$template: SimpleTemplate instance for the form
  3062. 'UserEffectiveGroups': Called in User::getEffectiveGroups().
  3063. &$user: User to get groups for
  3064. &$groups: Current effective groups
  3065. 'UserGetAllRights': After calculating a list of all available rights.
  3066. &$rights: Array of rights, which may be added to.
  3067. 'UserGetDefaultOptions': After fetching the core default, this hook is run right
  3068. before returning the options to the caller. Warning: This hook is called for
  3069. every call to User::getDefaultOptions(), which means it's potentially called
  3070. dozens or hundreds of times. You may want to cache the results of non-trivial
  3071. operations in your hook function for this reason.
  3072. &$defaultOptions: Array of preference keys and their default values.
  3073. 'UserGetEmail': Called when getting an user email address.
  3074. $user: User object
  3075. &$email: email, change this to override local email
  3076. 'UserGetEmailAuthenticationTimestamp': Called when getting the timestamp of
  3077. email authentication.
  3078. $user: User object
  3079. &$timestamp: timestamp, change this to override local email authentication
  3080. timestamp
  3081. 'UserGetImplicitGroups': DEPRECATED!
  3082. Called in User::getImplicitGroups().
  3083. &$groups: List of implicit (automatically-assigned) groups
  3084. 'UserGetLanguageObject': Called when getting user's interface language object.
  3085. $user: User object
  3086. &$code: Language code that will be used to create the object
  3087. $context: IContextSource object
  3088. 'UserGetReservedNames': Allows to modify $wgReservedUsernames at run time.
  3089. &$reservedUsernames: $wgReservedUsernames
  3090. 'UserGetRights': Called in User::getRights().
  3091. $user: User to get rights for
  3092. &$rights: Current rights
  3093. 'UserGroupsChanged': Called after user groups are changed.
  3094. $user: User whose groups changed
  3095. $added: Groups added
  3096. $removed: Groups removed
  3097. $performer: User who performed the change, false if via autopromotion
  3098. $reason: The reason, if any, given by the user performing the change,
  3099. false if via autopromotion.
  3100. $oldUGMs: An associative array (group name => UserGroupMembership object) of
  3101. the user's group memberships before the change.
  3102. $newUGMs: An associative array (group name => UserGroupMembership object) of
  3103. the user's current group memberships.
  3104. 'UserIsBlockedFrom': Check if a user is blocked from a specific page (for
  3105. specific block exemptions).
  3106. $user: User in question
  3107. $title: Title of the page in question
  3108. &$blocked: Out-param, whether or not the user is blocked from that page.
  3109. &$allowUsertalk: If the user is blocked, whether or not the block allows users
  3110. to edit their own user talk pages.
  3111. 'UserIsBlockedGlobally': Check if user is blocked on all wikis.
  3112. &$user: User object
  3113. $ip: User's IP address
  3114. &$blocked: Whether the user is blocked, to be modified by the hook
  3115. &$block: The Block object, to be modified by the hook
  3116. 'UserIsEveryoneAllowed': Check if all users are allowed some user right; return
  3117. false if a UserGetRights hook might remove the named right.
  3118. $right: The user right being checked
  3119. 'UserIsHidden': Check if the user's name should be hidden. See User::isHidden().
  3120. $user: User in question.
  3121. &$hidden: Set true if the user's name should be hidden.
  3122. 'UserIsLocked': Check if the user is locked. See User::isLocked().
  3123. $user: User in question.
  3124. &$locked: Set true if the user should be locked.
  3125. 'UserLoadAfterLoadFromSession': Called to authenticate users on external or
  3126. environmental means; occurs after session is loaded.
  3127. $user: user object being loaded
  3128. 'UserLoadDefaults': Called when loading a default user.
  3129. $user: user object
  3130. $name: user name
  3131. 'UserLoadFromDatabase': Called when loading a user from the database.
  3132. $user: user object
  3133. &$s: database query object
  3134. 'UserLoadFromSession': DEPRECATED! Create a MediaWiki\Session\SessionProvider instead.
  3135. Called to authenticate users on external/environmental means; occurs before
  3136. session is loaded.
  3137. $user: user object being loaded
  3138. &$result: set this to a boolean value to abort the normal authentication
  3139. process
  3140. 'UserLoadOptions': When user options/preferences are being loaded from the
  3141. database.
  3142. $user: User object
  3143. &$options: Options, can be modified.
  3144. 'UserLoggedIn': Called after a user is logged in
  3145. $user: User object for the logged-in user
  3146. 'UserLoginComplete': Show custom content after a user has logged in via the web interface.
  3147. For functionality that needs to run after any login (API or web) use UserLoggedIn.
  3148. &$user: the user object that was created on login
  3149. &$inject_html: Any HTML to inject after the "logged in" message.
  3150. $direct: (bool) The hook is called directly after a successful login. This will only happen once
  3151. per login. A UserLoginComplete call with direct=false can happen when the user visits the login
  3152. page while already logged in.
  3153. 'UserLoginForm': DEPRECATED! Create an AuthenticationProvider instead.
  3154. Manipulate the login form.
  3155. &$template: QuickTemplate instance for the form
  3156. 'UserLogout': Before a user logs out.
  3157. &$user: the user object that is about to be logged out
  3158. 'UserLogoutComplete': After a user has logged out.
  3159. &$user: the user object _after_ logout (won't have name, ID, etc.)
  3160. &$inject_html: Any HTML to inject after the "logged out" message.
  3161. $oldName: name of the user before logout (string)
  3162. 'UserMailerChangeReturnPath': Called to generate a VERP return address
  3163. when UserMailer sends an email, with a bounce handling extension.
  3164. $to: Array of MailAddress objects for the recipients
  3165. &$returnPath: The return address string
  3166. 'UserMailerSplitTo': Called in UserMailer::send() to give extensions a chance
  3167. to split up an email with multiple the To: field into separate emails.
  3168. &$to: array of MailAddress objects; unset the ones which should be mailed separately
  3169. 'UserMailerTransformContent': Called in UserMailer::send() to change email contents.
  3170. Extensions can block sending the email by returning false and setting $error.
  3171. $to: array of MailAdresses of the targets
  3172. $from: MailAddress of the sender
  3173. &$body: email body, either a string (for plaintext emails) or an array with 'text' and 'html' keys
  3174. &$error: should be set to an error message string
  3175. 'UserMailerTransformMessage': Called in UserMailer::send() to change email after it has gone through
  3176. the MIME transform. Extensions can block sending the email by returning false and setting $error.
  3177. $to: array of MailAdresses of the targets
  3178. $from: MailAddress of the sender
  3179. &$subject: email subject (not MIME encoded)
  3180. &$headers: email headers (except To: and Subject:) as an array of header name => value pairs
  3181. &$body: email body (in MIME format) as a string
  3182. &$error: should be set to an error message string
  3183. 'UserRemoveGroup': Called when removing a group; return false to override stock
  3184. group removal.
  3185. $user: the user object that is to have a group removed
  3186. &$group: the group to be removed, can be modified
  3187. 'UserRequiresHTTPS': Called to determine whether a user needs
  3188. to be switched to HTTPS.
  3189. $user: User in question.
  3190. &$https: Boolean whether $user should be switched to HTTPS.
  3191. 'UserResetAllOptions': Called in User::resetOptions() when user preferences
  3192. have been requested to be reset. This hook can be used to exclude certain
  3193. options from being reset even when the user has requested all prefs to be reset,
  3194. because certain options might be stored in the user_properties database table
  3195. despite not being visible and editable via Special:Preferences.
  3196. $user: the User (object) whose preferences are being reset
  3197. &$newOptions: array of new (site default) preferences
  3198. $options: array of the user's old preferences
  3199. $resetKinds: array containing the kinds of preferences to reset
  3200. 'UserRetrieveNewTalks': Called when retrieving "You have new messages!"
  3201. message(s).
  3202. &$user: user retrieving new talks messages
  3203. &$talks: array of new talks page(s)
  3204. 'UserRights': DEPRECATED! Use UserGroupsChanged instead.
  3205. After a user's group memberships are changed.
  3206. &$user: User object that was changed
  3207. $add: Array of strings corresponding to groups added
  3208. $remove: Array of strings corresponding to groups removed
  3209. 'UserSaveOptions': Called just before saving user preferences. Hook handlers can either add or
  3210. manipulate options, or reset one back to it's default to block changing it. Hook handlers are also
  3211. allowed to abort the process by returning false, e.g. to save to a global profile instead. Compare
  3212. to the UserSaveSettings hook, which is called after the preferences have been saved.
  3213. $user: The User for which the options are going to be saved
  3214. &$options: The users options as an associative array, modifiable
  3215. 'UserSaveSettings': Called directly after user preferences (user_properties in the database) have
  3216. been saved. Compare to the UserSaveOptions hook, which is called before.
  3217. $user: The User for which the options have been saved
  3218. 'UserSetCookies': DEPRECATED! If you're trying to replace core session cookie
  3219. handling, you want to create a subclass of MediaWiki\Session\CookieSessionProvider
  3220. instead. Otherwise, you can no longer count on user data being saved to cookies
  3221. versus some other mechanism.
  3222. Called when setting user cookies.
  3223. $user: User object
  3224. &$session: session array, will be added to the session
  3225. &$cookies: cookies array mapping cookie name to its value
  3226. 'UserSetEmail': Called when changing user email address.
  3227. $user: User object
  3228. &$email: new email, change this to override new email address
  3229. 'UserSetEmailAuthenticationTimestamp': Called when setting the timestamp of
  3230. email authentication.
  3231. $user: User object
  3232. &$timestamp: new timestamp, change this to override local email
  3233. authentication timestamp
  3234. 'UserToolLinksEdit': Called when generating a list of user tool links, e.g.
  3235. "Foobar (Talk | Contribs | Block)".
  3236. $userId: User id of the current user
  3237. $userText: User name of the current user
  3238. &$items: Array of user tool links as HTML fragments
  3239. 'UsersPagerDoBatchLookups': Called in UsersPager::doBatchLookups() to give
  3240. extensions providing user group data from an alternate source a chance to add
  3241. their data into the cache array so that things like global user groups are
  3242. displayed correctly in Special:ListUsers.
  3243. $dbr: Read-only database handle
  3244. $userIds: Array of user IDs whose groups we should look up
  3245. &$cache: Array of user ID -> (array of internal group name (e.g. 'sysop') ->
  3246. UserGroupMembership object)
  3247. &$groups: Array of group name -> bool true mappings for members of a given user
  3248. group
  3249. 'ValidateExtendedMetadataCache': Called to validate the cached metadata in
  3250. FormatMetadata::getExtendedMeta (return false means cache will be
  3251. invalidated and GetExtendedMetadata hook called again).
  3252. $timestamp: The timestamp metadata was generated
  3253. $file: The file the metadata is for
  3254. 'WantedPages::getQueryInfo': Called in WantedPagesPage::getQueryInfo(), can be
  3255. used to alter the SQL query which gets the list of wanted pages.
  3256. &$wantedPages: WantedPagesPage object
  3257. &$query: query array, see QueryPage::getQueryInfo() for format documentation
  3258. 'WatchArticle': Before a watch is added to an article.
  3259. &$user: user that will watch
  3260. &$page: WikiPage object to be watched
  3261. &$status: Status object to be returned if the hook returns false
  3262. 'WatchArticleComplete': After a watch is added to an article.
  3263. &$user: user that watched
  3264. &$page: WikiPage object watched
  3265. 'WatchedItemQueryServiceExtensions': Create a WatchedItemQueryServiceExtension.
  3266. &$extensions: Add WatchedItemQueryServiceExtension objects to this array
  3267. $watchedItemQueryService: Service object
  3268. 'WatchlistEditorBeforeFormRender': Before building the Special:EditWatchlist
  3269. form, used to manipulate the list of pages or preload data based on that list.
  3270. &$watchlistInfo: array of watchlisted pages in
  3271. [namespaceId => ['title1' => 1, 'title2' => 1]] format
  3272. 'WatchlistEditorBuildRemoveLine': when building remove lines in
  3273. Special:Watchlist/edit.
  3274. &$tools: array of extra links
  3275. $title: Title object
  3276. $redirect: whether the page is a redirect
  3277. $skin: Skin object
  3278. &$link: HTML link to title
  3279. 'WebRequestPathInfoRouter': While building the PathRouter to parse the
  3280. REQUEST_URI.
  3281. $router: The PathRouter instance
  3282. 'WebResponseSetCookie': when setting a cookie in WebResponse::setcookie().
  3283. Return false to prevent setting of the cookie.
  3284. &$name: Cookie name passed to WebResponse::setcookie()
  3285. &$value: Cookie value passed to WebResponse::setcookie()
  3286. &$expire: Cookie expiration, as for PHP's setcookie()
  3287. &$options: Options passed to WebResponse::setcookie()
  3288. 'wfShellWikiCmd': Called when generating a shell-escaped command line string to
  3289. run a MediaWiki cli script.
  3290. &$script: MediaWiki cli script path
  3291. &$parameters: Array of arguments and options to the script
  3292. &$options: Associative array of options, may contain the 'php' and 'wrapper'
  3293. keys
  3294. 'wgQueryPages': Called when initialising list of QueryPage subclasses, use this
  3295. to add new query pages to be updated with maintenance/updateSpecialPages.php.
  3296. &$qp: The list of QueryPages
  3297. 'WhatLinksHereProps': Allows annotations to be added to WhatLinksHere
  3298. $row: The DB row of the entry.
  3299. $title: The Title of the page where the link comes FROM
  3300. $target: The Title of the page where the link goes TO
  3301. &$props: Array of HTML strings to display after the title.
  3302. 'WikiExporter::dumpStableQuery': Get the SELECT query for "stable" revisions
  3303. dumps. One, and only one hook should set this, and return false.
  3304. &$tables: Database tables to use in the SELECT query
  3305. &$opts: Options to use for the query
  3306. &$join: Join conditions
  3307. 'WikiPageDeletionUpdates': manipulate the list of DeferrableUpdates to be applied when
  3308. a page is deleted. Called in WikiPage::getDeletionUpdates(). Note that updates
  3309. specific to a content model should be provided by the respective Content's
  3310. getDeletionUpdates() method.
  3311. $page: the WikiPage
  3312. $content: the Content to generate updates for, or null in case the page revision could not be
  3313. loaded. The delete will succeed despite this.
  3314. &$updates: the array of objects that implement DeferrableUpdate. Hook function may want to add to
  3315. it.
  3316. 'WikiPageFactory': Override WikiPage class used for a title
  3317. $title: Title of the page
  3318. &$page: Variable to set the created WikiPage to.
  3319. 'XmlDumpWriterOpenPage': Called at the end of XmlDumpWriter::openPage, to allow
  3320. extra metadata to be added.
  3321. $obj: The XmlDumpWriter object.
  3322. &$out: The output string.
  3323. $row: The database row for the page.
  3324. $title: The title of the page.
  3325. 'XmlDumpWriterWriteRevision': Called at the end of a revision in an XML dump, to
  3326. add extra metadata.
  3327. &$obj: The XmlDumpWriter object.
  3328. &$out: The text being output.
  3329. $row: The database row for the revision.
  3330. $text: The revision text.
  3331. More hooks might be available but undocumented, you can execute
  3332. "php maintenance/findHooks.php" to find hidden ones.