MediaWiki REL1_28
Go to the documentation of this file.
41if ( PHP_SAPI != 'cli' ) {
42 die( "This filter can only be run from the command line.\n" );
45$source = file_get_contents( $argv[1] );
46$tokens = token_get_all( $source );
48$buffer = $bufferType = null;
49foreach ( $tokens as $token ) {
50 if ( is_string( $token ) ) {
51 if ( $buffer !== null && $token === ';' ) {
52 // If we still have a buffer and the statement has ended,
53 // flush it and move on.
54 echo $buffer;
55 $buffer = $bufferType = null;
56 }
57 echo $token;
58 continue;
59 }
60 list( $id, $content ) = $token;
61 switch ( $id ) {
62 case T_DOC_COMMENT:
63 // Escape slashes so that references to namespaces are not
64 // wrongly interpreted as a Doxygen "\command".
65 $content = addcslashes( $content, '\\' );
66 // Look for instances of "@var Type" not followed by $name.
67 if ( preg_match( '#@var\s+([^\s]+)\s+([^\$]+)#s', $content ) ) {
68 $buffer = preg_replace_callback(
69 // Strip the "@var Type" part and remember the type
70 '#(@var\s+)([^\s]+)#s',
71 function ( $matches ) use ( &$bufferType ) {
72 $bufferType = $matches[2];
73 return '';
74 },
76 );
77 } else {
78 echo $content;
79 }
80 break;
82 case T_VARIABLE:
83 if ( $buffer !== null ) {
84 echo $buffer;
85 echo "$bufferType $content";
86 $buffer = $bufferType = null;
87 } else {
88 echo $content;
89 }
90 break;
92 default:
93 if ( $buffer !== null ) {
95 } else {
96 echo $content;
97 }
98 break;
99 }
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
Definition deferred.txt:11
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content $content
Definition hooks.txt:1094
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:37