Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Drupal\Core\Config;
- use Drupal\Core\Config\DrupalConfigVerifiedStorage;
- /**
- * Represents an SQL-based configuration storage object.
- */
- class DrupalVerifiedStorageSQL extends DrupalVerifiedStorageFile {
- /**
- * Implements DrupalConfigVerifiedStorage::read().
- */
- public function read() {
- if (!empty($GLOBALS['databases']) && function_exists('db_table_exists') && db_table_exists('config')) {
- return db_query('SELECT data FROM {config} WHERE name = :name', array(':name' => $this->name))->fetchField();
- }
- return parent::read();
- }
- /**
- * Implements DrupalConfigVerifiedStorageInterface::writeToActive().
- */
- public function writeToActive($data) {
- return db_merge('config')
- ->key(array('name' => $this->name))
- ->fields(array('data' => $data))
- ->execute();
- }
- /**
- * @todo
- */
- public function deleteFromActive() {
- db_delete('config')
- ->condition('name', $this->name)
- ->execute();
- }
- /**
- * Implements DrupalConfigVerifiedStorageInterface::getNamesWithPrefix().
- */
- static public function getNamesWithPrefix($prefix = '') {
- return db_query('SELECT name FROM {config} WHERE name LIKE :name', array(':name' => db_like($prefix) . '%'))->fetchCol();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment