/** * @param TestPaths $localPaths Paths for step or run to save the cached data * @param array $requests The requests to save * @param array $pageData The page data to save * @param int $ver Cache version */ function SaveCachedDevToolsRequests($localPaths, &$requests, &$pageData, $ver) { $cacheFile = $localPaths->devtoolsRequestsCacheFile($ver); $lock = Lock($cacheFile); if (isset($lock)) { if (gz_is_file($cacheFile)) { $cache = json_decode(gz_file_get_contents($cacheFile), true); } if (!isset($cache) || !is_array($cache)) { $cache = array(); } $cache['requests'] = $requests; $cache['pageData'] = $pageData; gz_file_put_contents($cacheFile, json_encode($cache)); Unlock($lock); } }