Skip to content
Permalink
Browse files

MDL-56347 caching: Better class variables for notices.

  • Loading branch information...
mr-russ authored and Rajesh Taneja committed Oct 11, 2016
1 parent ca08b73 commit a14e7965497b13e2135d0ed0c65df240872117ce
Showing with 7 additions and 4 deletions.
  1. +7 −4 cache/tests/fixtures/lib.php
@@ -535,6 +535,11 @@ public static function phpunit_disable() {
parent::disable();
}
/**
* @var bool Whether the warning notice about alternative cache store used has been displayed.
*/
protected $altcachestorenotice = false;
/**
* Creates a store instance given its name and configuration.
*
@@ -547,8 +552,6 @@ public static function phpunit_disable() {
*/
public function create_store_from_config($name, array $details, cache_definition $definition) {
static $noticeshown = false;
if (isset($details['use_test_store'])) {
// name, plugin, alt
$class = 'cachestore_'.$details['plugin'];
@@ -562,10 +565,10 @@ public function create_store_from_config($name, array $details, cache_definition
}
// Notify user that alternative store is being used, so action can be taken.
if (!$noticeshown) {
if (!$this->altcachestorenotice) {
echo PHP_EOL . "++ WARNING: " . 'Failed to use "' . $details['plugin'] . '" cache store, alt "' .
$details['alt']['plugin'] . '" cache store is used.' . PHP_EOL . PHP_EOL;
$noticeshown = true;
$this->altcachestorenotice = true;
}
$details = $details['alt'];
$details['class'] = 'cachestore_'.$details['plugin'];

0 comments on commit a14e796

Please sign in to comment.
You can’t perform that action at this time.