Ispconfig is not updating a database

Discussion in 'Developers' Forum' started by Martin K., Apr 17, 2016.

  1. Martin K.

    Martin K. New Member

    Hi,
    Im facing issue using the ispconfig remote api I'm unable to save a database parameters.
    for example when a customer on the hosting interface try to create a data base everything gone fine but when he try to update the database parameters nothing happen the return value is 0 ( mean no data saved according to documentation).
    what can be the problem ? this is a part of my code.
    PHP:
    $params = array(
                
    'server_id' => 1,
                
    'website_id' => 1,
                
    'type' => 'mysql',
                
    'database_name' => 'c'.$client_id.$database['name'],
                
    'database_user_id' => $database['database_user_id'],
                
    'database_quota' => 100,
                
    'database_ro_user_id' =>$database['database_user_id'],
                
    'database_password' => $database['password'],
                
    'database_charset' => 'UTF8',
                
    'remote_access' => 'n',
                
    'remote_ips' => '',
                 
    'active' => 'y'
                
    );
    //here I unset the password parameter if empty on update

    if(isset($database["database_id"])&&!empty($database["database_id"])) {
         if(empty(
    $database["password"])) unset($params["database_password"]);
    }

    //and here where I save Using drupal

    $action=isset($database["database_id"])&&!empty($database["database_id"])?ispconfig_sites_sites_database_update($client_id,$database["database_id"], $params$session_id ''$show_errors TRUE):ispconfig_sites_sites_database_add($client_id$params$session_id ''$show_errors TRUE); 
         
    Regards.
     
  2. florian030

    florian030 ISPConfig Developer ISPConfig Developer

    Did you check $params inside your ispconfig_sites_sites_database_update function?
     
  3. Martin K.

    Martin K. New Member

    Hi florian thanks for answering
    indeed I checked everything and ispconfig return 0 so there is no error, just unable to make the update.
    Regarsds.
    Martin.
     
  4. Martin K.

    Martin K. New Member

    I got it, Florian.
    the problem was the extra parameter
    PHP:
     'database_quota' => 100
    that isn't documented.
    I don't know how to set the quota for a database no function exists for this.

    Regards.
     
  5. Martin K.

    Martin K. New Member

    Sorry to came back the problem is not solved.
    I've just created a database, and I believed that it was an update operation so still facing the issue.
     
  6. Martin K.

    Martin K. New Member

    Hi,
    No solution for this issue? now event emails and FTP accounts doesn't accept update what can be the mater?
    Regards
     
  7. florian030

    florian030 ISPConfig Developer ISPConfig Developer

    I think, there is something wrong wiith your update-function. just read the current settings before upgrading the settings, adjust the values in the array and run update afterwards.
     
  8. Martin K.

    Martin K. New Member

    Hi florian this is the query I took in the log
    Code:
    UPDATE `web_database` SET `server_id` = '1', `parent_domain_id` = '1', `type` = 'mysql', `database_name` = 'c1Base_site1', `database_name_prefix` = '', `database_user_id` = '46', `database_ro_user_id` = '46', `database_charset` = 'UTF8', `remote_access` = 'n', `active` = 'y', `remote_ips` = '', `sys_userid` = 2, `sys_groupid` = 2 WHERE database_id = 44
    what do you think about?

    Regards
    Martin
     
  9. Martin K.

    Martin K. New Member

    there where no error,
    Really sorry! the problem was the fact that I was interpreting the return value 0 as an error,
    Regards
     

Share This Page