hooks.txt 152 KB

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