Go to the documentation of this file.
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'];
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 );
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'],
131 'options' => $data[
'options'],
132 'config' => $data[
'config'],
133 'line' => $this->sectionLineNum[
'test'],
137 if ( $nonTidySection !==
false ) {
140 'result' => $data[$nonTidySection],
141 'resultSection' => $nonTidySection
144 if ( $tidySection !==
false ) {
147 'desc' => $data[
'test'] .
' (with tidy)',
148 'result' => $data[$tidySection],
149 'resultSection' => $tidySection,
150 'options' => $data[
'options'] .
' tidy',
154 } elseif ( $tidySection !==
false ) {
157 'result' => $data[$tidySection],
158 'resultSection' => $tidySection,
159 'options' => $data[
'options'] .
' tidy'
162 throw new MWException(
"Test at {$this->file}:{$this->sectionLineNum['test']} " .
163 "lacks result section" );
168 while (
false !== (
$line = fgets( $this->fh ) ) ) {
173 $this->section = strtolower(
$matches[1] );
175 if ( $this->section ==
'endarticle' ) {
180 ParserTestRunner::chomp( $this->sectionData[
'article'] ),
181 $this->sectionData[
'text'], $this->lineNum );
188 if ( $this->section ==
'endhooks' ) {
191 foreach ( explode(
"\n", $this->sectionData[
'hooks'] )
as $line ) {
204 if ( $this->section ==
'endfunctionhooks' ) {
207 foreach ( explode(
"\n", $this->sectionData[
'functionhooks'] )
as $line ) {
220 if ( $this->section ==
'endtransparenthooks' ) {
223 foreach ( explode(
"\n", $this->sectionData[
'transparenthooks'] )
as $line ) {
236 if ( $this->section ==
'end' ) {
243 if ( isset( $this->sectionData[$this->section] ) ) {
244 throw new MWException(
"duplicate section '$this->section' "
245 .
"at line {$this->lineNum} of $this->file\n" );
254 if ( $this->section ) {
264 $this->sectionLineNum = [];
265 $this->sectionData = [];
266 $this->section =
null;
283 if ( is_null( $this->section ) ) {
284 throw new MWException( __METHOD__ .
" can not verify a null section!\n" );
290 throw new MWException( __METHOD__ .
" can not verify zero sections!\n" );
295 return isset( $data[$token] );
303 "'%s' without '%s' at line %s of %s\n",
312 "'%s' with unexpected tokens '%s' at line %s of %s\n",
320 return array_values(
$tokens )[0];
324 $this->articles[] = [
Using a hook running we can avoid having all this option specific stuff in our mainline code Using the function 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
clearSection()
Clear section name and its data.
checkSection( $tokens, $fatal=true)
Verify the current section data has some value for the given token name(s) (first parameter).
$sectionData
String|null: current test section being analyzed.
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
if(is_array( $mode)) switch( $mode) $input
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
Allows to change the fields on the form that will be generated $name
__construct( $file, $options)
static read( $file, array $options=[])
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
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
addRequirement( $type, $name)
addArticle( $name, $text, $line)