aboutsummaryrefslogtreecommitdiffstats
path: root/includes/cache/CacheDependency.php
diff options
context:
space:
mode:
authordaniel <daniel.kinzler@wikimedia.de>2016-05-13 21:27:06 +0200
committerBryanDavis <bdavis@wikimedia.org>2016-05-17 15:24:31 +0000
commitfc1d4d79602415d1362de9286b0729bd86d03fc1 (patch)
tree8af4aab8777d23da8a019d92b1e51ba8bc28c12b /includes/cache/CacheDependency.php
parent045ca4ca47eb3b9120599d6964b33c15bd96b6e7 (diff)
downloadmediawikicore-fc1d4d79602415d1362de9286b0729bd86d03fc1.tar.gz
mediawikicore-fc1d4d79602415d1362de9286b0729bd86d03fc1.zip
Fix installer issues introduces by MediaWikiServices
This fixes three issues with the installer: 1) Make sure LocalizationCache can find the installer's i18n files. 2) Make sure we don't try to use an SqlBagOStuff for caching before we have a functioning database. 3) Don't try to output HTML when redirecting (this is unrelated to MediaWikiServices, but came up during testing) Bug: T135169 Change-Id: I7caa932024cd771d6fa226a3ac6001c3148ecc9c
Diffstat (limited to 'includes/cache/CacheDependency.php')
-rw-r--r--includes/cache/CacheDependency.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/includes/cache/CacheDependency.php b/includes/cache/CacheDependency.php
index 2d29d8651306..a59ba97d0a00 100644
--- a/includes/cache/CacheDependency.php
+++ b/includes/cache/CacheDependency.php
@@ -20,6 +20,7 @@
* @file
* @ingroup Cache
*/
+use MediaWiki\MediaWikiServices;
/**
* This class stores an arbitrary value along with its dependencies.
@@ -247,6 +248,34 @@ class GlobalDependency extends CacheDependency {
/**
* @ingroup Cache
*/
+class MainConfigDependency extends CacheDependency {
+ private $name;
+ private $value;
+
+ function __construct( $name ) {
+ $this->name = $name;
+ $this->value = $this->getConfig()->get( $this->name );
+ }
+
+ private function getConfig() {
+ return MediaWikiServices::getInstance()->getMainConfig();
+ }
+
+ /**
+ * @return bool
+ */
+ function isExpired() {
+ if ( !$this->getConfig()->has( $this->name ) ) {
+ return true;
+ }
+
+ return $this->getConfig()->get( $this->name ) != $this->value;
+ }
+}
+
+/**
+ * @ingroup Cache
+ */
class ConstantDependency extends CacheDependency {
private $name;
private $value;