Commit 1489e11c authored by Richard Mansfield's avatar Richard Mansfield Committed by Gerrit Code Review
Browse files

Merge "Revert "Add upgrade/postinst script to selectively enable Gravatar support""

parents 0234b014 54891e1d
......@@ -1376,38 +1376,6 @@ function xmldb_core_upgrade($oldversion=0) {
}
}
if ($oldversion < 2010021600) {
// Set remoteavatars defaults
// Check if the site is using https
$urlprotocol = substr(get_config('wwwroot'), 0, 5);
if (strtolower($urlprotocol) == 'https') {
// Avoid mix of secure and insecure contents
set_config('remoteavatars', 0);
}
else {
// Check to see if we can reach gravatar.com
$ch = curl_init();
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_VERBOSE, false);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 5); // timeout in seconds
curl_setopt($ch, CURLOPT_COOKIE, '');
curl_setopt($ch, CURLOPT_REFERER, ''); // for privacy
curl_setopt($ch, CURLOPT_URL, 'http://www.gravatar.com/');
if (curl_exec($ch)) {
// By default, turn it on
set_config('remoteavatars', 1);
}
else {
// Can't reach gravatar.com in a timely fashion
set_config('remoteavatars', 0);
}
curl_close($ch);
}
}
if ($oldversion < 2010031000) {
// For existing sites, preserve current user search behaviour:
// Users are only searchable by their display names.
......
......@@ -614,7 +614,6 @@ function core_postinst() {
)');
set_antispam_defaults();
set_remoteavatars_default();
reload_html_filters();
return $status;
}
......@@ -1058,40 +1057,6 @@ function reload_html_filters() {
log_info('Enabled ' . count($filters) . ' HTML filters.');
}
/**
* Use a meaningful default for the 'remoteavatars' setting.
*/
function set_remoteavatars_default() {
// Check if the site is using https
$urlprotocol = substr(get_config('wwwroot'), 0, 5);
if (strtolower($urlprotocol) == 'https') {
// Avoid mix of secure and insecure contents
set_config('remoteavatars', 0);
}
else {
// Check to see if we can reach gravatar.com
$ch = curl_init();
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_VERBOSE, false);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 5); // timeout in seconds
curl_setopt($ch, CURLOPT_COOKIE, '');
curl_setopt($ch, CURLOPT_REFERER, ''); // for privacy
curl_setopt($ch, CURLOPT_URL, 'http://www.gravatar.com/');
if (curl_exec($ch)) {
// By default, turn it on
set_config('remoteavatars', 1);
}
else {
// Can't reach gravatar.com in a timely fashion
set_config('remoteavatars', 0);
}
curl_close($ch);
}
}
/**
* Use meaningful defaults for the antispam settings.
*/
......
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