- $f_name = $dir.'/'.$d; // makes a proper Filename
- if (!preg_match('@(\.|\.\.|\.revision|\.svn|debug\.log|\.cache)$@',$d)) { // no . or .. or .revision or .svn in the filename
- $is_dir = is_dir($f_name);
- if (!$is_dir) { // $f_name is a filename and no directory
- $time = filemtime($f_name);
- if ($last_changed['time'] < $time) { // This file is newer as the file before
- $last_changed['path_name'] = $f_name;
+ // Generate proper FQFN
+ $FQFN = str_replace("//", "/", constant('PATH') . $dir. "/". $d);
+
+ // Does it match what we are looking for? (We skip a lot files already!)
+ if (!preg_match('@(\.|\.\.|\.revision|\.svn|debug\.log|\.cache)$@', $d)) { // no . or .. or .revision or .svn in the filename
+ // Is it a file and readable?
+ //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):FQFN={$FQFN}<br />\n";
+ if (isDirectory($FQFN)) {
+ // $FQFN is a directory so also crawl into this directory
+ $newDir = $d;
+ if (!empty($dir)) $newDir = $dir . "/". $d;
+ //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):DESCENT: ".$newDir."<br />\n";
+ searchDirsRecursive($newDir, $last_changed);
+ } elseif (FILE_READABLE($FQFN)) {
+ // $FQFN is a filename and no directory
+ $time = filemtime($FQFN);
+ //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):File: ".$d." found. (".($last_changed['time'] - $time).")<br />\n";
+ if ($last_changed['time'] < $time) {
+ // This file is newer as the file before
+ //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>) - NEWER!<br />\n";
+ $last_changed['path_name'] = $FQFN;