Merge branch 'MDL-53226-master' of git://github.com/andrewnicols/moodle
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Wed, 28 Mar 2018 16:15:52 +0000 (18:15 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Wed, 28 Mar 2018 16:15:52 +0000 (18:15 +0200)
1  2 
lib/db/upgrade.php
search/engine/solr/tests/engine_test.php
version.php

@@@ -2020,175 -2020,14 +2020,184 @@@ function xmldb_main_upgrade($oldversion
          upgrade_main_savepoint(true, 2018022800.03);
      }
  
 -    if ($oldversion < 2018031600.01) {
 +    if ($oldversion < 2018032200.01) {
 +        // Define table 'messages' to be created.
 +        $table = new xmldb_table('messages');
 +
 +        // Adding fields to table 'messages'.
 +        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
 +        $table->add_field('useridfrom', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('conversationid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('subject', XMLDB_TYPE_TEXT, null, null, null, null, null);
 +        $table->add_field('fullmessage', XMLDB_TYPE_TEXT, null, null, null, null, null);
 +        $table->add_field('fullmessageformat', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, 0);
 +        $table->add_field('fullmessagehtml', XMLDB_TYPE_TEXT, null, null, null, null, null);
 +        $table->add_field('smallmessage', XMLDB_TYPE_TEXT, null, null, null, null, null);
 +        $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +
 +        // Adding keys to table 'messages'.
 +        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
 +        $table->add_key('useridfrom', XMLDB_KEY_FOREIGN, array('useridfrom'), 'user', array('id'));
 +        $table->add_key('conversationid', XMLDB_KEY_FOREIGN, array('conversationid'), 'message_conversations', array('id'));
 +
 +        // Conditionally launch create table for 'messages'.
 +        if (!$dbman->table_exists($table)) {
 +            $dbman->create_table($table);
 +        }
 +
 +        // Define table 'message_conversations' to be created.
 +        $table = new xmldb_table('message_conversations');
 +
 +        // Adding fields to table 'message_conversations'.
 +        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
 +        $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +
 +        // Adding keys to table 'message_conversations'.
 +        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
 +
 +        // Conditionally launch create table for 'message_conversations'.
 +        if (!$dbman->table_exists($table)) {
 +            $dbman->create_table($table);
 +        }
 +
 +        // Define table 'message_conversation_members' to be created.
 +        $table = new xmldb_table('message_conversation_members');
 +
 +        // Adding fields to table 'message_conversation_members'.
 +        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
 +        $table->add_field('conversationid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +
 +        // Adding keys to table 'message_conversation_members'.
 +        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
 +        $table->add_key('conversationid', XMLDB_KEY_FOREIGN, array('conversationid'), 'message_conversations', array('id'));
 +        $table->add_key('userid', XMLDB_KEY_FOREIGN, array('userid'), 'user', array('id'));
 +
 +        // Conditionally launch create table for 'message_conversation_members'.
 +        if (!$dbman->table_exists($table)) {
 +            $dbman->create_table($table);
 +        }
 +
 +        // Define table 'message_user_actions' to be created.
 +        $table = new xmldb_table('message_user_actions');
 +
 +        // Adding fields to table 'message_user_actions'.
 +        $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, null);
 +        $table->add_field('messageid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('action', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +
 +        // Adding keys to table 'message_user_actions'.
 +        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
 +        $table->add_key('userid', XMLDB_KEY_FOREIGN, array('userid'), 'user', array('id'));
 +        $table->add_key('messageid', XMLDB_KEY_FOREIGN, array('messageid'), 'messages', array('id'));
 +
 +        // Conditionally launch create table for 'message_user_actions'.
 +        if (!$dbman->table_exists($table)) {
 +            $dbman->create_table($table);
 +        }
 +
 +        // Define table 'notifications' to be created.
 +        $table = new xmldb_table('notifications');
 +
 +        // Adding fields to table 'notifications'.
 +        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
 +        $table->add_field('useridfrom', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('useridto', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('subject', XMLDB_TYPE_TEXT, null, null, null, null, null);
 +        $table->add_field('fullmessage', XMLDB_TYPE_TEXT, null, null, null, null, null);
 +        $table->add_field('fullmessageformat', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, 0);
 +        $table->add_field('fullmessagehtml', XMLDB_TYPE_TEXT, null, null, null, null, null);
 +        $table->add_field('smallmessage', XMLDB_TYPE_TEXT, null, null, null, null, null);
 +        $table->add_field('component', XMLDB_TYPE_CHAR, '100', null, null, null, null);
 +        $table->add_field('eventtype', XMLDB_TYPE_CHAR, '100', null, null, null, null);
 +        $table->add_field('contexturl', XMLDB_TYPE_TEXT, null, null, null, null, null);
 +        $table->add_field('contexturlname', XMLDB_TYPE_TEXT, null, null, null, null, null);
 +        $table->add_field('timeread', XMLDB_TYPE_INTEGER, '10', null, false, null, null);
 +        $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +
 +        // Adding keys to table 'notifications'.
 +        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
 +        $table->add_key('useridto', XMLDB_KEY_FOREIGN, array('useridto'), 'user', array('id'));
 +
 +        // Conditionally launch create table for 'notifications'.
 +        if (!$dbman->table_exists($table)) {
 +            $dbman->create_table($table);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2018032200.01);
 +    }
 +
 +    if ($oldversion < 2018032200.04) {
 +        // Define table 'message_conversations' to be updated.
 +        $table = new xmldb_table('message_conversations');
 +        $field = new xmldb_field('convhash', XMLDB_TYPE_CHAR, '40', null, XMLDB_NOTNULL, null, null, 'id');
 +
 +        // Conditionally launch add field 'convhash'.
 +        if (!$dbman->field_exists($table, $field)) {
 +            $dbman->add_field($table, $field);
 +        }
 +
 +        // Conditionally launch add index.
 +        $index = new xmldb_index('convhash', XMLDB_INDEX_UNIQUE, array('convhash'));
 +        if (!$dbman->index_exists($table, $index)) {
 +            $dbman->add_index($table, $index);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2018032200.04);
 +    }
 +
 +    if ($oldversion < 2018032200.05) {
 +        // Drop table that is no longer needed.
 +        $table = new xmldb_table('message_working');
 +        if ($dbman->table_exists($table)) {
 +            $dbman->drop_table($table);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2018032200.05);
 +    }
 +
 +    if ($oldversion < 2018032200.06) {
 +        // Define table 'message_user_actions' to add an index to.
 +        $table = new xmldb_table('message_user_actions');
 +
 +        // Conditionally launch add index.
 +        $index = new xmldb_index('userid_messageid_action', XMLDB_INDEX_UNIQUE, array('userid, messageid, action'));
 +        if (!$dbman->index_exists($table, $index)) {
 +            $dbman->add_index($table, $index);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2018032200.06);
 +    }
 +
 +    if ($oldversion < 2018032200.07) {
 +        // Define table 'messages' to add an index to.
 +        $table = new xmldb_table('messages');
 +
 +        // Conditionally launch add index.
 +        $index = new xmldb_index('conversationid_timecreated', XMLDB_INDEX_NOTUNIQUE, array('conversationid, timecreated'));
 +        if (!$dbman->index_exists($table, $index)) {
 +            $dbman->add_index($table, $index);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2018032200.07);
 +    }
 +
++    if ($oldversion < 2018032700.00) {
+         // Update default search engine to search_simpledb if global search is disabled and there is no solr index defined.
+         if (empty($CFG->enableglobalsearch) && empty(get_config('search_solr', 'indexname'))) {
+             set_config('searchengine', 'simpledb');
+         }
 -        upgrade_main_savepoint(true, 2018031600.01);
++        upgrade_main_savepoint(true, 2018032700.00);
+     }
      return true;
  }
diff --cc version.php
@@@ -29,7 -29,7 +29,7 @@@
  
  defined('MOODLE_INTERNAL') || die();
  
- $version  = 2018032200.07;              // YYYYMMDD      = weekly release date of this DEV branch.
 -$version  = 2018031600.01;              // YYYYMMDD      = weekly release date of this DEV branch.
++$version  = 2018032700.00;              // YYYYMMDD      = weekly release date of this DEV branch.
                                          //         RR    = release increments - 00 in DEV branches.
                                          //           .XX = incremental changes.