}
if ($oldversion < 2014012300.01) {
+ // Remove deleted users home pages.
+ $sql = "DELETE FROM {my_pages}
+ WHERE EXISTS (SELECT {user}.id
+ FROM {user}
+ WHERE {user}.id = {my_pages}.userid
+ AND {user}.deleted = 1)
+ AND {my_pages}.private = 1";
+ $DB->execute($sql);
+
+ // Reached main savepoint.
+ upgrade_main_savepoint(true, 2014012300.01);
+ }
+
+ if ($oldversion < 2014012400.00) {
+ // Define table lock_db to be created.
+ $table = new xmldb_table('lock_db');
- upgrade_main_savepoint(true, 2014012300.01);
+ // Adding fields to table lock_db.
+ $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
+ $table->add_field('resourcekey', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('expires', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
+ $table->add_field('owner', XMLDB_TYPE_CHAR, '36', null, null, null, null);
+
+ // Adding keys to table lock_db.
+ $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
+
+ // Adding indexes to table lock_db.
+ $table->add_index('resourcekey_uniq', XMLDB_INDEX_UNIQUE, array('resourcekey'));
+ $table->add_index('expires_idx', XMLDB_INDEX_NOTUNIQUE, array('expires'));
+ $table->add_index('owner_idx', XMLDB_INDEX_NOTUNIQUE, array('owner'));
+
+ // Conditionally launch create table for lock_db.
+ if (!$dbman->table_exists($table)) {
+ $dbman->create_table($table);
+ }
+
+ // Main savepoint reached.
+ upgrade_main_savepoint(true, 2014012400.00);
+ }
+
++ if ($oldversion < 2014020500.00) {
+ // Define field variant to be added to question_statistics.
+ $table = new xmldb_table('question_statistics');
+ $field = new xmldb_field('variant', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'subquestion');
+
+ // Conditionally launch add field variant.
+ if (!$dbman->field_exists($table, $field)) {
+ $dbman->add_field($table, $field);
+ }
+
+ // Main savepoint reached.
++ upgrade_main_savepoint(true, 2014020500.00);
+ }
+
return true;
}