Commit fc8d64fd authored by Nigel McNie's avatar Nigel McNie
Browse files

Only include DDL where it's needed, saves about 8 included files every page load.

It's now only included on lib/upgrade.php.

One existing call to table_exists that was in safe_require has now been ditched as it's unnecessary.
parent 1f0cf78b
......@@ -76,7 +76,6 @@ if (empty($CFG->directorypermissions)) {
require('mahara.php');
ensure_sanity();
require('dml.php');
require('ddl.php');
require('web.php');
require('activity.php');
require('user.php');
......@@ -92,7 +91,6 @@ try {
ob_start();
$db = &ADONewConnection($CFG->dbtype);
$dbgenerator = null;
if (empty($CFG->dbhost)) {
$CFG->dbhost = '';
}
......
......@@ -43,6 +43,7 @@
*/
// Mahara hacks
global $CFG;
$CFG->libdir = get_config('libroot');
$CFG->prefix = (isset($CFG->dbprefix)) ? $CFG->dbprefix : '';
if (is_postgres()) {
......
......@@ -1409,10 +1409,6 @@ function db_format_tsfield($field, $as = null) {
*/
function configure_dbconnection() {
global $db;
global $dbgenerator;
$classname = 'XMLDB' . get_config('dbtype');
$dbgenerator = new $classname();
increment_perf_db_writes();
$db->Execute("SET NAMES 'utf8'");
......
......@@ -855,10 +855,8 @@ function safe_require($plugintype, $pluginname, $filename='lib.php', $function='
$fullpath = get_config('docroot') . 'artefact/' . $bits[0] . '/blocktype/' . $bits[1] . '/' . $filename;
}
else {
if (table_exists(new XMLDBTable('blocktype_installed'))) {
if ($artefactplugin = get_field('blocktype_installed', 'artefactplugin', 'name', $pluginname)) {
$fullpath = get_config('docroot') . 'artefact/' . $artefactplugin . '/blocktype/' . $pluginname . '/'. $filename;
}
if ($artefactplugin = get_field('blocktype_installed', 'artefactplugin', 'name', $pluginname)) {
$fullpath = get_config('docroot') . 'artefact/' . $artefactplugin . '/blocktype/' . $pluginname . '/'. $filename;
}
}
}
......
......@@ -31,6 +31,7 @@ defined('INTERNAL') || die();
*/
class InstallationException extends SystemException {}
require_once('ddl.php');
/**
* This function checks core and plugins for which need to be upgraded/installed
......
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