MediaWiki  1.27.1
ArrayDiffFormatter.php
Go to the documentation of this file.
1 <?php
32 
38  public function format( $diff ) {
39  $oldline = 1;
40  $newline = 1;
41  $retval = [];
42  foreach ( $diff->getEdits() as $edit ) {
43  switch ( $edit->getType() ) {
44  case 'add':
45  foreach ( $edit->getClosing() as $line ) {
46  $retval[] = [
47  'action' => 'add',
48  'new' => $line,
49  'newline' => $newline++
50  ];
51  }
52  break;
53  case 'delete':
54  foreach ( $edit->getOrig() as $line ) {
55  $retval[] = [
56  'action' => 'delete',
57  'old' => $line,
58  'oldline' => $oldline++,
59  ];
60  }
61  break;
62  case 'change':
63  foreach ( $edit->getOrig() as $key => $line ) {
64  $retval[] = [
65  'action' => 'change',
66  'old' => $line,
67  'new' => $edit->getClosing( $key ),
68  'oldline' => $oldline++,
69  'newline' => $newline++,
70  ];
71  }
72  break;
73  case 'copy':
74  $oldline += count( $edit->getOrig() );
75  $newline += count( $edit->getOrig() );
76  }
77  }
78 
79  return $retval;
80  }
81 
82 }
magic word the default is to use $key to get the and $key value or $key value text $key value html to format the value $key
Definition: hooks.txt:2321
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
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
Definition: injection.txt:35
$line
Definition: cdb.php:59
A pseudo-formatter that just passes along the Diff::$edits array.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account incomplete not yet checked for validity & $retval
Definition: hooks.txt:242
Base class for diff formatters.