mirror of
https://github.com/moodle/moodle.git
synced 2025-07-12 01:46:32 +02:00
Added a new table for logging ADODB requests and a config variable to
turn it on. Very useful for debugging performance issues.
This commit is contained in:
@ -1198,6 +1198,17 @@ function main_upgrade($oldversion=0) {
|
||||
table_column('user', '', 'dstpreset', 'int', '10', '', '0', 'not null', 'timezone');
|
||||
}
|
||||
|
||||
if ($oldversion < 2005021800) { // For database debugging, not for normal use
|
||||
modify_database(""," CREATE TABLE `adodb_logsql` (
|
||||
`created` datetime NOT NULL,
|
||||
`sql0` varchar(250) NOT NULL,
|
||||
`sql1` text NOT NULL,
|
||||
`params` text NOT NULL,
|
||||
`tracer` text NOT NULL,
|
||||
`timer` decimal(16,6) NOT NULL
|
||||
);");
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -103,6 +103,21 @@ CREATE TABLE `prefix_course_display` (
|
||||
# --------------------------------------------------------
|
||||
|
||||
|
||||
#
|
||||
# Table structure for table `course_meta`
|
||||
#
|
||||
|
||||
CREATE TABLE `prefix_course_meta` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`parent_course` int(10) NOT NULL default 0,
|
||||
`child_course` int(10) NOT NULL default 0,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `parent_course` (parent_course),
|
||||
KEY `child_course` (child_course)
|
||||
);
|
||||
# --------------------------------------------------------
|
||||
|
||||
|
||||
#
|
||||
# Table structure for table `course_modules`
|
||||
#
|
||||
@ -559,13 +574,17 @@ CREATE TABLE `prefix_user_coursecreators` (
|
||||
) TYPE=MyISAM COMMENT='One record per course creator';
|
||||
|
||||
|
||||
CREATE TABLE `prefix_course_meta` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`parent_course` int(10) NOT NULL default 0,
|
||||
`child_course` int(10) NOT NULL default 0,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `parent_course` (parent_course),
|
||||
KEY `child_course` (child_course)
|
||||
#
|
||||
# For debugging puposes, see admin/dbperformance.php
|
||||
#
|
||||
|
||||
CREATE TABLE `adodb_logsql` (
|
||||
`created` datetime NOT NULL,
|
||||
`sql0` varchar(250) NOT NULL,
|
||||
`sql1` text NOT NULL,
|
||||
`params` text NOT NULL,
|
||||
`tracer` text NOT NULL,
|
||||
`timer` decimal(16,6) NOT NULL
|
||||
);
|
||||
|
||||
INSERT INTO prefix_log_display VALUES ('user', 'view', 'user', 'CONCAT(firstname," ",lastname)');
|
||||
|
@ -921,6 +921,17 @@ function main_upgrade($oldversion=0) {
|
||||
table_column('user', '', 'dstpreset', 'int', '10', '', '0', 'not null', 'timezone');
|
||||
}
|
||||
|
||||
if ($oldversion < 2005021800) {
|
||||
modify_database("","CREATE TABLE adodb_logsql (
|
||||
created timestamp NOT NULL,
|
||||
sql0 varchar(250) NOT NULL,
|
||||
sql1 text NOT NULL,
|
||||
params text NOT NULL,
|
||||
tracer text NOT NULL,
|
||||
timer decimal(16,6) NOT NULL
|
||||
);");
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -65,6 +65,15 @@ CREATE TABLE prefix_course_display (
|
||||
|
||||
CREATE INDEX prefix_course_display_courseuserid_idx ON prefix_course_display (course,userid);
|
||||
|
||||
CREATE TABLE prefix_course_meta (
|
||||
id SERIAL primary key,
|
||||
parent_course integer NOT NULL,
|
||||
child_course integer NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX prefix_course_meta_parent_idx ON prefix_course_meta (parent_course);
|
||||
CREATE INDEX prefix_course_meta_child_idx ON prefix_course_meta (child_course);
|
||||
|
||||
CREATE TABLE prefix_course_modules (
|
||||
id SERIAL PRIMARY KEY,
|
||||
course integer NOT NULL default '0',
|
||||
@ -390,14 +399,15 @@ CREATE TABLE prefix_user_coursecreators (
|
||||
userid int8 NOT NULL default '0'
|
||||
);
|
||||
|
||||
CREATE TABLE prefix_course_meta (
|
||||
id SERIAL primary key,
|
||||
parent_course integer NOT NULL,
|
||||
child_course integer NOT NULL
|
||||
CREATE TABLE adodb_logsql (
|
||||
created timestamp NOT NULL,
|
||||
sql0 varchar(250) NOT NULL,
|
||||
sql1 text NOT NULL,
|
||||
params text NOT NULL,
|
||||
tracer text NOT NULL,
|
||||
timer decimal(16,6) NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX prefix_course_meta_parent_idx ON prefix_course_meta (parent_course);
|
||||
CREATE INDEX prefix_course_meta_child_idx ON prefix_course_meta (child_course);
|
||||
|
||||
INSERT INTO prefix_log_display VALUES ('user', 'view', 'user', 'firstname||\' \'||lastname');
|
||||
INSERT INTO prefix_log_display VALUES ('course', 'user report', 'user', 'firstname||\' \'||lastname');
|
||||
|
@ -142,6 +142,10 @@ global $THEME;
|
||||
unset($config);
|
||||
}
|
||||
|
||||
/// Turn on SQL logging if required
|
||||
if (!empty($CFG->logsql)) {
|
||||
$db->LogSQL();
|
||||
}
|
||||
|
||||
|
||||
/// Set error reporting back to normal
|
||||
|
@ -6,7 +6,7 @@
|
||||
// This is compared against the values stored in the database to determine
|
||||
// whether upgrades should be performed (see lib/db/*.php)
|
||||
|
||||
$version = 2005021700; // YYYYMMDD = date
|
||||
$version = 2005021800; // YYYYMMDD = date
|
||||
// XY = increments within a single day
|
||||
|
||||
$release = '1.5 UNSTABLE DEVELOPMENT'; // Human-friendly version name
|
||||
|
Reference in New Issue
Block a user