Allow for an optional argument to only delete cached entries from
a specific module.
delete all cache entries
$ gallery-dl --clear-cache
or
$ gallery-dl --clear-cache all
only delete entries for instagram
$ gallery-dl --clear-cache instagram
instead of calling 'sleep()' to let time advance.
This shortens the time needed to run those tests,
and ensures consistent results.
(Tests would randomly fail when using 'sleep()')
- call db.commit() after changes have been made
- remove 'LIMIT 1' from the DELETE statement in invalidate()
(only available if SQLite3 was compiled with the right flags
enabled, syntax error otherwise)
Use a 'gallery-dl' subdirectory in ~/.cache to adhere to how other
programs store their cached data, and call os.makedirs() so it also
works without an existing ~/.cache directory.
Use either $XDG_CACHE_HOME or ~/.cache (if the former isn't set)
and store potentially sensitive cookies and tokens in a user's
home directory and not in the world-readable /tmp.
and only on non-Windows systems.
1. On Windows the 'mode' argument for os.open() has no (visible) effect
on access permissions for new files.
2. The default location for 'cache.file' on Windows is in
%USERPROFILE%\AppData\Local\Temp which can only be accessed by the
owner himself (or an admin).
Previously cache.file could be created world readable leading to
possible sensitive information disclosure on multi-user systems.
Restrict permissions only to the owner by creating an empty file.
Please note that cache.file created before this commit may need a
`chmod 600' or similar!
- remove support for old windows config paths
- catch exception if cache-database can't be opened
- fix username/password settings for unit tests
- rename variable 'max_tries' to 'retries'