Forum OpenACS Development: Un-set Tcl procedures upon package uninstall

Hi,

It has come to my awareness that there might be a need for a package to be able to un-define its Tcl procs when it is being uninstalled from the system. I noticed this problem when I uninstalled the curriculum package on our test server, and there was a server error all of a sudden ... This error occured because I hadn't followed up the removal with a server restart. The default-master thinks that the bar should still be included on each page since it concludes there's still a proc by the name curriculum::get_bar around, although it's not. The bar gets included, calls a missing proc, and all hell breaks loose :'( ...

What would be the best solution here?

(After a server restart the problem goes away, since the proc is then gone.)

Collapse
Posted by Dave Bauer on
Ola, There is a better way to detect if a package is installed. Try apm_package_installed_p.
https://openacs.org/api-doc/proc-view?proc=apm%5fpackage%5finstalled%5fp

I think both of these solutions would be true if the package was installed, but not mounted.

Collapse
Posted by Ola Hansson on
Okay. That proc calls a probably very speedy query, but keep in mind that it will run on all pages that call the default master. I am worrying that it will be too slow on busy sites... Sure, it will be a drop in the ocean compared to the bar and its registered procedure(s), but OTOH, the curriculum package will not be installed on the average installation so it might be a lot of querying for nothing.
Collapse
Posted by Dave Bauer on
Ola,

Excellent point.

Definitely don't use that on every page :)

Perhaps we need after-unmount after instance-delete and after uninstall callbacks.

Collapse
Posted by Don Baccus on
Actually that function is cached so calling it should be fine ...
Collapse
Posted by Lars Pind on
I'd like to see some more streamlined method for putting stuff into the master template, rather than packages haphazardly adding hooks for their own private stuff.

A package should register with the default master upon install, and unregister when uninstalling. (In version 5.0, 5.1, or 5.2, that is.)

/Lars