public static function LingotekSync::updateNotifyUrl in Lingotek Translation 7.7
Same name and namespace in other branches
- 7.3 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::updateNotifyUrl()
- 7.4 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::updateNotifyUrl()
- 7.5 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::updateNotifyUrl()
- 7.6 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::updateNotifyUrl()
2 calls to LingotekSync::updateNotifyUrl()
- lingotek_notify_url_update in ./
lingotek.sync.inc - Update the Notify URL (via API)
- lingotek_update_7404 in ./
lingotek.install - Upgrade the callback URL signature and adds translation profiles.
File
- lib/
Drupal/ lingotek/ LingotekSync.php, line 1259 - LingotekSync
Class
- LingotekSync
- A utility class for Lingotek Syncing.
Code
public static function updateNotifyUrl() {
$security_token = md5(time());
$new_url = lingotek_notify_url_generate();
$api = LingotekApi::instance();
$integration_method_id = variable_get('lingotek_integration_method', '');
if (!strlen($integration_method_id)) {
// request integration id when not already set, attempt to detect
$integration_method_id = static::getIntegrationMethodId($api);
}
$parameters = array(
'id' => $integration_method_id,
'url' => $new_url,
'projectId' => variable_get('lingotek_project', ''),
);
$response = $api
->request('updateOutboundIntegrationUrl', $parameters);
$success = isset($response->results) ? $response->results : FALSE;
if ($success) {
variable_set('lingotek_notify_url', $new_url);
variable_set('lingotek_notify_security_token', $security_token);
if (strpos($new_url, 'localhost') !== false) {
$success = 'localhost_url';
}
}
return $success;
}