40 const PARSE_THRESHOLD_SEC = 1.0;
42 const CLOCK_FUDGE = 10;
44 const LAG_WAIT_TIMEOUT = 15;
47 parent::__construct(
'refreshLinks', $title, $params );
49 $this->removeDuplicates = (
51 !isset( $params[
'range'] ) &&
53 !( isset( $params[
'pages'] ) && count( $params[
'pages'] ) != 1 )
64 $job->command =
'refreshLinksPrioritized';
76 $job->command =
'refreshLinksDynamic';
85 if ( !empty( $this->params[
'recursive'] ) ) {
89 if ( !isset(
$params[
'range'] ) ) {
93 'timeout' => self::LAG_WAIT_TIMEOUT
96 $stats = MediaWikiServices::getInstance()->getStatsdDataFactory();
97 $stats->increment(
'refreshlinks.lag_wait_failed' );
102 $extraParams[
'triggeredRecursive'] =
true;
109 [
'params' => $extraParams ]
113 } elseif ( isset( $this->params[
'pages'] ) ) {
114 foreach ( $this->params[
'pages']
as $pageId => $nsAndKey ) {
115 list( $ns, $dbKey ) = $nsAndKey;
131 $stats = MediaWikiServices::getInstance()->getStatsdDataFactory();
143 if ( !empty( $this->params[
'triggeringRevisionId'] ) ) {
147 $this->params[
'triggeringRevisionId'],
156 $stats->increment(
'refreshlinks.rev_not_found' );
157 $this->
setLastError(
"Revision not found for {$title->getPrefixedDBkey()}" );
159 } elseif ( $revision->getId() != $latest || $revision->getPage() !==
$page->getId() ) {
164 $stats->increment(
'refreshlinks.rev_not_current' );
165 $this->
setLastError(
"Revision {$revision->getId()} is not current" );
172 $content = $revision->getContentHandler()->makeEmptyContent();
176 $parserOptions =
$page->makeParserOptions(
'canonical' );
180 if ( isset( $this->params[
'rootJobTimestamp'] ) ) {
181 $opportunistic = !empty( $this->params[
'isOpportunistic'] );
183 $skewedTimestamp = $this->params[
'rootJobTimestamp'];
184 if ( $opportunistic ) {
194 if (
$page->getLinksTimestamp() > $skewedTimestamp ) {
196 $stats->increment(
'refreshlinks.update_skipped' );
200 if (
$page->getTouched() >= $this->params[
'rootJobTimestamp'] || $opportunistic ) {
215 $stats->increment(
'refreshlinks.parser_cached' );
217 $start = microtime(
true );
220 $title, $revision->getId(), $parserOptions,
false );
221 $elapsed = microtime(
true ) - $start;
225 if ( $elapsed >= self::PARSE_THRESHOLD_SEC
226 &&
$page->shouldCheckParserCache( $parserOptions, $revision->getId() )
234 $stats->increment(
'refreshlinks.parser_uncached' );
237 $updates =
$content->getSecondaryDataUpdates(
240 !empty( $this->params[
'useRecursiveLinksUpdate'] ),
244 foreach ( $updates
as $key => $update ) {
249 $update->setRevision( $revision );
250 if ( !empty( $this->params[
'triggeringUser'] ) ) {
251 $userInfo = $this->params[
'triggeringUser'];
252 if ( $userInfo[
'userId'] ) {
258 $update->setTriggeringUser(
$user );
271 $info = parent::getDeduplicationInfo();
272 if ( is_array( $info[
'params'] ) ) {
275 if ( isset( $info[
'pages'] ) ) {
276 unset( $info[
'namespace'] );
277 unset( $info[
'title'] );
285 return isset( $this->params[
'pages'] ) ? count( $this->params[
'pages'] ) : 1;
static newFromName($name, $validate= 'valid')
Static factory method for creation from username.
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
getLatestRevID($flags=0)
What is the page_latest field for this page?
__construct(Title $title, array $params)
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
wfGetDB($db, $groups=[], $wiki=false)
Get a Database object.
the array() calling protocol came about after MediaWiki 1.4rc1.
processing should stop and the error should be shown to the user * false
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
Class the manages updates of *_link tables as well as similar extension-managed tables.
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException'returning false will NOT prevent logging $e
$wgUpdateRowsPerJob
Number of rows to update per job.
Class to both describe a background job and handle jobs.
static newFromId($id)
Static factory method for creation from a given user ID.
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 MediaWikiServices
Represents a title within MediaWiki.
when a variable name is used in a it is silently declared as a new local masking the global
static newFromTitle(LinkTarget $linkTarget, $id=0, $flags=0)
Load either the current, or a specified, revision that's attached to a given link target...
wfTimestamp($outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
runForTitle(Title $title)
static runUpdates(array $updates, $mode= 'run')
Convenience method, calls doUpdate() on every DataUpdate in the array.
static invalidateCache(Title $title, $revid=null)
Clear the info cache for a given Title.
Exception class for replica DB wait timeouts.
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 $parserOutput
const GAID_FOR_UPDATE
Used to be GAID_FOR_UPDATE define.
static makeTitleSafe($ns, $title, $fragment= '', $interwiki= '')
Create a new Title from a namespace index and a DB key.
wfWikiID()
Get an ASCII string identifying this wiki This is used as a prefix in memcached keys.
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
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account $user
static singleton($wiki=false)
static singleton()
Get an instance of this object.
Job to update link tables for pages.
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
static newFromId($id, $flags=0)
Load a page revision from a given revision ID number.
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
static newDynamic(Title $title, array $params)
wfGetLBFactory()
Get the load balancer factory object.
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
getDeduplicationInfo()
Subclasses may need to override this to make duplication detection work.
static newPrioritized(Title $title, array $params)
to move a page</td >< td > &*You are moving the page across *A non empty talk page already exists under the new or *You uncheck the box below In those you will have to move or merge the page manually if desired</td >< td > be sure to &You are responsible for making sure that links continue to point where they are supposed to go Note that the page will &a page at the new title
array $params
Array of job parameters.
static partitionBacklinkJob(Job $job, $bSize, $cSize, $opts=[])
Break down $job into approximately ($bSize/$cSize) leaf jobs and a single partition job that covers t...
const TS_UNIX
Unix time - the number of seconds since 1970-01-01 00:00:00 UTC.
static acquirePageLock(IDatabase $dbw, $pageId, $why= 'atomicity')
Acquire a lock for performing link table updates for a page on a DB.
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