text_cache --> cache_text much better

This commit is contained in:
moodler 2004-02-09 13:10:19 +00:00
parent f0aa2fed24
commit 45121ffbf3
6 changed files with 10 additions and 10 deletions

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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;

View File

@ -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