Skip to content

Commit b482632

Browse files
committed
Remove unnecessary calls to Wings to add/remove mounts
1 parent ebd81e9 commit b482632

File tree

1 file changed

+7
-28
lines changed

1 file changed

+7
-28
lines changed

app/Http/Controllers/Admin/ServersController.php

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -420,26 +420,18 @@ public function deleteDatabase($server, $database)
420420
*
421421
* @param Server $server
422422
* @param \Pterodactyl\Models\Mount $mount
423-
*
424423
* @return \Illuminate\Http\RedirectResponse
425-
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException|\Throwable
424+
*
425+
* @throws \Throwable
426426
*/
427427
public function addMount(Server $server, Mount $mount)
428428
{
429-
$mountServer = new MountServer;
430-
$mountServer->mount_id = $mount->id;
431-
$mountServer->server_id = $server->id;
432-
$mountServer->saveOrFail();
433-
434-
$data = $this->serverConfigurationStructureService->handle($server);
429+
$mountServer = (new MountServer)->forceFill([
430+
'mount_id' => $mount->id,
431+
'server_id' => $server->id,
432+
]);
435433

436-
try {
437-
$this->daemonServerRepository
438-
->setServer($server)
439-
->update(Arr::only($data, ['mounts']));
440-
} catch (RequestException $exception) {
441-
throw new DaemonConnectionException($exception);
442-
}
434+
$mountServer->saveOrFail();
443435

444436
$this->alert->success('Mount was added successfully.')->flash();
445437

@@ -452,24 +444,11 @@ public function addMount(Server $server, Mount $mount)
452444
* @param Server $server
453445
* @param \Pterodactyl\Models\Mount $mount
454446
* @return \Illuminate\Http\RedirectResponse
455-
*
456-
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
457-
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
458447
*/
459448
public function deleteMount(Server $server, Mount $mount)
460449
{
461450
MountServer::where('mount_id', $mount->id)->where('server_id', $server->id)->delete();
462451

463-
$data = $this->serverConfigurationStructureService->handle($server);
464-
465-
try {
466-
$this->daemonServerRepository
467-
->setServer($server)
468-
->update(Arr::only($data, ['mounts']));
469-
} catch (RequestException $exception) {
470-
throw new DaemonConnectionException($exception);
471-
}
472-
473452
$this->alert->success('Mount was removed successfully.')->flash();
474453

475454
return redirect()->route('admin.servers.view.mounts', $server->id);

0 commit comments

Comments
 (0)