You are here

protected function SearchApiAcquiaApi::sanitizeDatabaseRoleName in Acquia Search for Search API 7.2

Removes extra characters from database role name.

Parameters

string $database_role: Raw database role.

Return value

string Sanitized string.

1 call to SearchApiAcquiaApi::sanitizeDatabaseRoleName()
SearchApiAcquiaApi::getDatabaseRole in includes/v3/SearchApiAcquiaApi.php
Returns the name of the Acquia "DB Role".

File

includes/v3/SearchApiAcquiaApi.php, line 284

Class

SearchApiAcquiaApi
Class SearchApiAcquiaApi.

Code

protected function sanitizeDatabaseRoleName(string $database_role) {

  // In database role naming, we only accept alphanumeric chars.
  $pattern = '/[^a-zA-Z0-9_]+/';
  $database_role = preg_replace($pattern, '', $database_role);
  return $database_role;
}