Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure we refresh FTL's internal groups cache. #1142

Merged
merged 2 commits into from Feb 3, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
58 changes: 29 additions & 29 deletions scripts/pi-hole/php/groups.php
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