mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-18 22:33:44 +02:00
Modify how deletion service works (actually fixes #2085); cover changes with test
This commit is contained in:
@@ -151,20 +151,19 @@ class DatabaseManagementService
|
||||
/**
|
||||
* Delete a database from the given host server.
|
||||
*
|
||||
* @param int $id
|
||||
* @param \Pterodactyl\Models\Database $database
|
||||
* @return bool|null
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function delete($id)
|
||||
public function delete(Database $database)
|
||||
{
|
||||
$database = $this->repository->find($id);
|
||||
$this->dynamic->set('dynamic', $database->database_host_id);
|
||||
|
||||
$this->repository->dropDatabase($database->database);
|
||||
$this->repository->dropUser($database->username, $database->remote);
|
||||
$this->repository->flush();
|
||||
|
||||
return $this->repository->delete($id);
|
||||
return $database->delete();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user