Commit 5321f11a by Scott

Split plugin init code into separate functions

parent 2cf5701e
......@@ -118,8 +118,8 @@ function qa_options_set_pending($names)
/**
* Load all of the Q2A options from the database, unless QA_OPTIMIZE_DISTANT_DB is set in qa-config.php,
* in which case queue the options for later retrieval
* Load all of the Q2A options from the database.
* From Q2A 1.8 we always load the options in a separate query regardless of QA_OPTIMIZE_DISTANT_DB.
*/
function qa_preload_options()
{
......
......@@ -64,9 +64,10 @@ qa_initialize_constants_2();
qa_initialize_modularity();
qa_register_core_modules();
qa_initialize_predb_plugins();
require_once QA_INCLUDE_DIR . 'qa-db.php';
qa_db_allow_connect();
qa_initialize_plugins();
// Version comparison functions
......@@ -369,19 +370,30 @@ function qa_register_core_modules()
/**
* Load all plugins. They are split into two groups: plugins loaded before database is available, and those loaded afterward.
* Load plugins before database is available. Generally this includes database overrides and
* process plugins that run early in the request lifecycle.
*/
function qa_initialize_plugins()
function qa_initialize_predb_plugins()
{
$pluginManager = new Q2A_Plugin_PluginManager();
$pluginManager->readAllPluginMetadatas();
global $qa_pluginManager;
$qa_pluginManager = new Q2A_Plugin_PluginManager();
$qa_pluginManager->readAllPluginMetadatas();
$pluginManager->loadPluginsBeforeDbInit();
$qa_pluginManager->loadPluginsBeforeDbInit();
qa_load_override_files();
}
/**
* Load plugins after database is available. Plugins loaded here are able to be disabled in admin.
*/
function qa_initialize_postdb_plugins()
{
global $qa_pluginManager;
qa_db_allow_connect();
require_once QA_INCLUDE_DIR . 'app/options.php';
qa_preload_options();
$pluginManager->loadPluginsAfterDbInit();
$qa_pluginManager->loadPluginsAfterDbInit();
qa_load_override_files();
}
......
......@@ -34,6 +34,7 @@ global $qa_usage;
qa_report_process_stage('init_page');
qa_db_connect('qa_page_db_fail_handler');
qa_initialize_postdb_plugins();
qa_page_queue_pending();
qa_load_state();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment