mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 20:38:52 +00:00
[ticket/15342] Add again check of free space when uploading attachments
PHPBB3-15342
This commit is contained in:
parent
4cff370f8d
commit
22b2e95531
1 changed files with 27 additions and 1 deletions
|
@ -327,10 +327,36 @@ class upload
|
||||||
/**
|
/**
|
||||||
* Check if there is enough free space available on disk
|
* Check if there is enough free space available on disk
|
||||||
*
|
*
|
||||||
* @return bool True if disk space is available, false if not
|
* @return bool True if disk space is available or can't get it, false if not
|
||||||
*/
|
*/
|
||||||
protected function check_disk_space()
|
protected function check_disk_space()
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$free_space = $this->storage->free_space();
|
||||||
|
|
||||||
|
if ($free_space <= $this->file->get('filesize'))
|
||||||
|
{
|
||||||
|
if ($this->auth->acl_get('a_'))
|
||||||
|
{
|
||||||
|
$this->file_data['error'][] = $this->language->lang('ATTACH_DISK_FULL');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->file_data['error'][] = $this->language->lang('ATTACH_QUOTA_REACHED');
|
||||||
|
}
|
||||||
|
$this->file_data['post_attach'] = false;
|
||||||
|
|
||||||
|
$this->file->remove($this->storage);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (\phpbb\storage\exception\exception $e)
|
||||||
|
{
|
||||||
|
// Nothing
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue