From 336cb718b10ff053b119216cdd68f832271a175c Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Sun, 20 Mar 2005 20:50:02 +0000 Subject: If glob does not return an array, deal with the single filename. --- etc/inc/util.inc | 11 +++++++---- 1 file 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) */ -- cgit v1.1