Changeset 4985 for trunk/admin/include


Ignore:
Timestamp:
Feb 27, 2010, 9:00:00 PM (15 years ago)
Author:
nikrou
Message:

Feature 1460 : Customize form installation depending on database engine

  • sqlite is proposed by default if severals

database engine are available (cf conf)

  • sqlite is proposed before pdo-sqlite
  • remove host, user and password for sqlite
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/functions_install.inc.php

    r4967 r4985  
    8787  foreach ($dblayers as $engine_name => $engine)
    8888  {
    89     if (file_exists(sprintf($pattern, $engine_name))
    90         && isset($engine['function_available'])
    91         && function_exists($engine['function_available']))
     89    if (file_exists(sprintf($pattern, $engine_name)))
    9290    {
    93       $engines[$engine_name] = $engine['engine'];
    94     }
    95     elseif (file_exists(sprintf($pattern, $engine_name))
    96             && isset($engine['class_available'])
    97             && class_exists($engine['class_available']))
    98     {
    99       $engines[$engine_name] = $engine['engine'];
     91      $engines[$engine_name]['label'] = $engine['engine'];
     92      $engines[$engine_name]['available'] = 'disabled';
     93
     94      if (isset($engine['function_available'])
     95          && function_exists($engine['function_available']))
     96      {
     97        $engines[$engine_name]['available'] = true;
     98      }
     99      elseif (isset($engine['class_available'])
     100              && class_exists($engine['class_available']))
     101      {
     102        $engines[$engine_name]['available'] = true;
     103      }
    100104    }
    101105  }
     106
     107  if (count($engines)>1)
     108  {
     109    $engines[$GLOBALS['conf']['dbengine_select_default']]['selected'] = true;
     110  }
    102111 
     112  if ($engines['sqlite']['available'] && $engines['pdo-sqlite']['available'])
     113  {
     114    if ($GLOBALS['conf']['db_sqlite_default']=='native')
     115    {
     116      unset($engines['pdo-sqlite']);
     117    }
     118    else
     119    {
     120      unset($engines['sqlite']);
     121    }
     122  }
     123
    103124  return $engines;
    104125}
Note: See TracChangeset for help on using the changeset viewer.