Fleshed in the config->delete() functionality
parent
dbd6ffc8f0
commit
3e49865c23
|
@ -354,6 +354,13 @@ class SignedFileStorage {
|
|||
return $verification;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a configuration file.
|
||||
*/
|
||||
public function delete() {
|
||||
@drupal_unlink($this->getFilePath());
|
||||
}
|
||||
}
|
||||
|
||||
interface DrupalConfigVerifiedStorageInterface {
|
||||
|
@ -385,6 +392,11 @@ interface DrupalConfigVerifiedStorageInterface {
|
|||
*/
|
||||
function copyFromFile();
|
||||
|
||||
/**
|
||||
* Delete the configuration data file.
|
||||
*/
|
||||
function deleteFile();
|
||||
|
||||
/**
|
||||
* Check whether the file and the verified storage is in sync.
|
||||
*
|
||||
|
@ -425,6 +437,10 @@ abstract class DrupalConfigVerifiedStorage implements DrupalConfigVerifiedStorag
|
|||
public function copyTofile() {
|
||||
return $this->signedFileStorage()->write($this->read());
|
||||
}
|
||||
|
||||
public function deleteFile() {
|
||||
return $this->signedFileStorage()->delete();
|
||||
}
|
||||
|
||||
public function copyFromFile() {
|
||||
return $this->writeToActive($this->readFromFile());
|
||||
|
@ -442,6 +458,11 @@ abstract class DrupalConfigVerifiedStorage implements DrupalConfigVerifiedStorag
|
|||
$this->writeToActive($data);
|
||||
$this->copyToFile();
|
||||
}
|
||||
|
||||
public function delete() {
|
||||
$this->deleteFromActive();
|
||||
$this->deleteFile();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -466,6 +487,12 @@ class DrupalVerifiedStorageSQL extends DrupalConfigVerifiedStorage {
|
|||
->execute();
|
||||
}
|
||||
|
||||
public function deleteFromActive() {
|
||||
db_delete('config')
|
||||
->condition('name', $this->name)
|
||||
->execute();
|
||||
}
|
||||
|
||||
static public function getNamesWithPrefix($prefix = '') {
|
||||
return db_query('SELECT name FROM {config} WHERE name LIKE :name', array(':name' => db_like($prefix) . '%'))->fetchCol();
|
||||
}
|
||||
|
@ -568,5 +595,11 @@ class DrupalConfig {
|
|||
public function save() {
|
||||
$this->_verifiedStorage->write(config_encode($this->data));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the configuration object on disk.
|
||||
*/
|
||||
public function delete() {
|
||||
$this->_verifiedStorage->delete();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue