Edit File by line
/home/barbar84/www/wp-conte.../plugins/worker/src/MWP/Stream
File: FileLimit.php
<?php
[0] Fix | Delete
/*
[1] Fix | Delete
* This file is part of the ManageWP Worker plugin.
[2] Fix | Delete
*
[3] Fix | Delete
* (c) ManageWP LLC <contact@managewp.com>
[4] Fix | Delete
*
[5] Fix | Delete
* For the full copyright and license information, please view the LICENSE
[6] Fix | Delete
* file that was distributed with this source code.
[7] Fix | Delete
*/
[8] Fix | Delete
[9] Fix | Delete
/**
[10] Fix | Delete
* Unlike MWP_Stream_Limit, this stream reader is specialized for limited reading of files because
[11] Fix | Delete
* it is not seekable and automatically closes the underlying stream after it has been read to the end (or limit is exceeded).
[12] Fix | Delete
*/
[13] Fix | Delete
class MWP_Stream_FileLimit extends MWP_Stream_Limit
[14] Fix | Delete
{
[15] Fix | Delete
[16] Fix | Delete
/**
[17] Fix | Delete
* If EOF is ever reached, it gets remembered so file handle reinitializing is prevented
[18] Fix | Delete
* since eof will always return true from then on.
[19] Fix | Delete
*
[20] Fix | Delete
* @var bool|null
[21] Fix | Delete
*/
[22] Fix | Delete
private $eof = null;
[23] Fix | Delete
[24] Fix | Delete
public function isSeekable()
[25] Fix | Delete
{
[26] Fix | Delete
return false;
[27] Fix | Delete
}
[28] Fix | Delete
[29] Fix | Delete
/**
[30] Fix | Delete
* {@inheritdoc}
[31] Fix | Delete
*/
[32] Fix | Delete
public function eof()
[33] Fix | Delete
{
[34] Fix | Delete
if ($this->eof === true) {
[35] Fix | Delete
return true;
[36] Fix | Delete
}
[37] Fix | Delete
[38] Fix | Delete
$this->eof = parent::eof();
[39] Fix | Delete
[40] Fix | Delete
return $this->eof;
[41] Fix | Delete
}
[42] Fix | Delete
[43] Fix | Delete
/**
[44] Fix | Delete
* {@inheritdoc}
[45] Fix | Delete
*/
[46] Fix | Delete
public function read($length)
[47] Fix | Delete
{
[48] Fix | Delete
$buffer = parent::read($length);
[49] Fix | Delete
if ($this->eof()) {
[50] Fix | Delete
$this->close();
[51] Fix | Delete
}
[52] Fix | Delete
[53] Fix | Delete
return $buffer;
[54] Fix | Delete
}
[55] Fix | Delete
}
[56] Fix | Delete
[57] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function