Getting database info to module

2 posts / 0 new
Last post
#1 Thu, 09/08/2011 - 08:54
MachineRebel

Getting database info to module

Hi -

I'm trying to make a tool in virtualmin that allows a domain owner to work with the databases they own. To start, I'm trying display a list of databases in the index.cgi. I've seen that you can pass a domain to the CGI using feature_links like this:

sub feature_links
{
    local ($d) = @_;

    open FILE, ">>", "/tmp/plugin_debug.txt" or die $!;
    print FILE "Called Feature links\n";
    close FILE;

    return ( { 'mod' => $module_name,
           'desc' => "My module",
           'page' => 'index.cgi?dom='.$d->{'dom'},
           'cat' => 'services',
             } );
}

but feature_links isn't being called for me, even after deleting and re-adding a domain. (same thing for feature_setup) When does feature_links and feature_setup get called?

My questions is, how do you get information about the domain, the user, (and the databases they own) over to the CGI? I looked through the module API, and I can't find the functions for pulling that information out. I see how it's available to the callbacks in virtual-feature.pl, but it seems that's separate from the CGIs

feature_webmin is successfully being called to make sure this module is available to all domains.

Thanks!! -Mike

Mon, 09/12/2011 - 15:56
andreychek

We discussed this via IRC... it looks like the issue is that all the plugin functions need to be implemented (even with just dummy information) before the feature will show up in Virtual Server's "Enabled Features" list.

And until it's listed there, Virtualmin won't think it's enabled, so "feature_links" wouldn't be called. By implementing the other plugin functions, the above code should begin working.

Topic locked