function _apachesolr_drush_variable_like in Apache Solr Search 8
Same name and namespace in other branches
- 6.3 drush/apachesolr.drush.inc \_apachesolr_drush_variable_like()
- 7 drush/apachesolr.drush.inc \_apachesolr_drush_variable_like()
Search for similar variable names.
Parameters
string $env_id:
string $arg:
bool|string $starts_with:
Return value
array $variable Only return it if found
Throws
Exception
3 calls to _apachesolr_drush_variable_like()
- drush_apachesolr_solr_variable_delete in drush/
apachesolr.drush.inc - Command callback. Delete a variable.
- drush_apachesolr_solr_variable_get in drush/
apachesolr.drush.inc - Command callback.
- drush_apachesolr_solr_variable_set in drush/
apachesolr.drush.inc - Command callback. Set a variable.
File
- drush/
apachesolr.drush.inc, line 629 - drush integration for apachesolr.
Code
function _apachesolr_drush_variable_like($env_id, $arg = NULL, $starts_with = FALSE) {
$found = array();
$environment = _apachesolr_drush_environment_load_and_validate($env_id);
if (!isset($arg)) {
return $environment['conf'];
}
if ($starts_with) {
$pattern = "/^{$arg}/i";
}
else {
$pattern = "/{$arg}/i";
}
foreach ($environment['conf'] as $name => $value) {
// Find all variable that start with $arg.
if (preg_match($pattern, $name)) {
$found[$name] = $value;
}
}
return $found;
}