MDL-40103 Now xmldb code matches original templates 100%

There were still some differences between the php code
used in the issue and the php code generated by the
xmldb editor for the template tables. This commit put
both 100% in sync.
This commit is contained in:
Eloy Lafuente (stronk7)
2013-06-18 15:22:51 +02:00
parent 2412371efd
commit d745d2d45e
2 changed files with 29 additions and 29 deletions
@@ -107,18 +107,18 @@ abstract class backup_controller_dbops extends backup_dbops {
$dbman = $DB->get_manager(); // We are going to use database_manager services
$xmldb_table = new xmldb_table('backup_ids_temp');
$xmldb_table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
$xmldb_table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
// Set default backupid (not needed but this enforce any missing backupid). That's hackery in action!
$xmldb_table->add_field('backupid', XMLDB_TYPE_CHAR, 32, null, XMLDB_NOTNULL, null, $backupid);
$xmldb_table->add_field('itemname', XMLDB_TYPE_CHAR, 160, null, XMLDB_NOTNULL, null, null);
$xmldb_table->add_field('itemid', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, null, null);
$xmldb_table->add_field('newitemid', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, null, '0');
$xmldb_table->add_field('parentitemid', XMLDB_TYPE_INTEGER, 10, null, null, null, '0');
$xmldb_table->add_field('info', XMLDB_TYPE_TEXT, 1333, null, null, null, null);
$xmldb_table->add_field('parentitemid', XMLDB_TYPE_INTEGER, 10, null, null, null, null);
$xmldb_table->add_field('info', XMLDB_TYPE_TEXT, null, null, null, null, null);
$xmldb_table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
$xmldb_table->add_key('backupid_itemname_itemid_uk', XMLDB_KEY_UNIQUE, array('backupid','itemname','itemid'));
$xmldb_table->add_index('backupid_parentitemid_ix', null, array('backupid','itemname','parentitemid'));
$xmldb_table->add_index('backupid_itemname_newitemid_ix', null, array('backupid','itemname','newitemid'));
$xmldb_table->add_index('backupid_parentitemid_ix', XMLDB_INDEX_NOTUNIQUE, array('backupid','itemname','parentitemid'));
$xmldb_table->add_index('backupid_itemname_newitemid_ix', XMLDB_INDEX_NOTUNIQUE, array('backupid','itemname','newitemid'));
$dbman->create_temp_table($xmldb_table); // And create it
@@ -129,18 +129,18 @@ abstract class backup_controller_dbops extends backup_dbops {
$dbman = $DB->get_manager(); // We are going to use database_manager services
$xmldb_table = new xmldb_table('backup_files_temp');
$xmldb_table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
$xmldb_table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
// Set default backupid (not needed but this enforce any missing backupid). That's hackery in action!
$xmldb_table->add_field('backupid', XMLDB_TYPE_CHAR, 32, null, XMLDB_NOTNULL, null, $backupid);
$xmldb_table->add_field('contextid', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, null, null);
$xmldb_table->add_field('component', XMLDB_TYPE_CHAR, 100, null, XMLDB_NOTNULL, null, null);
$xmldb_table->add_field('filearea', XMLDB_TYPE_CHAR, 50, null, XMLDB_NOTNULL, null, null);
$xmldb_table->add_field('itemid', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, null, null);
$xmldb_table->add_field('info', XMLDB_TYPE_TEXT, 1333, null, null, null, null);
$xmldb_table->add_field('newcontextid', XMLDB_TYPE_INTEGER, 10, null, null, null, '0');
$xmldb_table->add_field('newitemid', XMLDB_TYPE_INTEGER, 10, null, null, null, '0');
$xmldb_table->add_field('info', XMLDB_TYPE_TEXT, null, null, null, null, null);
$xmldb_table->add_field('newcontextid', XMLDB_TYPE_INTEGER, 10, null, null, null, null);
$xmldb_table->add_field('newitemid', XMLDB_TYPE_INTEGER, 10, null, null, null, null);
$xmldb_table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
$xmldb_table->add_index('backupid_contextid_component_filearea_itemid_ix', null, array('backupid','contextid','component','filearea','itemid'));
$xmldb_table->add_index('backupid_contextid_component_filearea_itemid_ix', XMLDB_INDEX_NOTUNIQUE, array('backupid','contextid','component','filearea','itemid'));
$dbman->create_temp_table($xmldb_table); // And create it
}
+19 -19
View File
@@ -1593,7 +1593,7 @@ function stats_temp_table_create() {
/// Define tables user to be created
$table = new xmldb_table('temp_stats_daily');
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
$table->add_field('courseid', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, null, '0');
$table->add_field('timeend', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, null, '0');
$table->add_field('roleid', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, null, '0');
@@ -1601,13 +1601,13 @@ function stats_temp_table_create() {
$table->add_field('stat1', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, null, '0');
$table->add_field('stat2', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, null, '0');
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
$table->add_index('courseid', null, array('courseid'));
$table->add_index('timeend', null, array('timeend'));
$table->add_index('roleid', null, array('roleid'));
$table->add_index('courseid', XMLDB_INDEX_NOTUNIQUE, array('courseid'));
$table->add_index('timeend', XMLDB_INDEX_NOTUNIQUE, array('timeend'));
$table->add_index('roleid', XMLDB_INDEX_NOTUNIQUE, array('roleid'));
$tables['temp_stats_daily'] = $table;
$table = new xmldb_table('temp_stats_user_daily');
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
$table->add_field('courseid', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, null, '0');
$table->add_field('userid', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, null, '0');
$table->add_field('roleid', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, null, '0');
@@ -1616,34 +1616,34 @@ function stats_temp_table_create() {
$table->add_field('statswrites', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, null, '0');
$table->add_field('stattype', XMLDB_TYPE_CHAR, 30, null, XMLDB_NOTNULL, null, null);
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
$table->add_index('courseid', null, array('courseid'));
$table->add_index('userid', null, array('userid'));
$table->add_index('timeend', null, array('timeend'));
$table->add_index('roleid', null, array('roleid'));
$table->add_index('courseid', XMLDB_INDEX_NOTUNIQUE, array('courseid'));
$table->add_index('userid', XMLDB_INDEX_NOTUNIQUE, array('userid'));
$table->add_index('timeend', XMLDB_INDEX_NOTUNIQUE, array('timeend'));
$table->add_index('roleid', XMLDB_INDEX_NOTUNIQUE, array('roleid'));
$tables['temp_stats_user_daily'] = $table;
$table = new xmldb_table('temp_enroled');
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
$table->add_field('userid', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, null, '0');
$table->add_field('courseid', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, null, '0');
$table->add_field('roleid', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, null, '0');
$table->add_field('roleid', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, null, null);
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
$table->add_index('userid', null, array('userid'));
$table->add_index('courseid', null, array('courseid'));
$table->add_index('roleid', null, array('roleid'));
$table->add_index('userid', XMLDB_INDEX_NOTUNIQUE, array('userid'));
$table->add_index('courseid', XMLDB_INDEX_NOTUNIQUE, array('courseid'));
$table->add_index('roleid', XMLDB_INDEX_NOTUNIQUE, array('roleid'));
$tables['temp_enroled'] = $table;
$table = new xmldb_table('temp_log1');
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
$table->add_field('userid', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, null, '0');
$table->add_field('course', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, null, '0');
$table->add_field('action', XMLDB_TYPE_CHAR, 40, null, XMLDB_NOTNULL, null, null);
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
$table->add_index('action', null, array('action'));
$table->add_index('course', null, array('course'));
$table->add_index('user', null, array('userid'));
$table->add_index('usercourseaction', null, array('userid','course','action'));
$table->add_index('action', XMLDB_INDEX_NOTUNIQUE, array('action'));
$table->add_index('course', XMLDB_INDEX_NOTUNIQUE, array('course'));
$table->add_index('user', XMLDB_INDEX_NOTUNIQUE, array('userid'));
$table->add_index('usercourseaction', XMLDB_INDEX_NOTUNIQUE, array('userid','course','action'));
$tables['temp_log1'] = $table;
/// temp_log2 is exactly the same as temp_log1.