As discovered at #1522040: Google server returns 404 for gears_init.js, results in PHP warning (and likely broken functionality), Google has removed the gears_init.js file from their servers.

Which will cause a warning like this in device_geolocation_init() of the Device Geolocation sub-module:

Warning: file_get_contents(http://code.google.com/apis/gears/gears_init.js): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found in drupal_build_js_cache() 

The attached patch is a workaround that adds gears_init.js locally and loads from the module's js directory instead.

Comments

socialnicheguru’s picture

git apply s*patch
smart_ip-gears_init_new_location_7.x-1.x.patch:11: trailing whitespace.
drupal_add_js(drupal_get_path('module', 'device_geolocation') . '/js/gears_init.js');
warning: 1 line adds whitespace errors.

damien_vancouver’s picture

Assigned: Unassigned » damien_vancouver
Status: Needs review » Needs work

Hi, I'll re-roll the patch because...

I submitted a bug request upstream at the ip_geolocation javascript library, and the maintainer there has included the gears_init.js code into the main ip_geo.js.

@see http://code.google.com/p/geo-location-javascript/issues/detail?id=48

Anyway, the fix has now changed for downstream modules. Rather than include a locally cached gears_init.js, we just need to not drupal_add_js() it at all.
Also it means that failing configurations will now just start working again (though the 404 error will remain).

So, I will prepare a revised patch and resubmit here (without extra whitespace). Thanks!

damien_vancouver’s picture

Status: Needs work » Needs review
StatusFileSize
new4.77 KB

Disregard what I said in #2, smart_ip doesn't use geo-location-javascript.

So my first patch was right (other than the whitespace). I've re-rolled it to fix that - this one should apply cleanly.

imoreno’s picture

Status: Needs review » Reviewed & tested by the community

Hi,
applying patch #3 on 7.x - 1.5 version from 2012-Feb-29 eliminates the error and now it's gone.
I think it can be committed.

BR
Itzhak

socialnicheguru’s picture

same here

arpeggio’s picture

Status: Reviewed & tested by the community » Fixed

Hi, I have committed/pushed the patch @ #3 and I've also ported this fix to 6.x. Please use the dev version. Thank you damien_vancouver for sharing the fix.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.