Go to the documentation of this file.
52 $this->
code = $options[
'lang'];
62 $this->doLinks = isset(
$options[
'links'] );
63 $this->includeExif = !isset(
$options[
'noexif'] );
64 $this->checkAll = isset(
$options[
'all'] );
67 $this->linksPrefix =
$options[
'prefix'];
70 if ( isset(
$options[
'wikilang'] ) ) {
71 $this->wikiCode =
$options[
'wikilang'];
74 if ( isset(
$options[
'whitelist'] ) ) {
75 $this->checks = explode(
',',
$options[
'whitelist'] );
76 } elseif ( isset(
$options[
'blacklist'] ) ) {
77 $this->checks = array_diff(
79 explode(
',',
$options[
'blacklist'] )
81 } elseif ( isset(
$options[
'easy'] ) ) {
88 $this->
output = $options[
'output'];
91 $this->L =
new Languages( $this->includeExif );
100 'untranslated',
'duplicate',
'obsolete',
'variables',
'empty',
'plural',
101 'whitespace',
'xhtml',
'chars',
'links',
'unbalanced',
'namespace',
102 'projecttalk',
'magic',
'magic-old',
'magic-over',
'magic-case',
103 'special',
'special-old',
113 'namespace',
'projecttalk',
'magic',
'magic-old',
'magic-over',
114 'magic-case',
'special',
'special-old',
124 'duplicate',
'obsolete',
'empty',
'whitespace',
'xhtml',
'chars',
'magic-old',
125 'magic-over',
'magic-case',
'special-old',
135 'untranslated' =>
'getUntranslatedMessages',
136 'duplicate' =>
'getDuplicateMessages',
137 'obsolete' =>
'getObsoleteMessages',
138 'variables' =>
'getMessagesWithMismatchVariables',
139 'plural' =>
'getMessagesWithoutPlural',
140 'empty' =>
'getEmptyMessages',
141 'whitespace' =>
'getMessagesWithWhitespace',
142 'xhtml' =>
'getNonXHTMLMessages',
143 'chars' =>
'getMessagesWithWrongChars',
144 'links' =>
'getMessagesWithDubiousLinks',
145 'unbalanced' =>
'getMessagesWithUnbalanced',
146 'namespace' =>
'getUntranslatedNamespaces',
147 'projecttalk' =>
'getProblematicProjectTalks',
148 'magic' =>
'getUntranslatedMagicWords',
149 'magic-old' =>
'getObsoleteMagicWords',
150 'magic-over' =>
'getOverridingMagicWords',
151 'magic-case' =>
'getCaseMismatchMagicWords',
152 'special' =>
'getUntraslatedSpecialPages',
153 'special-old' =>
'getObsoleteSpecialPages',
165 'namespace' => [
'getNamespaceNames',
'en' ],
166 'projecttalk' =>
null,
167 'magic' => [
'getMagicWords',
'en' ],
168 'magic-old' => [
'getMagicWords', null ],
169 'magic-over' => [
'getMagicWords', null ],
170 'magic-case' => [
'getMagicWords', null ],
171 'special' => [
'getSpecialPageAliases',
'en' ],
172 'special-old' => [
'getSpecialPageAliases', null ],
182 'untranslated' =>
'$1 message(s) of $2 are not translated to $3, but exist in en:',
183 'duplicate' =>
'$1 message(s) of $2 are translated the same in en and $3:',
185 '$1 message(s) of $2 do not exist in en or are in the ignore list, but exist in $3:',
186 'variables' =>
'$1 message(s) of $2 in $3 don\'t match the variables used in en:',
187 'plural' =>
'$1 message(s) of $2 in $3 don\'t use {{plural}} while en uses:',
188 'empty' =>
'$1 message(s) of $2 in $3 are empty or -:',
189 'whitespace' =>
'$1 message(s) of $2 in $3 have trailing whitespace:',
190 'xhtml' =>
'$1 message(s) of $2 in $3 contain illegal XHTML:',
192 '$1 message(s) of $2 in $3 include hidden chars which should not be used in the messages:',
193 'links' =>
'$1 message(s) of $2 in $3 have problematic link(s):',
194 'unbalanced' =>
'$1 message(s) of $2 in $3 have unbalanced {[]}:',
195 'namespace' =>
'$1 namespace name(s) of $2 are not translated to $3, but exist in en:',
197 '$1 namespace name(s) and alias(es) in $3 are project talk namespaces without the parameter:',
198 'magic' =>
'$1 magic word(s) of $2 are not translated to $3, but exist in en:',
199 'magic-old' =>
'$1 magic word(s) of $2 do not exist in en, but exist in $3:',
200 'magic-over' =>
'$1 magic word(s) of $2 in $3 do not contain the original en word(s):',
202 '$1 magic word(s) of $2 in $3 change the case-sensitivity of the original en word:',
203 'special' =>
'$1 special page alias(es) of $2 are not translated to $3, but exist in en:',
204 'special-old' =>
'$1 special page alias(es) of $2 do not exist in en, but exist in $3:',
219 --all: Check all customized languages.
221 * 0: Skip the checks (useful
for checking syntax).
234 to focus
on other problems (
default off).
237 --easy: Do only the easy checks, which can be treated
by non-speakers
of
240 Check codes (ideally, all
of them should result 0; all the checks
are executed
244 * duplicate: Messages which translation equal to fallback.
245 * obsolete: Messages which
are untranslatable
or do not exist, but
are
247 * variables: Messages without variables which should be
used,
or with
248 variables which should
not be
used.
250 * whitespace: Messages which have trailing whitespace.
251 * xhtml: Messages which
are not well-formed XHTML (checks only few common
253 * chars: Messages with hidden characters.
255 * unbalanced: Messages which
contains unequal numbers
of opening {[
and
261 * magic-old: Magic
words which
do not exist.
263 * magic-
case: Magic
words whose translation changes the
case-sensitivity
of
276 if ( $this->level > 0 ) {
277 switch ( $this->
output ) {
285 throw new MWException(
"Invalid output type $this->output" );
294 $ignoredCodes = [
'en',
'enRTL' ];
298 if ( $this->checkAll ) {
299 foreach ( $this->L->getLanguages()
as $language ) {
300 if ( !in_array( $language, $ignoredCodes ) ) {
301 $this->results[$language] = $this->
checkLanguage( $language );
305 if ( in_array( $this->
code, $ignoredCodes ) ) {
306 throw new MWException(
"Cannot check code $this->code." );
317 unset( $this->results[
$code][$check][$key] );
329 static $blacklist =
null;
331 if ( $blacklist !==
null ) {
341 Hooks::run(
'LocalisationChecksBlacklist', [ &$blacklist ] );
357 foreach ( $blacklist
as $item ) {
358 if ( isset( $item[
'check'] ) && $check !== $item[
'check'] ) {
362 if ( isset( $item[
'code'] ) && !in_array(
$code, $item[
'code'] ) ) {
366 if ( isset( $item[
'message'] ) &&
367 ( $message ===
false || !in_array( $message, $item[
'message'] ) )
387 if ( $this->level === 0 ) {
388 $this->L->getMessages(
$code );
394 foreach ( $this->checks
as $check ) {
400 $callback = [
$this->L, $checkFunctions[$check] ];
401 if ( !is_callable( $callback ) ) {
417 if ( $this->doLinks ) {
418 $displayKey = ucfirst( $key );
419 if (
$code == $this->wikiCode ) {
420 return "[[{$this->linksPrefix}MediaWiki:$displayKey|$key]]";
422 return "[[{$this->linksPrefix}MediaWiki:$displayKey/$code|$key]]";
434 $translated = $this->L->getMessages(
$code );
435 $translated =
count( $translated[
'translated'] );
439 if ( $check ==
'untranslated' ) {
440 $translatable = $this->L->getGeneralMessages();
441 $total =
count( $translatable[
'translatable'] );
444 $totalCount = $totalCount[$check];
445 $callback = [
$this->L, $totalCount[0] ];
446 $callCode = $totalCount[1] ? $totalCount[1] :
$code;
447 $total =
count( call_user_func( $callback, $callCode ) );
449 $total = $translated;
451 $search = [
'$1',
'$2',
'$3' ];
452 $replace = [ $count, $total,
$code ];
454 echo
"\n" . str_replace( $search, $replace, $descriptions[$check] ) .
"\n";
455 if ( $this->level == 1 ) {
456 echo
"[messages are hidden]\n";
462 if ( $this->level == 2 || empty(
$value ) ) {
465 echo
"* $key: '$value'\n";
479 $rows[] =
'! Language !! Code !! Total !! ' .
482 $detailTextForLang =
"==$code==\n";
485 $detailTextForLangChecks = [];
493 $messageDetails = [];
496 $messageDetails[] = $displayKey;
498 $detailTextForLangChecks[] =
"=== $code-$check ===\n* " . implode(
', ', $messageDetails );
499 $numbers[] =
"'''[[#$code-$check|$count]]'''";
505 if (
count( $detailTextForLangChecks ) ) {
506 $detailText .= $detailTextForLang . implode(
"\n", $detailTextForLangChecks ) .
"\n";
510 # Don't list languages without problems
514 $rows[] =
"| $language || $code || $problems || " . implode(
' || ', $numbers );
517 $tableRows = implode(
"\n|-\n",
$rows );
525 {|
class=
"sortable wikitable" border=
"2" cellpadding=
"4" cellspacing=
"0" style=
"background-color: #F9F9F9; border: 1px #AAAAAA solid; border-collapse: collapse; clear: both;"
569 $this->
code = $options[
'lang'];
579 $this->doLinks = isset(
$options[
'links'] );
582 $this->wikiCode =
$options[
'wikilang'];
585 if ( isset(
$options[
'whitelist'] ) ) {
586 $this->checks = explode(
',',
$options[
'whitelist'] );
587 } elseif ( isset(
$options[
'blacklist'] ) ) {
588 $this->checks = array_diff(
590 explode(
',',
$options[
'blacklist'] )
598 if ( isset(
$options[
'output'] ) ) {
599 $this->
output = $options[
'output'];
602 # Some additional checks not enabled by default
603 if ( isset(
$options[
'duplicate'] ) ) {
604 $this->checks[] =
'duplicate';
607 $this->extensions = [];
608 $extensions =
new PremadeMediawikiExtensionGroups();
610 if ( $extension ==
'all' ) {
611 foreach ( MessageGroups::singleton()->getGroups()
as $group ) {
612 if ( strpos( $group->getId(),
'ext-' ) === 0 && !$group->isMeta() ) {
613 $this->extensions[] =
new ExtensionLanguages( $group );
616 } elseif ( $extension ==
'wikimedia' ) {
617 $wikimedia = MessageGroups::getGroup(
'ext-0-wikimedia' );
618 foreach ( $wikimedia->wmfextensions()
as $extension ) {
619 $group = MessageGroups::getGroup( $extension );
620 $this->extensions[] =
new ExtensionLanguages( $group );
622 } elseif ( $extension ==
'flaggedrevs' ) {
623 foreach ( MessageGroups::singleton()->getGroups()
as $group ) {
624 if ( strpos( $group->getId(),
'ext-flaggedrevs-' ) === 0 && !$group->isMeta() ) {
625 $this->extensions[] =
new ExtensionLanguages( $group );
631 $group = MessageGroups::getGroup(
'ext-' . $extension );
633 $extension =
new ExtensionLanguages( $group );
634 $this->extensions[] = $extension;
636 print
"No such extension $extension.\n";
648 'untranslated',
'duplicate',
'obsolete',
'variables',
'empty',
'plural',
649 'whitespace',
'xhtml',
'chars',
'links',
'unbalanced',
667 'duplicate',
'obsolete',
'empty',
'whitespace',
'xhtml',
'chars',
675 protected function help() {
681 *
First parameter (mandatory): Extension
name, multiple extension
names
682 (separated
by commas),
"all" for all the
extensions,
"wikimedia" for
693 * easy: Do only the easy checks, which can be treated
by non-speakers
of
696 Check codes (ideally, all
of them should result 0; all the checks
are executed
700 * duplicate: Messages which translation equal to fallback.
701 * obsolete: Messages which
are untranslatable, but translated.
702 * variables: Messages without variables which should be
used,
or with
703 variables which should
not be
used.
705 * whitespace: Messages which have trailing whitespace.
706 * xhtml: Messages which
are not well-formed XHTML (checks only few common
708 * chars: Messages with hidden characters.
710 * unbalanced: Messages which
contains unequal numbers
of opening {[
and
713 Display levels (
default: 2):
714 * 0: Skip the checks (useful for checking syntax).
738 foreach ( $this->extensions
as $extension ) {
739 $this->L = $extension;
741 $this->results[
$code] = parent::checkLanguage(
$code );
744 echo $extension->name() .
":\n";
746 if ( $this->level > 0 ) {
747 switch ( $this->
output ) {
755 throw new MWException(
"Invalid output type $this->output" );
770 'code' => [
'az',
'bo',
'cdo',
'dz',
'id',
'fa',
'gan',
'gan-hans',
771 'gan-hant',
'gn',
'hak',
'hu',
'ja',
'jv',
'ka',
'kk-arab',
772 'kk-cyrl',
'kk-latn',
'km',
'kn',
'ko',
'lzh',
'mn',
'ms',
773 'my',
'sah',
'sq',
'tet',
'th',
'to',
'tr',
'vi',
'wuu',
'xmf',
774 'yo',
'yue',
'zh',
'zh-classical',
'zh-cn',
'zh-hans',
775 'zh-hant',
'zh-hk',
'zh-sg',
'zh-tw',
'zh-yue'
and give any other recipients of the Program a copy of this License along with the Program You may charge a fee for the physical act of transferring a and you may at your option offer warranty protection in exchange for a fee You may modify your copy or copies of the Program or any portion of thus forming a work based on the and copy and distribute such modifications or work under the terms of Section provided that you also meet all of these that in whole or in part contains or is derived from the Program or any part to be licensed as a whole at no charge to all third parties under the terms of this License c If the modified program normally reads commands interactively when you must cause when started running for such interactive use in the most ordinary to print or display an announcement including an appropriate copyright notice and a notice that there is no and telling the user how to view a copy of this and can be reasonably considered independent and separate works in then this and its do not apply to those sections when you distribute them as separate works But when you distribute the same sections as part of a whole which is a work based on the the distribution of the whole must be on the terms of this whose permissions for other licensees extend to the entire and thus to each and every part regardless of who wrote it it is not the intent of this section to claim rights or contest your rights to work written entirely by you
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped broken
We ve cleaned up the code here by removing clumps of infrequently used code and moving them off somewhere else It s much easier for someone working with this code to see what s _really_ going and make changes or fix bugs In we can take all the code that deals with the little used title reversing we can concentrate it all in an extension file
if the prop value should be in the metadata multi language array can modify can modify indexed by page_id indexed by prefixed DB keys can modify can modify can modify this should be populated with an alert message to that effect to be fed to an HTMLForm object and populate $result with the reason in the form of error messages should be plain text with no special etc to show that they re errors
per default it will return the text for text based content
easyChecks()
Get the checks that can easily be treated by non-speakers of the language.
We use the convention $dbr for read and $dbw for write to help you keep track of whether the database object is a the world will explode Or to be a subsequent write query which succeeded on the master may fail when replicated to the slave due to a unique key collision Replication on the slave will stop and it may take hours to repair the database and get it back online Setting read_only in my cnf on the slave will avoid this but given the dire we prefer to have as many checks as possible We provide a but the wrapper functions like please read the documentation for except in special pages derived from QueryPage It s a common pitfall for new developers to submit code containing SQL queries which examine huge numbers of rows Remember that COUNT * is(N), counting rows in atable is like counting beans in a bucket.------------------------------------------------------------------------ Replication------------------------------------------------------------------------The largest installation of MediaWiki, Wikimedia, uses a large set ofslave MySQL servers replicating writes made to a master MySQL server. Itis important to understand the issues associated with this setup if youwant to write code destined for Wikipedia.It 's often the case that the best algorithm to use for a given taskdepends on whether or not replication is in use. Due to our unabashedWikipedia-centrism, we often just use the replication-friendly version, but if you like, you can use wfGetLB() ->getServerCount() > 1 tocheck to see if replication is in use.===Lag===Lag primarily occurs when large write queries are sent to the master.Writes on the master are executed in parallel, but they are executed inserial when they are replicated to the slaves. The master writes thequery to the binlog when the transaction is committed. The slaves pollthe binlog and start executing the query as soon as it appears. They canservice reads while they are performing a write query, but will not readanything more from the binlog and thus will perform no more writes. Thismeans that if the write query runs for a long time, the slaves will lagbehind the master for the time it takes for the write query to complete.Lag can be exacerbated by high read load. MediaWiki 's load balancer willstop sending reads to a slave when it is lagged by more than 30 seconds.If the load ratios are set incorrectly, or if there is too much loadgenerally, this may lead to a slave permanently hovering around 30seconds lag.If all slaves are lagged by more than 30 seconds, MediaWiki will stopwriting to the database. All edits and other write operations will berefused, with an error returned to the user. This gives the slaves achance to catch up. Before we had this mechanism, the slaves wouldregularly lag by several minutes, making review of recent editsdifficult.In addition to this, MediaWiki attempts to ensure that the user seesevents occurring on the wiki in chronological order. A few seconds of lagcan be tolerated, as long as the user sees a consistent picture fromsubsequent requests. This is done by saving the master binlog positionin the session, and then at the start of each request, waiting for theslave to catch up to that position before doing any reads from it. Ifthis wait times out, reads are allowed anyway, but the request isconsidered to be in "lagged slave mode". Lagged slave mode can bechecked by calling wfGetLB() ->getLaggedSlaveMode(). The onlypractical consequence at present is a warning displayed in the pagefooter.===Lag avoidance===To avoid excessive lag, queries which write large numbers of rows shouldbe split up, generally to write one row at a time. Multi-row INSERT ...SELECT queries are the worst offenders should be avoided altogether.Instead do the select first and then the insert.===Working with lag===Despite our best efforts, it 's not practical to guarantee a low-lagenvironment. Lag will usually be less than one second, but mayoccasionally be up to 30 seconds. For scalability, it 's very importantto keep load on the master low, so simply sending all your queries tothe master is not the answer. So when you have a genuine need forup-to-date data, the following approach is advised:1) Do a quick query to the master for a sequence number or timestamp 2) Run the full query on the slave and check if it matches the data you gotfrom the master 3) If it doesn 't, run the full query on the masterTo avoid swamping the master every time the slaves lag, use of thisapproach should be kept to a minimum. In most cases you should just readfrom the slave and let the user deal with the delay.------------------------------------------------------------------------ Lock contention------------------------------------------------------------------------Due to the high write rate on Wikipedia(and some other wikis), MediaWiki developers need to be very careful to structure their writesto avoid long-lasting locks. By default, MediaWiki opens a transactionat the first query, and commits it before the output is sent. Locks willbe held from the time when the query is done until the commit. So youcan reduce lock time by doing as much processing as possible before youdo your write queries.Often this approach is not good enough, and it becomes necessary toenclose small groups of queries in their own transaction. Use thefollowing syntax:$dbw=wfGetDB(DB_MASTER
Prior to maintenance scripts were a hodgepodge of code that had no cohesion or formal method of action Beginning maintenance scripts have been cleaned up to use a unified class Directory structure How to run a script How to write your own DIRECTORY STRUCTURE The maintenance directory of a MediaWiki installation contains several all of which have unique purposes HOW TO RUN A SCRIPT Ridiculously just call php someScript php that s in the top level maintenance directory if not default wiki
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two distribute and or modify the software for each author s protection and we want to make certain that everyone understands that there is no warranty for this free software If the software is modified by someone else and passed we want its recipients to know that what they have is not the original
An extension or a will often add custom code to the function with or without a global variable For someone wanting email notification when an article is shown may add
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for and distribution as defined by Sections through of this document Licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the License Legal Entity shall mean the union of the acting entity and all other entities that control are controlled by or are under common control with that entity For the purposes of this definition control direct or to cause the direction or management of such whether by contract or including but not limited to software source documentation and configuration files Object form shall mean any form resulting from mechanical transformation or translation of a Source including but not limited to compiled object generated and conversions to other media types Work shall mean the work of whether in Source or Object made available under the as indicated by a copyright notice that is included in or attached to the whether in Source or Object that is based or other modifications as a an original work of authorship For the purposes of this Derivative Works shall not include works that remain separable or merely the Work and Derivative Works thereof Contribution shall mean any work of including the original version of the Work and any modifications or additions to that Work or Derivative Works that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner For the purposes of this submitted means any form of or written communication sent to the Licensor or its including but not limited to communication on electronic mailing source code control and issue tracking systems that are managed or on behalf the Licensor for the purpose of discussing and improving the but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as Not a Contribution Contributor shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work Grant of Copyright License Subject to the terms and conditions of this each Contributor hereby grants to You a non no royalty irrevocable copyright license to prepare Derivative Works publicly publicly perform
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such and we might be restricted by PHP settings such as safe mode or open_basedir We cannot assume that the software even has read access anywhere useful Many shared hosts run all users web applications under the same so they can t rely on Unix and must forbid reads to even standard directories like tmp lest users read each others files We cannot assume that the user has the ability to install or run any programs not written as web accessible PHP scripts Since anything that works on cheap shared hosting will work if you have shell or root access MediaWiki s design is based around catering to the lowest common denominator Although we support higher end setups as the way many things work by default is tailored toward shared hosting These defaults are unconventional from the point of view of and they certainly aren t ideal for someone who s installing MediaWiki as MediaWiki does not conform to normal Unix filesystem layout Hopefully we ll offer direct support for standard layouts in the but for now *any change to the location of files is unsupported *Moving things and leaving symlinks will *probably *not break but it is *strongly *advised not to try any more intrusive changes to get MediaWiki to conform more closely to your filesystem hierarchy Any such attempt will almost certainly result in unnecessary bugs The standard recommended location to install relative to the web is it should be possible to enable the appropriate rewrite rules by default
Class to extract and validate Exif data from jpeg (and possibly tiff) files.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
The ContentHandler facility adds support for arbitrary content types on wiki pages
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two distribute and or modify the software for each author s protection and we want to make certain that everyone understands that there is no warranty for this free software If the software is modified by someone else and passed we want its recipients to know that what they have is not the so that any problems introduced by others will not reflect on the original authors reputations any free program is threatened constantly by software patents We wish to avoid the danger that redistributors of a free program will individually obtain patent in effect making the program proprietary To prevent this
checkLanguage( $code)
Check a language and show the results.
execute()
Execute the script.
__construct(array $options)
outputText()
Output the checks results as plain text.
</source > ! result< div class="mw-highlight mw-content-ltr" dir="ltr">< pre >< span ></span >< span class="kd"> var</span >< span class="nx"> a</span >< span class="p"></span ></pre ></div > ! end ! test Multiline< source/> in lists !input *< source > a b</source > *foo< source > a b</source > ! html< ul >< li >< div class="mw-highlight mw-content-ltr" dir="ltr">< pre > a b</pre ></div ></li ></ul >< ul >< li > foo< div class="mw-highlight mw-content-ltr" dir="ltr">< pre > a b</pre ></div ></li ></ul > ! html tidy< ul >< li >< div class="mw-highlight mw-content-ltr" dir="ltr">< pre > a b</pre ></div ></li ></ul >< ul >< li > foo< div class="mw-highlight mw-content-ltr" dir="ltr">< pre > a b</pre ></div ></li ></ul > ! end ! test Custom attributes !input< source lang="javascript" id="foo" class="bar" dir="rtl" style="font-size: larger;"> var a
nonMessageChecks()
Get the checks which check other things than messages.
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that they
script(document.cookie)%253c/script%253e</pre ></div > !! end !! test XSS is escaped(inline) !!input< source lang
getChecks()
Get all checks.
null for the wiki Added in
outputWiki()
Output the checks results as wiki text.
Returning false makes less sense for events where the action is complete
I won t presume to tell you how to I m just describing the methods I chose to use for myself If you do choose to follow these it will probably be easier for you to collaborate with others on the project
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those were
null means default in associative array form
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a message
defaultChecks()
Get the default checks.
when a variable name is used in a it is silently declared as a new masking the global
getCheckBlacklist()
Get the check blacklist.
globals will be eliminated from MediaWiki replaced by an application object which would be passed to constructors Whether that would be an convenient solution remains to be but certainly PHP makes such object oriented programming models easier than they were in previous versions For the time being MediaWiki programmers will have to work in an environment with some global context At the time of globals were initialised on startup by MediaWiki of these were configuration settings
in this case you re responsible for computing and outputting the entire conflict i the difference between revisions and your text headers and sections and Diff or overridable Default is either copyrightwarning or copyrightwarning2 overridable Default is editpage tos summary such as anonymity and the real check
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for and distribution as defined by Sections through of this document Licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the License Legal Entity shall mean the union of the acting entity and all other entities that control are controlled by or are under common control with that entity For the purposes of this definition control direct or to cause the direction or management of such whether by contract or including but not limited to software source documentation and configuration files Object form shall mean any form resulting from mechanical transformation or translation of a Source including but not limited to compiled object generated and conversions to other media types Work shall mean the work of whether in Source or Object made available under the as indicated by a copyright notice that is included in or attached to the whether in Source or Object that is based or other modifications as a an original work of authorship For the purposes of this Derivative Works shall not include works that remain separable or merely the Work and Derivative Works thereof Contribution shall mean any work of including the original version of the Work and any modifications or additions to that Work or Derivative Works that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner For the purposes of this submitted means any form of or written communication sent to the Licensor or its including but not limited to communication on electronic mailing source code control and issue tracking systems that are managed by
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
defaultChecks()
Get the default checks.
getDescriptions()
Get all check descriptions.
This document describes the XML format used to represent information about external sites known to a MediaWiki installation This information about external sites is used to allow inter wiki links
doChecks()
Execute the checks.
static getVersion( $flags='', $lang=null)
Return a string of the MediaWiki version with Git revision if available.
and how to run hooks for an and one after Each event has a preferably in CamelCase For ArticleDelete hook A clump of code and data that should be run when an event happens This can be either a function and a chunk of or an object and a method hook function The function part of a third party developers and administrators to define code that will be run at certain points in the mainline code
We ve cleaned up the code here by removing clumps of infrequently used code and moving them off somewhere else It s much easier for someone working with this code to see what s _really_ going on
The ContentHandler facility adds support for arbitrary content types on wiki instead of relying on wikitext for everything It was introduced in MediaWiki Each kind of and so on Built in content types as usual *javascript user provided javascript code *json simple implementation for use by extensions
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two distribute and or modify the software for each author s protection and we want to make certain that everyone understands that there is no warranty for this free software If the software is modified by someone else and passed we want its recipients to know that what they have is not the so that any problems introduced by others will not reflect on the original authors reputations any free program is threatened constantly by software patents We wish to avoid the danger that redistributors of a free program will individually obtain patent in effect making the program proprietary To prevent we have made it clear that any patent must be licensed for everyone s free use or not licensed at all The precise terms and conditions for distribution and modification follow GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR DISTRIBUTION AND MODIFICATION This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License The refers to any such program or and a work based on the Program means either the Program or any derivative work under copyright a work containing the Program or a portion of either verbatim or with modifications and or translated into another language(Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying
$wgLanguageCode
Site language code.
checkLanguage( $code)
Check a language.
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for and distribution as defined by Sections through of this document Licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the License Legal Entity shall mean the union of the acting entity and all other entities that control are controlled by or are under common control with that entity For the purposes of this definition control direct or to cause the direction or management of such whether by contract or including but not limited to software source documentation and configuration files Object form shall mean any form resulting from mechanical transformation or translation of a Source including but not limited to compiled object generated and conversions to other media types Work shall mean the work of whether in Source or Object made available under the as indicated by a copyright notice that is included in or attached to the whether in Source or Object that is based or other modifications as a an original work of authorship For the purposes of this Derivative Works shall not include works that remain separable or merely the Work and Derivative Works thereof Contribution shall mean any work of including the original version of the Work and any modifications or additions to that Work or Derivative Works that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner For the purposes of this submitted means any form of or written communication sent to the Licensor or its including but not limited to communication on electronic mailing source code control and issue tracking systems that are managed or on behalf the Licensor for the purpose of discussing and improving the but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as Not a Contribution Contributor shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work Grant of Copyright License Subject to the terms and conditions of this each Contributor hereby grants to You a non no royalty irrevocable copyright license to prepare Derivative Works publicly display
Prior to maintenance scripts were a hodgepodge of code that had no cohesion or formal method of action Beginning maintenance scripts have been cleaned up to use a unified class Directory structure How to run a script How to write your own DIRECTORY STRUCTURE The maintenance directory of a MediaWiki installation contains several all of which have unique purposes HOW TO RUN A SCRIPT Ridiculously just call php someScript php that s in the top level maintenance directory if not default do this many per batch HOW TO WRITE YOUR OWN Make a file in the maintenance directory called myScript php or something In write the following
static fetchLanguageName( $code, $inLanguage=null, $include='all')
isEmpty()
Check if there are any results for the checks, in any language.
formatKey( $key, $code)
Format a message key.
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring which defines all default service and specifies how they depend on each other("wiring"). When a new service is added to MediaWiki core
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction $rows
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add in any and then calling output() to send it all. It could be easily changed to send incrementally if that becomes useful
def translate(text, conv_table)
you don t have to do a grep find to see where the $wgReverseTitle variable is used
The ContentHandler facility adds support for arbitrary content types on wiki instead of relying on wikitext for everything It was introduced in MediaWiki Each kind of and so on Built in content types are
This code would result in ircNotify being run twice when an article is and once for brion Hooks can return three possible values
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
nonMessageChecks()
Get the checks which check other things than messages.
passed in as a query string parameter to the various URLs constructed here(i.e. $prevlink) $ldel you ll need to handle error messages
isCheckBlacklisted( $check, $code, $message)
Verify whether a check is blacklisted.
globals txt Globals are evil The original MediaWiki code relied on globals for processing context far too often MediaWiki development since then has been a story of slowly moving context out of global variables and into objects Storing processing context in object member variables allows those objects to be reused in a much more flexible way Consider the elegance of
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at name
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global then executing the whole list after the page is displayed We don t do anything smart like collating updates to the same table or such because the list is almost always going to have just one item on if that
c Accompany it with the information you received as to the offer to distribute corresponding source complete source code means all the source code for all modules it contains
execute()
Execute the script.
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add headers
easyChecks()
Get the checks that can easily be treated by non-speakers of the language.
Internationalisation code.
__construct(array $options, $extension)
I won t presume to tell you how to I m just describing the methods I chose to use for myself If you do choose to follow these it will probably be easier for you to collaborate with others on the but if you want to contribute without by all means do which work well I also use K &R brace matching style I know that s a religious issue for so if you want to use a style that puts opening braces on the next line
the array() calling protocol came about after MediaWiki 1.4rc1.
getTotalCount()
Get total count for each check non-messages check.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing them