public function RestrictIpMapper::saveWhitelistedPaths in Restrict IP 8
Same name and namespace in other branches
- 8.2 src/Mapper/RestrictIpMapper.php \Drupal\restrict_ip\Mapper\RestrictIpMapper::saveWhitelistedPaths()
- 3.x src/Mapper/RestrictIpMapper.php \Drupal\restrict_ip\Mapper\RestrictIpMapper::saveWhitelistedPaths()
*
Overrides RestrictIpMapperInterface::saveWhitelistedPaths
File
- src/
Mapper/ RestrictIpMapper.php, line 59
Class
Namespace
Drupal\restrict_ip\MapperCode
public function saveWhitelistedPaths(array $whitelistedPaths, $overwriteExisting = TRUE) {
if ($overwriteExisting) {
$this->connection
->query('DELETE FROM {restrict_ip_paths} WHERE type = :white', [
':white' => 'white',
]);
}
$query = $this->connection
->insert('restrict_ip_paths')
->fields([
'type',
'path',
]);
foreach ($whitelistedPaths as $whitelisted_path) {
$query
->values([
'type' => 'white',
'path' => $whitelisted_path,
]);
}
$query
->execute();
}