Commit ca9b9b7b authored by Armando Lüscher's avatar Armando Lüscher

Merge branch 'dl-down-fix' into 'develop'

Error out if detectlanguage.com issue vs die out on script

See merge request !239
parents aee61e54 7ad1f203
Pipeline #1473 passed with stage
in 4 minutes and 13 seconds
......@@ -9,6 +9,7 @@ The format is based on [Keep a Changelog] and this project adheres to [Semantic
### Deprecated
### Removed
### Fixed
- Error out if detectlanguage.com issue vs die out on script
### Security
## [2.6.0] - 2019-04-13
......
......@@ -279,10 +279,9 @@ foreach ($pods as $pod) {
} elseif ($debug || $langhours > 24) {
$detectedlanguage = detectWebsiteLanguageFromSnippet($language_snippet);
$languagesupdated = true;
debug('Detected Language', $detectedlanguage);
}
debug('Detected Language', $detectedlanguage);
if (!$jsonssl || !$language_snippet) {
debug('Connection', 'Can not connect to pod');
......
......@@ -183,8 +183,12 @@ function detectWebsiteLanguageFromSnippet(string $snippet): ?string
if (!$snippet) {
return null;
}
return DetectLanguage::simpleDetect($snippet);
try {
$language = DetectLanguage::simpleDetect($snippet);
} catch (\DetectLanguage\DetectLanguageError $e) {
debug('Error in DetectLanguage: ' . $e->getMessage());
}
return $language;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment