forked from Alex/Pterodactyl-Panel
[L6] Update cursor() calls to work with new lazy collections
This commit is contained in:
parent
08bdc9705f
commit
1c5b9dbb87
@ -98,7 +98,7 @@ class BulkPowerActionCommand extends Command
|
||||
$bar = $this->output->createProgressBar($count);
|
||||
$servers = $this->repository->getServersForPowerAction($servers, $nodes);
|
||||
|
||||
foreach ($servers as $server) {
|
||||
$servers->each(function ($server) use ($action, &$bar) {
|
||||
$bar->clear();
|
||||
|
||||
try {
|
||||
@ -117,7 +117,7 @@ class BulkPowerActionCommand extends Command
|
||||
|
||||
$bar->advance();
|
||||
$bar->display();
|
||||
}
|
||||
});
|
||||
|
||||
$this->line('');
|
||||
}
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
namespace Pterodactyl\Contracts\Repository;
|
||||
|
||||
use Generator;
|
||||
use Pterodactyl\Models\Node;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\LazyCollection;
|
||||
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
||||
use Pterodactyl\Contracts\Repository\Attributes\SearchableInterface;
|
||||
|
||||
@ -69,7 +69,7 @@ interface NodeRepositoryInterface extends RepositoryInterface, SearchableInterfa
|
||||
* @param array $locations
|
||||
* @param int $disk
|
||||
* @param int $memory
|
||||
* @return \Generator
|
||||
* @return \Illuminate\Support\LazyCollection
|
||||
*/
|
||||
public function getNodesWithResourceUse(array $locations, int $disk, int $memory): Generator;
|
||||
public function getNodesWithResourceUse(array $locations, int $disk, int $memory): LazyCollection;
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ interface ServerRepositoryInterface extends RepositoryInterface, SearchableInter
|
||||
* @param int[] $servers
|
||||
* @param int[] $nodes
|
||||
* @param bool $returnCount
|
||||
* @return int|\Generator
|
||||
* @return int|\Illuminate\Support\LazyCollection
|
||||
*/
|
||||
public function getServersForPowerAction(array $servers = [], array $nodes = [], bool $returnCount = false);
|
||||
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
namespace Pterodactyl\Repositories\Eloquent;
|
||||
|
||||
use Generator;
|
||||
use Pterodactyl\Models\Node;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\LazyCollection;
|
||||
use Pterodactyl\Repositories\Concerns\Searchable;
|
||||
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
||||
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
|
||||
@ -172,9 +172,9 @@ class NodeRepository extends EloquentRepository implements NodeRepositoryInterfa
|
||||
* @param array $locations
|
||||
* @param int $disk
|
||||
* @param int $memory
|
||||
* @return \Generator
|
||||
* @return \Illuminate\Support\LazyCollection
|
||||
*/
|
||||
public function getNodesWithResourceUse(array $locations, int $disk, int $memory): Generator
|
||||
public function getNodesWithResourceUse(array $locations, int $disk, int $memory): LazyCollection
|
||||
{
|
||||
$instance = $this->getBuilder()
|
||||
->select(['nodes.id', 'nodes.memory', 'nodes.disk', 'nodes.memory_overallocate', 'nodes.disk_overallocate'])
|
||||
|
@ -291,7 +291,7 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt
|
||||
* @param int[] $servers
|
||||
* @param int[] $nodes
|
||||
* @param bool $returnCount
|
||||
* @return int|\Generator
|
||||
* @return int|\Illuminate\Support\LazyCollection
|
||||
*/
|
||||
public function getServersForPowerAction(array $servers = [], array $nodes = [], bool $returnCount = false)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user