24require_once __DIR__ .
'/Maintenance.php';
33 parent::__construct();
34 $this->
addDescription(
'Send purge requests for listed pages to squid' );
35 $this->
addOption(
'purge',
'Whether to update page_touched.',
false,
false );
36 $this->
addOption(
'namespace',
'Namespace number',
false,
true );
37 $this->
addOption(
'all',
'Purge all pages',
false,
false );
38 $this->
addOption(
'delay',
'Number of seconds to delay between each purge',
false,
true );
39 $this->
addOption(
'verbose',
'Show more output',
false,
false,
'v' );
46 } elseif ( $this->
hasOption(
'namespace' ) ) {
51 $this->
output(
"Done!\n" );
61 while ( !feof( $stdin ) ) {
62 $page = trim( fgets( $stdin ) );
63 if ( preg_match(
'%^https?://%',
$page ) ) {
65 } elseif (
$page !==
'' ) {
68 $url =
$title->getInternalURL();
75 $this->
output(
"(Invalid title '$page')\n" );
79 $this->
output(
"Purging " . count(
$urls ) .
" urls\n" );
91 if ( $namespace ===
false ) {
94 $conds = [
'page_namespace' => $namespace ];
98 [
'page_id',
'page_namespace',
'page_title' ],
99 $conds + [
'page_id > ' .
$dbr->addQuotes( $startId ) ],
102 'LIMIT' => $this->mBatchSize,
103 'ORDER BY' =>
'page_id'
107 if ( !
$res->numRows() ) {
111 foreach (
$res as $row ) {
113 $url =
$title->getInternalURL();
115 $startId = $row->page_id;
127 $delay = floatval( $this->
getOption(
'delay' ) );
130 $this->
output( $url .
"\n" );
134 usleep( $delay * 1e6 );
Handles purging appropriate CDN URLs given a title (or titles)
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
getStdin( $len=null)
Return input from stdin.
getDB( $db, $groups=[], $wiki=false)
Returns a database to be used by current maintenance script.
hasOption( $name)
Checks to see if a particular param exists.
addDescription( $text)
Set the description text.
addOption( $name, $description, $required=false, $withArg=false, $shortName=false, $multiOccurrence=false)
Add a parameter to the script.
getOption( $name, $default=null)
Get an option, or return the default.
setBatchSize( $s=0)
Set the batch size.
Maintenance script that sends purge requests for listed pages to squid.
execute()
Do the actual work.
__construct()
Default constructor.
sendPurgeRequest( $urls)
Helper to purge an array of $urls.
purgeNamespace( $namespace=false)
Purge a namespace or all pages.
doPurge()
Purge URL coming from stdin.
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
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
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
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached $page
namespace and then decline to actually register it file or subcat img or subcat $title
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
require_once RUN_MAINTENANCE_IF_MAIN