Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Plugin install_options and uninstall

Quote Reply
Plugin install_options and uninstall
Couple questions about the Plugin Wizard.
-------------------------
in sub uninstall{...}, is it necessary to have the parameter list?

To install:
$mgr->install_options('Guestbook', [['gb_sort_order', 'DESC', 'Specify the sort order for comment listings', 'RADIO', ['Descending','Ascending'], ['DESC','ASC'], '']]);

To uninstall:
$mgr->uninstall_options('Guestbook', [['gb_sort_order', 'DESC', 'Specify the sort order for comment listings', 'RADIO', ['Descending','Ascending'], ['DESC','ASC'], '']]);

Can uninstall_options be shortened something like below?
$mgr->uninstall_options('Guestbook', 'gb_sort_order');

-------------------------
When uninstalling a plugin... who is responsible for deleting the .cgi files? GT or developer?
I ask because the Wizard installs the .cgi file, but doesn't generate any code to delete it on uninstall.
Even deleting the plugin from the Manager leaves the .cgi files behind.

Same for templates?

-------------------------
language.txt file...

During install of plugin, I add:
my $selected_dir = "$CFG->{admin_root_path}/templates/$CFG->{default_template_set}";
my $language = GT::Config->load("$selected_dir/language.txt", { create_ok => 0, inheritance => 1, local => 1, debug => $CFG->{debug_level}, header => <<HEADER });
# This file is auto-generated and contains a perl hash of your
# language variables for the '$selected_dir' template set.
# Generated: [localtime]
# vim:syn=perl:ts=4
HEADER

$language->{GB_NAME_REQUIRED} = 'You must enter your Name.';
...
...
$language->save();

How do I delete language entries on uninstall?
Shouldn't we almost have a language_pluginname.txt file that could just be deleted?

---------------------
Plugin docs...
Under Plugins
Manager displays nothing
Wizard displays nothing

Are these docs "to come" or is something wrong on my end?

-----------------------

Thank you
Chris
RGB World, Inc. - Software &amp; Web Development.
rgbworld.com
Quote Reply
Re: [rgbworld] Plugin install_options and uninstall In reply to
Quote:
Can uninstall_options be shortened something like below?
$mgr->uninstall_options('Guestbook', 'gb_sort_order');

Yes, theoritically, yes. I should check Plugins.pm to tell you sure anwer.


Quote:
When uninstalling a plugin... who is responsible for deleting the .cgi files? GT or developer?
I ask because the Wizard installs the .cgi file, but doesn't generate any code to delete it on uninstall.
Even deleting the plugin from the Manager leaves the .cgi files behind.

No. You should handle these kind of file operations manually.
Templates and cgi files are not deleted at uninstall, AFAIR (as far as I rememeber).

But would be a good idea, to have high level install/uninstall features, which could also manage the file uninstalls.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] Plugin install_options and uninstall In reply to
So, as a plugin developer...

Do I just leave the following files on uninstall?
- plugin.cgi
- Plugin.pm
- language.txt entries

I thought the purpose of an installer was to install/remove EVERYTHING I installed, leaving GLinks the way I found it.

Please advise if it is "common" behavior to just leave the files mentioned above - on an uninstall.

Thanks,
Chris
RGB World, Inc. - Software &amp; Web Development.
rgbworld.com
Quote Reply
Re: [rgbworld] Plugin install_options and uninstall In reply to
It's a minor annoyance to not automaticly remove files, IMO. I also don't care too much for the excess code used for extracting files from the tar. It'd be much less code if it just ran a loop on a hash of files and their installed to directory.

What I was thinking about doing for my blogger program was use my own form in pre_uninstall for complete unininstalls. when the submit button is clicked, an extra parameter is passed designating an extra step in the uninstall process. Then you can check for that parameter in the uninstall routine and do whatever you want (drop columns/tables, delete templates, etc.).

Philip
------------------
Limecat is not pleased.
Quote Reply
Re: [fuzzy logic] Plugin install_options and uninstall In reply to
Just put your uninstall code in the uninstall routine. It will run, and it can do all the clean up.

I think starting with 2.1 the plugin manager automatically removes all hooks and options when it is uninstalled. It was up to you to delete any templates, .cgi files, tables, etc.

You can put options in the pre-uninstall, to ask if you want the templates, language files, etc removed, but it's up to you to actually use those flags and do something to them.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [rgbworld] Plugin install_options and uninstall In reply to
Code:
foreach my $lang_key (keys %$language) {
next if ($lang_key !~ /^GB_/);
delete $language->{$lang_key};
};


Load the config, run the above code, save the config.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [rgbworld] Plugin install_options and uninstall In reply to
Quote:
Do I just leave the following files on uninstall?
- plugin.cgi
- Plugin.pm
- language.txt entries

I thought the purpose of an installer was to install/remove EVERYTHING I installed, leaving GLinks the way I found it.

In my TopLinks plugin, I took care of to uninstall what my plugin installed: all the files, SQL columns, SQL tables, templates. None of my other plugins needed such advanced installer/uninstaller.
But in the future, when I will release a complex plugin again, will have advanced installer/uninstaller. An advanced installer/uninstaller needs a lot additional (sometimes complex) work. I started to develop a common installer/uninstaller code, which will make easier such tasks easier, but I will not have more time for it, until I don't finish my studies.

Not all existing plugins does this, so this depends on the plugin developer (if takes care to do additional work).

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...