Go to the documentation of this file.
24 require_once __DIR__ .
'/Maintenance.php';
33 parent::__construct();
34 $this->mDescription =
"Build file cache for content pages";
35 $this->
addOption(
'start',
'Page_id to start from',
false,
true );
36 $this->
addOption(
'end',
'Page_id to end on',
false,
true );
37 $this->
addOption(
'overwrite',
'Refresh page cache' );
46 $wgDebugToolbar =
false;
53 if ( !$wgUseFileCache ) {
54 $this->
error(
"Nothing to do -- \$wgUseFileCache is disabled.",
true );
57 $wgReadOnly =
'Building cache';
59 $start = $this->
getOption(
'start',
"0" );
60 if ( !ctype_digit( $start ) ) {
61 $this->
error(
"Invalid value for start parameter.",
true );
63 $start = intval( $start );
66 if ( !ctype_digit( $end ) ) {
67 $this->
error(
"Invalid value for end parameter.",
true );
69 $end = intval( $end );
71 $this->
output(
"Building content page file cache from page {$start}!\n" );
74 $overwrite = $this->
getOption(
'overwrite',
false );
75 $start = ( $start > 0 )
77 :
$dbr->selectField(
'page',
'MIN(page_id)',
false, __FUNCTION__ );
80 :
$dbr->selectField(
'page',
'MAX(page_id)',
false, __FUNCTION__ );
82 $this->
error(
"Nothing to do.",
true );
85 $_SERVER[
'HTTP_ACCEPT_ENCODING'] =
'bgzip';
88 $end += $this->mBatchSize - 1;
90 $blockEnd = $start + $this->mBatchSize - 1;
94 while ( $blockEnd <= $end ) {
96 $res =
$dbr->select(
'page',
array(
'page_namespace',
'page_title',
'page_id' ),
97 array(
'page_namespace' => $wgContentNamespaces,
98 "page_id BETWEEN $blockStart AND $blockEnd" ),
99 array(
'ORDER BY' =>
'page_id ASC',
'USE INDEX' =>
'PRIMARY' )
102 $dbw->begin( __METHOD__ );
103 foreach (
$res as $row ) {
109 $this->
output(
"Page {$row->page_id} has bad title\n" );
116 $context->setWikiPage(
$article->getPage() );
118 $wgOut = $context->getOutput();
121 if (
$article->isFileCacheable() ) {
123 if (
$cache->isCacheGood() ) {
127 $this->
output(
"Page {$row->page_id} already cached\n" );
132 $wgUseFileCache =
false;
137 $wgUseFileCache =
true;
140 $this->
output(
"Re-cached page {$row->page_id}\n" );
142 $this->
output(
"Cached page {$row->page_id}\n" );
145 $this->
output(
"Page {$row->page_id} not cacheable\n" );
148 $dbw->commit( __METHOD__ );
153 $this->
output(
"Done!\n" );
int $mBatchSize
Batch size.
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
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
addOption( $name, $description, $required=false, $withArg=false, $shortName=false)
Add a parameter to the script.
wfSuppressWarnings( $end=false)
Reference-counted warning suppression.
require_once RUN_MAINTENANCE_IF_MAIN
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
Maintenance script that builds file cache for content pages.
__construct()
Default constructor.
setTitle( $t)
Set the Title object.
wfRestoreWarnings()
Restore error level to previous value.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
Group all the pieces relevant to the context of a request into one instance.
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
presenting them properly to the user as errors is done by the caller $title
static newFromTitle( $title, $action)
Construct an ObjectFileCache from a Title and an action.
getOption( $name, $default=null)
Get an option, or return the default.
execute()
Do the actual work.
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
error( $err, $die=0)
Throw an error to the user.
output( $out, $channel=null)
Throw some output to the user.
Using a hook running we can avoid having all this option specific stuff in our mainline code Using the function array $article
setBatchSize( $s=0)
Set the batch size.
static newFromTitle( $title, IContextSource $context)
Create an Article object of the appropriate class for the given page.
finalSetup()
Handle some last-minute setup here.