MDL-24302 removing multiple field from block table in install.xml - it was already...
authorPetr Skoda <skodak@moodle.org>
Mon, 20 Sep 2010 19:13:07 +0000 (19:13 +0000)
committerPetr Skoda <skodak@moodle.org>
Mon, 20 Sep 2010 19:13:07 +0000 (19:13 +0000)
lib/db/install.xml
lib/db/upgrade.php
lib/upgradelib.php
version.php

index a7c3bf3..149fe25 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="lib/db" VERSION="20100915" COMMENT="XMLDB file for core Moodle tables"
+<XMLDB PATH="lib/db" VERSION="20100920" COMMENT="XMLDB file for core Moodle tables"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
 >
         <FIELD NAME="version" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="name" NEXT="cron"/>
         <FIELD NAME="cron" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="version" NEXT="lastcron"/>
         <FIELD NAME="lastcron" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="cron" NEXT="visible"/>
-        <FIELD NAME="visible" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="false" DEFAULT="1" SEQUENCE="false" PREVIOUS="lastcron" NEXT="multiple"/>
-        <FIELD NAME="multiple" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" PREVIOUS="visible"/>
+        <FIELD NAME="visible" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="false" DEFAULT="1" SEQUENCE="false" PREVIOUS="lastcron"/>
       </FIELDS>
       <KEYS>
         <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
index d51aba1..ef550bd 100644 (file)
@@ -5251,6 +5251,23 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL");
         upgrade_main_savepoint(true, 2010091700);
     }
 
+    if ($oldversion < 2010092000) {
+        // drop multiple field again because it was still in install.xml in 2.0dev
+
+        // Define field multiple to be dropped from block
+        $table = new xmldb_table('block');
+        $field = new xmldb_field('multiple');
+
+        // Conditionally launch drop field multiple
+        if ($dbman->field_exists($table, $field)) {
+            $dbman->drop_field($table, $field);
+        }
+
+        // Main savepoint reached
+        upgrade_main_savepoint(true, 2010092000);
+    }
+
+
     return true;
 }
 
index c6b4e9b..d6b4ca6 100644 (file)
@@ -585,7 +585,6 @@ function upgrade_plugins_blocks($startcallback, $endcallback, $verbose) {
         }
 
         $block->name     = $blockname;   // The name MUST match the directory
-        $block->multiple = $blockobj->instance_allow_multiple() ? 1 : 0;
 
         if (empty($block->version)) {
             throw new plugin_defective_exception($component, 'Missing block version.');
@@ -614,8 +613,6 @@ function upgrade_plugins_blocks($startcallback, $endcallback, $verbose) {
         }
 
         if (empty($currblock->version)) { // block not installed yet, so install it
-            // If it allows multiples, start with it enabled
-
             $conflictblock = array_search($blocktitle, $blocktitles);
             if ($conflictblock !== false) {
                 // Duplicate block titles are not allowed, they confuse people
index 182f05f..ed9d59d 100644 (file)
@@ -29,7 +29,7 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$version = 2010091900;  // YYYYMMDD   = date of the last version bump
+$version = 2010092000;  // YYYYMMDD   = date of the last version bump
                         //         XX = daily increments
 
 $release = '2.0 Preview 4+ (Build: 20100920)';  // Human-friendly version name