Prevent backups containing legacy MD5 hashed user passwords
from being added back into the database. Hashes are converted
to random SHA512 hashed passwords upon restore for these backups.
This was causing problems when sections or activity names where
set to be empty or whitespace-only, with the PARAM_CLEANHTML
leading to exception.
Now they are supported and handled like (0xc2a0) to
allow the process to continue.
Added a few extra tests to confirm the behaviour.
Any backup & restore operation may be leaving opened files
if a file logger is being used. This implementes the close()
method, so every logger can close any resource.
Also, the recommended backup_controlled::destroy() method
now calls to new logger::destroy() method in charge of
deleting all the references and closing any resource.
Finally, some internally used controllers, were missing
their destroy call, leading to associated loggers to
remain open. Now all them are explicitly deltroyed.
encode_backup_temp_info() and decode_backup_temp_info() have been
introduced to keep the info field encoding in one place.
Many locations used get_backup_ids_record() to obtain info, that
makes lots of calls to get_backup_ids_record() which can be slow.
We now complete all those inline by adding the info field to the query.
To reduce memory usage, all queries of that nature have been changed
to use get_recordset_*. gzcompress was introduced if available to minimize
traffic to/from the database and to decrease the memory required for caching.
The compression time is saved by the benefits in other places of having smaller data.