Fix the service delete (#7944)

* Fix the service delete

* Update services.php
This commit is contained in:
Alex
2026-05-01 16:04:33 +00:00
committed by GitHub
parent 4022dbb3b2
commit 571c5f98f4
2 changed files with 4 additions and 29 deletions
+2 -2
View File
@@ -99,7 +99,7 @@ class services {
*/ */
public function delete($records) { public function delete($records) {
// Permission not found // Permission not found
if (permission_exists($this->name.'_delete')) { if (!permission_exists($this->name.'_delete')) {
return; return;
} }
@@ -237,7 +237,7 @@ class services {
foreach($service_files as $file) { foreach($service_files as $file) {
// Get the service name // Get the service name
$service_name = $this->find_service_name($file); $service_name = $this->find_service_name($file);
// Get the service status // Get the service status
if ($details) { if ($details) {
$service_status = $this->is_running($service_name); $service_status = $this->is_running($service_name);
+2 -27
View File
@@ -50,30 +50,6 @@
// process the http post data by action // process the http post data by action
if (!empty($action) && !empty($services) && is_array($services) && @sizeof($services) != 0) { if (!empty($action) && !empty($services) && is_array($services) && @sizeof($services) != 0) {
// validate the token
$token = new token;
if (!$token->validate($_SERVER['PHP_SELF'])) {
message::add($text['message-invalid_token'],'negative');
header('Location: services.php');
exit;
}
// prepare the array
if (!empty($services)) {
foreach ($services as $row) {
$array['services'][$x]['checked'] = $row['checked'];
$array['services'][$x]['service_uuid'] = $row['service_uuid'];
$array['services'][$x]['service_enabled'] = $row['service_enabled'];
$x++;
}
}
// prepare the database object
$database->app_name = 'services';
$database->app_uuid = '540c3ec2-4f0c-467f-a09d-d644439c96f2';
// send the array to the database class
switch ($action) { switch ($action) {
case 'toggle': case 'toggle':
if (permission_exists('service_edit')) { if (permission_exists('service_edit')) {
@@ -83,9 +59,8 @@
break; break;
case 'delete': case 'delete':
if (permission_exists('service_delete')) { if (permission_exists('service_delete')) {
$database->delete($array); $obj = new services;
// $obj = new services; $obj->delete($services);
// $obj->delete($services);
} }
break; break;
} }