HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (
-   Developers' Forum (
-   -   API Stats Modification (

abdi 1st April 2013 21:48

API Stats Modification
Hello Till,

After a through investigation I have noticed the following situation with the API.

The API function (say)


$domain_record = sites_web_domain_get($session_id, $domain_id)
Returns the entire record inclusive of the stats_password crypt-ed value.

That might not be a problem, however it's:

When updating any of the above returned record with say:

$domain_record['active'] = 'n';
sites_web_domain_update($session_id, $client_id, $domain_id, $domain_record)

The finely updated record will hold a crypt-ed, crypt-ed stats_password Thus killing or resetting the stats_password set originally to some Un-Known crypt-ed characters ...

Do you see a problem there?


abdi 1st April 2013 21:55

Solution to the problem
My suggested solution to that problem is as follows:

In the API lib file "/usr/local/ispconfig/interface/lib/classes/"

I have introduced a new variable called update_stats_password which a user should set to 1 if they wish to update a stats_password. Otherwise by default its removed from the array to avoid messing up the preset stats_password .

Below is my updated function suggesting to be added to the next update if its OK.


//* Update a record
        public function sites_web_domain_update($session_id, $client_id, $primary_id, $params)
                if(!$this->checkPerm($session_id, 'sites_web_domain_update')) {
                        $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
                        return false;
                //* Set a few defaults for nginx servers
                if($params['pm_max_children'] == '') $params['pm_max_children'] = 1;
                if($params['pm_start_servers'] == '') $params['pm_start_servers'] = 1;
                if($params['pm_min_spare_servers'] == '') $params['pm_min_spare_servers'] = 1;
                if($params['pm_max_spare_servers'] == '') $params['pm_max_spare_servers'] = 1;
                //* Added by Abdi Joseph
                if($params['update_stats_password'] != '1') unset($params['stats_password']);
                $affected_rows = $this->updateQuery('../sites/form/web_domain.tform.php',$client_id,$primary_id,$params);
                return $affected_rows;

Any suggestions or comments are welcome ...

Abdi Joseph

till 2nd April 2013 10:56

The api function works fine, you just used it the wrong way. Like with all API functions you have to pass a empty password parameter when the password shall not be change don update. So the correct API usage wozld be:

$domain_record['active'] = 'n';
$domain_record['stats_password'] = '';
sites_web_domain_update($session_id, $client_id, $domain_id, $domain_record)

All times are GMT +2. The time now is 08:57.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.