[feature/session-storage] Turn some db access in session into storage calls

PHPBB3-9733
[feature/session-storage] Rebase pre-existing session-storage work into branch