1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-03-23 17:10:53 +01:00

Merge pull request #4750 from rubencm/ticket/15134

[ticket/15134] Replace php native functions for filesystem service methods
This commit is contained in:
Marc Alexander 2017-03-25 11:30:13 +01:00
commit bf6822ed1b
No known key found for this signature in database
GPG Key ID: 50E0D2423696F995

View File

@ -281,12 +281,20 @@ class upload extends \phpbb\avatar\driver\driver
);
extract($this->dispatcher->trigger_event('core.avatar_driver_upload_delete_before', compact($vars)));
if (!sizeof($error) && file_exists($filename))
if (!sizeof($error) && $this->filesystem->exists($filename))
{
@unlink($filename);
try
{
$this->filesystem->remove($filename);
return true;
}
catch (\phpbb\filesystem\exception\filesystem_exception $e)
{
// Fail is covered by return statement below
}
}
return true;
return false;
}
/**
@ -304,6 +312,6 @@ class upload extends \phpbb\avatar\driver\driver
*/
protected function can_upload()
{
return (file_exists($this->phpbb_root_path . $this->config['avatar_path']) && $this->filesystem->is_writable($this->phpbb_root_path . $this->config['avatar_path']) && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on'));
return ($this->filesystem->exists($this->phpbb_root_path . $this->config['avatar_path']) && $this->filesystem->is_writable($this->phpbb_root_path . $this->config['avatar_path']) && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on'));
}
}