|
@@ 555-569 (lines=15) @@
|
| 552 |
|
* @param int $id |
| 553 |
|
* @return \Illuminate\Http\RedirectResponse |
| 554 |
|
*/ |
| 555 |
|
public function resetDatabasePassword(Request $request, $id) |
| 556 |
|
{ |
| 557 |
|
$database = Models\Database::where('server_id', $id)->findOrFail($request->input('database')); |
| 558 |
|
$repo = new DatabaseRepository; |
| 559 |
|
|
| 560 |
|
try { |
| 561 |
|
$repo->password($database->id, str_random(20)); |
| 562 |
|
|
| 563 |
|
return response('', 204); |
| 564 |
|
} catch (\Exception $ex) { |
| 565 |
|
Log::error($ex); |
| 566 |
|
|
| 567 |
|
return response()->json(['error' => 'A unhandled exception occurred while attempting to reset this password. This error has been logged.'], 503); |
| 568 |
|
} |
| 569 |
|
} |
| 570 |
|
|
| 571 |
|
/** |
| 572 |
|
* Deletes a database from a server. |
|
@@ 579-593 (lines=15) @@
|
| 576 |
|
* @param int $database |
| 577 |
|
* @return \Illuminate\Http\RedirectResponse |
| 578 |
|
*/ |
| 579 |
|
public function deleteDatabase(Request $request, $id, $database) |
| 580 |
|
{ |
| 581 |
|
$database = Models\Database::where('server_id', $id)->findOrFail($database); |
| 582 |
|
$repo = new DatabaseRepository; |
| 583 |
|
|
| 584 |
|
try { |
| 585 |
|
$repo->drop($database->id); |
| 586 |
|
|
| 587 |
|
return response('', 204); |
| 588 |
|
} catch (\Exception $ex) { |
| 589 |
|
Log::error($ex); |
| 590 |
|
|
| 591 |
|
return response()->json(['error' => 'A unhandled exception occurred while attempting to drop this database. This error has been logged.'], 503); |
| 592 |
|
} |
| 593 |
|
} |
| 594 |
|
} |
| 595 |
|
|