diff --git a/CHANGELOG.md b/CHANGELOG.md
index 365b6c7bd..20d862794 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
* Subuser permissions are now stored in `Permission::list()` to make views way cleaner and make adding to views significantly cleaner.
* `[pre.7]` — Sidebar for file manager now is a single link rather than a dropdown.
* Attempting to reset a password for an account that does not exist no longer returns an error, rather it displays a success message. Failed resets trigger a `Pterodactyl\Events\Auth\FailedPasswordReset` event that can be caught if needed to perform other actions.
+* Servers are no longer queued for deletion due to the general hassle and extra logic required.
## v0.6.0-pre.7 (Courageous Carniadactylus)
### Fixed
diff --git a/app/Http/Controllers/API/ServerController.php b/app/Http/Controllers/API/ServerController.php
index 2dae6bcdc..769fa9412 100755
--- a/app/Http/Controllers/API/ServerController.php
+++ b/app/Http/Controllers/API/ServerController.php
@@ -219,7 +219,7 @@ class ServerController extends BaseController
$repo = new ServerRepository;
try {
- $repo->deleteServer($id, $force);
+ $repo->delete($id, is_null($force));
return $this->response->noContent();
} catch (DisplayException $ex) {
diff --git a/app/Http/Controllers/Admin/ServersController.php b/app/Http/Controllers/Admin/ServersController.php
index dd1ae466d..9b239d8b8 100644
--- a/app/Http/Controllers/Admin/ServersController.php
+++ b/app/Http/Controllers/Admin/ServersController.php
@@ -46,9 +46,7 @@ class ServersController extends Controller
*/
public function index(Request $request)
{
- $servers = Models\Server::withTrashed()->with(
- 'node', 'user', 'allocation'
- );
+ $servers = Models\Server::with('node', 'user', 'allocation');
if (! is_null($request->input('query'))) {
$servers->search($request->input('query'));
@@ -146,7 +144,7 @@ class ServersController extends Controller
*/
public function viewIndex(Request $request, $id)
{
- return view('admin.servers.view.index', ['server' => Models\Server::withTrashed()->findOrFail($id)]);
+ return view('admin.servers.view.index', ['server' => Models\Server::findOrFail($id)]);
}
/**
@@ -238,7 +236,7 @@ class ServersController extends Controller
*/
public function viewDelete(Request $request, $id)
{
- return view('admin.servers.view.delete', ['server' => Models\Server::withTrashed()->findOrFail($id)]);
+ return view('admin.servers.view.delete', ['server' => Models\Server::findOrFail($id)]);
}
/**
@@ -420,49 +418,7 @@ class ServersController extends Controller
$repo = new ServerRepository;
try {
- $repo->queueDeletion($id, ($request->input('is_force') > 0));
- Alert::success('Server has been marked for deletion on the system.')->flash();
- } catch (DisplayException $ex) {
- Alert::danger($ex->getMessage())->flash();
- } catch (\Exception $ex) {
- Log::error($ex);
- Alert::danger('An unhandled exception occured while attemping to delete this server. This error has been logged.')->flash();
- }
-
- return redirect()->route('admin.servers.view.delete', $id);
- }
-
- /**
- * Cancels a pending server deletion request.
- *
- * @param \Illuminate\Http\Request $request
- * @param int $id
- * @return \Illuminate\Http\RedirectResponse
- */
- public function cancelDeletion(Request $request, $id)
- {
- $repo = new ServerRepository;
-
- $repo->cancelDeletion($id);
- Alert::success('Server deletion has been cancelled. This server will remain suspended until you unsuspend it.')->flash();
-
- return redirect()->route('admin.servers.view.delete', $id);
- }
-
- /**
- * Skips the queue and continues the server deletion process.
- *
- * @param \Illuminate\Http\Request $request
- * @param int $id
- * @param string $method
- * @return \Illuminate\Http\RedirectResponse
- */
- public function continueDeletion(Request $request, $id, $method = 'safe')
- {
- $repo = new ServerRepository;
-
- try {
- $repo->delete($id, (isset($method) && $method === 'force'));
+ $repo->delete($id, $request->has('force_delete'));
Alert::success('Server was successfully deleted from the system.')->flash();
return redirect()->route('admin.servers');
diff --git a/app/Jobs/DeleteServer.php b/app/Jobs/DeleteServer.php
deleted file mode 100644
index 881d7dc9c..000000000
--- a/app/Jobs/DeleteServer.php
+++ /dev/null
@@ -1,64 +0,0 @@
-.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-namespace Pterodactyl\Jobs;
-
-use Illuminate\Queue\SerializesModels;
-use Illuminate\Queue\InteractsWithQueue;
-use Illuminate\Contracts\Queue\ShouldQueue;
-use Pterodactyl\Repositories\ServerRepository;
-
-class DeleteServer extends Job implements ShouldQueue
-{
- use InteractsWithQueue, SerializesModels;
-
- /**
- * ID of server to be deleted.
- *
- * @var int
- */
- protected $id;
-
- /**
- * Create a new job instance.
- *
- * @param int $id
- * @return void
- */
- public function __construct($id)
- {
- $this->id = $id;
- }
-
- /**
- * Execute the job.
- *
- * @return void
- */
- public function handle()
- {
- $repo = new ServerRepository;
- $repo->delete($this->id);
- }
-}
diff --git a/app/Jobs/SuspendServer.php b/app/Jobs/SuspendServer.php
deleted file mode 100644
index 8129bfae5..000000000
--- a/app/Jobs/SuspendServer.php
+++ /dev/null
@@ -1,64 +0,0 @@
-.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-namespace Pterodactyl\Jobs;
-
-use Illuminate\Queue\SerializesModels;
-use Illuminate\Queue\InteractsWithQueue;
-use Illuminate\Contracts\Queue\ShouldQueue;
-use Pterodactyl\Repositories\ServerRepository;
-
-class SuspendServer extends Job implements ShouldQueue
-{
- use InteractsWithQueue, SerializesModels;
-
- /**
- * ID of associated server model.
- *
- * @var int
- */
- protected $id;
-
- /**
- * Create a new job instance.
- *
- * @param int $id
- * @return void
- */
- public function __construct($id)
- {
- $this->id = $id;
- }
-
- /**
- * Execute the job.
- *
- * @return void
- */
- public function handle()
- {
- $repo = new ServerRepository;
- $repo->suspend($this->id, true);
- }
-}
diff --git a/app/Models/Server.php b/app/Models/Server.php
index fdeca115a..633c1a542 100644
--- a/app/Models/Server.php
+++ b/app/Models/Server.php
@@ -30,12 +30,11 @@ use Carbon;
use Javascript;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
-use Illuminate\Database\Eloquent\SoftDeletes;
use Nicolaslopezj\Searchable\SearchableTrait;
class Server extends Model
{
- use Notifiable, SearchableTrait, SoftDeletes;
+ use Notifiable, SearchableTrait;
/**
* The table associated with the model.
diff --git a/app/Observers/ServerObserver.php b/app/Observers/ServerObserver.php
index 9866cb661..f69ac225b 100644
--- a/app/Observers/ServerObserver.php
+++ b/app/Observers/ServerObserver.php
@@ -78,8 +78,6 @@ class ServerObserver
public function deleting(Server $server)
{
event(new Events\Server\Deleting($server));
-
- $this->dispatch((new SuspendServer($server->id))->onQueue(config('pterodactyl.queues.high')));
}
/**
@@ -91,12 +89,6 @@ class ServerObserver
public function deleted(Server $server)
{
event(new Events\Server\Deleted($server));
-
- $this->dispatch(
- (new DeleteServer($server->id))
- ->delay(Carbon::now()->addMinutes(config('pterodactyl.tasks.delete_server')))
- ->onQueue(config('pterodactyl.queues.standard'))
- );
}
/**
diff --git a/app/Repositories/ServerRepository.php b/app/Repositories/ServerRepository.php
index 16d618edc..1c6f01904 100644
--- a/app/Repositories/ServerRepository.php
+++ b/app/Repositories/ServerRepository.php
@@ -719,25 +719,6 @@ class ServerRepository
});
}
- /**
- * Queue a server for deletion.
- *
- * @param int $id
- * @param bool $force
- * @return void
- */
- public function queueDeletion($id, $force = false)
- {
- $server = Models\Server::findOrFail($id);
-
- DB::transaction(function () use ($force, $server) {
- $server->installed = $force ? 3 : $server->installed;
- $server->save();
-
- $server->delete();
- });
- }
-
/**
* Delete a server from the system permanetly.
*
@@ -749,13 +730,7 @@ class ServerRepository
*/
public function delete($id, $force = false)
{
- $server = Models\Server::withTrashed()->with('node', 'allocations', 'variables')->findOrFail($id);
-
- // Handle server being restored previously or
- // an accidental queue.
- if (! $server->trashed()) {
- return;
- }
+ $server = Models\Server::with('node', 'allocations', 'variables')->findOrFail($id);
// Due to MySQL lockouts if the daemon response fails, we need to
// delete the server from the daemon first. If it succeedes and then
@@ -768,7 +743,7 @@ class ServerRepository
'X-Access-Server' => $server->uuid,
])->request('DELETE', '/servers');
} catch (TransferException $ex) {
- if ($server->installed !== 3 && ! $force) {
+ if (! $force) {
throw new DisplayException($ex->getMessage());
}
} catch (\Exception $ex) {
@@ -807,25 +782,10 @@ class ServerRepository
}
// Fully delete the server.
- $server->forceDelete();
+ $server->delete();
});
}
- /**
- * Cancel the deletion of a server.
- *
- * @param int $id
- * @return void
- */
- public function cancelDeletion($id)
- {
- $server = Models\Server::withTrashed()->findOrFail($id);
- $server->restore();
-
- $server->installed = 1;
- $server->save();
- }
-
/**
* Toggle the install status of a serve.
*
@@ -856,7 +816,7 @@ class ServerRepository
*/
public function suspend($id, $deleted = false)
{
- $server = Models\Server::withTrashed()->with('node')->findOrFail($id);
+ $server = Models\Server::with('node')->findOrFail($id);
DB::beginTransaction();
diff --git a/resources/themes/pterodactyl/admin/servers/index.blade.php b/resources/themes/pterodactyl/admin/servers/index.blade.php
index 820ca47df..3a59f266e 100644
--- a/resources/themes/pterodactyl/admin/servers/index.blade.php
+++ b/resources/themes/pterodactyl/admin/servers/index.blade.php
@@ -70,10 +70,8 @@
{{ $server->allocation->alias }}:{{ $server->allocation->port }}
This server is currently marked for deletion by the system {{ Carbon::parse($server->deleted_at)->addMinutes(config('pterodactyl.tasks.delete_server'))->diffForHumans() }}.
-Deleting a server is an irreversible action. All server data (including files and users) will be removed from the system.
-