function drush_ip2country_status in IP-based Determination of a Visitor's Country 8
Same name and namespace in other branches
- 7 ip2country.drush.inc \drush_ip2country_status()
Displays the time and RIR of the last database update.
File
- ./
ip2country.drush.inc, line 208 - ip2country module integration with Drush 8 and earlier.
Code
function drush_ip2country_status() {
$stateService = \Drupal::service('state');
$update_time = $stateService
->get('ip2country_last_update');
if (!empty($update_time)) {
$dateFormatter = \Drupal::service('date.formatter');
$message = dt('Database last updated on @date at @time from @registry server.', [
'@date' => $dateFormatter
->format($update_time, 'ip2country_date'),
'@time' => $dateFormatter
->format($update_time, 'ip2country_time'),
'@registry' => mb_strtoupper($stateService
->get('ip2country_last_update_rir')),
]);
}
else {
$message = dt('Database is empty.');
}
drush_print($message);
}