mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
text_cache --> cache_text much better
This commit is contained in:
parent
f0aa2fed24
commit
45121ffbf3
@ -643,8 +643,8 @@ function main_upgrade($oldversion=0) {
|
||||
table_column("course", "", "lang", "varchar", "5", "", "", "", "groupmodeforce");
|
||||
}
|
||||
|
||||
if ($oldversion < 2004020902) {
|
||||
modify_database("", "CREATE TABLE `prefix_text_cache` (
|
||||
if ($oldversion < 2004020903) {
|
||||
modify_database("", "CREATE TABLE `prefix_cache_text` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`md5key` varchar(32) NOT NULL default '',
|
||||
`formattedtext` longtext NOT NULL,
|
||||
|
@ -158,10 +158,10 @@ CREATE TABLE `prefix_event` (
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `text_cache`
|
||||
# Table structure for table `cache_text`
|
||||
#
|
||||
|
||||
CREATE TABLE `prefix_text_cache` (
|
||||
CREATE TABLE `prefix_cache_text` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`md5key` varchar(32) NOT NULL default '',
|
||||
`formattedtext` longtext NOT NULL,
|
||||
|
@ -389,8 +389,8 @@ function main_upgrade($oldversion=0) {
|
||||
table_column("course", "", "lang", "varchar", "5", "", "", "", "groupmodeforce");
|
||||
}
|
||||
|
||||
if ($oldversion < 2004020902) {
|
||||
modify_database("", "CREATE TABLE prefix_text_cache (
|
||||
if ($oldversion < 2004020903) {
|
||||
modify_database("", "CREATE TABLE prefix_cache_text (
|
||||
id SERIAL PRIMARY KEY,
|
||||
md5key varchar(32) NOT NULL default '',
|
||||
formattedtext text,
|
||||
|
@ -165,7 +165,7 @@ CREATE TABLE prefix_scale (
|
||||
timemodified integer NOT NULL default '0'
|
||||
);
|
||||
|
||||
CREATE TABLE prefix_text_cache (
|
||||
CREATE TABLE prefix_cache_text (
|
||||
id SERIAL PRIMARY KEY,
|
||||
md5key varchar(32) NOT NULL default '',
|
||||
formattedtext text,
|
||||
|
@ -494,7 +494,7 @@ function format_text($text, $format=FORMAT_MOODLE, $options=NULL, $courseid=NULL
|
||||
if (!empty($CFG->cachetext)) {
|
||||
$time = time() - $CFG->cachetext;
|
||||
$md5key = md5($text);
|
||||
if ($cacheitem = get_record_select('text_cache', "md5key = '$md5key' AND timemodified > '$time'")) {
|
||||
if ($cacheitem = get_record_select('cache_text', "md5key = '$md5key' AND timemodified > '$time'")) {
|
||||
return $cacheitem->formattedtext;
|
||||
}
|
||||
}
|
||||
@ -539,7 +539,7 @@ function format_text($text, $format=FORMAT_MOODLE, $options=NULL, $courseid=NULL
|
||||
$newrecord->md5key = $md5key;
|
||||
$newrecord->formattedtext = addslashes($text);
|
||||
$newrecord->timemodified = time();
|
||||
insert_record('text_cache', $newrecord);
|
||||
insert_record('cache_text', $newrecord);
|
||||
}
|
||||
|
||||
return $text;
|
||||
|
@ -5,7 +5,7 @@
|
||||
// database to determine whether upgrades should
|
||||
// be performed (see lib/db/*.php)
|
||||
|
||||
$version = 2004020902; // The current version is a date (YYYYMMDDXX)
|
||||
$version = 2004020903; // The current version is a date (YYYYMMDDXX)
|
||||
|
||||
$release = "1.2 development"; // User-friendly version number
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user