Commit 3f18f628 authored by Guillaume Perréal's avatar Guillaume Perréal
Browse files

Suppression de méthodes d'UploadedFile qui ne servent plus.

parent a73e273c
......@@ -446,15 +446,15 @@ class UploadedFile implements UploadedFileInterface
if (false !== $fileHandle = $stream->cast(STREAM_CAST_AS_STREAM)) {
// Utilise stream_copy_to_stream si le Gaufrette\Stream peut nous retourner un filehandle
$copied = $this->stream_copy_to_stream($source, $fileHandle, $maxlen);
$copied = stream_copy_to_stream($source, $fileHandle, $maxlen);
} else {
// Sinon fait une copie par blocs (moins performant)
if ($maxlen === -1) {
$maxlen = PHP_INT_MAX;
}
$copied = 0;
while (!$this->feof($source) && $copied <= $maxlen) {
$copied += $stream->write($this->fread($source, min(static::$copyBlockSize, $maxlen - $copied)));
while (!feof($source) && $copied <= $maxlen) {
$copied += $stream->write(fread($source, min(static::$copyBlockSize, $maxlen - $copied)));
}
}
$stream->close();
......@@ -483,12 +483,12 @@ class UploadedFile implements UploadedFileInterface
if (false !== $fileHandle = $stream->cast(STREAM_CAST_AS_STREAM)) {
// Utilise stream_copy_to_stream si le Stream nous renvoie un filehandle
$copied = $this->stream_copy_to_stream($fileHandle, $dest, $actualLength);
$copied = stream_copy_to_stream($fileHandle, $dest, $actualLength);
} else {
// Sinon, on fait ça à la main par blocs de 8ko
$copied = 0;
while (!$stream->eof() && $copied < $actualLength) {
$copied += $this->fwrite($dest, $stream->read(min(static::$copyBlockSize, $actualLength - $copied)));
$copied += fwrite($dest, $stream->read(min(static::$copyBlockSize, $actualLength - $copied)));
}
}
......@@ -497,59 +497,6 @@ class UploadedFile implements UploadedFileInterface
return $copied;
}
/** Wrapper de stream_copy_to_stream
* @param resource $source
* @param resource $dest
* @param int $maxlen
* @param int $offset
*
* @return int
*
* @internal
*/
protected function stream_copy_to_stream($source, $dest, $maxlen = -1, $offset = 0)
{
return stream_copy_to_stream($source, $dest, $maxlen, $offset);
}
/** Wrapper de feof
* @param resource $filehandle
*
* @return bool
*
* @internal
*/
protected function feof($filehandle)
{
return feof($filehandle);
}
/** Wrapper de fread
* @param resource $filehandle
* @param int $maxlen
*
* @return int|bool
*
* @internal
*/
protected function fread($filehandle, $maxlen = -1)
{
return fread($filehandle, $maxlen);
}
/** Wrapper de fwrite
* @param resource $filehandle
* @param int $maxlen
*
* @return int|bool
*
* @internal
*/
protected function fwrite($filehandle, $maxlen = -1)
{
return fwrite($filehandle, $maxlen);
}
/** Vérifie si un chemin est "safe".
* @param string $path
*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment