public static function cacheTree($path, $force = false) { // split path into array if (is_string($path)) { $path = Site::splitPath($path); } // check if this tree has already been cached $cacheKey = 'cacheTree:' . implode('/', $path); if (!Site::$autoPull || !$force && Cache::fetch($cacheKey)) { return 0; } Cache::store($cacheKey, true); // get tree map from parent $remoteTree = Emergence::resolveCollectionFromParent($path); if (!$remoteTree) { return 0; } $filesResolved = 0; $startTime = time(); foreach ($remoteTree['files'] as $remotePath => $remoteFile) { $node = Site::resolvePath($remotePath); if ($node && $node->Timestamp >= $startTime) { $filesResolved++; } } return $filesResolved; }