mirror of
https://github.com/nextcloud/server.git
synced 2026-06-08 16:26:59 -04:00
Apply suggestions from code review in View.php
Co-authored-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com> Signed-off-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com> Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
ea2b28e1fc
commit
342cb33f71
1 changed files with 4 additions and 4 deletions
|
|
@ -428,11 +428,11 @@ class View {
|
|||
}
|
||||
$handle = $this->fopen($path, 'rb');
|
||||
if ($handle) {
|
||||
$chunkSize = 524288; // 512 kB chunks
|
||||
$chunkSize = 524288; // 512 kiB chunks
|
||||
while (!feof($handle)) {
|
||||
echo fread($handle, $chunkSize);
|
||||
$this->checkConnectionStatus();
|
||||
flush();
|
||||
$this->checkConnectionStatus();
|
||||
}
|
||||
fclose($handle);
|
||||
return $this->filesize($path);
|
||||
|
|
@ -484,8 +484,8 @@ class View {
|
|||
$len = $chunkSize;
|
||||
}
|
||||
echo fread($handle, $len);
|
||||
$this->checkConnectionStatus();
|
||||
flush();
|
||||
$this->checkConnectionStatus();
|
||||
}
|
||||
return ftell($handle) - $from;
|
||||
}
|
||||
|
|
@ -498,7 +498,7 @@ class View {
|
|||
|
||||
private function checkConnectionStatus(): void {
|
||||
$connectionStatus = \connection_status();
|
||||
if ($connectionStatus !== 0) {
|
||||
if ($connectionStatus !== CONNECTION_NORMAL) {
|
||||
throw new ConnectionLostException("Connection lost. Status: $connectionStatus");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue