public function modified($format = null, $handler = 'date')
{
$modified = filemtime($this->root);
$items = $this->scan(array('.', '..'));
foreach ($items as $item) {
if (is_file($this->root . DS . $item)) {
$newModified = filemtime($this->root . DS . $item);
} else {
$object = new static($this->root . DS . $item);
$newModified = $object->modified();
}
$modified = $newModified > $modified ? $newModified : $modified;
}
return !is_null($format) ? $handler($format, $modified) : $modified;
}
/** * Recursively check when the dir and all * subfolders have been modified for the last time. * * @param string $dir The path of the directory * @param string $format * @return int */ public static function modified($dir, $format = null) { // It's easier to handle this with the Folder class $object = new Folder($dir); return $object->modified($format); }