[ticket/15342] free_space() now return false if there is any error

PHPBB3-15342
This commit is contained in:
Rubén Calvo 2018-07-01 18:46:48 +02:00
parent 6d2aae5853
commit c039fcba18
3 changed files with 5 additions and 12 deletions

View file

@ -99,9 +99,7 @@ interface adapter_interface
/* /*
* Get space available in bytes. * Get space available in bytes.
* *
* @throws \phpbb\storage\exception\exception When unable to retrieve available storage space * @return mixed Returns available space or null when unable to retrieve available space
*
* @return int Returns available space
*/ */
public function free_space(); public function free_space();
} }

View file

@ -432,11 +432,6 @@ class local implements adapter_interface, stream_interface
{ {
$free_space = @disk_free_space($this->root_path); $free_space = @disk_free_space($this->root_path);
if ($free_space === false) return $free_space;
{
throw new exception('STORAGE_CANNOT_GET_FREE_SPACE');
}
return (int) $free_space;
} }
} }

View file

@ -43,7 +43,7 @@ class storage
protected $factory; protected $factory;
/** /**
* @var string * @var stringshould be caste
*/ */
protected $storage_name; protected $storage_name;
@ -384,7 +384,7 @@ class storage
$this->db->sql_freeresult($result); $this->db->sql_freeresult($result);
} }
return $number_files; return (int) $number_files;
} }
/** /**
@ -392,7 +392,7 @@ class storage
* *
* @throws \phpbb\storage\exception\exception When can't get available space * @throws \phpbb\storage\exception\exception When can't get available space
* *
* @return int Returns available space * @return mixed Returns available space or null when unable to retrieve available space
*/ */
public function free_space() public function free_space()
{ {