diff --git a/modules/web/doc_classes/FileCache.xml b/modules/web/doc_classes/FileCache.xml index f4676e2df..bb505dd4e 100644 --- a/modules/web/doc_classes/FileCache.xml +++ b/modules/web/doc_classes/FileCache.xml @@ -1,15 +1,13 @@ - The FileCache class provide functionality for file and directory caching for the web module. + The FileCache class provide functionality for file caching and name and path sanitization for the web module. - The FileCache class provide functionality for file and directory caching for the web module. - It can evaluate a folder, and save all file paths into memory. - Using this functionality can increase performance in certain scenarios, as the application does not have to use a syscall to evaluate whether a file exists or not, and also helps with avoiding directory traversal attacks, as relative paths are not going to be expanded by accident. + The FileCache class provide functionality for file caching and name and path sanitization for the web module. + It helps with avoiding directory traversal attacks, as relative paths are not going to be expanded by accident. (A directory traversal attach would be if an application receives this get request: [code]server.net/../../../etc/passwd[/code], and it would result in success, if the app then returns the contents of the "passwd" file, which is outside of the root folder of the server.) - [FileCache] has a drawback for now, as it doesn't yet watch for changes in the folder, so if files change it needs to be manually refreshed. - It can also save contents of files into memory if needed using the [code]set_cached_body()[/code] helper method. + It can save contents of files or pages into memory if needed using the [code]set_cached_body()[/code] helper method. @@ -17,23 +15,27 @@ + Clear all internal caches. + Get a previously stored page's or file's body. + Return the set [member wwwroot]'s absolute path. + Check whether a page's or file's body is available. @@ -41,25 +43,43 @@ + Store a page's or file's body. + Returns the absolute path to a file if it exists in the given [member wwwroot]. If it doesn't exists returns an empty [String]. + Guards against directory traversal. + Note: file path should be the url you want to access the file with, including lead slash. e.g. http://127.0.0.1/a/b/d.jpg -> /a/b/d.jpg + + + + + + + Returns the absolute path to a file in the given [member wwwroot]. Does not checks if the file exists or not. Returns an empty [String] on error. + Guards against directory traversal. + Note: file path should be the url you want to access the file with, including lead slash. e.g. http://127.0.0.1/a/b/d.jpg -> /a/b/d.jpg + Check whether a file exists in the given [member wwwroot]. + Guards against directory traversal. + Note: file path should be the url you want to access the file with, including lead slash. e.g. http://127.0.0.1/a/b/d.jpg -> /a/b/d.jpg + How long a page's or file's body should be stored. + Set a www root directory for this [FileCache]. It can be both relative and absolute.