From 47d456192c8bfd07fa9eabd91a8506f87d243f1c Mon Sep 17 00:00:00 2001 From: Colin Smith Date: Sun, 20 Mar 2005 20:26:18 +0000 Subject: Make unlink_if_exists work with wildcards using a foreach and glob(). --- etc/inc/util.inc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/etc/inc/util.inc b/etc/inc/util.inc index bdcd832..49a6104 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -287,8 +287,9 @@ function mwexec_bg($command) { /* unlink a file, if it exists */ function unlink_if_exists($fn) { - if (file_exists($fn)) - unlink($fn); + foreach(glob($fn) as $filename) { + if (file_exists($filename)) unlink($filename); + } } /* make a global alias table (for faster lookups) */ -- cgit v1.1