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