Tools access to DB functions

Discussion in 'Developers' Forum' started by djtremors, Apr 9, 2007.

  1. djtremors

    djtremors ISPConfig Developer ISPConfig Developer

    Can someone guide me to how to automatically add a database to a website? I am writing a new Tools interface which needs to auto create a database on behalf of the "client" and the only a function I could find to do it properly was in the isp_datenbank class, calling the datenbank_insert function.

    function datenbank_insert($doc_id, $doctype_id, $die_on_error = '1')

    Is this the right way to actually do it as I don't see it used anywhere weirdly enough...????:confused:

    I have the client sites $web_doc_id and just need a little help here and this is where i'm currently stuck at.
    Last edited: Apr 9, 2007
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    This function does not insert the records in the DB. ISPConfig is event based and this function is just a event handler that does some additional steps after a database has been inserted into the database. The insertion of the records itself is done by the form processing scrpts and these scripts are calling also the event handlers.

    I think you will have to add the records in the tables isp_isp_datenbank, isp_nodes and isp_dep manually. I guess the best way to see what has to be added is to add a database trough ISPConfig and see what is changed in these three tables.
  3. djtremors

    djtremors ISPConfig Developer ISPConfig Developer

    Well, i thought of doing this the easy way and use the remote framework only to fail when ispconfig php isnt compiled with xml2 functions :( otherwise I would've been sweet and plugins could just use the remote framework to do the dirty work... oh well.

    so i'm back to doing it the SQL direct way. I added a simple database and 2 tables changed, isp_isp_dep and isp_isp_datenbank.

    I can't see where some of the fields are related to anything. Some things are obvious ie. doc_id = autoincrement, datenbankname , datenbankuser , etc but what are the relationships with the other fields so i know where the values come from?


  4. djtremors

    djtremors ISPConfig Developer ISPConfig Developer

    Unfortunately I can't figure out how the table fields work or relate to anything so I resorted to remote framework but then hit a wall again when the php that compiles with ispconfig doesn't have XML support in it so I can't use the remote framework "client" inside the http:81 of ispconfig... *sigh*.

    can anyone help?
  5. falko

    falko Super Moderator ISPConfig Developer

    You can change the PHP configure string in install_ispconfig/compile_aps/compile and then install ISPConfig again. But make sure that libxml2-dev is installed. And back up your ISPConfig installation before you try this!
  6. djtremors

    djtremors ISPConfig Developer ISPConfig Developer

    yeah I did go down this path already but considering that this was to be a package to use in ispconfig, there's no point telling users that they must reinstall their ispconfig and make changes to the compile script to use my module all because i can't work out how to add a database to a site...
    If this was done on future releases then at least it would make it easier for me and possibly others wanting to make changes easily.

    The remote-framework is encrypted as well othewise I'd look into that on how it adds a new database to a site.... but no go there either.

    Is this telling me that no body knows the structure of the ISPC database?
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    The ISPConfig Development versions contain all PHP with XML compiled in, so every version > ISPConfig 2.3.x will have xml support and the remoting framework by default.

    No. The remoting framework is already part of the dev branch as source for several weeks.

    Not at all. I've written the structure, so I know it. And Falko and some other developers know them too.

Share This Page