summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/util.inc11
1 files changed, 7 insertions, 4 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc
index 51bb46f..b555115 100644
--- a/etc/inc/util.inc
+++ b/etc/inc/util.inc
@@ -287,10 +287,13 @@ function mwexec_bg($command) {
/* unlink a file, if it exists */
function unlink_if_exists($fn) {
- %filename = $fn;
-// foreach(glob($fn) as $filename) {
- if (file_exists($filename)) unlink($filename);
-// }
+ $to_do = glob($fn);
+ if(is_array($to_do) {
+ foreach($to_do as $filename)
+ if (file_exists($filename)) unlink($filename);
+ } else {
+ if (file_exists($to_do)) unlink($to_do);
+ }
}
/* make a global alias table (for faster lookups) */
OpenPOWER on IntegriCloud