function geoip_data_file_validate in GeoIP API 5
Same name and namespace in other branches
- 6 geoip.admin.inc \geoip_data_file_validate()
 - 7.2 geoip.admin.inc \geoip_data_file_validate()
 - 7 geoip.admin.inc \geoip_data_file_validate()
 
Validate that the geoip_data_file exists
1 string reference to 'geoip_data_file_validate'
- geoip_admin_settings in ./
geoip.module  - /admin/settings/geoip
 
File
- ./
geoip.module, line 85  - API for using the MaxMind GeoLite Country database
 
Code
function geoip_data_file_validate($form_element) {
  $file = $form_element['#value'];
  if (!file_exists($file)) {
    form_error($form_element, t('The GeoIP data file could not be located at the specified location.'));
  }
  else {
    $mtime = filemtime($file);
    if ($mtime < strtotime('1 months ago')) {
      drupal_set_message(t('The GeoIP database file is more than a month old. Download the latest file at <a href="@url">MaxMind.com</a>.', array(
        '@url' => 'http://www.maxmind.com/download/geoip/database/GeoIP.dat.gz',
      )), 'warning');
    }
  }
  return $form_element;
}