pegasus
Well-known member
Okay, I've looked into this, and there's not a bug in VaultWiki. The XenForo_Application::loadConfig method uses 'require' instead of 'require_once' to load the config file. The expectation is that 'require_once' is not needed because config.php only sets keys on the $config array. It does not cache the config output in that method. Thus, subsequent calls to XenForo_Application::loadConfig (which VaultWiki makes) will read from the config file each time.
Since XenForo intends to allow reading from the config.php file multiple times if needed (require instead of require_once), your placement of PHP code that cannot run multiple times there is a problem. Ideally, the code that actually registers the stream wrapper would be a code event listener somewhere like init_dependencies, but if you need it to happen during XenForo upgrades, you can just wrap your $s3 lines so they only run once.
I've updated VaultWiki so that it doesn't go through ::loadConfig. I think this is leftover from early RC and nowadays the config is available another way. I consider this change to be a simple micro-optimization, since there is nothing really wrong with the current way. In vault/core/controller/db/xf.php, find:
Replace with:
Since XenForo intends to allow reading from the config.php file multiple times if needed (require instead of require_once), your placement of PHP code that cannot run multiple times there is a problem. Ideally, the code that actually registers the stream wrapper would be a code event listener somewhere like init_dependencies, but if you need it to happen during XenForo upgrades, you can just wrap your $s3 lines so they only run once.
I've updated VaultWiki so that it doesn't go through ::loadConfig. I think this is leftover from early RC and nowadays the config is available another way. I consider this change to be a simple micro-optimization, since there is nothing really wrong with the current way. In vault/core/controller/db/xf.php, find:
Code:
$config = XenForo_Application::getInstance()->loadConfig();
Code:
$config = XenForo_Application::getInstance()->get('config');