protected function SearchApiAcquiaSearchMultiService::getAcquiaSubscriptionError in Acquia Search Multiple Indexes 7
Same name and namespace in other branches
- 8 src/Plugin/search_api/backend/SearchApiAcquiaSearchMultiService.php \SearchApiAcquiaSearchMultiService::getAcquiaSubscriptionError()
Check Acquia subscription data.
Parameters
$subscription: FALSE, integer (xmlrpc error number), or subscription data array. @see acquia_agent_get_subscription()
string $identifier:
bool $quiet: If FALSE display or log error message.
Return value
bool|string FALSE if subscription is valid or translated error message otherwise.
3 calls to SearchApiAcquiaSearchMultiService::getAcquiaSubscriptionError()
- SearchApiAcquiaSearchMultiService::configurationFormValidate in lib/
Drupal/ SearchApiSolr/ SearchApiAcquiaSearchMultiService.php - Overrides SearchApiSolrService::configurationFormValidate().
- SearchApiAcquiaSearchMultiService::getAcquiaSubscription in lib/
Drupal/ SearchApiSolr/ SearchApiAcquiaSearchMultiService.php - Get subscription info from the acquia_connector module, and cache it for 6 hours.
- SearchApiAcquiaSearchMultiService::setConnectionOptions in lib/
Drupal/ SearchApiSolr/ SearchApiAcquiaSearchMultiService.php
File
- lib/
Drupal/ SearchApiSolr/ SearchApiAcquiaSearchMultiService.php, line 199 - Contains SearchApiAcquiaSearchMultiService.
Class
- SearchApiAcquiaSearchMultiService
- Provides automatic environment switching for Acquia Search servers.
Code
protected function getAcquiaSubscriptionError($subscription, $identifier, $quiet = FALSE) {
if (!is_array($subscription)) {
$t_args = array(
'%subscription' => $identifier,
);
$error_message = t('Unable to get %subscription subscription data. Please try later.', $t_args);
if (is_numeric($subscription)) {
switch ($subscription) {
case SUBSCRIPTION_NOT_FOUND:
$error_message = t('Your %subscription subscription not found.', $t_args);
break;
case SUBSCRIPTION_EXPIRED:
$error_message = t('Your %subscription subscription expired.', $t_args);
break;
}
}
elseif ($subscription === FALSE) {
// Occurs when response validation failed.
$error_message = t('Acquia subscription response validation error. Please check your <a href="!url">Acquia Subscription Settings</a> settings and try again.', array(
'!url' => url('admin/config/system/acquia-agent'),
));
}
// Log and display error message (if the user has access).
if (!$quiet) {
if (user_access('administer search_api')) {
drupal_set_message($error_message, 'warning', FALSE);
}
watchdog('acquia_search_multi_subs', $error_message, array(), WATCHDOG_WARNING);
}
return $error_message;
}
return FALSE;
}