Skip to content

Commit

Permalink
dont assume 'quota' will be in the values, just like block before was…
Browse files Browse the repository at this point in the history
…n't assuming (#823)

Co-authored-by: Nuno Tavares <n.tavares@portavita.eu>
  • Loading branch information
ntavares and Nuno Tavares committed Apr 22, 2024
1 parent 0876c36 commit 4ae78cd
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions model/MailboxHandler.php
Expand Up @@ -239,17 +239,17 @@ protected function read_from_db_postprocess($db_result)

protected function preSave(): bool
{
if (isset($this->values['quota']) && $this->values['quota'] != -1 && is_numeric($this->values['quota'])) {
$multiplier = Config::read_string('quota_multiplier');
if ($multiplier == 0 || !is_numeric($multiplier)) { // or empty string, or null, or false...
$multiplier = 1;
if (isset($this->values['quota'])) {
if ($this->values['quota'] != -1 && is_numeric($this->values['quota'])) {
$multiplier = Config::read_string('quota_multiplier');
if ($multiplier == 0 || !is_numeric($multiplier)) { // or empty string, or null, or false...
$multiplier = 1;
}
$this->values['quota'] = $this->values['quota'] * $multiplier; # convert quota from MB to bytes
// Avoid trying to store '' in an integer field
if ($this->values['quota'] === '') {
$this->values['quota'] = 0;
}
$this->values['quota'] = $this->values['quota'] * $multiplier; # convert quota from MB to bytes
}

// Avoid trying to store '' in an integer field
if ($this->values['quota'] === '') {
$this->values['quota'] = 0;
}

$ah = new AliasHandler($this->new, $this->admin_username);
Expand Down

0 comments on commit 4ae78cd

Please sign in to comment.