function _varnish_execute_command in Varnish 8
Same name and namespace in other branches
- 6 varnish.module \_varnish_execute_command()
- 7 varnish.module \_varnish_execute_command()
1 call to _varnish_execute_command()
- _varnish_terminal_run in ./
varnish.module - Send one or more commands to Varnish.
File
- ./
varnish.module, line 287 - varnish.module
Code
function _varnish_execute_command($client, $command) {
// Send command and get response.
$result = socket_write($client, "{$command}\n");
$status = _varnish_read_socket($client);
if ($status['code'] != 200) {
\Drupal::logger('varnish')
->error('Received status code @code running %command. Full response text: @error', [
'@code' => $status['code'],
'%command' => $command,
'@error' => $status['msg'],
]);
return FALSE;
}
else {
// successful connection
return $status;
}
}