You are here

function apachesolr_create_unique_id in Apache Solr Search 8

Same name and namespace in other branches
  1. 6.3 apachesolr.module \apachesolr_create_unique_id()
  2. 7 apachesolr.module \apachesolr_create_unique_id()

Generator for an unique ID of an environment

Parameters

$environments: The environments that are available

$original_environment: The environment it needs to replicate an ID for.

Return value

The new environment ID

2 calls to apachesolr_create_unique_id()
apachesolr_environment_clone in ./apachesolr.module
Function that clones an environment
apachesolr_search_page_clone in ./apachesolr_search.module
Function that clones a search page

File

./apachesolr.module, line 1336
Integration with the Apache Solr search application.

Code

function apachesolr_create_unique_id($existing, $id) {
  $count = 0;
  $cloned_env_int = 0;
  do {
    $new_id = $id . '_' . $count;
    $count++;
  } while (isset($existing[$new_id]));
  return $new_id;
}