Merge branch 'passwordreset-2013-10-07-1031Z' of https://github.com/peterbulmer/moodle
authorDamyon Wiese <damyon@moodle.com>
Tue, 8 Oct 2013 02:30:57 +0000 (10:30 +0800)
committerDamyon Wiese <damyon@moodle.com>
Tue, 8 Oct 2013 02:30:57 +0000 (10:30 +0800)
Conflicts:
lib/db/install.xml
lib/db/upgrade.php
version.php

1  2 
lang/en/admin.php
lang/en/moodle.php
lib/cronlib.php
lib/db/install.xml
lib/db/upgrade.php
lib/moodlelib.php
version.php

Simple merge
Simple merge
diff --cc lib/cronlib.php
Simple merge
@@@ -1,5 -1,5 +1,5 @@@
  <?xml version="1.0" encoding="UTF-8" ?>
- <XMLDB PATH="lib/db" VERSION="20131004" COMMENT="XMLDB file for core Moodle tables"
 -<XMLDB PATH="lib/db" VERSION="20130927" COMMENT="XMLDB file for core Moodle tables"
++<XMLDB PATH="lib/db" VERSION="20131008" COMMENT="XMLDB file for core Moodle tables"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
  >
          <KEY NAME="fk_backpackid" TYPE="foreign" FIELDS="backpackid" REFTABLE="badge_backpack" REFFIELDS="id"/>
        </KEYS>
      </TABLE>
 +    <TABLE NAME="user_devices" COMMENT="This table stores user's mobile devices information in order to send PUSH notifications">
 +      <FIELDS>
 +        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
 +        <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
 +        <FIELD NAME="appid" TYPE="char" LENGTH="128" NOTNULL="true" SEQUENCE="false" COMMENT="the app id, usually something like com.moodle.moodlemobile"/>
 +        <FIELD NAME="name" TYPE="char" LENGTH="32" NOTNULL="true" SEQUENCE="false" COMMENT="the device name, occam or iPhone etc.."/>
 +        <FIELD NAME="model" TYPE="char" LENGTH="32" NOTNULL="true" SEQUENCE="false" COMMENT="the device model, Nexus 4 or iPad 1,1"/>
 +        <FIELD NAME="platform" TYPE="char" LENGTH="32" NOTNULL="true" SEQUENCE="false" COMMENT="the device platform, Android or iOS etc"/>
 +        <FIELD NAME="version" TYPE="char" LENGTH="32" NOTNULL="true" SEQUENCE="false" COMMENT="The device version, 6.1.2, 4.2.2 etc.."/>
 +        <FIELD NAME="pushid" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="the device PUSH token/key/identifier/registration id"/>
 +        <FIELD NAME="uuid" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="The device vendor UUID"/>
 +        <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
 +        <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
 +      </FIELDS>
 +      <KEYS>
 +        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
 +        <KEY NAME="pushid-userid" TYPE="unique" FIELDS="pushid, userid"/>
 +        <KEY NAME="pushid-platform" TYPE="unique" FIELDS="pushid, platform"/>
 +        <KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
 +      </KEYS>
 +    </TABLE>
+     <TABLE NAME="user_password_resets" COMMENT="table tracking password reset confirmation tokens">
+       <FIELDS>
+         <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
+         <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="id of the user account which requester claimed to be"/>
+         <FIELD NAME="timerequested" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The time that the user first requested this password reset"/>
+         <FIELD NAME="timererequested" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="The time the user re-requested the password reset."/>
+         <FIELD NAME="token" TYPE="char" LENGTH="32" NOTNULL="true" SEQUENCE="false" COMMENT="secret set and emailed to user"/>
+       </FIELDS>
+       <KEYS>
+         <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
+         <KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
+       </KEYS>
+     </TABLE>
    </TABLES>
  </XMLDB>
@@@ -2552,75 -2555,25 +2552,95 @@@ function xmldb_main_upgrade($oldversion
          upgrade_main_savepoint(true, 2013092001.02);
      }
  
 -    if ($oldversion < 2013092700.02) {
 +    if ($oldversion < 2013092700.01) {
 +
 +        $table = new xmldb_table('files');
 +
 +        // Define field referencelastsync to be dropped from files.
 +        $field = new xmldb_field('referencelastsync');
 +
 +        // Conditionally launch drop field referencelastsync.
 +        if ($dbman->field_exists($table, $field)) {
 +            $dbman->drop_field($table, $field);
 +        }
 +
 +        // Define field referencelifetime to be dropped from files.
 +        $field = new xmldb_field('referencelifetime');
 +
 +        // Conditionally launch drop field referencelifetime.
 +        if ($dbman->field_exists($table, $field)) {
 +            $dbman->drop_field($table, $field);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2013092700.01);
 +    }
 +
 +    if ($oldversion < 2013100400.01) {
 +        // Add user_devices core table.
 +
 +        // Define field id to be added to user_devices.
 +        $table = new xmldb_table('user_devices');
 +
 +        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null);
 +        $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'id');
 +        $table->add_field('appid', XMLDB_TYPE_CHAR, '128', null, XMLDB_NOTNULL, null, null, 'userid');
 +        $table->add_field('name', XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null, 'appid');
 +        $table->add_field('model', XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null, 'name');
 +        $table->add_field('platform', XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null, 'model');
 +        $table->add_field('version', XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null, 'platform');
 +        $table->add_field('pushid', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, 'version');
 +        $table->add_field('uuid', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, 'pushid');
 +        $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, 'uuid');
 +        $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, 'timecreated');
 +
 +        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
 +        $table->add_key('pushid-userid', XMLDB_KEY_UNIQUE, array('pushid', 'userid'));
 +        $table->add_key('pushid-platform', XMLDB_KEY_UNIQUE, array('pushid', 'platform'));
 +        $table->add_key('userid', XMLDB_KEY_FOREIGN, array('userid'), 'user', array('id'));
 +
 +        if (!$dbman->table_exists($table)) {
 +            $dbman->create_table($table);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2013100400.01);
 +    }
 +
 +    if ($oldversion < 2013100800.00) {
 +
 +        // Define field maxfraction to be added to question_attempts.
 +        $table = new xmldb_table('question_attempts');
 +        $field = new xmldb_field('maxfraction', XMLDB_TYPE_NUMBER, '12, 7', null, XMLDB_NOTNULL, null, '1', 'minfraction');
 +
 +        // Conditionally launch add field maxfraction.
 +        if (!$dbman->field_exists($table, $field)) {
 +            $dbman->add_field($table, $field);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2013100800.00);
 +    }
 +
++    if ($oldversion < 2013100800.01) {
+         // Create a new 'user_password_resets' table.
+         $table = new xmldb_table('user_password_resets');
+         $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null);
+         $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, null);
+         $table->add_field('timerequested', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, null);
+         $table->add_field('timererequested', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, 0, null);
+         $table->add_field('token', XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null, null);
+         // Adding keys to table.
+         $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
+         $table->add_key('fk_userid', XMLDB_KEY_FOREIGN, array('userid'), 'user', array('id'));
+         // Conditionally launch create table.
+         if (!$dbman->table_exists($table)) {
+             $dbman->create_table($table);
+         }
 -        upgrade_main_savepoint(true, 2013092700.02);
++        upgrade_main_savepoint(true, 2013100800.01);
+     }
      return true;
  }
Simple merge
diff --cc version.php
@@@ -29,7 -29,7 +29,7 @@@
  
  defined('MOODLE_INTERNAL') || die();
  
- $version  = 2013100800.00;              // YYYYMMDD      = weekly release date of this DEV branch.
 -$version  = 2013092700.02;              // YYYYMMDD      = weekly release date of this DEV branch.
++$version  = 2013100800.01;              // YYYYMMDD      = weekly release date of this DEV branch.
                                          //         RR    = release increments - 00 in DEV branches.
                                          //           .XX = incremental changes.