Merge branch 'MDL-26504_blog_unregister' of git://github.com/andyjdavis/moodle
authorAparup Banerjee <aparup@moodle.com>
Tue, 4 Sep 2012 05:43:11 +0000 (13:43 +0800)
committerAparup Banerjee <aparup@moodle.com>
Tue, 4 Sep 2012 05:43:11 +0000 (13:43 +0800)
Conflicts:
lib/db/upgrade.php
version.php

1  2 
lib/db/upgrade.php
version.php

@@@ -1120,69 -1120,14 +1120,79 @@@ function xmldb_main_upgrade($oldversion
      }
  
      if ($oldversion < 2012082300.01) {
 -        upgrade_main_savepoint(true, 2012082300.01);
 +        // Add more custom enrol fields.
 +        $table = new xmldb_table('enrol');
 +
 +        $field = new xmldb_field('customint5', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'customint4');
 +        if (!$dbman->field_exists($table, $field)) {
 +            $dbman->add_field($table, $field);
 +        }
 +
 +        $field = new xmldb_field('customint6', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'customint5');
 +        if (!$dbman->field_exists($table, $field)) {
 +            $dbman->add_field($table, $field);
 +        }
 +
 +        $field = new xmldb_field('customint7', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'customint6');
 +        if (!$dbman->field_exists($table, $field)) {
 +            $dbman->add_field($table, $field);
 +        }
 +
 +        $field = new xmldb_field('customint8', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'customint7');
 +        if (!$dbman->field_exists($table, $field)) {
 +            $dbman->add_field($table, $field);
 +        }
 +
 +        $field = new xmldb_field('customchar3', XMLDB_TYPE_CHAR, '1333', null, null, null, null, 'customchar2');
 +        if (!$dbman->field_exists($table, $field)) {
 +            $dbman->add_field($table, $field);
 +        }
 +
 +        $field = new xmldb_field('customtext3', XMLDB_TYPE_TEXT, null, null, null, null, null, 'customtext2');
 +        if (!$dbman->field_exists($table, $field)) {
 +            $dbman->add_field($table, $field);
 +        }
 +
 +        $field = new xmldb_field('customtext4', XMLDB_TYPE_TEXT, null, null, null, null, null, 'customtext3');
 +        if (!$dbman->field_exists($table, $field)) {
 +            $dbman->add_field($table, $field);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2012082300.01);
 +    }
 +
 +    if ($oldversion < 2012082300.02) {
 +        // Define field component to be added to groups_members
 +        $table = new xmldb_table('groups_members');
 +        $field = new xmldb_field('component', XMLDB_TYPE_CHAR, '100', null, XMLDB_NOTNULL, null, null, 'timeadded');
 +
 +        // Conditionally launch add field component
 +        if (!$dbman->field_exists($table, $field)) {
 +            $dbman->add_field($table, $field);
 +        }
 +
 +        // Define field itemid to be added to groups_members
 +        $field = new xmldb_field('itemid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'component');
 +
 +        // Conditionally launch add field itemid
 +        if (!$dbman->field_exists($table, $field)) {
 +            $dbman->add_field($table, $field);
 +        }
 +
 +        // Main savepoint reached
 +        upgrade_main_savepoint(true, 2012082300.02);
 +    }
 +
++    if ($oldversion < 2012090400.00) {
+         $subquery = 'SELECT b.id FROM {blog_external} b where ' . $DB->sql_compare_text('b.id') . ' = ' . $DB->sql_compare_text('{post}.content');
+         $sql = 'DELETE FROM {post}
+                       WHERE {post}.module = \'blog_external\'
+                             AND NOT EXISTS (' . $subquery . ')
+                             AND ' . $DB->sql_isnotempty('post', 'uniquehash', false, false);
+         $DB->execute($sql);
++        upgrade_main_savepoint(true, 2012090400.00);
+     }
      return true;
  }
diff --cc version.php
@@@ -30,7 -30,7 +30,7 @@@
  defined('MOODLE_INTERNAL') || die();
  
  
- $version  = 2012083100.00;              // YYYYMMDD      = weekly release date of this DEV branch
 -$version  = 2012082300.01;              // YYYYMMDD      = weekly release date of this DEV branch
++$version  = 2012090400.00;              // YYYYMMDD      = weekly release date of this DEV branch
                                          //         RR    = release increments - 00 in DEV branches
                                          //           .XX = incremental changes