Overriding CPanel functions

These APIs are available for Installatron Plugin:
Installatron Plugin Automation API and CLI
Installatron Plugin Licensing API
Installatron Plugin Control Panel Integration API
Post Reply
Posts: 2
Joined: Wed Mar 23, 2016 12:18 am

Overriding CPanel functions

Post by bug248 » Wed Mar 23, 2016 12:42 am

We run Installatron via CPanel and would like to change some of the data that is displayed/used for users accounts.

From what we can determine we can place code inside installercustomcode.php (i_installer_customcode) which will allow us to change or add packages. However we do not seem to be able to modify some of the details (eg. available virtual hosts, listed databases, ip addresses...).
Looking at what is defined there appears to be a class named i_cpanel which has functions which maybe related to what we need to change.

Code: Select all

    [0] => __construct
    [1] => _enkompass_utf8_processor
    [2] => initSession
    [3] => getName
    [4] => getDBs
    [5] => dbExists
    [6] => createDB
    [7] => removeDB
    [8] => getPackages
    [9] => getUsers
    [10] => getUser
    [11] => taskqueue
    [12] => getVersion
    [13] => getDnsCacheByUrl
    [14] => doHtaccessWarning
    [15] => getHttpInput_isCmd
    [16] => getHttpInput
    [17] => getHttpCookie
    [18] => setEffectiveUser
    [19] => getHttpConfPath
    [20] => doHttpReload
    [21] => getSystemUser
    [22] => getHomeDirectories
    [23] => getDataDirectories
    [24] => getDomains
    [25] => getSubDomainsOf
    [26] => isDomainHttpsEnabled
    [27] => generateDB
    [28] => getInstallFtpInfo
    [29] => getInstallPath
    [30] => getFreeSpace
    [31] => log
    [32] => exec
    [33] => _query_cpanel
    [34] => _query_directadmin
    [35] => termFspath
    [36] => initFspath
Is there a way we can extend this class and then override the functions to return the data we need? Maybe something like a i_cpanel_customcode class?

Posts: 492
Joined: Tue Jun 19, 2007 6:06 am

Re: Overriding CPanel functions

Post by Phil » Fri Mar 25, 2016 9:27 am


We might be able to accommodate this with hooks, however the list of virtual hosts, etc., are pulled directly from the cPanel API and there's no easy way to overload these methods.

Why isn't the cPanel API returning the correct data? If this is a custom platform built on top of cPanel then our Installatron Server product would be the correct solution. More information:


Thank you,
Phillip Stier
Installatron Co-Founder

Posts: 2
Joined: Wed Mar 23, 2016 12:18 am

Re: Overriding CPanel functions

Post by bug248 » Mon Mar 28, 2016 5:29 pm

Thank you for the reply.

We use pure CPanel, however there are a few things we would like to do different based on how we run the servers. From what we can determine the getUser function currently returns the vhosts and the servers IP which we would like to change so that it is more meaningful to our customers:.
eg. we want to change this:

Code: Select all

    [hosted_ip] =>
    [vhosts] => Array
            [http://test.com] => public_html
            [http://www.test.com] => public_html
            [https://test.com] => public_html
            [https://www.test.com] => public_html
            [] => public_html
to include the correct IP (not the natted one) as well as other sub domains we setup such as http://m.test.com and https://server/~test

We also provide a MariaDB server (as well as MySQL) and it would be good to be able to use Installatron to list and even create the databases on that platform as well. From the method list it appears there are db methods to make this happen.
With the current hooks (i_installer_customcode) we don't seem to be able to change any of this info without it reverting back to the original when it is written to the website files.

What we were hoping for is the ability to extend the i_cpanel class and then override the methods. This should make it easy to implement on your side (if its not already) as you would just need to check for a file and use the custom class (which then extends the original)

ps. the live demo of that server product returns an Nginx 404 page.

Post Reply