Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Ideally this should return the string returned by google as to WHY it failed, but the following is far better than silence.
diff -r 917ae7c81790 location/geocoding/google.inc
--- a/location/geocoding/google.inc Mon Sep 27 20:05:31 2010 -0400
+++ b/location/geocoding/google.inc Tue Sep 28 13:55:26 2010 -0400
@@ -130,6 +130,7 @@
preg_match('/<code>(.*)<\/code>/', $http_reply->data, $status_code_match);
$status_code = $status_code_match[1];
if ($status_code != 200) {
+ watchdog('location', t('Google geocoding returned: %status_code', array('%status_code' => $status_code)));
return NULL;
}
@@ -137,6 +138,7 @@
preg_match('/Accuracy="([0-9])"/', $http_reply->data, $accuracy_code_match);
$accuracy_code = $accuracy_code_match[1];
if ($accuracy_code < variable_get('location_geocode_' . $location['country'] . 'google_accuracy_code', variable_get('location_geocode_google_minimum_accuracy', '3'))) {
+ watchdog('location',t('Google geocoding accuracy: %accuracy_code', array('%accuracy_code' => $accuracy_code)));
return NULL;
}
Comment | File | Size | Author |
---|---|---|---|
#2 | location_925480.patch | 1.15 KB | tobiasb |
google.inc_.patch | 2.08 KB | DanGarthwaite | |
Comments
Comment #1
sethcohn CreditAttribution: sethcohn commented+1
Comment #2
tobiasbComment #3
rooby CreditAttribution: rooby commented@tobiasb:
When setting issues to RTBC it is good to give some sort of comment like that you have tested it (and how you tested it if it is not obvious) and it works or something. Especially if no one else has commented anything along those lines.
Also, when adding a new patch you should say why. How it is different from the patches before.
I have committed a slightly modified version of the patch to all versions.
Changes I made were:
* Removed t() from the watchdog() calls as watchdog handles that itself (except for in drupal 5).
* Changed the accuracy message to make it more useful.
* Added the changes to location_geocode_au_google() in location.au.inc also. Geocoding functionalities can be overridden per country in these include files. In this case the only country that has code relevant to this patch was Australia.
http://drupal.org/cvs?commit=473176
http://drupal.org/cvs?commit=473168
http://drupal.org/cvs?commit=473172