Commit 54891e1d authored by Francois Marier's avatar Francois Marier
Browse files

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

This reverts commit a6475339.

Now that we support avatars over HTTPS (4902e46d

)
the HTTPS part of this check is unnecessary.

The other part of the check which used curl was bogus. The fact that the
server cannot reach Gravatar doesn't necessarily mean that clients won't
be able to. It could just be that the server is firewalled off. Since we
don't have a reliable way to detect fully separated networks, we may as
well opt for the solution with less code.

Conflicts:

	htdocs/lib/db/upgrade.php
	htdocs/lib/upgrade.php
	htdocs/lib/version.php

Change-Id: I29d61c41469c826555c15642b5b5a92b2e823947
Signed-off-by: default avatarFrancois Marier <francois@catalyst.net.nz>
parent 4902e46d
......@@ -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.
*/
......
Supports Markdown
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