Revision: 4331
Author:   seba.wagner
Date:     Fri Sep 30 09:24:57 2011
Log:      fix upgrade script
http://code.google.com/p/openmeetings/source/detail?r=4331

Modified:
 /trunk/plugins/moodle_plugin/db/install.xml
 /trunk/plugins/moodle_plugin/db/upgrade.php
 /trunk/plugins/moodle_plugin/version.php

=======================================
--- /trunk/plugins/moodle_plugin/db/install.xml Fri Sep 30 08:38:05 2011
+++ /trunk/plugins/moodle_plugin/db/install.xml Fri Sep 30 09:24:57 2011
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="mod/openmeetings/db" VERSION="20110930" COMMENT="XMLDB file for OpenMeetings" +<XMLDB PATH="mod/openmeetings/db" VERSION="20111002" COMMENT="XMLDB file for OpenMeetings"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
 >
@@ -15,7 +15,6 @@
<FIELD NAME="language" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" ENUM="false" COMMENT="RoomType id" PREVIOUS="max_user" NEXT="name"/> <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="name field for moodle instances" PREVIOUS="language" NEXT="intro"/> <FIELD NAME="intro" TYPE="text" LENGTH="medium" NOTNULL="false" SEQUENCE="false" ENUM="false" COMMENT="General introduction of the whiteboard activity" PREVIOUS="name" NEXT="introformat"/> - <FIELD NAME="introformat" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Format of the intro field (MOODLE, HTML, MARKDOWN...)" PREVIOUS="intro" NEXT="timecreated"/> <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="introformat" NEXT="timemodified"/> <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="timecreated" NEXT="room_id"/> <FIELD NAME="room_id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="timemodified" NEXT="room_recording_id"/>
=======================================
--- /trunk/plugins/moodle_plugin/db/upgrade.php Fri Sep 30 09:09:19 2011
+++ /trunk/plugins/moodle_plugin/db/upgrade.php Fri Sep 30 09:24:57 2011
@@ -1,27 +1,46 @@
 <?php  //$Id: upgrade.php,v 1.0 2008/05/12 12:00:00 Sebastian Wagner Exp $

-function xmldb_openmeetings_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $db;
+function xmldb_openmeetings_upgrade($oldversion) {
+
+    global $CFG, $DB, $OUTPUT;
+
+    $dbman = $DB->get_manager();

     $result = true;

+    if ($oldversion < 20111001) {
+
+       // Define field allow_recording to be added to openmeetings
+       $table = new xmldb_table('openmeetings');
+ $field = new xmldb_field('allow_recording', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '1', 'room_recording_id');
+
+       // Conditionally launch add field allow_recording
+       if (!$dbman->field_exists($table, $field)) {
+               $dbman->add_field($table, $field);
+       }
+
+       // openmeetings savepoint reached
+       upgrade_mod_savepoint(true, 20111001, 'openmeetings');
+    }
+
+    if ($oldversion < 20111002) {
+
+       // Define field introformat to be dropped from openmeetings
+       $table = new xmldb_table('openmeetings');
+       $field = new xmldb_field('introformat');
+
+       // Conditionally launch drop field introformat
+       if ($dbman->field_exists($table, $field)) {
+               $dbman->drop_field($table, $field);
+       }
+
+       // openmeetings savepoint reached
+       upgrade_mod_savepoint(true, 20111002, 'openmeetings');
+    }
+
     return $result;
 }

-if ($oldversion < 20111001) {
-
-       // Define field allow_recording to be added to openmeetings
-        $table = new xmldb_table('openmeetings');
- $field = new xmldb_field('allow_recording', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '1', 'room_recording_id');
-
-        // Conditionally launch add field allow_recording
-        if (!$dbman->field_exists($table, $field)) {
-            $dbman->add_field($table, $field);
-        }
-
-       // openmeetings savepoint reached
-       upgrade_mod_savepoint(true, 20111001, 'openmeetings');
-}
+

 ?>
=======================================
--- /trunk/plugins/moodle_plugin/version.php    Fri Sep 30 09:09:19 2011
+++ /trunk/plugins/moodle_plugin/version.php    Fri Sep 30 09:24:57 2011
@@ -1,6 +1,6 @@
 <?php // $Id: version.php,v 1.0 2008/05/12 12:00:00 Sebastian Wagner Exp $

-$module->version  = 20111001;
+$module->version  = 20111002;
 $module->cron     = 0;

 ?>

--
You received this message because you are subscribed to the Google Groups 
"OpenMeetings developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/openmeetings-dev?hl=en.

Reply via email to