mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-10-31 00:26:51 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			36 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace Pterodactyl\Repositories\Wings;
 | |
| 
 | |
| use Pterodactyl\Models\Node;
 | |
| use Pterodactyl\Models\Server;
 | |
| use GuzzleHttp\Exception\TransferException;
 | |
| use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException;
 | |
| 
 | |
| class DaemonTransferRepository extends DaemonRepository
 | |
| {
 | |
|     /**
 | |
|      * @param Server $server
 | |
|      * @param array $data
 | |
|      * @param Node $node
 | |
|      * @param string $token
 | |
|      *
 | |
|      * @throws DaemonConnectionException
 | |
|      */
 | |
|     public function notify(Server $server, array $data, Node $node, string $token): void
 | |
|     {
 | |
|         try {
 | |
|             $this->getHttpClient()->post('/api/transfer', [
 | |
|                 'json' => [
 | |
|                     'server_id' => $server->uuid,
 | |
|                     'url' => $node->getConnectionAddress() . sprintf('/api/servers/%s/archive', $server->uuid),
 | |
|                     'token' => 'Bearer ' . $token,
 | |
|                     'server' => $data,
 | |
|                 ],
 | |
|             ]);
 | |
|         } catch (TransferException $exception) {
 | |
|             throw new DaemonConnectionException($exception);
 | |
|         }
 | |
|     }
 | |
| }
 | 
