dns zone import

Discussion in 'Developers' Forum' started by pyte, Feb 9, 2023.

  1. pyte

    pyte Well-Known Member HowtoForge Supporter

    Hi,
    there is a issue open for a few month regarding DNS Zone imports: https://git.ispconfig.org/ispconfig/ispconfig3/-/issues/6345
    I want to get this working, to make my life easier. As correctly statet by Dovi Cowan this issue occures because checkDomainModuleDomains gets called with the domain_name instead of the domain_id which it expects.
    Code:
    $app->tools_sites->checkDomainModuleDomain($soa['name'])
    Code:
     checkDomainModuleDomain($domain_id)
    Could we just fix this by getting the domain_id from $soa['name'] and hand the id over to checkDomainModuleDomains? I'm not that familiar with ISPConfigs code, is there an internal function to get the domain_id by domain_name or should we query the db for the id?

    any thoughts and input is appreciated!
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes, basically you must look up the domain_id in the domain table like:

    Code:
    $tmp = $app->db->queryOneRecord('SELECT domain_id from domain where domain = ?', $soa['name']);
    $app->tools_sites->checkDomainModuleDomain($tmp['domain_id'])
    
    Untested, variable and column names might vary ;)
     
    pyte likes this.
  3. pyte

    pyte Well-Known Member HowtoForge Supporter

    fiddling around with it right now. Is there a quick and dirty way to print debug? :)

    NVM!
    Code:
    echo "<script>console.log('{$var}' );</script>"; 
    works just fine
     
    Last edited: Feb 9, 2023
  4. pyte

    pyte Well-Known Member HowtoForge Supporter

    The issue in the issue 6345 is fixed with the code appended, but there are other major issues with this import code itself.
    In my testings $soa['name'] had multiple dots(".") at the end. The "origin_name" function does not work reliable. Sadly solving this function alone will not correct the issue as $soa['name'] gets set at multiple stages during the script, and i'm just not expirenced enough to fix this myself.

    Should i put the change into a MR to at least fix the domain_id vs domain_name bug?
    Code:
       
    $tmp_soa_name = trim($soa['name'], ".");
    $tmp_domain_id = $app->db->queryOneRecord('SELECT domain_id FROM domain where domain = ?', $tmp_soa_name);
    
     if ($settings['use_domain_module'] == 'y' && ! $app->tools_sites->checkDomainModuleDomain($tmp_domain_id['domain_id']) ) {
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes, this would be good. At least one issue less in that function.
     
  6. pyte

    pyte Well-Known Member HowtoForge Supporter

    ahrasis, till and Th0m like this.

Share This Page