Skip to content

Commit

Permalink
Merge pull request #1142 from pi-hole/fix/FTL_group_update
Browse files Browse the repository at this point in the history
Ensure we refresh FTL's internal groups cache.
  • Loading branch information
PromoFaux committed Feb 3, 2020
2 parents d008bca + 174c063 commit 4958ed2
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions scripts/pi-hole/php/groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function JSON_error($message = null)
}
echo json_encode(array('data' => $data));
} catch (\Exception $ex) {
return JSON_error($ex->getMessage());
JSON_error($ex->getMessage());
}
} elseif ($_POST['action'] == 'add_group') {
// Add new group
Expand All @@ -72,9 +72,9 @@ function JSON_error($message = null)
}

$reload = true;
return JSON_success();
JSON_success();
} catch (\Exception $ex) {
return JSON_error($ex->getMessage());
JSON_error($ex->getMessage());
}
} elseif ($_POST['action'] == 'edit_group') {
// Edit group identified by ID
Expand Down Expand Up @@ -111,9 +111,9 @@ function JSON_error($message = null)
}

$reload = true;
return JSON_success();
JSON_success();
} catch (\Exception $ex) {
return JSON_error($ex->getMessage());
JSON_error($ex->getMessage());
}
} elseif ($_POST['action'] == 'delete_group') {
// Delete group identified by ID
Expand Down Expand Up @@ -142,9 +142,9 @@ function JSON_error($message = null)
}
}
$reload = true;
return JSON_success();
JSON_success();
} catch (\Exception $ex) {
return JSON_error($ex->getMessage());
JSON_error($ex->getMessage());
}
} elseif ($_POST['action'] == 'get_clients') {
// List all available groups
Expand Down Expand Up @@ -193,7 +193,7 @@ function JSON_error($message = null)

echo json_encode(array('data' => $data));
} catch (\Exception $ex) {
return JSON_error($ex->getMessage());
JSON_error($ex->getMessage());
}
} elseif ($_POST['action'] == 'get_unconfigured_clients') {
// List all available clients WITHOUT already configured clients
Expand Down Expand Up @@ -227,7 +227,7 @@ function JSON_error($message = null)

echo json_encode($ips);
} catch (\Exception $ex) {
return JSON_error($ex->getMessage());
JSON_error($ex->getMessage());
}
} elseif ($_POST['action'] == 'add_client') {
// Add new client
Expand All @@ -246,9 +246,9 @@ function JSON_error($message = null)
}

$reload = true;
return JSON_success();
JSON_success();
} catch (\Exception $ex) {
return JSON_error($ex->getMessage());
JSON_error($ex->getMessage());
}
} elseif ($_POST['action'] == 'edit_client') {
// Edit client identified by ID
Expand Down Expand Up @@ -288,9 +288,9 @@ function JSON_error($message = null)
$db->query('COMMIT;');

$reload = true;
return JSON_success();
JSON_success();
} catch (\Exception $ex) {
return JSON_error($ex->getMessage());
JSON_error($ex->getMessage());
}
} elseif ($_POST['action'] == 'delete_client') {
// Delete client identified by ID
Expand Down Expand Up @@ -322,9 +322,9 @@ function JSON_error($message = null)
}

$reload = true;
return JSON_success();
JSON_success();
} catch (\Exception $ex) {
return JSON_error($ex->getMessage());
JSON_error($ex->getMessage());
}
} elseif ($_POST['action'] == 'get_domains') {
// List all available groups
Expand Down Expand Up @@ -352,7 +352,7 @@ function JSON_error($message = null)

echo json_encode(array('data' => $data));
} catch (\Exception $ex) {
return JSON_error($ex->getMessage());
JSON_error($ex->getMessage());
}
} elseif ($_POST['action'] == 'add_domain') {
// Add new domain
Expand Down Expand Up @@ -392,9 +392,9 @@ function JSON_error($message = null)
}

$reload = true;
return JSON_success();
JSON_success();
} catch (\Exception $ex) {
return JSON_error($ex->getMessage());
JSON_error($ex->getMessage());
}
} elseif ($_POST['action'] == 'edit_domain') {
// Edit domain identified by ID
Expand Down Expand Up @@ -469,9 +469,9 @@ function JSON_error($message = null)
$db->query('COMMIT;');

$reload = true;
return JSON_success();
JSON_success();
} catch (\Exception $ex) {
return JSON_error($ex->getMessage());
JSON_error($ex->getMessage());
}
} elseif ($_POST['action'] == 'delete_domain') {
// Delete domain identified by ID
Expand Down Expand Up @@ -503,9 +503,9 @@ function JSON_error($message = null)
}

$reload = true;
return JSON_success();
JSON_success();
} catch (\Exception $ex) {
return JSON_error($ex->getMessage());
JSON_error($ex->getMessage());
}
} elseif ($_POST['action'] == 'get_adlists') {
// List all available groups
Expand Down Expand Up @@ -533,7 +533,7 @@ function JSON_error($message = null)

echo json_encode(array('data' => $data));
} catch (\Exception $ex) {
return JSON_error($ex->getMessage());
JSON_error($ex->getMessage());
}
} elseif ($_POST['action'] == 'add_adlist') {
// Add new adlist
Expand All @@ -556,9 +556,9 @@ function JSON_error($message = null)
}

$reload = true;
return JSON_success();
JSON_success();
} catch (\Exception $ex) {
return JSON_error($ex->getMessage());
JSON_error($ex->getMessage());
}
} elseif ($_POST['action'] == 'edit_adlist') {
// Edit adlist identified by ID
Expand Down Expand Up @@ -629,9 +629,9 @@ function JSON_error($message = null)
$db->query('COMMIT;');

$reload = true;
return JSON_success();
JSON_success();
} catch (\Exception $ex) {
return JSON_error($ex->getMessage());
JSON_error($ex->getMessage());
}
} elseif ($_POST['action'] == 'delete_adlist') {
// Delete adlist identified by ID
Expand Down Expand Up @@ -663,9 +663,9 @@ function JSON_error($message = null)
}

$reload = true;
return JSON_success();
JSON_success();
} catch (\Exception $ex) {
return JSON_error($ex->getMessage());
JSON_error($ex->getMessage());
}
} else {
log_and_die('Requested action not supported!');
Expand Down

0 comments on commit 4958ed2

Please sign in to comment.