Separate statistics reporting from 'Use H5P Hub' option

JI-114
pull/10/merge
Frode Petterson 2017-04-10 14:09:02 +02:00
parent c4f2b26116
commit c475db843d
1 changed files with 27 additions and 18 deletions

View File

@ -2476,6 +2476,7 @@ class H5PCore {
); );
} }
if ($this->h5pF->getOption('h5p_send_usage_statistics', TRUE)) {
$siteData = array_merge( $siteData = array_merge(
$registrationData, $registrationData,
array( array(
@ -2492,6 +2493,10 @@ class H5PCore {
))) )))
) )
); );
}
else {
$siteData = $registrationData;
}
$result = $this->updateContentTypeCache($siteData); $result = $this->updateContentTypeCache($siteData);
@ -2851,10 +2856,14 @@ class H5PCore {
$endpoint = H5PHubEndpoints::CONTENT_TYPES; $endpoint = H5PHubEndpoints::CONTENT_TYPES;
$data = $interface->fetchExternalData("{$protocol}://{$endpoint}", $postData); $data = $interface->fetchExternalData("{$protocol}://{$endpoint}", $postData);
if (! $this->h5pF->getOption('h5p_hub_is_enabled', TRUE)) {
return TRUE;
}
// No data received // No data received
if (!$data) { if (!$data) {
$interface->setErrorMessage( $interface->setErrorMessage(
$interface->t('Could not connect to the H5P Content Type Hub. Please try again later.') $interface->t("Couldn't communicate with the H5P Hub. Please try again later.")
); );
return FALSE; return FALSE;
} }
@ -2864,7 +2873,7 @@ class H5PCore {
// No libraries received // No libraries received
if (!isset($json->contentTypes) || empty($json->contentTypes)) { if (!isset($json->contentTypes) || empty($json->contentTypes)) {
$interface->setErrorMessage( $interface->setErrorMessage(
$interface->t('No libraries was received from the Content Type Hub. Please try again later.') $interface->t('No content types were received from the H5P Hub. Please try again later.')
); );
return FALSE; return FALSE;
} }