sirdopes

Well-Known Member
PartnerNOC
Sep 25, 2007
141
0
66
Is there a way to modify the userdata file for a domain using the CustomEventHandler? I am trying to update the file after I add an addon domain. I tried calling Cpanel::Config::userdata::update_domain_datafield directly but I get permission denied since it is running as the cpanel user.
 

MattDees

Well-Known Member
Apr 29, 2005
416
1
243
Houston, TX
cPanel Access Level
Root Administrator
Well, you have a few different options here.

This code does require escalated privileges so you can use the AdminBin/AdminRun system to execute whatever you want.

You can also use the function hooks system to do this - these are already executed as root, but do not offer quite as much flexibilty as the CustomEventHandler system.

There is another option, bring it up with me tomorrow.
 

sirdopes

Well-Known Member
PartnerNOC
Sep 25, 2007
141
0
66
The function hooks look like they would work for what I am doing. Does it need to be all lower case or does the case need to be set? Right now, I just am trying to touch a file in /tmp/ when I add an addon domain. It looks like it is seeing the file and I don't have any errors in the error_log but do not see the file being touched.

/usr/local/cpanel/bin/register_hooks
Registered hook addondomain::addaddondomain
Registered 1 hooks