Forum .LRN Q&A: Package parameters question

Collapse
Posted by Paco Soler on
Hi everyone,

We are development a package to get de disk space used by:
- Community
- User
- User in one Comunity

We want to use this information to control the uploads to file-storage, comparing the three values obtained with the three parameters of the package.

When you define a parameter in a package, instances of this are created for each community that add the applet. I only need one parameter that works thus, the other two I don't need instances by each community. They would be like global parameters.

How I can declare these two parameters, so that they are global of the platform and only the administrator of the site can change them?

A service would be more advisable instead of making package?

Regards,

Paco Soler.

Collapse
Posted by Andrew Grumet on
There does seem to be a gap in the APIs and no best practice that I know of (please correct me), but there are quite a few ways to do it...

We have a function called parameter::get_from_package_key, which may work if you put the parameter in the server configuration file (config.tcl). You can also use parameter::get_from_package_key if there is only one instance of the package installed. However, it won't work if more than one instance of the package is installed.

If there are multiple packages installed and you don't want to use the server config file, you may simply want to perform regular lookups with parameter::get and not change them from instance to instance.

Another option is to declare a specific instance as canonical and always doing lookups against this instance by feeding the canonical instance id in the -package_id switch to parameter::get. I'm pretty sure the dotlrn package uses this approach, marking the instance at /dotlrn as canonical.

There may be a TIP brewing here.