ConfigReadonlyStorage.php in Configuration Read-only mode 7
File
lib/Drupal/config_readonly/Config/ConfigReadonlyStorage.php
View source
<?php
namespace Drupal\config_readonly\Config;
use Drupal\Core\Config\CachedStorage;
class ConfigReadonlyStorage extends CachedStorage {
public function write($name, array $data) {
if ($this
->read($name) != $data) {
$this
->checkLock();
}
return parent::write($name, $data);
}
public function delete($name) {
$this
->checkLock();
return parent::delete($name);
}
public function rename($name, $new_name) {
$this
->checkLock();
return parent::rename($name, $new_name);
}
public function deleteAll($prefix = '') {
$this
->checkLock();
return parent::deleteAll($prefix);
}
protected function checkLock() {
if (settings()
->get('config_readonly') && \Drupal::lock()
->lockMayBeAvailable('config.importer')) {
throw new \Exception('Your site configuration active store is currently locked.');
}
}
}