You are here

function db_maintenance_get_db_info in DB Maintenance 5.2

Same name and namespace in other branches
  1. 6.2 db_maintenance.module \db_maintenance_get_db_info()
2 calls to db_maintenance_get_db_info()
db_maintanence_do_files_backup in ./db_maintenance.module
db_maintenance_do_db_backup in ./db_maintenance.module

File

./db_maintenance.module, line 469
Optimizes database tables during cron runs.

Code

function db_maintenance_get_db_info($param) {
  global $db_url;
  $url = parse_url($db_url);
  switch (strtolower($param)) {
    case 'pass':
    case 'password':
      if (isset($url['pass'])) {
        $return = urldecode($url['pass']);
      }
      else {
        $return = '';
      }
      break;
    case 'user':
    case 'username':
      $return = urldecode($url['user']);
      break;
    case 'host':
    case 'hostname':
      $return = urldecode($url['host']);
      break;
    case 'db':
    case 'database':
    case 'dbname':
    case 'name':
      $url['path'] = urldecode($url['path']);
      $return = substr($url['path'], 1);
      break;
    case 'port':
      if (isset($url['port'])) {
        $return = urldecode($url['port']);
      }
      else {
        $return = '';
      }
      break;
    default:
      $return = '';
      break;
  }
  return $return;
}