Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/worker/src/MWP/Progress
File: Download.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
class MWP_Progress_Download extends MWP_Progress_Abstract
[10] Fix | Delete
{
[11] Fix | Delete
/**
[12] Fix | Delete
* @var Monolog_Psr_LoggerInterface
[13] Fix | Delete
*/
[14] Fix | Delete
private $logger;
[15] Fix | Delete
[16] Fix | Delete
/**
[17] Fix | Delete
* @var int
[18] Fix | Delete
*/
[19] Fix | Delete
private $lastProgress = 0;
[20] Fix | Delete
[21] Fix | Delete
public function __construct($threshold, Monolog_Psr_LoggerInterface $logger)
[22] Fix | Delete
{
[23] Fix | Delete
$this->logger = $logger;
[24] Fix | Delete
}
[25] Fix | Delete
[26] Fix | Delete
public function callback(&$curl, $downloadSize, $downloadedSize, $uploadSize, $uploadedSize = 0)
[27] Fix | Delete
{
[28] Fix | Delete
if (!$this->yieldCallback()) {
[29] Fix | Delete
return;
[30] Fix | Delete
}
[31] Fix | Delete
[32] Fix | Delete
if (func_num_args() < 5) {
[33] Fix | Delete
$uploadedSize = $uploadSize;
[34] Fix | Delete
$uploadSize = $downloadedSize;
[35] Fix | Delete
$downloadedSize = $downloadSize;
[36] Fix | Delete
$downloadSize = $curl;
[37] Fix | Delete
}
[38] Fix | Delete
[39] Fix | Delete
$currentProgress = $downloadedSize;
[40] Fix | Delete
$speed = $this->formatBytes(($currentProgress - $this->lastProgress) / $this->getThreshold());
[41] Fix | Delete
$this->lastProgress = $currentProgress;
[42] Fix | Delete
[43] Fix | Delete
$progress = round($currentProgress / $downloadSize * 100, 2);
[44] Fix | Delete
[45] Fix | Delete
$this->logger->info('Download progress: {progress}% (speed: {speed}/s)', array(
[46] Fix | Delete
'progress' => $progress,
[47] Fix | Delete
'speed' => $speed,
[48] Fix | Delete
));
[49] Fix | Delete
}
[50] Fix | Delete
}
[51] Fix | Delete
[52] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function