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:
@@ -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");
|
||||
|
Reference in New Issue
Block a user