/** * Delete file from the map * Mainly for use in tests * @param string $filename * @param bool $save should we save it to file? */ public static function delFromMap($filename, $save = true) { // Normalize directory separators $filename = self::normalizeFilePath($filename); // we have to reset here since we could delete a directory // and memmap is not hierarchical. It may be a performance hit // self::$memmap = array(); $parts = explode('/', $filename); $filename = array_pop($parts); $data =& self::$filemap; foreach ($parts as $part) { if (empty($part)) { continue; } // allow sequences of /s if (!isset($data[$part])) { return; } $data =& $data[$part]; } unset($data[$filename]); if ($save) { write_array_to_file("existing_files", self::$filemap, sugar_cached(self::CACHE_FILE)); } }