]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-17457 migrated all modules to new db/install.php; added upgrade.txt file for...
authorskodak <skodak>
Mon, 12 Jan 2009 21:13:28 +0000 (21:13 +0000)
committerskodak <skodak>
Mon, 12 Jan 2009 21:13:28 +0000 (21:13 +0000)
38 files changed:
lib/adminlib.php
mod/assignment/db/install.php [new file with mode: 0644]
mod/assignment/db/install.xml
mod/assignment/lib.php
mod/chat/db/install.php [new file with mode: 0644]
mod/chat/db/install.xml
mod/choice/db/install.php [new file with mode: 0644]
mod/choice/db/install.xml
mod/data/db/install.php [new file with mode: 0644]
mod/data/db/install.xml
mod/feedback/db/install.php [new file with mode: 0644]
mod/feedback/db/install.xml
mod/feedback/lib.php
mod/forum/db/install.php [new file with mode: 0644]
mod/forum/db/install.xml
mod/forum/lib.php
mod/glossary/db/install.php [new file with mode: 0644]
mod/glossary/db/install.xml
mod/hotpot/db/install.php [new file with mode: 0644]
mod/hotpot/db/upgrade.php
mod/hotpot/defaults.php [deleted file]
mod/hotpot/version.php
mod/label/db/install.php [new file with mode: 0644]
mod/label/db/install.xml
mod/lesson/db/install.php [new file with mode: 0644]
mod/lesson/db/install.xml
mod/lesson/lib.php
mod/quiz/db/install.php [new file with mode: 0644]
mod/quiz/db/install.xml
mod/quiz/lib.php
mod/resource/db/install.php [new file with mode: 0644]
mod/resource/db/install.xml
mod/scorm/db/install.php [new file with mode: 0644]
mod/scorm/db/install.xml
mod/survey/db/install.php [new file with mode: 0644]
mod/survey/db/install.xml
mod/upgrade.txt [new file with mode: 0644]
mod/wiki/db/install.php [new file with mode: 0644]

index 16de8c7e5e2718dc1eee0c8d72e1bd2de21260b5..d913944a03169d7b221fef4616e524b2269c9d33 100644 (file)
@@ -382,7 +382,7 @@ function get_db_directories() {
  * @param string $return The url to prompt the user to continue to
  */
 function upgrade_plugins($type, $dir) {
-    global $CFG, $interactive, $DB;
+    global $CFG, $DB;
 
 /// special cases
     if ($type === 'mod') {
@@ -521,20 +521,14 @@ function upgrade_plugins($type, $dir) {
 
 /**
  * Find and check all modules and load them up or upgrade them if necessary
- *
- * @uses $CFG
- * @param string $return The url to prompt the user to continue to
- * @todo Finish documenting this function
  */
 function upgrade_activity_modules() {
-
-    global $CFG, $interactive, $DB, $unittest;
+    global $CFG, $DB;
 
     if (!$mods = get_list_of_plugins('mod') ) {
         print_error('nomodules', 'debug');
     }
 
-    $updated_modules = false;
     $strmodulesetup  = get_string('modulesetup');
 
     foreach ($mods as $mod) {
@@ -547,11 +541,11 @@ function upgrade_activity_modules() {
 
         unset($module);
 
-        if ( is_readable($fullmod .'/version.php')) {
-            include_once($fullmod .'/version.php');  // defines $module with version etc
+
+        if (is_readable($fullmod .'/version.php')) {
+            require($fullmod .'/version.php');  // defines $module with version etc
         } else {
-            notify('Module '. $mod .': '. $fullmod .'/version.php was not readable');
-            continue;
+            error('Module '. $mod .': '. $fullmod .'/version.php was not readable'); // TODO: localise
         }
 
         $newupgrade = false;
@@ -573,7 +567,6 @@ function upgrade_activity_modules() {
                 $info->requiremoodle = $module->requires;
                 upgrade_log_start();
                 notify(get_string('modulerequirementsnotmet', 'error', $info));
-                $updated_modules = true;
                 continue;
             }
         }
@@ -627,8 +620,6 @@ function upgrade_activity_modules() {
             /// Update message providers
                 message_update_providers('mod/'.$module->name);
 
-                $updated_modules = true;
-
             } else {
                 print_error('cannotdowngrade', 'debug', '', (object)array('oldversion'=>$currmodule->version, 'newversion'=>$module->version));
             }
@@ -636,46 +627,31 @@ function upgrade_activity_modules() {
         } else {    // module not installed yet, so install it
             upgrade_log_start();
             print_heading($module->name);
-            $updated_modules = true;
-            // To avoid unnecessary output from the SQL queries in the CLI version
-            @set_time_limit(0);  // To allow slow databases to complete the long SQL
 
-        /// Both old .sql files and new install.xml are supported
-        /// but we priorize install.xml (XMLDB) if present
-            if (file_exists($fullmod . '/db/install.xml')) {
-                $DB->get_manager()->install_from_xmldb_file($fullmod . '/db/install.xml'); //New method
-                $status = true;
+        /// Execute install.xml (XMLDB) - must be present
+            $DB->get_manager()->install_from_xmldb_file($fullmod . '/db/install.xml'); //New method
+
+        /// Post installation hook - optional
+            if (file_exists("$fullmod/db/install.php")) {
+                require_once("$fullmod/db/install.php");
+                $post_install_function = 'xmldb_'.$module->name.'_install';;
+                $post_install_function();
             }
 
         /// Continue with the installation, roles and other stuff
-            if ($status) {
-                if ($module->id = $DB->insert_record('modules', $module)) {
+            $module->id = $DB->insert_record('modules', $module);
 
-                /// Capabilities
-                    update_capabilities('mod/'.$module->name);
+        /// Capabilities
+            update_capabilities('mod/'.$module->name);
 
-                /// Events
-                    events_update_definition('mod/'.$module->name);
+        /// Events
+            events_update_definition('mod/'.$module->name);
 
-                /// Message providers
-                    message_update_providers('mod/'.$module->name);
+        /// Message providers
+            message_update_providers('mod/'.$module->name);
 
-                /// Run local install function if there is one
-                    $installfunction = $module->name.'_install';
-                    if (function_exists($installfunction)) {
-                        if (! $installfunction() ) {
-                            notify('Encountered a problem running install function for '.$module->name.'!');
-                        }
-                    }
-
-                    notify(get_string('modulesuccess', '', $module->name), 'notifysuccess');
-                    print_upgrade_separator();
-                } else {
-                    print_error('cannotaddmodule', '', '', $module->name);
-                }
-            } else {
-                print_error('cannotsetuptable', 'debug', '', $module->name);
-            }
+            notify(get_string('modulesuccess', '', $module->name), 'notifysuccess');
+            print_upgrade_separator();
         }
 
     /// Check submodules of this module if necessary
@@ -710,8 +686,6 @@ function upgrade_activity_modules() {
             }
         }
     }
-
-    return $updated_modules;
 }
 
 /**
@@ -898,7 +872,6 @@ function upgrade_log_start($preinstall=false) {
                 build_navigation(array(array('name' => $strupgrade, 'link' => null, 'type' => 'misc'))), '',
                 upgrade_get_javascript(), false, '&nbsp;', '&nbsp;');
         }
-        //$DB->set_debug(true); // should be configurable soon
 
         ignore_user_abort(true);
         register_shutdown_function('upgrade_finished_handler');
diff --git a/mod/assignment/db/install.php b/mod/assignment/db/install.php
new file mode 100644 (file)
index 0000000..540c9e7
--- /dev/null
@@ -0,0 +1,18 @@
+<?php  //$Id$
+
+// This file replaces:
+//   * STATEMENTS section in db/install.xml
+//   * lib.php/modulename_install() post installation hook
+//   * partially defaults.php
+
+function xmldb_assignment_install() {
+    global $DB;
+
+/// Install logging support
+    upgrade_log_display_entry('assignment', 'view', 'assignment', 'name');
+    upgrade_log_display_entry('assignment', 'add', 'assignment', 'name');
+    upgrade_log_display_entry('assignment', 'update', 'assignment', 'name');
+    upgrade_log_display_entry('assignment', 'view submission', 'assignment', 'name');
+    upgrade_log_display_entry('assignment', 'upload', 'assignment', 'name');
+
+}
index d089265b49a50a088ff72195b61ca8491ebc2043..467ec70abbd6c343e4fba38905ef28a59242cfe2 100644 (file)
       </INDEXES>
     </TABLE>
   </TABLES>
-  <STATEMENTS>
-    <STATEMENT NAME="insert log_display" TYPE="insert" TABLE="log_display" COMMENT="Initial insert of records on table log_display">
-      <SENTENCES>
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('assignment', 'view', 'assignment', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('assignment', 'add', 'assignment', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('assignment', 'update', 'assignment', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('assignment', 'view submission', 'assignment', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('assignment', 'upload', 'assignment', 'name')" />
-      </SENTENCES>
-    </STATEMENT>
-  </STATEMENTS>
 </XMLDB>
index 8f08fc5f8b65d3f70314ae0fcc775ee672a512a6..e72319b82447010e11be06b21a0c66b2e92b3707 100644 (file)
@@ -1966,13 +1966,6 @@ class mod_assignment_upload_file_form extends moodleform {
 
 /// OTHER STANDARD FUNCTIONS ////////////////////////////////////////////////////////
 
-/**
- * Code to be executed when a module is installed
- */
-function assignment_install() {
-    return true;
-}
-
 /**
  * Deletes an assignment instance
  *
diff --git a/mod/chat/db/install.php b/mod/chat/db/install.php
new file mode 100644 (file)
index 0000000..6b355a4
--- /dev/null
@@ -0,0 +1,17 @@
+<?php  //$Id$
+
+// This file replaces:
+//   * STATEMENTS section in db/install.xml
+//   * lib.php/modulename_install() post installation hook
+//   * partially defaults.php
+
+function xmldb_chat_install() {
+    global $DB;
+
+/// Install logging support
+    upgrade_log_display_entry('chat', 'view', 'chat', 'name');
+    upgrade_log_display_entry('chat', 'add', 'chat', 'name');
+    upgrade_log_display_entry('chat', 'update', 'chat', 'name');
+    upgrade_log_display_entry('chat', 'report', 'chat', 'name');
+    upgrade_log_display_entry('chat', 'talk', 'chat', 'name');
+}
index 63b9b91e38ac8ab5e5aec6f8644ffdc4cb732a4a..021dd1c3f0c4a58560d51f888b0813bee8e63e7e 100644 (file)
       </INDEXES>
     </TABLE>
   </TABLES>
-  <STATEMENTS>
-    <STATEMENT NAME="insert log_display" TYPE="insert" TABLE="log_display" COMMENT="Initial insert of records on table log_display">
-      <SENTENCES>
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('chat', 'view', 'chat', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('chat', 'add', 'chat', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('chat', 'update', 'chat', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('chat', 'report', 'chat', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('chat', 'talk', 'chat', 'name')" />
-      </SENTENCES>
-    </STATEMENT>
-  </STATEMENTS>
 </XMLDB>
diff --git a/mod/choice/db/install.php b/mod/choice/db/install.php
new file mode 100644 (file)
index 0000000..e572adb
--- /dev/null
@@ -0,0 +1,19 @@
+<?php  //$Id$
+
+// This file replaces:
+//   * STATEMENTS section in db/install.xml
+//   * lib.php/modulename_install() post installation hook
+//   * partially defaults.php
+
+function xmldb_choice_install() {
+    global $DB;
+
+/// Install logging support
+    upgrade_log_display_entry('choice', 'view', 'choice', 'name');
+    upgrade_log_display_entry('choice', 'update', 'choice', 'name');
+    upgrade_log_display_entry('choice', 'add', 'choice', 'name');
+    upgrade_log_display_entry('choice', 'report', 'choice', 'name');
+    upgrade_log_display_entry('choice', 'choose', 'choice', 'name');
+    upgrade_log_display_entry('choice', 'choose again', 'choice', 'name');
+
+}
index 48aeb70c6862502bb4d774be5a8b1a93a264399f..f0d47f28d0355fcf1ee0f3e5a0d74527f8e46fb9 100644 (file)
       </INDEXES>
     </TABLE>
   </TABLES>
-  <STATEMENTS>
-    <STATEMENT NAME="insert log_display" TYPE="insert" TABLE="log_display" COMMENT="Initial insert of records on table log_display">
-      <SENTENCES>
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('choice', 'view', 'choice', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('choice', 'update', 'choice', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('choice', 'add', 'choice', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('choice', 'report', 'choice', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('choice', 'choose', 'choice', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('choice', 'choose again', 'choice', 'name')" />
-      </SENTENCES>
-    </STATEMENT>
-  </STATEMENTS>
 </XMLDB>
diff --git a/mod/data/db/install.php b/mod/data/db/install.php
new file mode 100644 (file)
index 0000000..5140563
--- /dev/null
@@ -0,0 +1,21 @@
+<?php  //$Id$
+
+// This file replaces:
+//   * STATEMENTS section in db/install.xml
+//   * lib.php/modulename_install() post installation hook
+//   * partially defaults.php
+
+function xmldb_data_install() {
+    global $DB;
+
+/// Install logging support
+    upgrade_log_display_entry('data', 'view', 'data', 'name');
+    upgrade_log_display_entry('data', 'add', 'data', 'name');
+    upgrade_log_display_entry('data', 'update', 'data', 'name');
+    upgrade_log_display_entry('data', 'record delete', 'data', 'name');
+    upgrade_log_display_entry('data', 'fields add', 'data_fields', 'name');
+    upgrade_log_display_entry('data', 'fields update', 'data_fields', 'name');
+    upgrade_log_display_entry('data', 'templates saved', 'data', 'name');
+    upgrade_log_display_entry('data', 'templates def', 'data', 'name');
+
+}
index d4fd6ac5b378a16a3650e0f0a292b68e37dd7029..079518a9ce7704f93bf6d7ed4e2c73b60a8c55cd 100644 (file)
       </KEYS>
     </TABLE>
   </TABLES>
-  <STATEMENTS>
-    <STATEMENT NAME="insert log_display" TYPE="insert" TABLE="log_display" COMMENT="Initial insert of records on table log_display">
-      <SENTENCES>
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('data', 'view', 'data', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('data', 'add', 'data', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('data', 'update', 'data', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('data', 'record delete', 'data', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('data', 'fields add', 'data_fields', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('data', 'fields update', 'data_fields', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('data', 'templates saved', 'data', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('data', 'templates def', 'data', 'name')" />
-      </SENTENCES>
-    </STATEMENT>
-  </STATEMENTS>
 </XMLDB>
diff --git a/mod/feedback/db/install.php b/mod/feedback/db/install.php
new file mode 100644 (file)
index 0000000..2042406
--- /dev/null
@@ -0,0 +1,18 @@
+<?php  //$Id$
+
+// This file replaces:
+//   * STATEMENTS section in db/install.xml
+//   * lib.php/modulename_install() post installation hook
+//   * partially defaults.php
+
+function xmldb_feedback_install() {
+    global $DB;
+
+/// Install logging support
+    upgrade_log_display_entry('feedback', 'startcomplete', 'feedback', 'name');
+    upgrade_log_display_entry('feedback', 'submit', 'feedback', 'name');
+    upgrade_log_display_entry('feedback', 'delete', 'feedback', 'name');
+    upgrade_log_display_entry('feedback', 'view', 'feedback', 'name');
+    upgrade_log_display_entry('feedback', 'view all', 'course', 'shortname');
+
+}
index 1ce25bf1f0544331cb11294c455bae391ad9d646..ff5a190996aab0fb04a6f301e423f5d92f82e501 100644 (file)
       </INDEXES>
     </TABLE>
   </TABLES>
-  <STATEMENTS>
-    <STATEMENT NAME="insert log_display" TYPE="insert" TABLE="log_display" COMMENT="Initial insert of records on table log_display">
-      <SENTENCES>
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('feedback', 'startcomplete', 'feedback', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('feedback', 'submit', 'feedback', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('feedback', 'delete', 'feedback', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('feedback', 'view', 'feedback', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('feedback', 'view all', 'course', 'shortname')" />
-      </SENTENCES>
-    </STATEMENT>
-  </STATEMENTS>
 </XMLDB>
index d06469fd1fba0db9bc33eb6782007b0fae93a9a6..6f4df83974284c0fda1e1f9deaaaab2ed3190e29 100644 (file)
@@ -29,13 +29,6 @@ if(!isset($SESSION->feedback) OR !is_object($SESSION->feedback)) {
     $SESSION->feedback = new object();
 }
 
-/** 
- * Code to be executed when a module is installed
- */ 
-function feedback_install() {
-    return true; 
-}
-
 /**
  * @param string $feature FEATURE_xx constant for requested feature
  * @return mixed True if module supports feature, null if doesn't know
diff --git a/mod/forum/db/install.php b/mod/forum/db/install.php
new file mode 100644 (file)
index 0000000..e4b4fdb
--- /dev/null
@@ -0,0 +1,25 @@
+<?php  //$Id$
+
+// This file replaces:
+//   * STATEMENTS section in db/install.xml
+//   * lib.php/modulename_install() post installation hook
+//   * partially defaults.php
+
+function xmldb_forum_install() {
+    global $DB;
+
+/// Install logging support
+    upgrade_log_display_entry('forum', 'add', 'forum', 'name');
+    upgrade_log_display_entry('forum', 'update', 'forum', 'name');
+    upgrade_log_display_entry('forum', 'add discussion', 'forum_discussions', 'name');
+    upgrade_log_display_entry('forum', 'add post', 'forum_posts', 'subject');
+    upgrade_log_display_entry('forum', 'update post', 'forum_posts', 'subject');
+    upgrade_log_display_entry('forum', 'user report', 'user', 'CONCAT(firstname,&quot; &quot;,lastname)');
+    upgrade_log_display_entry('forum', 'move discussion', 'forum_discussions', 'name');
+    upgrade_log_display_entry('forum', 'view subscribers', 'forum', 'name');
+    upgrade_log_display_entry('forum', 'view discussion', 'forum_discussions', 'name');
+    upgrade_log_display_entry('forum', 'view forum', 'forum', 'name');
+    upgrade_log_display_entry('forum', 'subscribe', 'forum', 'name');
+    upgrade_log_display_entry('forum', 'unsubscribe', 'forum', 'name');
+
+}
index a4012f0cd769756a73e15ced31c4367c34cdf13d..7538185ed943880160a57b208ea36099095de7d6 100644 (file)
       </INDEXES>
     </TABLE>
   </TABLES>
-  <STATEMENTS>
-    <STATEMENT NAME="insert log_display" TYPE="insert" TABLE="log_display" COMMENT="Initial insert of records on table log_display">
-      <SENTENCES>
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('forum', 'add', 'forum', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('forum', 'update', 'forum', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('forum', 'add discussion', 'forum_discussions', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('forum', 'add post', 'forum_posts', 'subject')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('forum', 'update post', 'forum_posts', 'subject')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('forum', 'user report', 'user', 'CONCAT(firstname,&quot; &quot;,lastname)')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('forum', 'move discussion', 'forum_discussions', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('forum', 'view subscribers', 'forum', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('forum', 'view discussion', 'forum_discussions', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('forum', 'view forum', 'forum', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('forum', 'subscribe', 'forum', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('forum', 'unsubscribe', 'forum', 'name')" />
-      </SENTENCES>
-    </STATEMENT>
-  </STATEMENTS>
 </XMLDB>
\ No newline at end of file
index f3eb8e49fa8205bc3f8c56c2b4c2ea0fd95ed3c6..955638e4e7b19903299234649b557e44e0c2170d 100644 (file)
@@ -30,14 +30,6 @@ define ('FORUM_AGGREGATE_SUM', 5);
 
 /// STANDARD FUNCTIONS ///////////////////////////////////////////////////////////
 
-/**
- * Code to be executed when a module is installed
- */
-function forum_install() {
-    return true;
-}
-
-
 /**
  * Given an object containing all the necessary data,
  * (defined by the form in mod_form.php) this function
diff --git a/mod/glossary/db/install.php b/mod/glossary/db/install.php
new file mode 100644 (file)
index 0000000..3d20ba4
--- /dev/null
@@ -0,0 +1,27 @@
+<?php  //$Id$
+
+// This file replaces:
+//   * STATEMENTS section in db/install.xml
+//   * lib.php/modulename_install() post installation hook
+//   * partially defaults.php
+
+function xmldb_glossary_install() {
+    global $DB;
+
+/// Install logging support
+    upgrade_log_display_entry('glossary', 'add', 'glossary', 'name');
+    upgrade_log_display_entry('glossary', 'update', 'glossary', 'name');
+    upgrade_log_display_entry('glossary', 'view', 'glossary', 'name');
+    upgrade_log_display_entry('glossary', 'view all', 'glossary', 'name');
+    upgrade_log_display_entry('glossary', 'add entry', 'glossary', 'name');
+    upgrade_log_display_entry('glossary', 'update entry', 'glossary', 'name');
+    upgrade_log_display_entry('glossary', 'add category', 'glossary', 'name');
+    upgrade_log_display_entry('glossary', 'update category', 'glossary', 'name');
+    upgrade_log_display_entry('glossary', 'delete category', 'glossary', 'name');
+    upgrade_log_display_entry('glossary', 'add comment', 'glossary', 'name');
+    upgrade_log_display_entry('glossary', 'update comment', 'glossary', 'name');
+    upgrade_log_display_entry('glossary', 'delete comment', 'glossary', 'name');
+    upgrade_log_display_entry('glossary', 'approve entry', 'glossary', 'name');
+    upgrade_log_display_entry('glossary', 'view entry', 'glossary_entries', 'concept');
+
+}
index 96d4622a2db13fe0a884e6fce1bd13f7debea8b8..c973e1218a14d331e46b230603ded0e8e65ef442 100644 (file)
       </INDEXES>
     </TABLE>
   </TABLES>
-  <STATEMENTS>
-    <STATEMENT NAME="insert log_display" TYPE="insert" TABLE="log_display" COMMENT="Initial insert of records on table log_display">
-      <SENTENCES>
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('glossary', 'add', 'glossary', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('glossary', 'update', 'glossary', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('glossary', 'view', 'glossary', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('glossary', 'view all', 'glossary', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('glossary', 'add entry', 'glossary', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('glossary', 'update entry', 'glossary', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('glossary', 'add category', 'glossary', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('glossary', 'update category', 'glossary', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('glossary', 'delete category', 'glossary', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('glossary', 'add comment', 'glossary', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('glossary', 'update comment', 'glossary', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('glossary', 'delete comment', 'glossary', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('glossary', 'approve entry', 'glossary', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('glossary', 'view entry', 'glossary_entries', 'concept')" />
-      </SENTENCES>
-    </STATEMENT>
-  </STATEMENTS>
 </XMLDB>
diff --git a/mod/hotpot/db/install.php b/mod/hotpot/db/install.php
new file mode 100644 (file)
index 0000000..71ecc02
--- /dev/null
@@ -0,0 +1,17 @@
+<?php  //$Id$
+
+// This file replaces:
+//   * STATEMENTS section in db/install.xml
+//   * lib.php/modulename_install() post installation hook
+//   * partially defaults.php
+
+function xmldb_hotpot_install() {
+    global $DB;
+
+/// Disable it by default
+    $DB->set_field('modules', 'visible', 0, array('name'=>'hotpot'));
+
+/// Install logging support here
+    
+
+}
index 158927a6ea496008bfc6c1f30e22501bc34aea96..dd990d9e3ab741f5e7028458620077709ec8b922 100644 (file)
@@ -18,6 +18,13 @@ function xmldb_hotpot_upgrade($oldversion) {
         // ensure "hotpot_upgrade_grades" function is available
         require_once $CFG->dirroot.'/mod/hotpot/lib.php';
         hotpot_upgrade_grades();
+        upgrade_mod_savepoint(true, 2007101511, 'hotpot');
+    }
+
+    if ($result && $oldversion < 2008011200) {
+        // remove not used setting
+        unset_config('hotpot_initialdisable');
+        upgrade_mod_savepoint(true, 2008011200, 'hotpot');
     }
 
     return $result;
diff --git a/mod/hotpot/defaults.php b/mod/hotpot/defaults.php
deleted file mode 100644 (file)
index 5d2820d..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<?php // $Id$
-    if (empty($CFG->hotpot_initialdisable)) {
-        if (!$DB->count_records('hotpot')) {
-            $DB->set_field('modules', 'visible', 0, array('name'=>'hotpot'));  // Disable it by default
-            set_config('hotpot_initialdisable', 1);
-        }
-    }
-
-?>
index 3723084385074a531124a1e056590ff2626a9872..178bab19097c31b3ff14d07b291343135cc142f7 100644 (file)
@@ -3,7 +3,7 @@
 ///  Code fragment to define the version of hotpot
 ///  This fragment is called by moodle_needs_upgrading() and /admin/index.php
 /////////////////////////////////////////////////////////////////////////////////
-$module->version  = 2007101511;   // release date of this version (see note below)
+$module->version  = 2008011200;   // release date of this version (see note below)
 $module->release  = 'v2.4.2';    // human-friendly version name (used in mod/hotpot/lib.php)
 $module->requires = 2007101509;  // Requires this Moodle version
 $module->cron     = 0;            // period for cron to check this module (secs)
diff --git a/mod/label/db/install.php b/mod/label/db/install.php
new file mode 100644 (file)
index 0000000..2ccae89
--- /dev/null
@@ -0,0 +1,15 @@
+<?php  //$Id$
+
+// This file replaces:
+//   * STATEMENTS section in db/install.xml
+//   * lib.php/modulename_install() post installation hook
+//   * partially defaults.php
+
+function xmldb_label_install() {
+    global $DB;
+
+/// Install logging support
+    upgrade_log_display_entry('label', 'add', 'label', 'name');
+    upgrade_log_display_entry('label', 'update', 'label', 'name');
+
+}
index 21b444f86ebc5545345bd9d1986ee72674f3a3ab..4269fb7805ef7a8caba4e2ceb0bf64b5ce16d0d4 100644 (file)
       </INDEXES>
     </TABLE>
   </TABLES>
-  <STATEMENTS>
-    <STATEMENT NAME="insert log_display" TYPE="insert" TABLE="log_display" COMMENT="Initial insert of records on table log_display">
-      <SENTENCES>
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('label', 'add', 'label', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('label', 'update', 'label', 'name')" />
-      </SENTENCES>
-    </STATEMENT>
-  </STATEMENTS>
 </XMLDB>
diff --git a/mod/lesson/db/install.php b/mod/lesson/db/install.php
new file mode 100644 (file)
index 0000000..a384594
--- /dev/null
@@ -0,0 +1,16 @@
+<?php  //$Id$
+
+// This file replaces:
+//   * STATEMENTS section in db/install.xml
+//   * lib.php/modulename_install() post installation hook
+//   * partially defaults.php
+
+function xmldb_lesson_install() {
+    global $DB;
+
+/// Install logging support
+    upgrade_log_display_entry('lesson', 'start', 'lesson', 'name');
+    upgrade_log_display_entry('lesson', 'end', 'lesson', 'name');
+    upgrade_log_display_entry('lesson', 'view', 'lesson_pages', 'title');
+
+}
index e64ababdcf0bc07b5096a24a1229cd24826c0afc..bd94f031e613293e998783297cd1f5fbf6bcb603 100644 (file)
       </INDEXES>
     </TABLE>
   </TABLES>
-  <STATEMENTS>
-    <STATEMENT NAME="insert log_display" TYPE="insert" TABLE="log_display" COMMENT="Initial insert of records on table log_display">
-      <SENTENCES>
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('lesson', 'start', 'lesson', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('lesson', 'end', 'lesson', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('lesson', 'view', 'lesson_pages', 'title')" />
-      </SENTENCES>
-    </STATEMENT>
-  </STATEMENTS>
 </XMLDB>
index 176c6e00fa259d6ee8dcbdc03bf9333b94a89fe6..f1b6f349a6f421edf18aba61b715a9a568f76086 100644 (file)
@@ -11,14 +11,6 @@ require_once($CFG->libdir.'/eventslib.php');
 
 define("LESSON_MAX_EVENT_LENGTH", "432000");   // 5 days maximum
 
-/** 
- * Code to be executed when a module is installed
- */ 
-function lesson_install() {
-    return true; 
-}
-
-
 /**
  * Given an object containing all the necessary data,
  * (defined by the form in mod_form.php) this function
diff --git a/mod/quiz/db/install.php b/mod/quiz/db/install.php
new file mode 100644 (file)
index 0000000..2603544
--- /dev/null
@@ -0,0 +1,40 @@
+<?php  //$Id$
+
+// This file replaces:
+//   * STATEMENTS section in db/install.xml
+//   * lib.php/modulename_install() post installation hook
+//   * partially defaults.php
+
+function xmldb_quiz_install() {
+    global $DB;
+
+/// Install logging support
+    upgrade_log_display_entry('quiz', 'add', 'quiz', 'name');
+    upgrade_log_display_entry('quiz', 'update', 'quiz', 'name');
+    upgrade_log_display_entry('quiz', 'view', 'quiz', 'name');
+    upgrade_log_display_entry('quiz', 'report', 'quiz', 'name');
+    upgrade_log_display_entry('quiz', 'attempt', 'quiz', 'name');
+    upgrade_log_display_entry('quiz', 'submit', 'quiz', 'name');
+    upgrade_log_display_entry('quiz', 'review', 'quiz', 'name');
+    upgrade_log_display_entry('quiz', 'editquestions', 'quiz', 'name');
+    upgrade_log_display_entry('quiz', 'preview', 'quiz', 'name');
+    upgrade_log_display_entry('quiz', 'start attempt', 'quiz', 'name');
+    upgrade_log_display_entry('quiz', 'close attempt', 'quiz', 'name');
+    upgrade_log_display_entry('quiz', 'continue attempt', 'quiz', 'name');
+
+    $record = new object();
+    $record->name         = 'overview';
+    $record->displayorder = '10000';
+    $DB->insert_record('quiz_report', $record);
+
+    $record = new object();
+    $record->name         = 'responses';
+    $record->displayorder = '9000';
+    $DB->insert_record('quiz_report', $record);
+
+    $record = new object();
+    $record->name         = 'grading';
+    $record->displayorder = '6000';
+    $DB->insert_record('quiz_report', $record);
+
+}
index d819845f0700cc5d1dbf63702f43217e16c6c719..ea2bfae425098c19315791ea2ba94914cc55fd89 100755 (executable)
       </KEYS>
     </TABLE>
   </TABLES>
-  <STATEMENTS>
-    <STATEMENT NAME="insert log_display" TYPE="insert" TABLE="log_display" COMMENT="Initial insert of records on table log_display" NEXT="insert quiz_report">
-      <SENTENCES>
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('quiz', 'add', 'quiz', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('quiz', 'update', 'quiz', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('quiz', 'view', 'quiz', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('quiz', 'report', 'quiz', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('quiz', 'attempt', 'quiz', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('quiz', 'submit', 'quiz', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('quiz', 'review', 'quiz', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('quiz', 'editquestions', 'quiz', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('quiz', 'preview', 'quiz', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('quiz', 'start attempt', 'quiz', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('quiz', 'close attempt', 'quiz', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('quiz', 'continue attempt', 'quiz', 'name')" />
-      </SENTENCES>
-    </STATEMENT>
-    <STATEMENT NAME="insert quiz_report" TYPE="insert" TABLE="quiz_report" COMMENT="Initial insert of records on table quiz_report" PREVIOUS="insert log_display">
-      <SENTENCES>
-        <SENTENCE TEXT="(name, displayorder) VALUES ('overview', '10000')" />
-        <SENTENCE TEXT="(name, displayorder) VALUES ('responses', '9000')" />
-        <SENTENCE TEXT="(name, displayorder) VALUES ('grading', '6000')" />
-      </SENTENCES>
-    </STATEMENT>
-  </STATEMENTS>
 </XMLDB>
\ No newline at end of file
index b5f57eeebdd34713fe19fc08c76cff6c80aabbcb..981454f1b1e562d37a52a198a4d17831891eba34 100644 (file)
@@ -67,13 +67,6 @@ define("QUIZ_MAX_EVENT_LENGTH", 5*24*60*60);   // 5 days maximum
 
 /// FUNCTIONS ///////////////////////////////////////////////////////////////////
 
-/**
- * Code to be executed when a module is installed
- */ 
-function quiz_install() {
-    return true; 
-}
-
 /**
  * Given an object containing all the necessary data,
  * (defined by the form in mod_form.php) this function
diff --git a/mod/resource/db/install.php b/mod/resource/db/install.php
new file mode 100644 (file)
index 0000000..27689f1
--- /dev/null
@@ -0,0 +1,17 @@
+<?php  //$Id$
+
+// This file replaces:
+//   * STATEMENTS section in db/install.xml
+//   * lib.php/modulename_install() post installation hook
+//   * partially defaults.php
+
+function xmldb_resource_install() {
+    global $DB;
+
+/// Install logging support
+
+    upgrade_log_display_entry('resource', 'view', 'resource', 'name');
+    upgrade_log_display_entry('resource', 'update', 'resource', 'name');
+    upgrade_log_display_entry('resource', 'add', 'resource', 'name');
+
+}
index 8e1bcd1afe8842a3f9ebd0cddae40631e68ea23c..865f9ce323e9946209b46645bcbcb82e93fe6283 100644 (file)
       </INDEXES>
     </TABLE>
   </TABLES>
-  <STATEMENTS>
-    <STATEMENT NAME="insert log_display" TYPE="insert" TABLE="log_display" COMMENT="Initial insert of records on table log_display">
-      <SENTENCES>
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('resource', 'view', 'resource', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('resource', 'update', 'resource', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('resource', 'add', 'resource', 'name')" />
-      </SENTENCES>
-    </STATEMENT>
-  </STATEMENTS>
 </XMLDB>
diff --git a/mod/scorm/db/install.php b/mod/scorm/db/install.php
new file mode 100644 (file)
index 0000000..1b68079
--- /dev/null
@@ -0,0 +1,17 @@
+<?php  //$Id$
+
+// This file replaces:
+//   * STATEMENTS section in db/install.xml
+//   * lib.php/modulename_install() post installation hook
+//   * partially defaults.php
+
+function xmldb_scorm_install() {
+    global $DB;
+
+/// Install logging support
+    upgrade_log_display_entry('scorm', 'view', 'scorm', 'name');
+    upgrade_log_display_entry('scorm', 'review', 'scorm', 'name');
+    upgrade_log_display_entry('scorm', 'update', 'scorm', 'name');
+    upgrade_log_display_entry('scorm', 'add', 'scorm', 'name');
+
+}
index de8118e07624147276dfd8e73667f7ed1bca0cd2..91e69572b526a434abb2dfb8a4092b1c71f75347 100644 (file)
       </KEYS>
     </TABLE>
   </TABLES>
-  <STATEMENTS>
-    <STATEMENT NAME="insert log_display" TYPE="insert" TABLE="log_display" COMMENT="Initial insert of records on table log_display">
-      <SENTENCES>
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('scorm', 'view', 'scorm', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('scorm', 'review', 'scorm', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('scorm', 'update', 'scorm', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('scorm', 'add', 'scorm', 'name')" />
-      </SENTENCES>
-    </STATEMENT>
-  </STATEMENTS>
 </XMLDB>
diff --git a/mod/survey/db/install.php b/mod/survey/db/install.php
new file mode 100644 (file)
index 0000000..e1d8e2a
--- /dev/null
@@ -0,0 +1,112 @@
+<?php  //$Id$
+
+// This file replaces:
+//   * STATEMENTS section in db/install.xml
+//   * lib.php/modulename_install() post installation hook
+//   * partially defaults.php
+
+function xmldb_survey_install() {
+    global $DB;
+
+/// Install logging support
+    upgrade_log_display_entry('survey', 'add', 'survey', 'name');
+    upgrade_log_display_entry('survey', 'update', 'survey', 'name');
+    upgrade_log_display_entry('survey', 'download', 'survey', 'name');
+    upgrade_log_display_entry('survey', 'view form', 'survey', 'name');
+    upgrade_log_display_entry('survey', 'view graph', 'survey', 'name');
+    upgrade_log_display_entry('survey', 'view report', 'survey', 'name');
+    upgrade_log_display_entry('survey', 'submit', 'survey', 'name');
+
+
+/// insert survey data
+    $records = array(
+        array_combine(array('course', 'template', 'days', 'timecreated', 'timemodified', 'name', 'intro', 'questions'), array(0, 0, 0, 985017600, 985017600, 'collesaname', 'collesaintro', '25,26,27,28,29,30,43,44')),
+        array_combine(array('course', 'template', 'days', 'timecreated', 'timemodified', 'name', 'intro', 'questions'), array(0, 0, 0, 985017600, 985017600, 'collespname', 'collespintro', '31,32,33,34,35,36,43,44')),
+        array_combine(array('course', 'template', 'days', 'timecreated', 'timemodified', 'name', 'intro', 'questions'), array(0, 0, 0, 985017600, 985017600, 'collesapname', 'collesapintro', '37,38,39,40,41,42,43,44')),
+        array_combine(array('course', 'template', 'days', 'timecreated', 'timemodified', 'name', 'intro', 'questions'), array(0, 0, 0, 985017600, 985017600, 'attlsname', 'attlsintro', '65,67,68')),
+        array_combine(array('course', 'template', 'days', 'timecreated', 'timemodified', 'name', 'intro', 'questions'), array(0, 0, 0, 985017600, 985017600, 'ciqname', 'ciqintro', '69,70,71,72,73')),
+    );
+    foreach ($records as $record) {
+        $DB->insert_record('survey', $record, false);
+    }
+
+    $records = array(
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('colles1', 'colles1short', 1, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('colles2', 'colles2short', 1, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('colles3', 'colles3short', 1, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('colles4', 'colles4short', 1, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('colles5', 'colles5short', 1, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('colles6', 'colles6short', 1, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('colles7', 'colles7short', 1, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('colles8', 'colles8short', 1, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('colles9', 'colles9short', 1, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('colles10', 'colles10short', 1, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('colles11', 'colles11short', 1, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('colles12', 'colles12short', 1, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('colles13', 'colles13short', 1, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('colles14', 'colles14short', 1, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('colles15', 'colles15short', 1, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('colles16', 'colles16short', 1, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('colles17', 'colles17short', 1, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('colles18', 'colles18short', 1, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('colles19', 'colles19short', 1, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('colles20', 'colles20short', 1, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('colles21', 'colles21short', 1, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('colles22', 'colles22short', 1, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('colles23', 'colles23short', 1, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('colles24', 'colles24short', 1, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'multi', 'intro', 'type', 'options'), array('collesm1', 'collesm1short', '1,2,3,4', 'collesmintro', 1, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'multi', 'intro', 'type', 'options'), array('collesm2', 'collesm2short', '5,6,7,8', 'collesmintro', 1, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'multi', 'intro', 'type', 'options'), array('collesm3', 'collesm3short', '9,10,11,12', 'collesmintro', 1, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'multi', 'intro', 'type', 'options'), array('collesm4', 'collesm4short', '13,14,15,16', 'collesmintro', 1, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'multi', 'intro', 'type', 'options'), array('collesm5', 'collesm5short', '17,18,19,20', 'collesmintro', 1, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'multi', 'intro', 'type', 'options'), array('collesm6', 'collesm6short', '21,22,23,24', 'collesmintro', 1, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'multi', 'intro', 'type', 'options'), array('collesm1', 'collesm1short', '1,2,3,4', 'collesmintro', 2, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'multi', 'intro', 'type', 'options'), array('collesm2', 'collesm2short', '5,6,7,8', 'collesmintro', 2, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'multi', 'intro', 'type', 'options'), array('collesm3', 'collesm3short', '9,10,11,12', 'collesmintro', 2, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'multi', 'intro', 'type', 'options'), array('collesm4', 'collesm4short', '13,14,15,16', 'collesmintro', 2, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'multi', 'intro', 'type', 'options'), array('collesm5', 'collesm5short', '17,18,19,20', 'collesmintro', 2, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'multi', 'intro', 'type', 'options'), array('collesm6', 'collesm6short', '21,22,23,24', 'collesmintro', 2, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'multi', 'intro', 'type', 'options'), array('collesm1', 'collesm1short', '1,2,3,4', 'collesmintro', 3, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'multi', 'intro', 'type', 'options'), array('collesm2', 'collesm2short', '5,6,7,8', 'collesmintro', 3, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'multi', 'intro', 'type', 'options'), array('collesm3', 'collesm3short', '9,10,11,12', 'collesmintro', 3, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'multi', 'intro', 'type', 'options'), array('collesm4', 'collesm4short', '13,14,15,16', 'collesmintro', 3, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'multi', 'intro', 'type', 'options'), array('collesm5', 'collesm5short', '17,18,19,20', 'collesmintro', 3, 'scaletimes5')),
+        array_combine(array('text', 'shorttext', 'multi', 'intro', 'type', 'options'), array('collesm6', 'collesm6short', '21,22,23,24', 'collesmintro', 3, 'scaletimes5')),
+        array_combine(array('text', 'type', 'options'), array('howlong', 1, 'howlongoptions')),
+        array_combine(array('text', 'type'), array('othercomments', 0)),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('attls1', 'attls1short', 1, 'scaleagree5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('attls2', 'attls2short', 1, 'scaleagree5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('attls3', 'attls3short', 1, 'scaleagree5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('attls4', 'attls4short', 1, 'scaleagree5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('attls5', 'attls5short', 1, 'scaleagree5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('attls6', 'attls6short', 1, 'scaleagree5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('attls7', 'attls7short', 1, 'scaleagree5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('attls8', 'attls8short', 1, 'scaleagree5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('attls9', 'attls9short', 1, 'scaleagree5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('attls10', 'attls10short', 1, 'scaleagree5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('attls11', 'attls11short', 1, 'scaleagree5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('attls12', 'attls12short', 1, 'scaleagree5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('attls13', 'attls13short', 1, 'scaleagree5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('attls14', 'attls14short', 1, 'scaleagree5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('attls15', 'attls15short', 1, 'scaleagree5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('attls16', 'attls16short', 1, 'scaleagree5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('attls17', 'attls17short', 1, 'scaleagree5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('attls18', 'attls18short', 1, 'scaleagree5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('attls19', 'attls19short', 1, 'scaleagree5')),
+        array_combine(array('text', 'shorttext', 'type', 'options'), array('attls20', 'attls20short', 1, 'scaleagree5')),
+        array_combine(array('text', 'shorttext', 'multi', 'intro', 'type', 'options'), array('attlsm1', 'attlsm1', '45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64', 'attlsmintro', 1, 'scaleagree5')),
+        array_combine(array('text', 'shorttext', 'multi', 'intro', 'type', 'options'), array('-', '-', '-', '-', 0, '-')),
+        array_combine(array('text', 'shorttext', 'multi', 'intro', 'type', 'options'), array('attlsm2', 'attlsm2', '63,62,59,57,55,49,52,50,48,47', 'attlsmintro', -1, 'scaleagree5')),
+        array_combine(array('text', 'shorttext', 'multi', 'intro', 'type', 'options'), array('attlsm3', 'attlsm3', '46,54,45,51,60,53,56,58,61,64', 'attlsmintro', -1, 'scaleagree5')),
+        array_combine(array('text', 'shorttext', 'type'), array('ciq1', 'ciq1short', 0)),
+        array_combine(array('text', 'shorttext', 'type'), array('ciq2', 'ciq2short', 0)),
+        array_combine(array('text', 'shorttext', 'type'), array('ciq3', 'ciq3short', 0)),
+        array_combine(array('text', 'shorttext', 'type'), array('ciq4', 'ciq4short', 0)),
+        array_combine(array('text', 'shorttext', 'type'), array('ciq5', 'ciq5short', 0)),
+    );
+    foreach ($records as $record) {
+        $DB->insert_record('survey_questions', $record, false);
+    }
+
+}
index bd7ca53b7a0284f3761699141c877e249e2ac764..d5feeb00297e97613e907ca9a317df17972f49d9 100644 (file)
       </INDEXES>
     </TABLE>
   </TABLES>
-  <STATEMENTS>
-    <STATEMENT NAME="insert survey" TYPE="insert" TABLE="survey" COMMENT="Initial insert of records on table survey" NEXT="insert survey_questions">
-      <SENTENCES>
-        <SENTENCE TEXT="(course, template, days, timecreated, timemodified, name, intro, questions) VALUES (0, 0, 0, 985017600, 985017600, 'collesaname', 'collesaintro', '25,26,27,28,29,30,43,44')" />
-        <SENTENCE TEXT="(course, template, days, timecreated, timemodified, name, intro, questions) VALUES (0, 0, 0, 985017600, 985017600, 'collespname', 'collespintro', '31,32,33,34,35,36,43,44')" />
-        <SENTENCE TEXT="(course, template, days, timecreated, timemodified, name, intro, questions) VALUES (0, 0, 0, 985017600, 985017600, 'collesapname', 'collesapintro', '37,38,39,40,41,42,43,44')" />
-        <SENTENCE TEXT="(course, template, days, timecreated, timemodified, name, intro, questions) VALUES (0, 0, 0, 985017600, 985017600, 'attlsname', 'attlsintro', '65,67,68')" />
-        <SENTENCE TEXT="(course, template, days, timecreated, timemodified, name, intro, questions) VALUES (0, 0, 0, 985017600, 985017600, 'ciqname', 'ciqintro', '69,70,71,72,73')" />
-      </SENTENCES>
-    </STATEMENT>
-    <STATEMENT NAME="insert survey_questions" TYPE="insert" TABLE="survey_questions" COMMENT="Initial insert of records on table survey_questions" PREVIOUS="insert survey" NEXT="insert log_display">
-      <SENTENCES>
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('colles1', 'colles1short', 1, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('colles2', 'colles2short', 1, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('colles3', 'colles3short', 1, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('colles4', 'colles4short', 1, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('colles5', 'colles5short', 1, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('colles6', 'colles6short', 1, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('colles7', 'colles7short', 1, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('colles8', 'colles8short', 1, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('colles9', 'colles9short', 1, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('colles10', 'colles10short', 1, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('colles11', 'colles11short', 1, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('colles12', 'colles12short', 1, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('colles13', 'colles13short', 1, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('colles14', 'colles14short', 1, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('colles15', 'colles15short', 1, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('colles16', 'colles16short', 1, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('colles17', 'colles17short', 1, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('colles18', 'colles18short', 1, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('colles19', 'colles19short', 1, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('colles20', 'colles20short', 1, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('colles21', 'colles21short', 1, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('colles22', 'colles22short', 1, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('colles23', 'colles23short', 1, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('colles24', 'colles24short', 1, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, multi, intro, type, options) VALUES ('collesm1', 'collesm1short', '1,2,3,4', 'collesmintro', 1, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, multi, intro, type, options) VALUES ('collesm2', 'collesm2short', '5,6,7,8', 'collesmintro', 1, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, multi, intro, type, options) VALUES ('collesm3', 'collesm3short', '9,10,11,12', 'collesmintro', 1, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, multi, intro, type, options) VALUES ('collesm4', 'collesm4short', '13,14,15,16', 'collesmintro', 1, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, multi, intro, type, options) VALUES ('collesm5', 'collesm5short', '17,18,19,20', 'collesmintro', 1, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, multi, intro, type, options) VALUES ('collesm6', 'collesm6short', '21,22,23,24', 'collesmintro', 1, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, multi, intro, type, options) VALUES ('collesm1', 'collesm1short', '1,2,3,4', 'collesmintro', 2, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, multi, intro, type, options) VALUES ('collesm2', 'collesm2short', '5,6,7,8', 'collesmintro', 2, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, multi, intro, type, options) VALUES ('collesm3', 'collesm3short', '9,10,11,12', 'collesmintro', 2, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, multi, intro, type, options) VALUES ('collesm4', 'collesm4short', '13,14,15,16', 'collesmintro', 2, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, multi, intro, type, options) VALUES ('collesm5', 'collesm5short', '17,18,19,20', 'collesmintro', 2, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, multi, intro, type, options) VALUES ('collesm6', 'collesm6short', '21,22,23,24', 'collesmintro', 2, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, multi, intro, type, options) VALUES ('collesm1', 'collesm1short', '1,2,3,4', 'collesmintro', 3, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, multi, intro, type, options) VALUES ('collesm2', 'collesm2short', '5,6,7,8', 'collesmintro', 3, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, multi, intro, type, options) VALUES ('collesm3', 'collesm3short', '9,10,11,12', 'collesmintro', 3, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, multi, intro, type, options) VALUES ('collesm4', 'collesm4short', '13,14,15,16', 'collesmintro', 3, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, multi, intro, type, options) VALUES ('collesm5', 'collesm5short', '17,18,19,20', 'collesmintro', 3, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, shorttext, multi, intro, type, options) VALUES ('collesm6', 'collesm6short', '21,22,23,24', 'collesmintro', 3, 'scaletimes5')" />
-        <SENTENCE TEXT="(text, type, options) VALUES ('howlong', 1, 'howlongoptions')" />
-        <SENTENCE TEXT="(text, type) VALUES ('othercomments', 0)" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('attls1', 'attls1short', 1, 'scaleagree5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('attls2', 'attls2short', 1, 'scaleagree5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('attls3', 'attls3short', 1, 'scaleagree5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('attls4', 'attls4short', 1, 'scaleagree5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('attls5', 'attls5short', 1, 'scaleagree5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('attls6', 'attls6short', 1, 'scaleagree5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('attls7', 'attls7short', 1, 'scaleagree5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('attls8', 'attls8short', 1, 'scaleagree5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('attls9', 'attls9short', 1, 'scaleagree5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('attls10', 'attls10short', 1, 'scaleagree5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('attls11', 'attls11short', 1, 'scaleagree5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('attls12', 'attls12short', 1, 'scaleagree5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('attls13', 'attls13short', 1, 'scaleagree5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('attls14', 'attls14short', 1, 'scaleagree5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('attls15', 'attls15short', 1, 'scaleagree5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('attls16', 'attls16short', 1, 'scaleagree5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('attls17', 'attls17short', 1, 'scaleagree5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('attls18', 'attls18short', 1, 'scaleagree5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('attls19', 'attls19short', 1, 'scaleagree5')" />
-        <SENTENCE TEXT="(text, shorttext, type, options) VALUES ('attls20', 'attls20short', 1, 'scaleagree5')" />
-        <SENTENCE TEXT="(text, shorttext, multi, intro, type, options) VALUES ('attlsm1', 'attlsm1', '45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64', 'attlsmintro', 1, 'scaleagree5')" />
-        <SENTENCE TEXT="(text, shorttext, multi, intro, type, options) VALUES ('-', '-', '-', '-', 0, '-')" />
-        <SENTENCE TEXT="(text, shorttext, multi, intro, type, options) VALUES ('attlsm2', 'attlsm2', '63,62,59,57,55,49,52,50,48,47', 'attlsmintro', -1, 'scaleagree5')" />
-        <SENTENCE TEXT="(text, shorttext, multi, intro, type, options) VALUES ('attlsm3', 'attlsm3', '46,54,45,51,60,53,56,58,61,64', 'attlsmintro', -1, 'scaleagree5')" />
-        <SENTENCE TEXT="(text, shorttext, type) VALUES ('ciq1', 'ciq1short', 0)" />
-        <SENTENCE TEXT="(text, shorttext, type) VALUES ('ciq2', 'ciq2short', 0)" />
-        <SENTENCE TEXT="(text, shorttext, type) VALUES ('ciq3', 'ciq3short', 0)" />
-        <SENTENCE TEXT="(text, shorttext, type) VALUES ('ciq4', 'ciq4short', 0)" />
-        <SENTENCE TEXT="(text, shorttext, type) VALUES ('ciq5', 'ciq5short', 0)" />
-      </SENTENCES>
-    </STATEMENT>
-    <STATEMENT NAME="insert log_display" TYPE="insert" TABLE="log_display" COMMENT="Initial insert of records on table log_display" PREVIOUS="insert survey_questions">
-      <SENTENCES>
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('survey', 'add', 'survey', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('survey', 'update', 'survey', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('survey', 'download', 'survey', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('survey', 'view form', 'survey', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('survey', 'view graph', 'survey', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('survey', 'view report', 'survey', 'name')" />
-        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('survey', 'submit', 'survey', 'name')" />
-      </SENTENCES>
-    </STATEMENT>
-  </STATEMENTS>
 </XMLDB>
diff --git a/mod/upgrade.txt b/mod/upgrade.txt
new file mode 100644 (file)
index 0000000..90cfb78
--- /dev/null
@@ -0,0 +1,22 @@
+This files describes API changes in /mod/* - activity modules,
+information provided here is intended especially for developers.
+
+=== 2.0 ===
+
+required changes in code:
+* use new DML syntax everywhere
+* use new DDL syntax in db/upgrade.php
+* replace defaults.php by settings.php and db/install.php
+* replace STATEMENTS section in db/install.xml by db/install.php
+* move post instalation code from lib.php into db/install.php
+* completely rewrite file handling
+* rewrite backup/restore
+
+optional - no changes needed in older code:
+* portfolio support
+* course completion tracking support
+* lib.php/xxx_supports() may describe module features and capabilities
+
+
+
+TODO: add links to docs
\ No newline at end of file
diff --git a/mod/wiki/db/install.php b/mod/wiki/db/install.php
new file mode 100644 (file)
index 0000000..fe37656
--- /dev/null
@@ -0,0 +1,13 @@
+<?php  //$Id$
+
+// This file replaces:
+//   * STATEMENTS section in db/install.xml
+//   * lib.php/modulename_install() post installation hook
+//   * partially defaults.php
+
+function xmldb_wiki_install() {
+    global $DB;
+
+/// Install logging support here
+
+}