|
@@ 543-557 (lines=15) @@
|
| 540 |
|
* @param int $id |
| 541 |
|
* @return \Illuminate\Response\RedirectResponse |
| 542 |
|
*/ |
| 543 |
|
public function resetDatabasePassword(Request $request, $id) |
| 544 |
|
{ |
| 545 |
|
$database = Models\Database::where('server_id', $id)->findOrFail($request->input('database')); |
| 546 |
|
$repo = new DatabaseRepository; |
| 547 |
|
|
| 548 |
|
try { |
| 549 |
|
$repo->password($database->id, str_random(20)); |
| 550 |
|
|
| 551 |
|
return response('', 204); |
| 552 |
|
} catch (\Exception $ex) { |
| 553 |
|
Log::error($ex); |
| 554 |
|
|
| 555 |
|
return response()->json(['error' => 'A unhandled exception occurred while attempting to reset this password. This error has been logged.'], 503); |
| 556 |
|
} |
| 557 |
|
} |
| 558 |
|
|
| 559 |
|
/** |
| 560 |
|
* Deletes a database from a server. |
|
@@ 565-579 (lines=15) @@
|
| 562 |
|
* @param int $id |
| 563 |
|
* @return \Illuminate\Response\RedirectResponse |
| 564 |
|
*/ |
| 565 |
|
public function deleteDatabase(Request $request, $id, $database) |
| 566 |
|
{ |
| 567 |
|
$database = Models\Database::where('server_id', $id)->findOrFail($database); |
| 568 |
|
$repo = new DatabaseRepository; |
| 569 |
|
|
| 570 |
|
try { |
| 571 |
|
$repo->drop($database->id); |
| 572 |
|
|
| 573 |
|
return response('', 204); |
| 574 |
|
} catch (\Exception $ex) { |
| 575 |
|
Log::error($ex); |
| 576 |
|
|
| 577 |
|
return response()->json(['error' => 'A unhandled exception occurred while attempting to drop this database. This error has been logged.'], 503); |
| 578 |
|
} |
| 579 |
|
} |
| 580 |
|
} |
| 581 |
|
|