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