Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Cpanel::PublicAPI deladdondomain

Discussion in 'cPanel Developers' started by morissette, Oct 28, 2011.

  1. morissette

    morissette Well-Known Member

    Joined:
    May 24, 2009
    Messages:
    119
    Likes Received:
    0
    Trophy Points:
    66
    Location:
    Austin, TX
    cPanel Access Level:
    Root Administrator
    In continuance to my previous ticket, can root not remove addon domains using the AddonDomain::deladdondomain function?

    domain,subdomain and user are defined properly but I am getting a park wrapper error.

    Does this need to be run as the user? If so would it be best to temporary create a access hash for said user and then create a new Cpanel::PublicAPI object with the new details to run the following subroutine:

    Code:
    sub deladdon{
            my $deladdon =  $cp->cpanel_api2_request('whostmgr', { 'module' => 'AddonDomain', 'func' => 'deladdondomain' },
                    {
                            'domain' => "$domain",
                            'subdomain' => "$subdom",
                            'user' => "$owner",
                    }
            );
            print Dumper $deladdon;
    }
    
    Returns Error:

    $VAR1 = {
    'cpanelresult' => {
    'apiversion' => 2,
    'error' => 'Error from park wrapper: Sorry, I do not believe you control the subdomain for removeme.com.',
    'func' => 'deladdondomain',
    'data' => [
    {
    'reason' => 'Error from park wrapper: Sorry, I do not believe you control the subdomain for removeme.com.',
    'result' => 0
    }
    ],
    'event' => {
    'result' => 1
    },
    'module' => 'AddonDomain'
    }
    };
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. sirdopes

    sirdopes Well-Known Member
    PartnerNOC

    Joined:
    Sep 25, 2007
    Messages:
    141
    Likes Received:
    0
    Trophy Points:
    66
    Are you using the subdomain or the domain key? It should be something like sub_maindomain.com for the subdomain and not the actual subdomain.
     
  3. morissette

    morissette Well-Known Member

    Joined:
    May 24, 2009
    Messages:
    119
    Likes Received:
    0
    Trophy Points:
    66
    Location:
    Austin, TX
    cPanel Access Level:
    Root Administrator
    You are so right! It's always the little things, I swear..... adds . "_$maindom"

    Code:
    sub findsubdom{
            my $userfile = "/etc/proftpd/$owner";
            open my $fh, "<", $userfile;
                    my @contents = <$fh>;
                    @contents = grep /$docroot/, @contents;
                    @contents = split(/:/, $contents[0]);
                    $subdom = $contents[0];
            close $fh;
    }
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice