1.20.x config_file_storage.inc public ConfigFileStorage::rename($name, $new_name)

Renames a configuration object in the storage.

Parameters

string $name: The name of a configuration object to rename.

string $new_name: The new name of a configuration object.

Return value

bool: TRUE on success, FALSE otherwise.

Overrides ConfigStorageInterface::rename

File

drivers/config_file/config_file_storage.inc, line 164

Class

ConfigFileStorage
Defines the file storage controller.

Code

public function rename($name, $new_name) {
  $status = @rename($this->getFilePath($name), $this->getFilePath($new_name));
  if ($status === FALSE) {
    throw new ConfigStorageException('Failed to rename configuration file from: ' . $this->getFilePath($name) . ' to: ' . $this->getFilePath($new_name));
  }
  return TRUE;
}