Clear quota usage immediately when data is deleted, triggering a recalc.

master
Moonchild 3 years ago
parent e092b46d79
commit 5f1f5f914b
No known key found for this signature in database
GPG Key ID: 26B40624BDBFD9F3

@ -280,6 +280,7 @@
if ($id)
{
$db->delete_object($collection, $id);
$db->clear_quota_usage($username);
}
else if ($collection)
{
@ -293,12 +294,14 @@
$params['ids'],
$params['index_above'], $params['index_below']
);
$db->clear_quota_usage($username);
}
else if($function == 'storage') // ich vermute mal storage reinigen
{
if (!array_key_exists('HTTP_X_CONFIRM_DELETE', $_SERVER))
report_problem(WEAVE_ERROR_NO_OVERWRITE, 412);
$db->delete_storage($username);
$db->clear_quota_usage($username);
}
else
{

@ -794,8 +794,25 @@ class WeaveStorage
return 0;
}
return 1;
}
}
function clear_quota_usage($username)
{
try
{
$update_statement = "update users set quota_usage = 0 where username = :username";
$sth = $this->_dbh->prepare($update_statement);
$sth->bindParam(':username', $username);
$sth->execute();
}
catch( PDOException $exception )
{
log_error("clear quota usage:" . $exception->getMessage());
return 0;
}
return 1;
}
function create_user($username, $password)
{
log_error("Create User - Username: ".$username."|".$password);

Loading…
Cancel
Save