@@ -120,9 +120,12 @@ public function archive(Request $request, string $uuid)
120120
121121 // Unsuspend the server and don't continue the transfer.
122122 if (! $ request ->input ('successful ' )) {
123- $ this ->suspensionService ->toggle ($ server , 'unsuspend ' );
123+ //$this->suspensionService->toggle($server, 'unsuspend');
124+ $ server ->transfer ->forceFill ([
125+ 'successful ' => false ,
126+ ])->saveOrFail ();
124127
125- return JsonResponse:: create ([], Response::HTTP_NO_CONTENT );
128+ return new JsonResponse ([], Response::HTTP_NO_CONTENT );
126129 }
127130
128131 $ server ->node_id = $ server ->transfer ->new_node ;
@@ -151,21 +154,23 @@ public function archive(Request $request, string $uuid)
151154 // because setServer() tells the repository to use the server's node and not the one
152155 // we want to specify.
153156 try {
157+ /** @var \Pterodactyl\Models\Node $newNode */
158+ $ newNode = $ this ->nodeRepository ->find ($ server ->transfer ->new_node );
159+
154160 $ this ->daemonTransferRepository
155161 ->setServer ($ server )
156- ->setNode ($ this -> nodeRepository -> find ( $ server -> transfer -> new_node ) )
162+ ->setNode ($ newNode )
157163 ->notify ($ server , $ data , $ server ->node , $ token ->__toString ());
158164 } catch (DaemonConnectionException $ exception ) {
159165 throw $ exception ;
160166 }
161167
162- return JsonResponse:: create ([], Response::HTTP_NO_CONTENT );
168+ return new JsonResponse ([], Response::HTTP_NO_CONTENT );
163169 }
164170
165171 /**
166172 * The daemon notifies us about a transfer failure.
167173 *
168- * @param \Illuminate\Http\Request $request
169174 * @param string $uuid
170175 * @return \Illuminate\Http\JsonResponse
171176 *
@@ -183,9 +188,9 @@ public function failure(string $uuid)
183188 $ this ->allocationRepository ->updateWhereIn ('id ' , $ allocationIds , ['server_id ' => null ]);
184189
185190 // Unsuspend the server.
186- $ this ->suspensionService ->toggle ($ server , 'unsuspend ' );
191+ // $this->suspensionService->toggle($server, 'unsuspend');
187192
188- return JsonResponse:: create ([], Response::HTTP_NO_CONTENT );
193+ return new JsonResponse ([], Response::HTTP_NO_CONTENT );
189194 }
190195
191196 /**
@@ -213,11 +218,11 @@ public function success(string $uuid)
213218 // Update the server's allocation_id and node_id.
214219 $ server ->allocation_id = $ transfer ->new_allocation ;
215220 $ server ->node_id = $ transfer ->new_node ;
216- $ server ->save ();
221+ $ server ->saveOrFail ();
217222
218223 // Mark the transfer as successful.
219224 $ transfer ->successful = true ;
220- $ transfer ->save ();
225+ $ transfer ->saveOrFail ();
221226
222227 // Commit the transaction.
223228 $ this ->connection ->commit ();
@@ -231,8 +236,8 @@ public function success(string $uuid)
231236
232237 // Unsuspend the server
233238 $ server ->load ('node ' );
234- $ this ->suspensionService ->toggle ($ server , $ this ->suspensionService ::ACTION_UNSUSPEND );
239+ // $this->suspensionService->toggle($server, $this->suspensionService::ACTION_UNSUSPEND);
235240
236- return JsonResponse:: create ([], Response::HTTP_NO_CONTENT );
241+ return new JsonResponse ([], Response::HTTP_NO_CONTENT );
237242 }
238243}
0 commit comments