fix(XML): Improve XML loading/parsing performance (refs #4881)

- Cache DOMDocuments from XML files for reuse.
- Prevent corruption of XML files (e.g. when in low disk space
  conditions) by safely writing them with a transaction.
fix(net): Improve network requests performance (refs #4881)

- Reduce network bandwidth usage by using "Accept-Encoding" headers for
  compressed responses.
- Reduce number of HTTP requests by caching the responses' files.
- Move all net/www related code into distinct WWW\UserAgent class.
refactor(lock): Reworked CLI locking mechanism (refs #4504)

A lock is acquired by the CLI for data modification operations. If the
CLI cannot acquire the lock, then it exits immediatly (with exit code 1)
and does not waits for the lock to be released.