Issue #118 wanted better TOR support, now Avatar URLs are not stored

There was no reason to store the generated Avatar URLs because it's so
cheap to generate them on the fly.
This commit is contained in:
Mikael Nordfeldth
2016-01-06 16:14:26 +01:00
parent 7b2036a4b5
commit 1a1e44cdfd
4 changed files with 4 additions and 49 deletions

View File

@@ -51,7 +51,6 @@ function updateUserUrls()
$profile = $user->getProfile();
updateProfileUrl($profile);
updateAvatarUrls($profile);
} catch (Exception $e) {
echo "Error updating URLs: " . $e->getMessage();
}
@@ -67,36 +66,6 @@ function updateProfileUrl($profile)
$profile->update($orig);
}
function updateAvatarUrls($profile)
{
$avatar = new Avatar();
$avatar->profile_id = $profile->id;
if ($avatar->find()) {
while ($avatar->fetch()) {
$orig_url = $avatar->url;
$avatar->url = Avatar::url($avatar->filename);
if ($avatar->url != $orig_url) {
$sql =
"UPDATE avatar SET url = '" . $avatar->url . "' ".
"WHERE profile_id = " . $avatar->profile_id . " ".
"AND width = " . $avatar->width . " " .
"AND height = " . $avatar->height . " ";
if ($avatar->original) {
$sql .= "AND original = 1 ";
}
if (!$avatar->query($sql)) {
throw new Exception("Can't update avatar for user " . $profile->nickname . ".");
} else {
$touched = true;
}
}
}
}
}
function updateGroupUrls()
{
printfnq("Updating group URLs...\n");