cyberhobo/wordpress-geo-mashup

Upgrades overwrite custom files

GoogleCodeExporter opened this issue · 5 comments

When using any of the WordPress automatic upgrade options in the admin
interface, the entire geo-mashup directory is removed from the plugin
folder, along with any files that have been added to that folder, including:

custom.js
map-style.css
info-window.php
full-post.php

and any images added to the images folder.

Original issue reported on code.google.com by dylankk...@gmail.com on 28 Apr 2009 at 1:21

Thanks Bruce - very good suggestion. In fact, maybe I could write the custom 
plugin
such that it attempts to rescue files from the existing geo-mashup folder. The
problem with that is that it's likely that PHP won't be able to write to a 
plugin
folder, whereas the themes and uploads folders usually allow this. I could 
notify the
user of rescue failure due to permissions problems.

Some people have expressed a desire for different map templates and styles in 
their
different themes, so I'd like to at least support that. But I could look in the
custom plugin directory also if nothing is found in the current theme.

Ok, I'll table my uploads folder idea and consider this. Meanwhile, I think I 
will
recommend that users put styles and templates in their active theme folder, 
which has
to be better than having them deleted.

There is a long and tortured wp-hackers discussion on this subject, but I 
didn't see
any better ideas there: 

http://groups.google.com/group/wp-hackers/browse_thread/thread/a4c519c4f88d6655/
c0f9e38e7a4708dc?lnk=gst

Original comment by dylankk...@gmail.com on 28 Apr 2009 at 3:26

Ok, I've made a simple custom plugin. Besides providing a safe directory for 
you, it
does two things:

1. If it can write in its own directory, it will look for known custom files
(custom.js, map-style.css, etc) and copy them. Far from foolproof because most
default permissions won't allow it, but it's there.

2. When deactivated, your custom files will no longer be used. Nice to be able 
to
flip back to vanilla Geo Mashup, I think.

Here it is. I'm in a rush to get 1.2.5 out now, because Issue 208 is widespread.
http://wordpress-geo-mashup.googlecode.com/files/geo-mashup-custom-1.0.zip

Original comment by dylankk...@gmail.com on 15 May 2009 at 6:45

  • Changed state: Fixed

Original comment by dylankk...@gmail.com on 8 Jan 2010 at 11:43

  • Changed state: Verified
Here is my proposed solution, please let me know if you see any problems with 
it.

Remove instructions to create files in the geo-mashup folder. For current
installations (1.2.4 and earlier), warn users in the documentation to move these
files to new locations.

In future versions, try to automatically copy these files to the new locations 
when
they are found.

New locations:

custom.js -> uploads/geo-mashup/custom.js
map-style.css -> themes/<active-theme>/map-style.css
info-window.php -> themes/<active-theme>/geo-mashup-info-window.php
full-post.php -> themes/<active-theme>/geo-mashup-full-post.php

Custom icon images should also go somewhere in the current theme directory.

Original comment by dylankk...@gmail.com on 28 Apr 2009 at 1:27

I wonder if the customizations are theme-specific they might get lost as users 
migrate themes? Or cease to 
function if a theme switcher is used (there are several, in both PHP and 
JavaScript)? I also like the idea of the 
plug-in related files being kept together in an "obvious" place (like the 
plugins folder, cf. distributed across 
the installation in the 3 places you propose), so an alternative might be this:

1. /plugins/geo-mashup-core directory containing "core" plug-in files that are 
completely replaced by WP 
auto-update.
2. /plugins/geo-mashup-custom directory containing geo-mashup-custom.php and 
(optionally) the four 
files above (and potentially images such as custom markers too), that does not 
auto-update.

This also has precedent; SimplePie (optionally) contains custom files in 
/plugins/simplepie-plugin-for-
wordpress/ and the directory /plugins/simplepie-core/ is managed separately. 
Geo Mashup would look for 
any files in the custom directory and load these if it finds them via 
geo-mashup-custom.php within that 
directory, which also hooks into the WP plugin manager for informational 
reasons. So under "Manage plugins" 
in WP settings you might see this (mock up):

Geo Mashup Core     1.2.5       Tools for adding maps to your blog, and plotting posts 
on a master map. 
Configure in Settings->Geo Mashup after the plugin is activated. Documentation 
is on the project site. By 
Dylan Kuhn.

Geo Mashup Custom   1.2.5       This merely loads any optional customizations and 
makes them available 
to your geo mashup.

Original comment by bioneura...@gmail.com on 28 Apr 2009 at 3:03