MediaWiki  master
PreparedEdit.php
Go to the documentation of this file.
1 <?php
21 namespace MediaWiki\Edit;
22 
23 use Content;
27 
35 class PreparedEdit {
41  public $timestamp;
42 
48  public $revid;
49 
55  public $pstContent;
56 
62  public $format;
63 
69  public $popts;
70 
77 
83  public $newContent;
84 
90  public $oldContent;
91 
98 
102  public function getOutput() {
103  if ( !$this->canonicalOutput ) {
104  $this->canonicalOutput = call_user_func( $this->parserOutputCallback );
105  }
106 
107  return $this->canonicalOutput;
108  }
109 
117  function __get( $name ) {
118  if ( $name === 'output' ) {
119  return $this->getOutput();
120  }
121 
122  throw new RuntimeException( "Undefined field $name." );
123  }
124 }
Content null $oldContent
Current content of the page, if any.
Content null $pstContent
Content after going through pre-save transform.
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
Represents information returned by WikiPage::prepareContentForEdit()
Content $newContent
Content that is being saved (before PST)
ParserOptions $popts
Parser options used to get parser output.
callable $parserOutputCallback
Lazy-loading callback to get canonical ParserOutput object.
string $format
Content format.
int null $revid
Revision ID.
__get( $name)
Fetch the ParserOutput via a lazy-loaded callback (for backwards compatibility).
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
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:271
ParserOutput null $canonicalOutput
Parser output.
string $timestamp
Time this prepared edit was made.