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';
82 global $wgUpdateRowsPerJob;
85 if ( !empty( $this->params[
'recursive'] ) ) {
89 if ( !isset(
$params[
'range'] ) ) {
91 $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
94 'timeout' => self::LAG_WAIT_TIMEOUT
97 $stats = MediaWikiServices::getInstance()->getStatsdDataFactory();
98 $stats->increment(
'refreshlinks.lag_wait_failed' );
103 $extraParams[
'triggeredRecursive'] =
true;
110 [
'params' => $extraParams ]
114 } elseif ( isset( $this->params[
'pages'] ) ) {
115 foreach ( $this->params[
'pages']
as $pageId => $nsAndKey ) {
116 list( $ns, $dbKey ) = $nsAndKey;
132 $services = MediaWikiServices::getInstance();
133 $stats =
$services->getStatsdDataFactory();
135 $ticket =
$lbFactory->getEmptyTransactionTicket( __METHOD__ );
138 $page->loadPageData( WikiPage::READ_LATEST );
149 if ( !empty( $this->params[
'triggeringRevisionId'] ) ) {
153 $this->params[
'triggeringRevisionId'],
154 Revision::READ_LATEST
162 $stats->increment(
'refreshlinks.rev_not_found' );
163 $this->
setLastError(
"Revision not found for {$title->getPrefixedDBkey()}" );
165 } elseif ( $revision->getId() != $latest || $revision->getPage() !==
$page->getId() ) {
170 $stats->increment(
'refreshlinks.rev_not_current' );
171 $this->
setLastError(
"Revision {$revision->getId()} is not current" );
178 $content = $revision->getContentHandler()->makeEmptyContent();
182 $parserOptions =
$page->makeParserOptions(
'canonical' );
186 if ( isset( $this->params[
'rootJobTimestamp'] ) ) {
187 $opportunistic = !empty( $this->params[
'isOpportunistic'] );
189 $skewedTimestamp = $this->params[
'rootJobTimestamp'];
190 if ( $opportunistic ) {
200 if (
$page->getLinksTimestamp() > $skewedTimestamp ) {
202 $stats->increment(
'refreshlinks.update_skipped' );
206 if (
$page->getTouched() >= $this->params[
'rootJobTimestamp'] || $opportunistic ) {
221 $stats->increment(
'refreshlinks.parser_cached' );
223 $start = microtime(
true );
226 $title, $revision->getId(), $parserOptions,
false );
227 $elapsed = microtime(
true ) - $start;
231 if ( $elapsed >= self::PARSE_THRESHOLD_SEC
232 &&
$page->shouldCheckParserCache( $parserOptions, $revision->getId() )
240 $stats->increment(
'refreshlinks.parser_uncached' );
243 $updates =
$content->getSecondaryDataUpdates(
246 !empty( $this->params[
'useRecursiveLinksUpdate'] ),
250 foreach ( $updates
as $key => $update ) {
255 $update->setRevision( $revision );
256 if ( !empty( $this->params[
'triggeringUser'] ) ) {
257 $userInfo = $this->params[
'triggeringUser'];
258 if ( $userInfo[
'userId'] ) {
264 $update->setTriggeringUser(
$user );
269 foreach ( $updates
as $update ) {
270 $update->setTransactionTicket( $ticket );
280 $info = parent::getDeduplicationInfo();
281 if ( is_array( $info[
'params'] ) ) {
284 if ( isset( $info[
'pages'] ) ) {
285 unset( $info[
'namespace'] );
286 unset( $info[
'title'] );
294 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
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
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
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...
const TS_UNIX
Unix time - the number of seconds since 1970-01-01 00:00:00 UTC.
wfTimestamp($outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
runForTitle(Title $title)
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.
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
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.
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title after the basic globals have been set but before ordinary actions take place or wrap services the preferred way to define a new service is the $wgServiceWiringFiles array $services
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.
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)
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)
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...
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