2020-04-04 03:45:37 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Services\Servers;
|
|
|
|
|
|
|
|
use Pterodactyl\Models\Server;
|
|
|
|
use Pterodactyl\Repositories\Wings\DaemonServerRepository;
|
2020-04-04 22:24:58 +00:00
|
|
|
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
|
2020-04-04 03:45:37 +00:00
|
|
|
|
|
|
|
class TransferService
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var \Pterodactyl\Contracts\Repository\ServerRepositoryInterface
|
|
|
|
*/
|
|
|
|
private $repository;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var \Pterodactyl\Repositories\Wings\DaemonServerRepository
|
|
|
|
*/
|
|
|
|
private $daemonServerRepository;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* TransferService constructor.
|
|
|
|
*
|
|
|
|
* @param \Pterodactyl\Repositories\Wings\DaemonServerRepository $daemonServerRepository
|
|
|
|
* @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $repository
|
|
|
|
*/
|
|
|
|
public function __construct(
|
|
|
|
DaemonServerRepository $daemonServerRepository,
|
2020-04-04 06:50:06 +00:00
|
|
|
ServerRepositoryInterface $repository
|
2020-04-04 03:45:37 +00:00
|
|
|
) {
|
|
|
|
$this->repository = $repository;
|
|
|
|
$this->daemonServerRepository = $daemonServerRepository;
|
|
|
|
}
|
|
|
|
|
2020-04-04 06:50:06 +00:00
|
|
|
/**
|
|
|
|
* Requests an archive from the daemon.
|
|
|
|
*
|
|
|
|
* @param int|\Pterodactyl\Models\Server $server
|
|
|
|
*
|
|
|
|
* @throws \Throwable
|
|
|
|
*/
|
|
|
|
public function requestArchive(Server $server)
|
2020-04-04 03:45:37 +00:00
|
|
|
{
|
2020-04-04 06:50:06 +00:00
|
|
|
$this->daemonServerRepository->setServer($server)->requestArchive();
|
2020-04-04 03:45:37 +00:00
|
|
|
}
|
|
|
|
}
|