|
@@ 510-524 (lines=15) @@
|
| 507 |
|
* @param int $id |
| 508 |
|
* @return \Illuminate\Http\RedirectResponse |
| 509 |
|
*/ |
| 510 |
|
public function resetDatabasePassword(Request $request, $id) |
| 511 |
|
{ |
| 512 |
|
$database = Models\Database::where('server_id', $id)->findOrFail($request->input('database')); |
| 513 |
|
$repo = new DatabaseRepository; |
| 514 |
|
|
| 515 |
|
try { |
| 516 |
|
$repo->password($database->id, str_random(20)); |
| 517 |
|
|
| 518 |
|
return response('', 204); |
| 519 |
|
} catch (\Exception $ex) { |
| 520 |
|
Log::error($ex); |
| 521 |
|
|
| 522 |
|
return response()->json(['error' => 'A unhandled exception occurred while attempting to reset this password. This error has been logged.'], 503); |
| 523 |
|
} |
| 524 |
|
} |
| 525 |
|
|
| 526 |
|
/** |
| 527 |
|
* Deletes a database from a server. |
|
@@ 534-548 (lines=15) @@
|
| 531 |
|
* @param int $database |
| 532 |
|
* @return \Illuminate\Http\RedirectResponse |
| 533 |
|
*/ |
| 534 |
|
public function deleteDatabase(Request $request, $id, $database) |
| 535 |
|
{ |
| 536 |
|
$database = Models\Database::where('server_id', $id)->findOrFail($database); |
| 537 |
|
$repo = new DatabaseRepository; |
| 538 |
|
|
| 539 |
|
try { |
| 540 |
|
$repo->drop($database->id); |
| 541 |
|
|
| 542 |
|
return response('', 204); |
| 543 |
|
} catch (\Exception $ex) { |
| 544 |
|
Log::error($ex); |
| 545 |
|
|
| 546 |
|
return response()->json(['error' => 'A unhandled exception occurred while attempting to drop this database. This error has been logged.'], 503); |
| 547 |
|
} |
| 548 |
|
} |
| 549 |
|
} |
| 550 |
|
|