diff options
author | Ermal <eri@pfsense.org> | 2013-07-02 19:05:07 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2013-07-02 19:05:29 +0000 |
commit | 92465c6fc85589298c8f97bf29c9b2ac179a474e (patch) | |
tree | 25bdb38e09636ca53228a5626f52ce729335da2b /etc | |
parent | 6c2bb4e62b7c55396d35559adf7c644a079e352b (diff) | |
download | pfsense-92465c6fc85589298c8f97bf29c9b2ac179a474e.zip pfsense-92465c6fc85589298c8f97bf29c9b2ac179a474e.tar.gz |
Correct variable used to delete symlinks and files delete from CP filemanager. Reported-by: http://forum.pfsense.org/index.php/topic,64016.0/topicseen.html. While here reduce some uneeded extra operations
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/captiveportal.inc | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc index 01caca5..1c2b89a 100644 --- a/etc/inc/captiveportal.inc +++ b/etc/inc/captiveportal.inc @@ -1319,17 +1319,8 @@ function captiveportal_write_elements() { $cpcfg = $config['captiveportal'][$cpzone]; - /* delete any existing elements */ - if (is_dir($g['captiveportal_element_path'])) { - $dh = opendir($g['captiveportal_element_path']); - while (($file = readdir($dh)) !== false) { - if ($file != "." && $file != "..") - unlink($g['captiveportal_element_path'] . "/" . $file); - } - closedir($dh); - } else { + if (!is_dir($g['captiveportal_element_path'])) @mkdir($g['captiveportal_element_path']); - } if (is_array($cpcfg['element'])) { conf_mount_rw(); @@ -1338,8 +1329,8 @@ function captiveportal_write_elements() { printf(gettext("Error: cannot open '%s' in captiveportal_write_elements()%s"), $data['name'], "\n"); return 1; } - unlink_if_exists("{$g['captiveportal_path']}/{$data['name']}"); - @symlink("{$g['captiveportal_element_path']}/{$data['name']}", "{$g['captiveportal_path']}/{$data['name']}"); + if (!file_exists("{$g['captiveportal_path']}/{$data['name']}")) + @symlink("{$g['captiveportal_element_path']}/{$data['name']}", "{$g['captiveportal_path']}/{$data['name']}"); } conf_mount_ro(); } |