dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Avoid using the deprecated ParserCache::singleton()
[lhc/web/wiklou.git]
/
includes
/
jobqueue
/
jobs
/
RefreshLinksJob.php
diff --git
a/includes/jobqueue/jobs/RefreshLinksJob.php
b/includes/jobqueue/jobs/RefreshLinksJob.php
index
02bb829
..
424fcec
100644
(file)
--- a/
includes/jobqueue/jobs/RefreshLinksJob.php
+++ b/
includes/jobqueue/jobs/RefreshLinksJob.php
@@
-39,9
+39,9
@@
use Wikimedia\Rdbms\DBReplicationWaitError;
class RefreshLinksJob extends Job {
/** @var float Cache parser output when it takes this long to render */
const PARSE_THRESHOLD_SEC = 1.0;
class RefreshLinksJob extends Job {
/** @var float Cache parser output when it takes this long to render */
const PARSE_THRESHOLD_SEC = 1.0;
- /** @var int
eger
Lag safety margin when comparing root job times to last-refresh times */
+ /** @var int Lag safety margin when comparing root job times to last-refresh times */
const CLOCK_FUDGE = 10;
const CLOCK_FUDGE = 10;
- /** @var int
eger
How many seconds to wait for replica DBs to catch up */
+ /** @var int How many seconds to wait for replica DBs to catch up */
const LAG_WAIT_TIMEOUT = 15;
function __construct( Title $title, array $params ) {
const LAG_WAIT_TIMEOUT = 15;
function __construct( Title $title, array $params ) {
@@
-207,7
+207,7
@@
class RefreshLinksJob extends Job {
if ( $page->getTouched() >= $this->params['rootJobTimestamp'] || $opportunistic ) {
// Cache is suspected to be up-to-date. As long as the cache rev ID matches
// and it reflects the job's triggering change, then it is usable.
if ( $page->getTouched() >= $this->params['rootJobTimestamp'] || $opportunistic ) {
// Cache is suspected to be up-to-date. As long as the cache rev ID matches
// and it reflects the job's triggering change, then it is usable.
- $parserOutput =
ParserCache::singleton
()->getDirty( $page, $parserOptions );
+ $parserOutput =
$services->getParserCache
()->getDirty( $page, $parserOptions );
if ( !$parserOutput
|| $parserOutput->getCacheRevisionId() != $revision->getId()
|| $parserOutput->getCacheTime() < $skewedTimestamp
if ( !$parserOutput
|| $parserOutput->getCacheRevisionId() != $revision->getId()
|| $parserOutput->getCacheTime() < $skewedTimestamp
@@
-234,7
+234,7
@@
class RefreshLinksJob extends Job {
&& $parserOutput->isCacheable()
) {
$ctime = wfTimestamp( TS_MW, (int)$start ); // cache time
&& $parserOutput->isCacheable()
) {
$ctime = wfTimestamp( TS_MW, (int)$start ); // cache time
-
ParserCache::singleton
()->save(
+
$services->getParserCache
()->save(
$parserOutput, $page, $parserOptions, $ctime, $revision->getId()
);
}
$parserOutput, $page, $parserOptions, $ctime, $revision->getId()
);
}
@@
-279,6
+279,10
@@
class RefreshLinksJob extends Job {
InfoAction::invalidateCache( $title );
InfoAction::invalidateCache( $title );
+ // Commit any writes here in case this method is called in a loop.
+ // In that case, the scoped lock will fail to be acquired.
+ $lbFactory->commitAndWaitForReplication( __METHOD__, $ticket );
+
return true;
}
return true;
}
@@
-297,6
+301,12
@@
class RefreshLinksJob extends Job {
}
public function workItemCount() {
}
public function workItemCount() {
- return isset( $this->params['pages'] ) ? count( $this->params['pages'] ) : 1;
+ if ( !empty( $this->params['recursive'] ) ) {
+ return 0; // nothing actually refreshed
+ } elseif ( isset( $this->params['pages'] ) ) {
+ return count( $this->params['pages'] );
+ }
+
+ return 1; // one title
}
}
}
}