43 foreach ( $reader->requirements
as $type => $reqsOfType ) {
44 foreach ( $reqsOfType
as $name => $unused ) {
54 'tests' => $reader->tests,
55 'articles' => $reader->articles
61 $this->fh = fopen( $this->
file,
"rt" );
64 throw new MWException(
"Couldn't open file '$file'\n" );
68 'runDisabled' =>
false,
69 'runParsoid' =>
false,
72 $this->runDisabled =
$options[
'runDisabled'];
73 $this->runParsoid =
$options[
'runParsoid'];
80 $input = $this->
checkSection( [
'wikitext',
'input' ],
false );
82 [
'html/php',
'html/*',
'html',
'result' ],
false );
84 $tidySection = $this->
checkSection( [
'html/php+tidy',
'html+tidy' ],
false );
87 $data = array_map(
'ParserTestRunner::chomp', $this->sectionData );
95 if ( $input ===
false ) {
96 throw new MWException(
"Test at {$this->file}:{$this->sectionLineNum['test']} " .
97 "lacks input section" );
100 if ( preg_match(
'/\\bdisabled\\b/i', $data[
'options'] ) && !$this->runDisabled ) {
105 if ( $tidySection ===
false && $nonTidySection ===
false ) {
106 if ( isset( $data[
'html/parsoid'] ) || isset( $data[
'wikitext/edited'] ) ) {
110 throw new MWException(
"Test at {$this->file}:{$this->sectionLineNum['test']} " .
111 "lacks result section" );
115 if ( preg_match(
'/\\bparsoid\\b/i', $data[
'options'] ) && $nonTidySection ===
'html'
116 && !$this->runParsoid
122 if ( !preg_match( $this->regex, $data[
'test'] ) ) {
128 'test' => $data[
'test'],
129 'desc' => $data[
'test'],
130 'input' => $data[$input],
131 'options' => $data[
'options'],
132 'config' => $data[
'config'],
135 if ( $nonTidySection !==
false ) {
138 'result' => $data[$nonTidySection],
141 if ( $tidySection !==
false ) {
144 'desc' => $data[
'test'] .
' (with tidy)',
145 'result' => $data[$tidySection],
146 'options' => $data[
'options'] .
' tidy',
149 } elseif ( $tidySection !==
false ) {
152 'result' => $data[$tidySection],
153 'options' => $data[
'options'] .
' tidy'
156 throw new MWException(
"Test at {$this->file}:{$this->sectionLineNum['test']} " .
157 "lacks result section" );
162 while (
false !== (
$line = fgets( $this->fh ) ) ) {
167 $this->section = strtolower(
$matches[1] );
169 if ( $this->section ==
'endarticle' ) {
175 $this->sectionData[
'text'], $this->lineNum );
182 if ( $this->section ==
'endhooks' ) {
185 foreach ( explode(
"\n", $this->sectionData[
'hooks'] )
as $line ) {
186 $line = trim( $line );
198 if ( $this->section ==
'endfunctionhooks' ) {
201 foreach ( explode(
"\n", $this->sectionData[
'functionhooks'] )
as $line ) {
202 $line = trim( $line );
214 if ( $this->section ==
'endtransparenthooks' ) {
217 foreach ( explode(
"\n", $this->sectionData[
'transparenthooks'] )
as $line ) {
218 $line = trim( $line );
230 if ( $this->section ==
'end' ) {
237 if ( isset( $this->sectionData[$this->section] ) ) {
238 throw new MWException(
"duplicate section '$this->section' "
239 .
"at line {$this->lineNum} of $this->file\n" );
248 if ( $this->section ) {
258 $this->sectionLineNum = [];
259 $this->sectionData = [];
260 $this->section = null;
278 if ( is_null( $this->section ) ) {
279 throw new MWException( __METHOD__ .
" can not verify a null section!\n" );
285 throw new MWException( __METHOD__ .
" can not verify zero sections!\n" );
290 return isset( $data[$token] );
298 "'%s' without '%s' at line %s of %s\n",
307 "'%s' with unexpected tokens '%s' at line %s of %s\n",
315 return array_values(
$tokens )[0];
319 $this->articles[] = [
the array() calling protocol came about after MediaWiki 1.4rc1.
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
__construct($file, $options)
static chomp($s)
Remove last character if it is a newline utility.
addRequirement($type, $name)
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
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context $options
clearSection()
Clear section name and its data.
$sectionData
String|null: current test section being analyzed.
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
checkSection($tokens, $fatal=true)
Verify the current section data has some value for the given token name(s) (first parameter)...
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
addArticle($name, $text, $line)
static read($file, array $options=[])
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached one of or reset my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled allows for interception of redirect as a string mapping parameter names to values & $type
Allows to change the fields on the form that will be generated $name