Gossamer Forum
Quote Reply
Backup Directory
I've found that during a plugin install, sometimes I need to modify some existing files, and if the plugin is uninstalled they should be restored back to their original state.

A perfect example is the MyLinksNG plugin. I have the a modified LINK.HTML that includes a 'Add to My Links' link after the rate it link.

To do a full uninstall, this would have to be removed...

So what I've been doing is checking for a Plugins/Backup directory during the install. If it doesn't exist, create it, then move originals of anything I'm changing in there.

During the uninstall, I reverse the process.

Is there anything already in the plugin system for this? Anyone see a better way to handle this?

If not, maybe we should all agree on a directory for backup files changed during a plugin install. We sure don't need backup directories created allover the place...

I like /Plugins/Backup/PLUGINNAME....

AlexJ

Quote Reply
Re: Backup Directory In reply to
The problems with this are legion. What if another plug-in, installed after yours, modifies the file?

You'd need to keep a registry of changed files similar to how the winInstallShield works.



PUGDOGŪ Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Forum:http://LinkSQL.com/forum
Quote Reply
Re: Backup Directory In reply to
Hmmm... I see your point there....

It can get quite complicated if you really look into it... and I don't think thats really where we want to go right now. (At least me...)

I was really just thinking aloud here. If I write a plugin and its changing files that could have already been changed, I want to at least tell them that they have been backed up, and where they were backed up to.

Of course a registry of changed files would be nice.... Lets add it to our wish list. Wink

AlexJ

Quote Reply
Re: Backup Directory In reply to
You could just create a .../Plugins/PluginName/backup directory.

Plugins will install by apparant convention, into a directory of the same name as the .pm file, but at the same level as Installed and Uninstalled directories.

If you copy any file you intend to change into a /backup directory in that named subdirectory, you will probably be ahead of the convention.



PUGDOGŪ Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Forum:http://LinkSQL.com/forum