42 foreach ( $reader->requirements
as $type => $reqsOfType ) {
43 foreach ( $reqsOfType
as $name => $unused ) {
53 'tests' => $reader->tests,
54 'articles' => $reader->articles
60 $this->fh = fopen( $this->
file,
"rt" );
63 throw new MWException(
"Couldn't open file '$file'\n" );
67 'runDisabled' =>
false,
70 $this->runDisabled =
$options[
'runDisabled'];
79 [
'html/php',
'html/*',
'html',
'result' ],
false );
81 $tidySection = $this->
checkSection( [
'html/php+tidy',
'html+tidy' ],
false );
84 $data = array_map(
'ParserTestRunner::chomp', $this->sectionData );
93 throw new MWException(
"Test at {$this->file}:{$this->sectionLineNum['test']} " .
94 "lacks input section" );
97 if ( preg_match(
'/\\bdisabled\\b/i',
$data[
'options'] ) && !$this->runDisabled ) {
102 if ( $tidySection ===
false && $nonTidySection ===
false ) {
103 if ( isset(
$data[
'html/parsoid'] ) || isset(
$data[
'wikitext/edited'] ) ) {
107 throw new MWException(
"Test at {$this->file}:{$this->sectionLineNum['test']} " .
108 "lacks result section" );
112 if ( !preg_match( $this->regex,
$data[
'test'] ) ) {
118 'test' =>
$data[
'test'],
119 'desc' =>
$data[
'test'],
121 'options' =>
$data[
'options'],
122 'config' =>
$data[
'config'],
123 'line' => $this->sectionLineNum[
'test'],
127 if ( $nonTidySection !==
false ) {
130 'result' =>
$data[$nonTidySection],
131 'resultSection' => $nonTidySection
134 if ( $tidySection !==
false ) {
137 'desc' =>
$data[
'test'] .
' (with tidy)',
138 'result' =>
$data[$tidySection],
139 'resultSection' => $tidySection,
140 'options' =>
$data[
'options'] .
' tidy',
144 } elseif ( $tidySection !==
false ) {
147 'result' =>
$data[$tidySection],
148 'resultSection' => $tidySection,
149 'options' =>
$data[
'options'] .
' tidy'
152 throw new MWException(
"Test at {$this->file}:{$this->sectionLineNum['test']} " .
153 "lacks result section" );
158 while ( (
$line = fgets( $this->fh ) ) !==
false ) {
163 $this->section = strtolower(
$matches[1] );
165 if ( $this->section ==
'endarticle' ) {
171 $this->sectionData[
'text'], $this->lineNum );
178 if ( $this->section ==
'endhooks' ) {
181 foreach ( explode(
"\n", $this->sectionData[
'hooks'] )
as $line ) {
194 if ( $this->section ==
'endfunctionhooks' ) {
197 foreach ( explode(
"\n", $this->sectionData[
'functionhooks'] )
as $line ) {
210 if ( $this->section ==
'endtransparenthooks' ) {
213 foreach ( explode(
"\n", $this->sectionData[
'transparenthooks'] )
as $line ) {
226 if ( $this->section ==
'end' ) {
233 if ( isset( $this->sectionData[$this->section] ) ) {
234 throw new MWException(
"duplicate section '$this->section' "
235 .
"at line {$this->lineNum} of $this->file\n" );
244 if ( $this->section ) {
254 $this->sectionLineNum = [];
255 $this->sectionData = [];
256 $this->section =
null;
273 if ( is_null( $this->section ) ) {
274 throw new MWException( __METHOD__ .
" can not verify a null section!\n" );
280 throw new MWException( __METHOD__ .
" can not verify zero sections!\n" );
285 return isset(
$data[$token] );
293 "'%s' without '%s' at line %s of %s\n",
302 "'%s' with unexpected tokens '%s' at line %s of %s\n",
310 return array_values(
$tokens )[0];
314 $this->articles[] = [
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
static chomp( $s)
Remove last character if it is a newline.
addArticle( $name, $text, $line)
clearSection()
Clear section name and its data.
__construct( $file, $options)
$sectionData
String|null: current test section being analyzed.
checkSection( $tokens, $fatal=true)
Verify the current section data has some value for the given token name(s) (first parameter).
addRequirement( $type, $name)
static read( $file, array $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
$data
Utility to generate mapping file used in mw.Title (phpCharToUpper.json)
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
Allows to change the fields on the form that will be generated $name
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
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 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))
if(is_array($mode)) switch( $mode) $input