You are here

protected function AcquiaSearchSolrApi::sanitizeDatabaseRoleName in Acquia Connector 7.3

Removes extra characters from database role name.

Parameters

string $database_role: Raw database role.

Return value

string Sanitized string.

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

File

acquia_search/includes/AcquiaSearchSolrApi.php, line 284

Class

AcquiaSearchSolrApi
Class AcquiaSearchApi.

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;
}