[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Avoid using the deprecated ParserCache::singleton()

2017-09-09 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/376855 )

Change subject: Avoid using the deprecated ParserCache::singleton()
..


Avoid using the deprecated ParserCache::singleton()

Change-Id: I0da6d9cbfad26c89bf5dab564071ef97acaf44f9
---
M includes/api/ApiPurge.php
M includes/jobqueue/jobs/RefreshLinksJob.php
M includes/page/Article.php
M includes/page/WikiPage.php
M includes/poolcounter/PoolWorkArticleView.php
M maintenance/compareParserCache.php
6 files changed, 21 insertions(+), 11 deletions(-)

Approvals:
  Aaron Schulz: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/api/ApiPurge.php b/includes/api/ApiPurge.php
index 83227a2..35f93e0 100644
--- a/includes/api/ApiPurge.php
+++ b/includes/api/ApiPurge.php
@@ -25,6 +25,7 @@
  * @file
  */
 use MediaWiki\Logger\LoggerFactory;
+use MediaWiki\MediaWikiServices;
 
 /**
  * API interface for page purging
@@ -98,7 +99,7 @@
$r['linkupdate'] = true;
 
if ( $enableParserCache ) {
-   $pcache = 
ParserCache::singleton();
+   $pcache = 
MediaWikiServices::getInstance()->getParserCache();
$pcache->save( 
$p_result, $page, $popts );
}
}
diff --git a/includes/jobqueue/jobs/RefreshLinksJob.php 
b/includes/jobqueue/jobs/RefreshLinksJob.php
index 9f3550f..424fcec 100644
--- a/includes/jobqueue/jobs/RefreshLinksJob.php
+++ b/includes/jobqueue/jobs/RefreshLinksJob.php
@@ -207,7 +207,7 @@
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
@@ -234,7 +234,7 @@
&& $parserOutput->isCacheable()
) {
$ctime = wfTimestamp( TS_MW, (int)$start ); // 
cache time
-   ParserCache::singleton()->save(
+   $services->getParserCache()->save(
$parserOutput, $page, $parserOptions, 
$ctime, $revision->getId()
);
}
diff --git a/includes/page/Article.php b/includes/page/Article.php
index f52cd8d..5b03a22 100644
--- a/includes/page/Article.php
+++ b/includes/page/Article.php
@@ -466,7 +466,7 @@
# Allow frames by default
$outputPage->allowClickjacking();
 
-   $parserCache = ParserCache::singleton();
+   $parserCache = 
MediaWikiServices::getInstance()->getParserCache();
 
$parserOptions = $this->getParserOptions();
# Render printable version, use printable version cache
diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php
index bf8a597..312edbd 100644
--- a/includes/page/WikiPage.php
+++ b/includes/page/WikiPage.php
@@ -1070,7 +1070,8 @@
}
 
if ( $useParserCache ) {
-   $parserOutput = ParserCache::singleton()->get( $this, 
$parserOptions );
+   $parserOutput = 
MediaWikiServices::getInstance()->getParserCache()
+   ->get( $this, $parserOptions );
if ( $parserOutput !== false ) {
return $parserOutput;
}
@@ -2162,7 +2163,7 @@
 
// Save it to the parser cache.
// Make sure the cache time matches page_touched to avoid 
double parsing.
-   ParserCache::singleton()->save(
+   MediaWikiServices::getInstance()->getParserCache()->save(
$editInfo->output, $this, $editInfo->popts,
$revision->getTimestamp(), $editInfo->revid
);
diff --git a/includes/poolcounter/PoolWorkArticleView.php 
b/includes/poolcounter/PoolWorkArticleView.php
index 1f1add7..17b62d7 100644
--- a/includes/poolcounter/PoolWorkArticleView.php
+++ b/includes/poolcounter/PoolWorkArticleView.php
@@ -17,6 +17,7 

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Avoid using the deprecated ParserCache::singleton()

2017-09-08 Thread Legoktm (Code Review)
Legoktm has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/376855 )

Change subject: Avoid using the deprecated ParserCache::singleton()
..

Avoid using the deprecated ParserCache::singleton()

Change-Id: I0da6d9cbfad26c89bf5dab564071ef97acaf44f9
---
M includes/api/ApiPurge.php
M includes/jobqueue/jobs/RefreshLinksJob.php
M includes/page/Article.php
M includes/page/WikiPage.php
M includes/poolcounter/PoolWorkArticleView.php
M maintenance/compareParserCache.php
6 files changed, 22 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/55/376855/1

diff --git a/includes/api/ApiPurge.php b/includes/api/ApiPurge.php
index 83227a2..35f93e0 100644
--- a/includes/api/ApiPurge.php
+++ b/includes/api/ApiPurge.php
@@ -25,6 +25,7 @@
  * @file
  */
 use MediaWiki\Logger\LoggerFactory;
+use MediaWiki\MediaWikiServices;
 
 /**
  * API interface for page purging
@@ -98,7 +99,7 @@
$r['linkupdate'] = true;
 
if ( $enableParserCache ) {
-   $pcache = 
ParserCache::singleton();
+   $pcache = 
MediaWikiServices::getInstance()->getParserCache();
$pcache->save( 
$p_result, $page, $popts );
}
}
diff --git a/includes/jobqueue/jobs/RefreshLinksJob.php 
b/includes/jobqueue/jobs/RefreshLinksJob.php
index 9f3550f..ec2695c 100644
--- a/includes/jobqueue/jobs/RefreshLinksJob.php
+++ b/includes/jobqueue/jobs/RefreshLinksJob.php
@@ -207,7 +207,8 @@
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 );
+   $parserCache = 
MediaWikiServices::getInstance()->getParserCache();
+   $parserOutput = $parserCache->getDirty( $page, 
$parserOptions );
if ( !$parserOutput
|| $parserOutput->getCacheRevisionId() 
!= $revision->getId()
|| $parserOutput->getCacheTime() < 
$skewedTimestamp
@@ -234,7 +235,8 @@
&& $parserOutput->isCacheable()
) {
$ctime = wfTimestamp( TS_MW, (int)$start ); // 
cache time
-   ParserCache::singleton()->save(
+   $parserCache = 
MediaWikiServices::getInstance()->getParserCache();
+   $parserCache->save(
$parserOutput, $page, $parserOptions, 
$ctime, $revision->getId()
);
}
diff --git a/includes/page/Article.php b/includes/page/Article.php
index f52cd8d..5b03a22 100644
--- a/includes/page/Article.php
+++ b/includes/page/Article.php
@@ -466,7 +466,7 @@
# Allow frames by default
$outputPage->allowClickjacking();
 
-   $parserCache = ParserCache::singleton();
+   $parserCache = 
MediaWikiServices::getInstance()->getParserCache();
 
$parserOptions = $this->getParserOptions();
# Render printable version, use printable version cache
diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php
index bf8a597..bb414b1 100644
--- a/includes/page/WikiPage.php
+++ b/includes/page/WikiPage.php
@@ -1070,7 +1070,7 @@
}
 
if ( $useParserCache ) {
-   $parserOutput = ParserCache::singleton()->get( $this, 
$parserOptions );
+   $parserOutput = 
MediaWikiServices::getInstance()->getParserCache()->get( $this, $parserOptions 
);
if ( $parserOutput !== false ) {
return $parserOutput;
}
@@ -2162,7 +2162,7 @@
 
// Save it to the parser cache.
// Make sure the cache time matches page_touched to avoid 
double parsing.
-   ParserCache::singleton()->save(
+   MediaWikiServices::getInstance()->getParserCache()->save(
$editInfo->output, $this, $editInfo->popts,
$revision->getTimestamp(), $editInfo->revid
);
diff --git a/includes/poolcounter/PoolWorkArticleView.php 
b/includes/poolcounter/PoolWorkArticleView.php
index