In the "REGENERATE GETLOCATIONS MARKER CACHE", the help read as follow:

You are using the Private download method. For markers to work properly. you must press the Regenerate button, manually copy js/getlocations_markers.js from the files directory to a location accessible by the webserver, and enter the file path relative to the Drupal root (including the filename) in this field. Example: sites/default/misc/getlocations_markers.js

Where's getlocations_markers.js in the first place ? I looked in the downloaded module, in the files folder (which contain an empty 'getlocations' folder), did a search on my server but the file is no where to be found. How am I suppose to copy it ?

Comments

hutch’s picture

Assuming that you have installed some markers in sites/all/libraries as per the instructions on the project page, the default place for getlocations_markers.js is in sites/default/files/getlocations/js/
You should check the settings in admin/config/media/file-system and make sure that 'Public file system path' exists and has the right permissions. Set the default to 'Public local files served by the webserver.', go back to the getlocations config page and regenerate the markers. If you really want to use the Private method you should copy that file over to wherever you have set the private files path and reset the default in the File system settings.

If you are having problems regenerating markers you should find an entry in the drupal log which might help.
Ensure that the private file path can be written to so that the file can be regenerated.

dmegatool’s picture

Switching to the public file system allowed me to generate the file. Seems like everything would work from here but I really need the private file system.

The logs show "Getlocations write error when saving the marker configuration to ." and the error when clicking regenrate is "Getlocations is unable to save the marker configuration, so the markers will not work. Please check file system permissions of !"

As you can see, the dot and the ! at the end seems weird. Like if the path wasn't set or something.

hutch’s picture

There is info on how to set up 'private' file system here:
http://drupal.org/documentation/modules/file scroll down to heading Managing file locations and access

Search drupal for more information.

darktygur-1’s picture

Category: support » bug

The instructions aren't accurate, and it wouldn't even work anyway.

If private files are enabled, this module will attempt to save the marker cache to a blank path ("" - a zero length string) unless you put something in the Path to getlocations_markers.js text field and then scroll down and click Save before you click Regenerate. The instructions say to click Regenerate and copy the file before putting something in the text field, which will never work because there won't be a file to copy.

I created a blank one, made sure it had write permissions, and entered the path to that. After doing that, I got a pair of errors:

  • The selected file /path/to/tmp/fileA3X9o6 could not be uploaded, because the destination is not properly configured.
  • Getlocations is unable to save the marker bundle, so the markers will not work. Please check file system permissions of sites/default/misc/getlocations_markers.js!

The first error error came from within file_copy(), which was indirectly called by file_save_data(), which was directly called by this module. Note that there is no path after the word destination in the first error (file_copy() has a %directory placeholder right there). The destination was blanked by file_create_path() because the path was not inside the "file system directory". Due to the use of file_create_path(), file_copy(), file_move(), and file_save_data() can only handle a destination inside the files directory. Because this module attempts to use file_save_data() to save the file outside the files directory when private files are enabled, it is doomed to fail.

In our case, we're actually ok with the file sitting in the private files directory and getting requested as system/files/js/getlocations_markers.js whenever it is needed. We're aware of the effect this is supposed to have on performance, and we've concluded that it's not a problem. So I will be patching our install to just do that. I can post it here if you want it, or you can try to fix this. The fix might be as simple as replacing that file_save_data() call and updating the instructions.

hutch’s picture

Patches are always welcome.

darktygur-1’s picture

Oops. I just noticed the version on this issue. I was testing in D6, not D7. Judging from the OP, my first large paragraph should still apply.

However, my experience after I created the blank file might only apply to D6. Looking at the D7 source code, the functions that replaced those D6 functions that I cited don't seem to care anymore whether they're operating on files inside the files directory.

hutch’s picture

Status: Active » Closed (works as designed)
broon’s picture

I just want to add that I got that error on a regular basis since I needed to use private files system as well. I copied the js file to /sites/all/misc/marker.js and entered that path in the settings. I even set chmod of misc folder and the file to 777, still I'd get that error.

While this didn't bother me before, the error now caused new trouble when I moved the site to a new server where I could use drush. Drush update of drupal core failes because GetLocations throws the permission error.

I was able to update anyway (in my case from core-7.14 to core-7.16) by setting the files system to public before the drush command and resetting it afterwards. Still, I got the following error which didn't stop the update though:
WD file: The file permissions could not be set on sites/default/files/js/markers.js. [error]
(Note: files and js folder had been chmodded to 777 before update.)

hutch’s picture

In current dev the path to the markers file is "/sites/default/files/getlocations/getlocations_markers.js", not "sites/default/files/js/markers.js" This was changed to prevent a clash with js aggregation which was deleting everything in /js.
If you enter the path to the private folder in admin > config > getlocations, the file must still be named "getlocations_markers.js", that is what the code looks for as you can see in function getlocations_get_markerfile().

broon’s picture

Thanks, hutch!
This finally brought some light into the issue. After renaming my file to the default value and using the newest version 7.x-1.5 I do not get the error anymore.