classes/Tasks/BatchManager.php
public function stats($batch) {
        $total = $this->totalCount($batch);
        $current = $this->current($batch);
        $totalTime = $this->totalTime($batch);

        $progress = 0;
        if ($total > 0) {
            $progress = ($current / $total) * 100;
        }

        $postsPerMinute = 0;
        $eta = 0;
        if (($totalTime > 0) && ($current > 1)) {
            $postsPerSecond = ($totalTime / ($current - 1));
            if ($postsPerSecond > 0) {
                $postsPerMinute = 60 / $postsPerSecond;
                $eta = ($total - $current) / $postsPerMinute;
            }
        }



        $thumbUrl = null;
        $icon = false;

        if (!empty($this->currentID($batch))) {
            $thumb = wp_get_attachment_image_src($this->currentID($batch), 'thumbnail', true);
            if (!empty($thumb)) {
                $thumbUrl = $thumb[0];
                $icon = (($thumb[1] != 150) && ($thumb[2] != 150));
            }
        }

        return [
            'running' => $this->status($batch),
            'current' => $current,
            'currentID' => $this->currentID($batch),
            'thumb' => $thumbUrl,
            'icon' => $icon,
            'currentFile' => $this->currentFile($batch),
            'total' => $total,
            'totalTime' => $totalTime,
            'lastTime' => $this->lastTime($batch),
            'lastRun' => $this->lastRun($batch),
            'lastUpdate' => $this->lastUpdate($batch),
            'eta' => $eta,
            'progress' => $progress,
            'postsPerMinute' => $postsPerMinute,
            'shouldCancel' => $this->shouldCancel($batch)
        ];
    }
public function stats($batch) {
        $total = $this->totalCount($batch);
        $current = $this->current($batch);
        $totalTime = $this->totalTime($batch);

        $progress = 0;
        if ($total > 0) {
            $progress = ($current / $total) * 100;
        }

        $postsPerMinute = 0;
        $eta = 0;
        if (($totalTime > 0) && ($current > 1)) {
            $postsPerSecond = ($totalTime / ($current - 1));
            if ($postsPerSecond > 0) {
                $postsPerMinute = 60 / $postsPerSecond;
                $eta = ($total - $current) / $postsPerMinute;
            }
        }



        $thumbUrl = null;
        $icon = false;

        if (!empty($this->currentID($batch))) {
            $thumb = wp_get_attachment_image_src($this->currentID($batch), 'thumbnail', true);
            if (!empty($thumb)) {
                $thumbUrl = $thumb[0];
                $icon = (($thumb[1] != 150) && ($thumb[2] != 150));
            }
        }

        return [
            'running' => $this->status($batch),
            'current' => $current,
            'currentID' => $this->currentID($batch),
            'thumb' => $thumbUrl,
            'icon' => $icon,
            'currentFile' => $this->currentFile($batch),
            'total' => $total,
            'totalTime' => $totalTime,
            'lastTime' => $this->lastTime($batch),
            'lastRun' => $this->lastRun($batch),
            'lastUpdate' => $this->lastUpdate($batch),
            'eta' => $eta,
            'progress' => $progress,
            'postsPerMinute' => $postsPerMinute,
            'shouldCancel' => $this->shouldCancel($batch)
        ];
    }
public function stats ( $ batch ) { $ total = $ this -> totalCount ( $ batch ) ; $ current = $ this -> current ( $ batch ) ; $ totalTime = $ this -> totalTime ( $ batch ) ; $ progress = 0 ; if ( $ total > 0 ) { $ progress = ( $ current / $ total ) * 100 ; } $ postsPerMinute = 0 ; $ eta = 0 ; if ( ( $ totalTime > 0 ) && ( $ current > 1 ) ) { $ postsPerSecond = ( $ totalTime / ( $ current - 1 ) ) ; if ( $ postsPerSecond > 0 ) { $ postsPerMinute = 60 / $ postsPerSecond ; $ eta = ( $ total - $ current ) / $ postsPerMinute ; } } $ thumbUrl = null ; $ icon = false ; if ( ! empty ( $ this -> currentID ( $ batch ) ) ) { $ thumb = wp_get_attachment_image_src ( $ this -> currentID ( $ batch ) , 'thumbnail' , true ) ; if ( ! empty ( $ thumb ) ) { $ thumbUrl = $ thumb [ 0 ] ; $ icon = ( ( $ thumb [ 1 ] != 150 ) && ( $ thumb [ 2 ] != 150 ) ) ; } } return [ 'running' => $ this -> status ( $ batch ) , 'current' => $ current , 'currentID' => $ this -> currentID ( $ batch ) , 'thumb' => $ thumbUrl , 'icon' => $ icon , 'currentFile' => $ this -> currentFile ( $ batch ) , 'total' => $ total , 'totalTime' => $ totalTime , 'lastTime' => $ this -> lastTime ( $ batch ) , 'lastRun' => $ this -> lastRun ( $ batch ) , 'lastUpdate' => $ this -> lastUpdate ( $ batch ) , 'eta' => $ eta , 'progress' => $ progress , 'postsPerMinute' => $ postsPerMinute , 'shouldCancel' => $ this -> shouldCancel ( $ batch ) ] ; }
Returns stats about this batch

@param $batch
@return array
Returns stats about this batch