MediaWiki  1.23.15
HtmlTest.php
Go to the documentation of this file.
1 <?php
4 class HtmlTest extends MediaWikiTestCase {
5 
6  protected function setUp() {
7  parent::setUp();
8 
9  $langCode = 'en';
10  $langObj = Language::factory( $langCode );
11 
12  // Hardcode namespaces during test runs,
13  // so that html output based on existing namespaces
14  // can be properly evaluated.
15  $langObj->setNamespaces( array(
16  -2 => 'Media',
17  -1 => 'Special',
18  0 => '',
19  1 => 'Talk',
20  2 => 'User',
21  3 => 'User_talk',
22  4 => 'MyWiki',
23  5 => 'MyWiki_Talk',
24  6 => 'File',
25  7 => 'File_talk',
26  8 => 'MediaWiki',
27  9 => 'MediaWiki_talk',
28  10 => 'Template',
29  11 => 'Template_talk',
30  14 => 'Category',
31  15 => 'Category_talk',
32  100 => 'Custom',
33  101 => 'Custom_talk',
34  ) );
35 
36  $this->setMwGlobals( array(
37  'wgLanguageCode' => $langCode,
38  'wgContLang' => $langObj,
39  'wgLang' => $langObj,
40  ) );
41  }
42 
46  public function testElementBasics() {
47  $this->assertEquals(
48  '<img/>',
49  Html::element( 'img', null, '' ),
50  'No close tag for short-tag elements'
51  );
52 
53  $this->assertEquals(
54  '<element></element>',
55  Html::element( 'element', null, null ),
56  'Close tag for empty element (null, null)'
57  );
58 
59  $this->assertEquals(
60  '<element></element>',
61  Html::element( 'element', array(), '' ),
62  'Close tag for empty element (array, string)'
63  );
64 
65  $this->assertEquals(
66  '<img/>',
67  Html::element( 'img', null, '' ),
68  'Self-closing tag for short-tag elements'
69  );
70  }
71 
72  public function dataXmlMimeType() {
73  return array(
74  // ( $mimetype, $isXmlMimeType )
75  # HTML is not an XML MimeType
76  array( 'text/html', false ),
77  # XML is an XML MimeType
78  array( 'text/xml', true ),
79  array( 'application/xml', true ),
80  # XHTML is an XML MimeType
81  array( 'application/xhtml+xml', true ),
82  # Make sure other +xml MimeTypes are supported
83  # SVG is another random MimeType even though we don't use it
84  array( 'image/svg+xml', true ),
85  # Complete random other MimeTypes are not XML
86  array( 'text/plain', false ),
87  );
88  }
89 
94  public function testXmlMimeType( $mimetype, $isXmlMimeType ) {
95  $this->assertEquals( $isXmlMimeType, Html::isXmlMimeType( $mimetype ) );
96  }
97 
101  public function testExpandAttributesSkipsNullAndFalse() {
102 
103  ### EMPTY ########
104  $this->assertEmpty(
105  Html::expandAttributes( array( 'foo' => null ) ),
106  'skip keys with null value'
107  );
108  $this->assertEmpty(
109  Html::expandAttributes( array( 'foo' => false ) ),
110  'skip keys with false value'
111  );
112  $this->assertNotEmpty(
113  Html::expandAttributes( array( 'foo' => '' ) ),
114  'keep keys with an empty string'
115  );
116  }
117 
121  public function testExpandAttributesForBooleans() {
122  $this->assertEquals(
123  '',
124  Html::expandAttributes( array( 'selected' => false ) ),
125  'Boolean attributes do not generates output when value is false'
126  );
127  $this->assertEquals(
128  '',
129  Html::expandAttributes( array( 'selected' => null ) ),
130  'Boolean attributes do not generates output when value is null'
131  );
132 
133  $this->assertEquals(
134  ' selected=""',
135  Html::expandAttributes( array( 'selected' => true ) ),
136  'Boolean attributes have no value when value is true'
137  );
138  $this->assertEquals(
139  ' selected=""',
140  Html::expandAttributes( array( 'selected' ) ),
141  'Boolean attributes have no value when value is true (passed as numerical array)'
142  );
143 
144  $this->assertEquals(
145  ' selected=""',
146  Html::expandAttributes( array( 'selected' => true ) ),
147  'Boolean attributes have empty string value when value is true'
148  );
149  }
150 
156  public function testExpandAttributesVariousExpansions() {
157  ### NOT EMPTY ####
158  $this->assertEquals(
159  ' empty_string=""',
160  Html::expandAttributes( array( 'empty_string' => '' ) ),
161  'Empty string is always quoted'
162  );
163  $this->assertEquals(
164  ' key="value"',
165  Html::expandAttributes( array( 'key' => 'value' ) ),
166  'Simple string value needs no quotes'
167  );
168  $this->assertEquals(
169  ' one="1"',
170  Html::expandAttributes( array( 'one' => 1 ) ),
171  'Number 1 value needs no quotes'
172  );
173  $this->assertEquals(
174  ' zero="0"',
175  Html::expandAttributes( array( 'zero' => 0 ) ),
176  'Number 0 value needs no quotes'
177  );
178  }
179 
186  public function testExpandAttributesListValueAttributes() {
187  ### STRING VALUES
188  $this->assertEquals(
189  ' class="redundant spaces here"',
190  Html::expandAttributes( array( 'class' => ' redundant spaces here ' ) ),
191  'Normalization should strip redundant spaces'
192  );
193  $this->assertEquals(
194  ' class="foo bar"',
195  Html::expandAttributes( array( 'class' => 'foo bar foo bar bar' ) ),
196  'Normalization should remove duplicates in string-lists'
197  );
198  ### "EMPTY" ARRAY VALUES
199  $this->assertEquals(
200  ' class=""',
201  Html::expandAttributes( array( 'class' => array() ) ),
202  'Value with an empty array'
203  );
204  $this->assertEquals(
205  ' class=""',
206  Html::expandAttributes( array( 'class' => array( null, '', ' ', ' ' ) ) ),
207  'Array with null, empty string and spaces'
208  );
209  ### NON-EMPTY ARRAY VALUES
210  $this->assertEquals(
211  ' class="foo bar"',
212  Html::expandAttributes( array( 'class' => array(
213  'foo',
214  'bar',
215  'foo',
216  'bar',
217  'bar',
218  ) ) ),
219  'Normalization should remove duplicates in the array'
220  );
221  $this->assertEquals(
222  ' class="foo bar"',
223  Html::expandAttributes( array( 'class' => array(
224  'foo bar',
225  'bar foo',
226  'foo',
227  'bar bar',
228  ) ) ),
229  'Normalization should remove duplicates in string-lists in the array'
230  );
231  }
232 
238  public function testExpandAttributesSpaceSeparatedAttributesWithBoolean() {
239  $this->assertEquals(
240  ' class="booltrue one"',
241  Html::expandAttributes( array( 'class' => array(
242  'booltrue' => true,
243  'one' => 1,
244 
245  # Method use isset() internally, make sure we do discard
246  # attributes values which have been assigned well known values
247  'emptystring' => '',
248  'boolfalse' => false,
249  'zero' => 0,
250  'null' => null,
251  ) ) )
252  );
253  }
254 
263  public function testValueIsAuthoritativeInSpaceSeparatedAttributesArrays() {
264  $this->assertEquals(
265  ' class=""',
266  Html::expandAttributes( array( 'class' => array(
267  'GREEN',
268  'GREEN' => false,
269  'GREEN',
270  ) ) )
271  );
272  }
273 
277  public function testNamespaceSelector() {
278  $this->assertEquals(
279  '<select id="namespace" name="namespace">' . "\n" .
280  '<option value="0">(Main)</option>' . "\n" .
281  '<option value="1">Talk</option>' . "\n" .
282  '<option value="2">User</option>' . "\n" .
283  '<option value="3">User talk</option>' . "\n" .
284  '<option value="4">MyWiki</option>' . "\n" .
285  '<option value="5">MyWiki Talk</option>' . "\n" .
286  '<option value="6">File</option>' . "\n" .
287  '<option value="7">File talk</option>' . "\n" .
288  '<option value="8">MediaWiki</option>' . "\n" .
289  '<option value="9">MediaWiki talk</option>' . "\n" .
290  '<option value="10">Template</option>' . "\n" .
291  '<option value="11">Template talk</option>' . "\n" .
292  '<option value="14">Category</option>' . "\n" .
293  '<option value="15">Category talk</option>' . "\n" .
294  '<option value="100">Custom</option>' . "\n" .
295  '<option value="101">Custom talk</option>' . "\n" .
296  '</select>',
297  Html::namespaceSelector(),
298  'Basic namespace selector without custom options'
299  );
300 
301  $this->assertEquals(
302  '<label for="mw-test-namespace">Select a namespace:</label>&#160;' .
303  '<select id="mw-test-namespace" name="wpNamespace">' . "\n" .
304  '<option value="all">all</option>' . "\n" .
305  '<option value="0">(Main)</option>' . "\n" .
306  '<option value="1">Talk</option>' . "\n" .
307  '<option value="2" selected="">User</option>' . "\n" .
308  '<option value="3">User talk</option>' . "\n" .
309  '<option value="4">MyWiki</option>' . "\n" .
310  '<option value="5">MyWiki Talk</option>' . "\n" .
311  '<option value="6">File</option>' . "\n" .
312  '<option value="7">File talk</option>' . "\n" .
313  '<option value="8">MediaWiki</option>' . "\n" .
314  '<option value="9">MediaWiki talk</option>' . "\n" .
315  '<option value="10">Template</option>' . "\n" .
316  '<option value="11">Template talk</option>' . "\n" .
317  '<option value="14">Category</option>' . "\n" .
318  '<option value="15">Category talk</option>' . "\n" .
319  '<option value="100">Custom</option>' . "\n" .
320  '<option value="101">Custom talk</option>' . "\n" .
321  '</select>',
322  Html::namespaceSelector(
323  array( 'selected' => '2', 'all' => 'all', 'label' => 'Select a namespace:' ),
324  array( 'name' => 'wpNamespace', 'id' => 'mw-test-namespace' )
325  ),
326  'Basic namespace selector with custom values'
327  );
328 
329  $this->assertEquals(
330  '<label for="namespace">Select a namespace:</label>&#160;' .
331  '<select id="namespace" name="namespace">' . "\n" .
332  '<option value="0">(Main)</option>' . "\n" .
333  '<option value="1">Talk</option>' . "\n" .
334  '<option value="2">User</option>' . "\n" .
335  '<option value="3">User talk</option>' . "\n" .
336  '<option value="4">MyWiki</option>' . "\n" .
337  '<option value="5">MyWiki Talk</option>' . "\n" .
338  '<option value="6">File</option>' . "\n" .
339  '<option value="7">File talk</option>' . "\n" .
340  '<option value="8">MediaWiki</option>' . "\n" .
341  '<option value="9">MediaWiki talk</option>' . "\n" .
342  '<option value="10">Template</option>' . "\n" .
343  '<option value="11">Template talk</option>' . "\n" .
344  '<option value="14">Category</option>' . "\n" .
345  '<option value="15">Category talk</option>' . "\n" .
346  '<option value="100">Custom</option>' . "\n" .
347  '<option value="101">Custom talk</option>' . "\n" .
348  '</select>',
349  Html::namespaceSelector(
350  array( 'label' => 'Select a namespace:' )
351  ),
352  'Basic namespace selector with a custom label but no id attribtue for the <select>'
353  );
354  }
355 
356  public function testCanFilterOutNamespaces() {
357  $this->assertEquals(
358  '<select id="namespace" name="namespace">' . "\n" .
359  '<option value="2">User</option>' . "\n" .
360  '<option value="4">MyWiki</option>' . "\n" .
361  '<option value="5">MyWiki Talk</option>' . "\n" .
362  '<option value="6">File</option>' . "\n" .
363  '<option value="7">File talk</option>' . "\n" .
364  '<option value="8">MediaWiki</option>' . "\n" .
365  '<option value="9">MediaWiki talk</option>' . "\n" .
366  '<option value="10">Template</option>' . "\n" .
367  '<option value="11">Template talk</option>' . "\n" .
368  '<option value="14">Category</option>' . "\n" .
369  '<option value="15">Category talk</option>' . "\n" .
370  '</select>',
371  Html::namespaceSelector(
372  array( 'exclude' => array( 0, 1, 3, 100, 101 ) )
373  ),
374  'Namespace selector namespace filtering.'
375  );
376  }
377 
378  public function testCanDisableANamespaces() {
379  $this->assertEquals(
380  '<select id="namespace" name="namespace">' . "\n" .
381  '<option disabled="" value="0">(Main)</option>' . "\n" .
382  '<option disabled="" value="1">Talk</option>' . "\n" .
383  '<option disabled="" value="2">User</option>' . "\n" .
384  '<option disabled="" value="3">User talk</option>' . "\n" .
385  '<option disabled="" value="4">MyWiki</option>' . "\n" .
386  '<option value="5">MyWiki Talk</option>' . "\n" .
387  '<option value="6">File</option>' . "\n" .
388  '<option value="7">File talk</option>' . "\n" .
389  '<option value="8">MediaWiki</option>' . "\n" .
390  '<option value="9">MediaWiki talk</option>' . "\n" .
391  '<option value="10">Template</option>' . "\n" .
392  '<option value="11">Template talk</option>' . "\n" .
393  '<option value="14">Category</option>' . "\n" .
394  '<option value="15">Category talk</option>' . "\n" .
395  '<option value="100">Custom</option>' . "\n" .
396  '<option value="101">Custom talk</option>' . "\n" .
397  '</select>',
398  Html::namespaceSelector( array(
399  'disable' => array( 0, 1, 2, 3, 4 )
400  ) ),
401  'Namespace selector namespace disabling'
402  );
403  }
404 
409  public function testHtmlElementAcceptsNewHtml5TypesInHtml5Mode( $HTML5InputType ) {
410  $this->assertEquals(
411  '<input type="' . $HTML5InputType . '"/>',
412  Html::element( 'input', array( 'type' => $HTML5InputType ) ),
413  'In HTML5, Html::element() should accept type="' . $HTML5InputType . '"'
414  );
415  }
416 
421  public static function provideHtml5InputTypes() {
422  $types = array(
423  'datetime',
424  'datetime-local',
425  'date',
426  'month',
427  'time',
428  'week',
429  'number',
430  'range',
431  'email',
432  'url',
433  'search',
434  'tel',
435  'color',
436  );
437  $cases = array();
438  foreach ( $types as $type ) {
439  $cases[] = array( $type );
440  }
441 
442  return $cases;
443  }
444 
450  public function testDropDefaults( $expected, $element, $attribs, $message = '' ) {
451  $this->assertEquals( $expected, Html::element( $element, $attribs ), $message );
452  }
453 
454  public static function provideElementsWithAttributesHavingDefaultValues() {
455  # Use cases in a concise format:
456  # <expected>, <element name>, <array of attributes> [, <message>]
457  # Will be mapped to Html::element()
458  $cases = array();
459 
460  ### Generic cases, match $attribDefault static array
461  $cases[] = array( '<area/>',
462  'area', array( 'shape' => 'rect' )
463  );
464 
465  $cases[] = array( '<button type="submit"></button>',
466  'button', array( 'formaction' => 'GET' )
467  );
468  $cases[] = array( '<button type="submit"></button>',
469  'button', array( 'formenctype' => 'application/x-www-form-urlencoded' )
470  );
471 
472  $cases[] = array( '<canvas></canvas>',
473  'canvas', array( 'height' => '150' )
474  );
475  $cases[] = array( '<canvas></canvas>',
476  'canvas', array( 'width' => '300' )
477  );
478  # Also check with numeric values
479  $cases[] = array( '<canvas></canvas>',
480  'canvas', array( 'height' => 150 )
481  );
482  $cases[] = array( '<canvas></canvas>',
483  'canvas', array( 'width' => 300 )
484  );
485 
486  $cases[] = array( '<command/>',
487  'command', array( 'type' => 'command' )
488  );
489 
490  $cases[] = array( '<form></form>',
491  'form', array( 'action' => 'GET' )
492  );
493  $cases[] = array( '<form></form>',
494  'form', array( 'autocomplete' => 'on' )
495  );
496  $cases[] = array( '<form></form>',
497  'form', array( 'enctype' => 'application/x-www-form-urlencoded' )
498  );
499 
500  $cases[] = array( '<input/>',
501  'input', array( 'formaction' => 'GET' )
502  );
503  $cases[] = array( '<input/>',
504  'input', array( 'type' => 'text' )
505  );
506 
507  $cases[] = array( '<keygen/>',
508  'keygen', array( 'keytype' => 'rsa' )
509  );
510 
511  $cases[] = array( '<link/>',
512  'link', array( 'media' => 'all' )
513  );
514 
515  $cases[] = array( '<menu></menu>',
516  'menu', array( 'type' => 'list' )
517  );
518 
519  $cases[] = array( '<script></script>',
520  'script', array( 'type' => 'text/javascript' )
521  );
522 
523  $cases[] = array( '<style></style>',
524  'style', array( 'media' => 'all' )
525  );
526  $cases[] = array( '<style></style>',
527  'style', array( 'type' => 'text/css' )
528  );
529 
530  $cases[] = array( '<textarea></textarea>',
531  'textarea', array( 'wrap' => 'soft' )
532  );
533 
534  ### SPECIFIC CASES
535 
536  # <link type="text/css">
537  $cases[] = array( '<link/>',
538  'link', array( 'type' => 'text/css' )
539  );
540 
541  # <input> specific handling
542  $cases[] = array( '<input type="checkbox"/>',
543  'input', array( 'type' => 'checkbox', 'value' => 'on' ),
544  'Default value "on" is stripped of checkboxes',
545  );
546  $cases[] = array( '<input type="radio"/>',
547  'input', array( 'type' => 'radio', 'value' => 'on' ),
548  'Default value "on" is stripped of radio buttons',
549  );
550  $cases[] = array( '<input type="submit" value="Submit"/>',
551  'input', array( 'type' => 'submit', 'value' => 'Submit' ),
552  'Default value "Submit" is kept on submit buttons (for possible l10n issues)',
553  );
554  $cases[] = array( '<input type="color"/>',
555  'input', array( 'type' => 'color', 'value' => '' ),
556  );
557  $cases[] = array( '<input type="range"/>',
558  'input', array( 'type' => 'range', 'value' => '' ),
559  );
560 
561  # <button> specific handling
562  # see remarks on http://msdn.microsoft.com/en-us/library/ie/ms535211%28v=vs.85%29.aspx
563  $cases[] = array( '<button type="submit"></button>',
564  'button', array( 'type' => 'submit' ),
565  'According to standard the default type is "submit". Depending on compatibility mode IE might use "button", instead.',
566  );
567 
568  # <select> specifc handling
569  $cases[] = array( '<select multiple=""></select>',
570  'select', array( 'size' => '4', 'multiple' => true ),
571  );
572  # .. with numeric value
573  $cases[] = array( '<select multiple=""></select>',
574  'select', array( 'size' => 4, 'multiple' => true ),
575  );
576  $cases[] = array( '<select></select>',
577  'select', array( 'size' => '1', 'multiple' => false ),
578  );
579  # .. with numeric value
580  $cases[] = array( '<select></select>',
581  'select', array( 'size' => 1, 'multiple' => false ),
582  );
583 
584  # Passing an array as value
585  $cases[] = array( '<a class="css-class-one css-class-two"></a>',
586  'a', array( 'class' => array( 'css-class-one', 'css-class-two' ) ),
587  "dropDefaults accepts values given as an array"
588  );
589 
590  # FIXME: doDropDefault should remove defaults given in an array
591  # Expected should be '<a></a>'
592  $cases[] = array( '<a class=""></a>',
593  'a', array( 'class' => array( '', '' ) ),
594  "dropDefaults accepts values given as an array"
595  );
596 
597  # Craft the Html elements
598  $ret = array();
599  foreach ( $cases as $case ) {
600  $ret[] = array(
601  $case[0],
602  $case[1], $case[2],
603  isset( $case[3] ) ? $case[3] : ''
604  );
605  }
606 
607  return $ret;
608  }
609 
613  public function testFormValidationBlacklist() {
614  $this->assertEmpty(
615  Html::expandAttributes( array( 'min' => 1, 'max' => 100, 'pattern' => 'abc', 'required' => true, 'step' => 2 ) ),
616  'Blacklist form validation attributes.'
617  );
618  $this->assertEquals(
619  ' step="any"',
620  Html::expandAttributes( array( 'min' => 1, 'max' => 100, 'pattern' => 'abc', 'required' => true, 'step' => 'any' ) ),
621  'Allow special case "step=any".'
622  );
623  }
624 }
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been 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 in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
Template
! article Main Page ! text blah blah ! endarticle !article Template
Definition: parserTests.txt:209
is
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
text
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 text
Definition: design.txt:12
Category
Category objects are immutable, strictly speaking.
Definition: Category.php:31
$ret
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 noclasses & $ret
Definition: hooks.txt:1530
Html\expandAttributes
static expandAttributes( $attribs)
Given an associative array of element attributes, generate a string to stick after the element name i...
Definition: Html.php:383
key
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 but I prefer the flexibility This should also do the output encoding The system allocates a global one in $wgOut Title Represents the title of an and does all the work of translating among various forms such as plain database key
Definition: design.txt:25
File
Implements some public methods and some protected utility functions which are required by multiple ch...
Definition: File.php:50
Html\element
static element( $element, $attribs=array(), $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
Definition: Html.php:141
MediaWikiTestCase\setMwGlobals
setMwGlobals( $pairs, $value=null)
Definition: MediaWikiTestCase.php:302
MediaWikiTestCase
Definition: MediaWikiTestCase.php:6
MediaWiki
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
options
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 options(say) and put it in one place. Instead of having little title-reversing if-blocks spread all over the codebase in showAnArticle
MediaWikiTestCase\setUp
setUp()
Definition: MediaWikiTestCase.php:187
output
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
in
Prior to maintenance scripts were a hodgepodge of code that had no cohesion or formal method of action Beginning in
Definition: maintenance.txt:1
are
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
Definition: contenthandler.txt:5
as
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
Definition: distributors.txt:9
though
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 though
Definition: globals.txt:25
values
This code would result in ircNotify being run twice when an article is and once for brion Hooks can return three possible values
Definition: hooks.txt:177
Language\factory
static factory( $code)
Get a cached or new language object for a given language code.
Definition: Language.php:184
name
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
Definition: design.txt:12
select
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 select() and insert() are usually more convenient. They take care of things like table prefixes and escaping for you. If you really need to make your own SQL
$attribs
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 noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing & $attribs
Definition: hooks.txt:1530
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:59
MediaWiki
The MediaWiki class is the helper class for the index.php entry point.
Definition: Wiki.php:28
$type
$type
Definition: testCompression.php:46