Commit bc2b20a1 by Scott

Fix external code to load optional plugins

parent c58e4c19
......@@ -33,29 +33,6 @@ require_once QA_INCLUDE_DIR . 'db/selects.php';
/**
* Standard database failure handler function which bring up the install/repair/upgrade page
* @param $type
* @param int $errno
* @param string $error
* @param string $query
* @return mixed
*/
function qa_page_db_fail_handler($type, $errno = null, $error = null, $query = null)
{
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$pass_failure_type = $type;
$pass_failure_errno = $errno;
$pass_failure_error = $error;
$pass_failure_query = $query;
require_once QA_INCLUDE_DIR . 'qa-install.php';
qa_exit('error');
}
/**
* Queue any pending requests which are required independent of which page will be shown
*/
function qa_page_queue_pending()
......
......@@ -32,6 +32,7 @@ header('Content-Type: text/plain; charset=utf-8');
// Load the Q2A base file which sets up a bunch of crucial functions
$qa_autoconnect = false;
require 'qa-base.php';
qa_report_process_stage('init_ajax');
......
......@@ -68,6 +68,12 @@ qa_initialize_predb_plugins();
require_once QA_INCLUDE_DIR . 'qa-db.php';
qa_db_allow_connect();
// $qa_autoconnect defaults to true so that optional plugins will load for external code. Q2A core
// code sets $qa_autoconnect to false so that we can use custom fail handlers.
if (!isset($qa_autoconnect) || $qa_autoconnect !== false) {
qa_db_connect('qa_page_db_fail_handler');
qa_initialize_postdb_plugins();
}
// Version comparison functions
......@@ -383,6 +389,7 @@ function qa_initialize_predb_plugins()
qa_load_override_files();
}
/**
* Load plugins after database is available. Plugins loaded here are able to be disabled in admin.
*/
......@@ -399,6 +406,29 @@ function qa_initialize_postdb_plugins()
/**
* Standard database failure handler function which bring up the install/repair/upgrade page
* @param $type
* @param int $errno
* @param string $error
* @param string $query
* @return mixed
*/
function qa_page_db_fail_handler($type, $errno = null, $error = null, $query = null)
{
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$pass_failure_type = $type;
$pass_failure_errno = $errno;
$pass_failure_error = $error;
$pass_failure_query = $query;
require_once QA_INCLUDE_DIR . 'qa-install.php';
qa_exit('error');
}
/**
* Retrieve metadata information from the $contents of a qa-theme.php or qa-plugin.php file, specified by $type ('Plugin' or 'Theme').
* If $versiononly is true, only min version metadata is parsed.
* Name, Description, Min Q2A & Min PHP are not currently used by themes.
......
......@@ -34,6 +34,7 @@ function qa_blob_db_fail_handler()
// Load the Q2A base file which sets up a bunch of crucial stuff
$qa_autoconnect = false;
require 'qa-base.php';
qa_report_process_stage('init_blob');
......
......@@ -34,6 +34,7 @@ function qa_image_db_fail_handler()
// Load the Q2A base file which sets up a bunch of crucial stuff
$qa_autoconnect = false;
require 'qa-base.php';
qa_report_process_stage('init_image');
......
......@@ -43,6 +43,7 @@ elseif (isset($_GET['qa']) && $_GET['qa'] == 'blob') {
else {
// Otherwise, load the Q2A base file which sets up a bunch of crucial stuff
$qa_autoconnect = false;
require 'qa-base.php';
/**
......
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