Пример #1
0
 public function callback(&$curl, $downloadSize, $downloadedSize, $uploadSize, $uploadedSize = 0)
 {
     if (!$this->yieldCallback()) {
         return;
     }
     if (func_num_args() < 5) {
         $uploadedSize = $uploadSize;
         $uploadSize = $downloadedSize;
         $downloadedSize = $downloadSize;
         $downloadSize = $curl;
     }
     $currentProgress = $downloadedSize;
     $speed = $this->formatBytes(($currentProgress - $this->lastProgress) / $this->getThreshold());
     $this->lastProgress = $currentProgress;
     $progress = round($currentProgress / $downloadSize * 100, 2);
     $this->logger->info('Download progress: {progress}% (speed: {speed}/s)', array('progress' => $progress, 'speed' => $speed));
 }
Пример #2
0
 public function callback(&$curl, $downloadSize, $downloadedSize, $uploadSize, $uploadedSize = 0)
 {
     if (!$this->yieldCallback()) {
         return;
     }
     if (func_num_args() < 5) {
         $uploadedSize = $uploadSize;
         $uploadSize = $downloadedSize;
         $downloadedSize = $downloadSize;
         $downloadSize = $curl;
     }
     $offset = is_resource($curl) ? $this->calculateOffset($curl) : 0;
     $currentProgress = $uploadedSize + $offset;
     $speed = $this->formatBytes(($currentProgress - $this->lastProgress) / $this->getThreshold());
     $this->lastProgress = $currentProgress;
     $progress = round($currentProgress / $this->fileSize * 100, 2);
     global $forkedRequest;
     if (!$forkedRequest) {
         echo " ";
         flush();
     }
     $this->logger->info('Upload progress: {progress}% (speed: {speed}/s)', array('progress' => $progress, 'speed' => $speed));
 }