Added tables for new tags

This commit is contained in:
moodler 2007-07-31 05:59:32 +00:00
parent f29146dd44
commit 7964206412
5 changed files with 126 additions and 4 deletions

View file

@ -37,7 +37,7 @@ $temp->add(new admin_setting_configselect('bloglevel', get_string('bloglevel', '
2 => get_string('groupblogs','blog'),
1 => get_string('personalblogs','blog'),
0 => get_string('disableblogs','blog'))));
$temp->add(new admin_setting_configcheckbox('usetags', get_string('usetags','admin'),get_string('configusetags', 'admin'),'1'));
$temp->add(new admin_setting_configcheckbox('cronclionly', get_string('cronclionly', 'admin'), get_string('configcronclionly', 'admin'), 0));
$temp->add(new admin_setting_configpasswordunmask('cronremotepassword', get_string('cronremotepassword', 'admin'), get_string('configcronremotepassword', 'admin'), '', PARAM_RAW));

View file

@ -1041,6 +1041,16 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
'moodle/tag:manage' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
)
);
?>

View file

@ -1579,7 +1579,7 @@
<KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the table, please edit me"/>
</KEYS>
</TABLE>
<TABLE NAME="grade_import_values" COMMENT="Temporary table for importing grades" PREVIOUS="grade_import_newitem">
<TABLE NAME="grade_import_values" COMMENT="Temporary table for importing grades" PREVIOUS="grade_import_newitem" NEXT="tag">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" COMMENT="id of the table, please edit me" NEXT="itemid"/>
<FIELD NAME="itemid" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="if set, this points to existing grade_items id" PREVIOUS="id" NEXT="newgradeitem"/>
@ -1595,6 +1595,51 @@
<KEY NAME="newgradeitem" TYPE="foreign" FIELDS="newgradeitem" REFTABLE="grade_import_newitem" REFFIELDS="id" PREVIOUS="itemid"/>
</KEYS>
</TABLE>
<TABLE NAME="tag" COMMENT="tag table" PREVIOUS="grade_import_values" NEXT="tag_correlation">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="11" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="userid"/>
<FIELD NAME="userid" TYPE="int" LENGTH="11" NOTNULL="true" UNSIGNED="false" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="name"/>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="userid" NEXT="tagtype"/>
<FIELD NAME="tagtype" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="description"/>
<FIELD NAME="description" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" ENUM="false" PREVIOUS="tagtype" NEXT="descriptionformat"/>
<FIELD NAME="descriptionformat" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="false" SEQUENCE="false" ENUM="false" PREVIOUS="description" NEXT="flag"/>
<FIELD NAME="flag" TYPE="int" LENGTH="4" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="a tag can be 'flagged' as inappropriate" PREVIOUS="descriptionformat" NEXT="timemodified"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="flag"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for tag"/>
</KEYS>
<INDEXES>
<INDEX NAME="name" UNIQUE="true" FIELDS="name" COMMENT="tag names are unique"/>
</INDEXES>
</TABLE>
<TABLE NAME="tag_correlation" COMMENT="The rationale for the 'tag_correlation' table is performance. It works as a cache for a potentially heavy load query done at the 'tag_instance' table. So, the 'tag_correlation' table stores redundant information derived from the 'tag_instance' table" PREVIOUS="tag" NEXT="tag_instance">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="11" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="tagid"/>
<FIELD NAME="tagid" TYPE="int" LENGTH="11" NOTNULL="true" UNSIGNED="false" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="correlatedtags"/>
<FIELD NAME="correlatedtags" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="tagid"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for tag_correlation"/>
</KEYS>
<INDEXES>
<INDEX NAME="tagid" UNIQUE="true" FIELDS="tagid" COMMENT="tagid"/>
</INDEXES>
</TABLE>
<TABLE NAME="tag_instance" COMMENT="tag_instance table holds the information of associations between tags and other items" PREVIOUS="tag_correlation">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="11" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="tagid"/>
<FIELD NAME="tagid" TYPE="int" LENGTH="11" NOTNULL="true" UNSIGNED="false" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="itemtype"/>
<FIELD NAME="itemtype" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="tagid" NEXT="itemid"/>
<FIELD NAME="itemid" TYPE="int" LENGTH="11" NOTNULL="true" UNSIGNED="false" SEQUENCE="false" ENUM="false" PREVIOUS="itemtype"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for tag_instance"/>
</KEYS>
<INDEXES>
<INDEX NAME="tagiditem" UNIQUE="false" FIELDS="tagid, itemtype, itemid"/>
</INDEXES>
</TABLE>
</TABLES>
<STATEMENTS>
<STATEMENT NAME="insert mnet_application" TYPE="insert" TABLE="mnet_application" COMMENT="Initial insert of records on table mnet_application" NEXT="insert log_display">

View file

@ -1453,6 +1453,73 @@ function xmldb_main_upgrade($oldversion=0) {
$result = $result && create_table($table);
}
if ($result && $oldversion < 2007073101) { // Add new tag tables
/// Define table tag to be created
$table = new XMLDBTable('tag');
/// Adding fields to table tag
$table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '11', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
$table->addFieldInfo('userid', XMLDB_TYPE_INTEGER, '11', null, XMLDB_NOTNULL, null, null, null, null);
$table->addFieldInfo('name', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null, null);
$table->addFieldInfo('tagtype', XMLDB_TYPE_CHAR, '255', null, null, null, null, null, null);
$table->addFieldInfo('description', XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null);
$table->addFieldInfo('descriptionformat', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, null, null, null);
$table->addFieldInfo('flag', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, null, null, null, null, '0');
$table->addFieldInfo('timemodified', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, null);
/// Adding keys to table tag
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
/// Adding indexes to table tag
$table->addIndexInfo('name', XMLDB_INDEX_UNIQUE, array('name'));
/// Launch create table for tag
$result = $result && create_table($table);
/// Define table tag_correlation to be created
$table = new XMLDBTable('tag_correlation');
/// Adding fields to table tag_correlation
$table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '11', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
$table->addFieldInfo('tagid', XMLDB_TYPE_INTEGER, '11', null, XMLDB_NOTNULL, null, null, null, null);
$table->addFieldInfo('correlatedtags', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, null, null);
/// Adding keys to table tag_correlation
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
/// Adding indexes to table tag_correlation
$table->addIndexInfo('tagid', XMLDB_INDEX_UNIQUE, array('tagid'));
/// Launch create table for tag_correlation
$result = $result && create_table($table);
/// Define table tag_instance to be created
$table = new XMLDBTable('tag_instance');
/// Adding fields to table tag_instance
$table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '11', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
$table->addFieldInfo('tagid', XMLDB_TYPE_INTEGER, '11', null, XMLDB_NOTNULL, null, null, null, null);
$table->addFieldInfo('itemtype', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null, null);
$table->addFieldInfo('itemid', XMLDB_TYPE_INTEGER, '11', null, XMLDB_NOTNULL, null, null, null, null);
/// Adding keys to table tag_instance
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
/// Adding indexes to table tag_instance
$table->addIndexInfo('tagiditem', XMLDB_INDEX_NOTUNIQUE, array('tagid', 'itemtype', 'itemid'));
/// Launch create table for tag_instance
$result = $result && create_table($table);
}
/*
/// drop old gradebook tables
if ($result && $oldversion < 2007072209) {

View file

@ -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 = 2007073100; // YYYYMMDD = date
$version = 2007073101; // YYYYMMDD = date
// XY = increments within a single day
$release = '1.9 dev'; // Human-friendly version name