Skip to content

Commit

Permalink
Merge pull request #2222 from pi-hole/fix2221
Browse files Browse the repository at this point in the history
Add a default option for PORTFILE
  • Loading branch information
yubiuser authored Jun 8, 2022
2 parents e2d52c7 + 1317528 commit 8465946
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions scripts/pi-hole/php/FTL.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
const DEFAULT_FTLCONFFILE = "/etc/pihole/pihole-FTL.conf";
const DEFAULT_FTL_IP = "127.0.0.1";
const DEFAULT_FTL_PORT = 4711;
const DEFAULT_FTL_PORTFILE = "/run/pihole-FTL.port";

function piholeFTLConfig($piholeFTLConfFile = DEFAULT_FTLCONFFILE, $force = false) {
static $piholeFTLConfig;
Expand All @@ -30,7 +31,7 @@ function connectFTL($address, $port) {
if ($address == DEFAULT_FTL_IP) {
$config = piholeFTLConfig();
// Read port
$portfileName = isset($config['PORTFILE']) ? $config['PORTFILE'] : '';
$portfileName = isset($config['PORTFILE']) ? $config['PORTFILE'] : DEFAULT_FTL_PORTFILE;
if ($portfileName != '') {
$portfileContents = file_get_contents($portfileName);
if (is_numeric($portfileContents)) {
Expand Down Expand Up @@ -79,9 +80,9 @@ function getResponseFTL($socket) {
}

function disconnectFTL($socket) {
if (is_resource($socket)) {
fclose($socket);
}
if (is_resource($socket)) {
fclose($socket);
}
}

function callFTLAPI($request, $FTL_IP = DEFAULT_FTL_IP, $port = DEFAULT_FTL_PORT) {
Expand Down

0 comments on commit 8465946

Please sign in to comment.