Go to the documentation of this file.
41 const PARSE_THRESHOLD_SEC = 1.0;
43 const CLOCK_FUDGE = 10;
45 const LAG_WAIT_TIMEOUT = 15;
50 $this->removeDuplicates = (
65 $job->command =
'refreshLinksPrioritized';
77 $job->command =
'refreshLinksDynamic';
86 if ( !empty( $this->params[
'recursive'] ) ) {
90 if ( !isset( $this->params[
'range'] ) ) {
92 $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
93 $lbFactory->waitForReplication( [
95 'timeout' => self::LAG_WAIT_TIMEOUT
98 $stats = MediaWikiServices::getInstance()->getStatsdDataFactory();
99 $stats->increment(
'refreshlinks.lag_wait_failed' );
104 $extraParams[
'triggeredRecursive'] =
true;
111 [
'params' => $extraParams ]
115 } elseif ( isset( $this->params[
'pages'] ) ) {
116 foreach ( $this->params[
'pages']
as $nsAndKey ) {
117 list( $ns, $dbKey ) = $nsAndKey;
133 $services = MediaWikiServices::getInstance();
134 $stats =
$services->getStatsdDataFactory();
135 $lbFactory =
$services->getDBLoadBalancerFactory();
136 $ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ );
139 $page->loadPageData( WikiPage::READ_LATEST );
142 $dbw = $lbFactory->getMainLB()->getConnection(
DB_MASTER );
150 if ( !empty( $this->params[
'triggeringRevisionId'] ) ) {
154 $this->params[
'triggeringRevisionId'],
155 Revision::READ_LATEST
163 $stats->increment(
'refreshlinks.rev_not_found' );
164 $this->
setLastError(
"Revision not found for {$title->getPrefixedDBkey()}" );
166 } elseif ( $revision->getId() != $latest || $revision->getPage() !== $page->getId() ) {
171 $stats->increment(
'refreshlinks.rev_not_current' );
172 $this->
setLastError(
"Revision {$revision->getId()} is not current" );
179 $content = $revision->getContentHandler()->makeEmptyContent();
182 $parserOutput =
false;
183 $parserOptions = $page->makeParserOptions(
'canonical' );
187 if ( isset( $this->params[
'rootJobTimestamp'] ) ) {
188 $opportunistic = !empty( $this->params[
'isOpportunistic'] );
190 $skewedTimestamp = $this->params[
'rootJobTimestamp'];
191 if ( $opportunistic ) {
197 wfTimestamp( TS_UNIX, $skewedTimestamp ) + self::CLOCK_FUDGE
201 if ( $page->getLinksTimestamp() > $skewedTimestamp ) {
203 $stats->increment(
'refreshlinks.update_skipped' );
207 if ( $page->getTouched() >= $this->params[
'rootJobTimestamp'] || $opportunistic ) {
210 $parserOutput =
$services->getParserCache()->getDirty( $page, $parserOptions );
212 || $parserOutput->getCacheRevisionId() != $revision->getId()
213 || $parserOutput->getCacheTime() < $skewedTimestamp
215 $parserOutput =
false;
221 if ( $parserOutput ) {
222 $stats->increment(
'refreshlinks.parser_cached' );
224 $start = microtime(
true );
226 $parserOutput = $content->getParserOutput(
227 $title, $revision->getId(), $parserOptions,
false );
228 $elapsed = microtime(
true ) - $start;
232 if ( $elapsed >= self::PARSE_THRESHOLD_SEC
233 && $page->shouldCheckParserCache( $parserOptions, $revision->getId() )
234 && $parserOutput->isCacheable()
238 $parserOutput, $page, $parserOptions, $ctime, $revision->getId()
241 $stats->increment(
'refreshlinks.parser_uncached' );
244 $updates = $content->getSecondaryDataUpdates(
247 !empty( $this->params[
'useRecursiveLinksUpdate'] ),
254 $lbFactory->commitAndWaitForReplication( __METHOD__, $ticket );
256 foreach ( $updates
as $update ) {
261 $update->setRevision( $revision );
262 if ( !empty( $this->params[
'triggeringUser'] ) ) {
263 $userInfo = $this->params[
'triggeringUser'];
264 if ( $userInfo[
'userId'] ) {
270 $update->setTriggeringUser(
$user );
275 foreach ( $updates
as $update ) {
276 $update->setTransactionTicket( $ticket );
284 $lbFactory->commitAndWaitForReplication( __METHOD__, $ticket );
290 $info = parent::getDeduplicationInfo();
291 if ( is_array( $info[
'params'] ) ) {
294 if ( isset( $info[
'pages'] ) ) {
295 unset( $info[
'namespace'] );
296 unset( $info[
'title'] );
304 if ( !empty( $this->params[
'recursive'] ) ) {
306 } elseif ( isset( $this->params[
'pages'] ) ) {
307 return count( $this->params[
'pages'] );
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 account $user
static newFromId( $id)
Static factory method for creation from a given user ID.
processing should stop and the error should be shown to the user * false
static newFromId( $id, $flags=0)
Load a page revision from a given revision ID number.
static acquirePageLock(IDatabase $dbw, $pageId, $why='atomicity')
Acquire a lock for performing link table updates for a page on a DB.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
__construct(Title $title, array $params)
getDeduplicationInfo()
Subclasses may need to override this to make duplication detection work.
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Class the manages updates of *_link tables as well as similar extension-managed tables.
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
static newDynamic(Title $title, array $params)
static newPrioritized(Title $title, array $params)
array $params
Array of job parameters.
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 partitionBacklinkJob(Job $job, $bSize, $cSize, $opts=[])
Break down $job into approximately ($bSize/$cSize) leaf jobs and a single partition job that covers t...
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
Class to both describe a background job and handle jobs.
static newFromTitle(LinkTarget $linkTarget, $id=0, $flags=0)
Load either the current, or a specified, revision that's attached to a given link target.
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
when a variable name is used in a it is silently declared as a new masking the global
$wgUpdateRowsPerJob
Number of rows to update per job.
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
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
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.
Job to update link tables for pages.
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e
getLatestRevID( $flags=0)
What is the page_latest field for this page?
const GAID_FOR_UPDATE
Used to be GAID_FOR_UPDATE define.
Represents a title within MediaWiki.
if(count( $args)< 1) $job
static singleton( $wiki=false)
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
static invalidateCache(Title $title, $revid=null)
Clear the info cache for a given Title.
runForTitle(Title $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 MediaWikiServices
the array() calling protocol came about after MediaWiki 1.4rc1.