MediaWiki REL1_30
rebuildSitesCache.php
Go to the documentation of this file.
1<?php
2
23require_once __DIR__ . '/Maintenance.php';
24
31
32 public function __construct() {
33 parent::__construct();
34
35 $this->addDescription( 'Cache sites as json for file-based lookup.' );
36 $this->addOption( 'file', 'File to output the json to', false, true );
37 }
38
39 public function execute() {
40 $sitesCacheFileBuilder = new SitesCacheFileBuilder(
41 \MediaWiki\MediaWikiServices::getInstance()->getSiteLookup(),
42 $this->getCacheFile()
43 );
44
45 $sitesCacheFileBuilder->build();
46 }
47
51 private function getCacheFile() {
52 if ( $this->hasOption( 'file' ) ) {
53 $jsonFile = $this->getOption( 'file' );
54 } else {
55 $jsonFile = $this->getConfig()->get( 'SitesCacheFile' );
56
57 if ( $jsonFile === false ) {
58 $this->error( 'Error: No file set in configuration for SitesCacheFile.', 1 );
59 }
60 }
61
62 return $jsonFile;
63 }
64
65}
66
67$maintClass = "RebuildSitesCache";
68require_once RUN_MAINTENANCE_IF_MAIN;
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
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.
Maintenance script to dump a SiteStore as a static json file.
__construct()
Default constructor.
execute()
Do the actual work.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults error
Definition hooks.txt:2581
require_once RUN_MAINTENANCE_IF_MAIN
A helper class for throttling authentication attempts.