MDL-23628 improved log action support - now similar to handling of capabilities
authorPetr Skoda <skodak@moodle.org>
Tue, 3 Aug 2010 10:07:18 +0000 (10:07 +0000)
committerPetr Skoda <skodak@moodle.org>
Tue, 3 Aug 2010 10:07:18 +0000 (10:07 +0000)
62 files changed:
lib/adminlib.php
lib/db/install.php
lib/db/install.xml
lib/db/log.php [new file with mode: 0644]
lib/db/upgrade.php
lib/deprecatedlib.php
lib/upgradelib.php
mod/assignment/db/install.php [deleted file]
mod/assignment/db/log.php [new file with mode: 0644]
mod/assignment/version.php
mod/chat/db/install.php [deleted file]
mod/chat/db/log.php [new file with mode: 0644]
mod/chat/version.php
mod/choice/db/install.php [deleted file]
mod/choice/db/log.php [new file with mode: 0644]
mod/choice/version.php
mod/data/db/install.php [deleted file]
mod/data/db/log.php [new file with mode: 0644]
mod/data/version.php
mod/feedback/db/install.php
mod/feedback/db/log.php [new file with mode: 0644]
mod/feedback/version.php
mod/folder/db/install.php
mod/folder/db/log.php [new file with mode: 0644]
mod/folder/version.php
mod/forum/db/install.php [deleted file]
mod/forum/db/log.php [new file with mode: 0644]
mod/forum/version.php
mod/glossary/db/install.php [deleted file]
mod/glossary/db/log.php [new file with mode: 0644]
mod/glossary/version.php
mod/imscp/db/install.php
mod/imscp/db/log.php [new file with mode: 0644]
mod/imscp/version.php
mod/label/db/log.php [moved from mod/label/db/install.php with 62% similarity]
mod/label/version.php
mod/lesson/db/log.php [moved from mod/lesson/db/install.php with 62% similarity]
mod/lesson/version.php
mod/page/db/install.php
mod/page/db/log.php [new file with mode: 0644]
mod/page/version.php
mod/quiz/db/install.php
mod/quiz/db/log.php [new file with mode: 0644]
mod/quiz/db/upgrade.php
mod/quiz/version.php
mod/resource/db/log.php [moved from mod/resource/db/install.php with 55% similarity]
mod/resource/db/upgrade.php
mod/resource/version.php
mod/scorm/db/install.php [deleted file]
mod/scorm/db/log.php [new file with mode: 0644]
mod/scorm/version.php
mod/survey/db/install.php
mod/survey/db/log.php [new file with mode: 0644]
mod/survey/version.php
mod/url/db/install.php
mod/url/db/log.php [new file with mode: 0644]
mod/url/version.php
mod/wiki/version.php
mod/workshop/db/install.php [deleted file]
mod/workshop/db/log.php [new file with mode: 0644]
mod/workshop/version.php
version.php

index 0caf7b0..8699735 100644 (file)
@@ -256,7 +256,7 @@ function uninstall_plugin($type, $name) {
     $DB->delete_records('log', array('module' => $pluginname));
 
     // delete log_display information
-    $DB->delete_records('log_display', array('module' => $pluginname));
+    $DB->delete_records('log_display', array('component' => $component));
 
     // delete the module configuration records
     unset_all_config_for_plugin($pluginname);
index 053a2af..8288f99 100644 (file)
@@ -141,28 +141,6 @@ function xmldb_main_install() {
     $mnetallhosts->id                 = $DB->insert_record('mnet_host', $mnetallhosts, true);
     set_config('mnet_all_hosts_id', $mnetallhosts->id);
 
-    /// insert log entries - replaces statements section in install.xml
-    update_log_display_entry('user', 'view', 'user', $DB->sql_concat('firstname', "' '" , 'lastname'));
-    update_log_display_entry('course', 'user report', 'user', $DB->sql_concat('firstname', "' '" , 'lastname'));
-    update_log_display_entry('course', 'view', 'course', 'fullname');
-    update_log_display_entry('course', 'update', 'course', 'fullname');
-    update_log_display_entry('course', 'enrol', 'user', 'course', 'fullname'); // there should be some way to store user id of the enrolled user!
-    update_log_display_entry('course', 'unenrol', 'user', 'course', 'fullname'); // there should be some way to store user id of the enrolled user!
-    update_log_display_entry('course', 'report log', 'course', 'fullname');
-    update_log_display_entry('course', 'report live', 'course', 'fullname');
-    update_log_display_entry('course', 'report outline', 'course', 'fullname');
-    update_log_display_entry('course', 'report participation', 'course', 'fullname');
-    update_log_display_entry('course', 'report stats', 'course', 'fullname');
-    update_log_display_entry('message', 'write', 'user', $DB->sql_concat('firstname', "' '" , 'lastname'));
-    update_log_display_entry('message', 'read', 'user', $DB->sql_concat('firstname', "' '" , 'lastname'));
-    update_log_display_entry('message', 'add contact', 'user', $DB->sql_concat('firstname', "' '" , 'lastname'));
-    update_log_display_entry('message', 'remove contact', 'user', $DB->sql_concat('firstname', "' '" , 'lastname'));
-    update_log_display_entry('message', 'block contact', 'user', $DB->sql_concat('firstname', "' '" , 'lastname'));
-    update_log_display_entry('message', 'unblock contact', 'user', $DB->sql_concat('firstname', "' '" , 'lastname'));
-    update_log_display_entry('group', 'view', 'groups', 'name');
-    update_log_display_entry('tag', 'update', 'tag', 'name');
-
-
     /// Create guest record - do not assign any role, guest user get's the default guest role automatically on the fly
     $guest = new object();
     $guest->auth        = 'manual';
@@ -210,7 +188,6 @@ function xmldb_main_install() {
 
     /// Now is the correct moment to install capabilities - after creation of legacy roles, but before assigning of roles
     update_capabilities('moodle');
-    external_update_descriptions('moodle');
 
     /// Default allow assign
     $defaultallowassigns = array(
index 866d31a..04d4fb9 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="lib/db" VERSION="20100727" COMMENT="XMLDB file for core Moodle tables"
+<XMLDB PATH="lib/db" VERSION="20100803" COMMENT="XMLDB file for core Moodle tables"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
 >
         <FIELD NAME="module" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false" PREVIOUS="id" NEXT="action"/>
         <FIELD NAME="action" TYPE="char" LENGTH="40" NOTNULL="true" SEQUENCE="false" PREVIOUS="module" NEXT="mtable"/>
         <FIELD NAME="mtable" TYPE="char" LENGTH="30" NOTNULL="true" SEQUENCE="false" PREVIOUS="action" NEXT="field"/>
-        <FIELD NAME="field" TYPE="char" LENGTH="200" NOTNULL="true" SEQUENCE="false" PREVIOUS="mtable"/>
+        <FIELD NAME="field" TYPE="char" LENGTH="200" NOTNULL="true" SEQUENCE="false" PREVIOUS="mtable" NEXT="component"/>
+        <FIELD NAME="component" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" COMMENT="owner of the log action" PREVIOUS="field"/>
       </FIELDS>
       <KEYS>
         <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
diff --git a/lib/db/log.php b/lib/db/log.php
new file mode 100644 (file)
index 0000000..2bb3222
--- /dev/null
@@ -0,0 +1,51 @@
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Definition of log events
+ *
+ * @package    core
+ * @subpackage admin
+ * @copyright  2010 Petr Skoda (http://skodak.org)
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+global $DB; // TODO: this is a hack, we should really do something with the SQL in SQL tables
+
+$logs = array(
+    array('module'=>'user', 'action'=>'view', 'mtable'=>'user', 'field'=>$DB->sql_concat('firstname', "' '" , 'lastname')),
+    array('module'=>'course', 'action'=>'user report', 'mtable'=>'user', 'field'=>$DB->sql_concat('firstname', "' '" , 'lastname')),
+    array('module'=>'course', 'action'=>'view', 'mtable'=>'course', 'field'=>'fullname'),
+    array('module'=>'course', 'action'=>'update', 'mtable'=>'course', 'field'=>'fullname'),
+    array('module'=>'course', 'action'=>'enrol', 'mtable'=>'course', 'field'=>'fullname'), // there should be some way to store user id of the enrolled user!
+    array('module'=>'course', 'action'=>'unenrol', 'mtable'=>'course', 'field'=>'fullname'), // there should be some way to store user id of the enrolled user!
+    array('module'=>'course', 'action'=>'report log', 'mtable'=>'course', 'field'=>'fullname'),
+    array('module'=>'course', 'action'=>'report live', 'mtable'=>'course', 'field'=>'fullname'),
+    array('module'=>'course', 'action'=>'report outline', 'mtable'=>'course', 'field'=>'fullname'),
+    array('module'=>'course', 'action'=>'report participation', 'mtable'=>'course', 'field'=>'fullname'),
+    array('module'=>'course', 'action'=>'report stats', 'mtable'=>'course', 'field'=>'fullname'),
+    array('module'=>'message', 'action'=>'write', 'mtable'=>'user', 'field'=>$DB->sql_concat('firstname', "' '" , 'lastname')),
+    array('module'=>'message', 'action'=>'read', 'mtable'=>'user', 'field'=>$DB->sql_concat('firstname', "' '" , 'lastname')),
+    array('module'=>'message', 'action'=>'add contact', 'mtable'=>'user', 'field'=>$DB->sql_concat('firstname', "' '" , 'lastname')),
+    array('module'=>'message', 'action'=>'remove contact', 'mtable'=>'user', 'field'=>$DB->sql_concat('firstname', "' '" , 'lastname')),
+    array('module'=>'message', 'action'=>'block contact', 'mtable'=>'user', 'field'=>$DB->sql_concat('firstname', "' '" , 'lastname')),
+    array('module'=>'message', 'action'=>'unblock contact', 'mtable'=>'user', 'field'=>$DB->sql_concat('firstname', "' '" , 'lastname')),
+    array('module'=>'group', 'action'=>'view', 'mtable'=>'groups', 'field'=>'name'),
+    array('module'=>'tag', 'action'=>'update', 'mtable'=>'tag', 'field'=>'name'),
+);
index 5ab7837..a42618a 100644 (file)
@@ -4910,22 +4910,6 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL");
         upgrade_main_savepoint(true, 2010072700);
     }
 
-    if ($oldversion < 2010080300) {
-
-        // We need to fix the use of hard coded CONCAT statements that won't work
-        // in some databases.
-        update_log_display_entry('user', 'view', 'user', $DB->sql_concat('firstname', "' '" , 'lastname'));
-        update_log_display_entry('course', 'user report', 'user', $DB->sql_concat('firstname', "' '" , 'lastname'));
-        update_log_display_entry('message', 'write', 'user', $DB->sql_concat('firstname', "' '" , 'lastname'));
-        update_log_display_entry('message', 'read', 'user', $DB->sql_concat('firstname', "' '" , 'lastname'));
-        update_log_display_entry('message', 'add contact', 'user', $DB->sql_concat('firstname', "' '" , 'lastname'));
-        update_log_display_entry('message', 'remove contact', 'user', $DB->sql_concat('firstname', "' '" , 'lastname'));
-        update_log_display_entry('message', 'block contact', 'user', $DB->sql_concat('firstname', "' '" , 'lastname'));
-        update_log_display_entry('message', 'unblock contact', 'user', $DB->sql_concat('firstname', "' '" , 'lastname'));
-
-        upgrade_main_savepoint(true, 2010080300);
-    }
-
     if ($oldversion < 2010080303) {
         $rs = $DB->get_recordset_sql('SELECT i.id, i.name, r.type FROM {repository_instances} i, {repository} r WHERE i.typeid = r.id');
         foreach ($rs as $record) {
@@ -4940,6 +4924,24 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL");
         upgrade_main_savepoint(true, 2010080303);
     }
 
+    if ($oldversion < 2010080305) {
+        // first drop all log disaply actions, we will rectreate them automatically later
+        $DB->delete_records('log_display', array());
+
+        // Define field component to be added to log_display
+        $table = new xmldb_table('log_display');
+        $field = new xmldb_field('component', XMLDB_TYPE_CHAR, '100', null, XMLDB_NOTNULL, null, null, 'field');
+
+        // Launch add field component
+        if (!$dbman->field_exists($table, $field)) {
+            $dbman->add_field($table, $field);
+        }
+
+        // Main savepoint reached
+        upgrade_main_savepoint(true, 2010080305);
+    }
+
+
     return true;
 }
 
index 6578b6e..7037669 100644 (file)
 defined('MOODLE_INTERNAL') || die();
 
 
+/**
+ * Insert or update log display entry. Entry may already exist.
+ * $module, $action must be unique
+ * @deprecated
+ *
+ * @param string $module
+ * @param string $action
+ * @param string $mtable
+ * @param string $field
+ * @return void
+ *
+ */
+function update_log_display_entry($module, $action, $mtable, $field) {
+    global $DB;
+
+    debugging('The update_log_display_entry() is deprecated, please use db/log.php description file instead.');
+}
+
 /**
  * Given some text in HTML format, this function will pass it
  * through any filters that have been configured for this context.
index 497e7f9..e46ef56 100644 (file)
@@ -97,37 +97,6 @@ class plugin_defective_exception extends moodle_exception {
     }
 }
 
-/**
- * Insert or update log display entry. Entry may already exist.
- * $module, $action must be unique
- *
- * @global object
- * @param string $module
- * @param string $action
- * @param string $mtable
- * @param string $field
- * @return void
- *
- */
-function update_log_display_entry($module, $action, $mtable, $field) {
-    global $DB;
-
-    if ($type = $DB->get_record('log_display', array('module'=>$module, 'action'=>$action))) {
-        $type->mtable = $mtable;
-        $type->field  = $field;
-        $DB->update_record('log_display', $type);
-
-    } else {
-        $type = new object();
-        $type->module = $module;
-        $type->action = $action;
-        $type->mtable = $mtable;
-        $type->field  = $field;
-
-        $DB->insert_record('log_display', $type, false);
-    }
-}
-
 /**
  * Upgrade savepoint, marks end of each upgrade block.
  * It stores new main version, resets upgrade timeout
@@ -334,6 +303,7 @@ function upgrade_plugins($type, $startcallback, $endcallback, $verbose) {
                     $recover_install_function();
                     unset_config('installrunning', 'block_'.$plugin->fullname);
                     update_capabilities($component);
+                    log_update_descriptions($component);
                     external_update_descriptions($component);
                     events_update_definition($component);
                     message_update_providers($component);
@@ -366,6 +336,7 @@ function upgrade_plugins($type, $startcallback, $endcallback, $verbose) {
 
         /// Install various components
             update_capabilities($component);
+            log_update_descriptions($component);
             external_update_descriptions($component);
             events_update_definition($component);
             message_update_providers($component);
@@ -395,6 +366,7 @@ function upgrade_plugins($type, $startcallback, $endcallback, $verbose) {
 
         /// Upgrade various components
             update_capabilities($component);
+            log_update_descriptions($component);
             external_update_descriptions($component);
             events_update_definition($component);
             message_update_providers($component);
@@ -464,6 +436,7 @@ function upgrade_plugins_modules($startcallback, $endcallback, $verbose) {
                     unset_config('installrunning', $module->name);
                     // Install various components too
                     update_capabilities($component);
+                    log_update_descriptions($component);
                     external_update_descriptions($component);
                     events_update_definition($component);
                     message_update_providers($component);
@@ -494,6 +467,7 @@ function upgrade_plugins_modules($startcallback, $endcallback, $verbose) {
 
         /// Install various components
             update_capabilities($component);
+            log_update_descriptions($component);
             external_update_descriptions($component);
             events_update_definition($component);
             message_update_providers($component);
@@ -522,6 +496,7 @@ function upgrade_plugins_modules($startcallback, $endcallback, $verbose) {
 
         /// Upgrade various components
             update_capabilities($component);
+            log_update_descriptions($component);
             external_update_descriptions($component);
             events_update_definition($component);
             message_update_providers($component);
@@ -616,6 +591,7 @@ function upgrade_plugins_blocks($startcallback, $endcallback, $verbose) {
                     unset_config('installrunning', 'block_'.$blockname);
                     // Install various components
                     update_capabilities($component);
+                    log_update_descriptions($component);
                     external_update_descriptions($component);
                     events_update_definition($component);
                     message_update_providers($component);
@@ -654,6 +630,7 @@ function upgrade_plugins_blocks($startcallback, $endcallback, $verbose) {
 
             // Install various components
             update_capabilities($component);
+            log_update_descriptions($component);
             external_update_descriptions($component);
             events_update_definition($component);
             message_update_providers($component);
@@ -687,6 +664,7 @@ function upgrade_plugins_blocks($startcallback, $endcallback, $verbose) {
 
             // Upgrade various components
             update_capabilities($component);
+            log_update_descriptions($component);
             external_update_descriptions($component);
             events_update_definition($component);
             message_update_providers($component);
@@ -714,6 +692,65 @@ function upgrade_plugins_blocks($startcallback, $endcallback, $verbose) {
     }
 }
 
+
+/**
+ * Log_display description function used during install and upgrade.
+ *
+ * @param string $component name of component (moodle, mod_assignment, etc.)
+ * @return void
+ */
+function log_update_descriptions($component) {
+    global $DB;
+
+    $defpath = get_component_directory($component).'/db/log.php';
+
+    if (!file_exists($defpath)) {
+        $DB->delete_records('log_display', array('component'=>$component));
+        return;
+    }
+
+    // load new info
+    $logs = array();
+    include($defpath);
+    $newlogs = array();
+    foreach ($logs as $log) {
+        $newlogs[$log['module'].'-'.$log['action']] = $log; // kind of unique name
+    }
+    unset($logs);
+    $logs = $newlogs;
+
+    $fields = array('module', 'action', 'mtable', 'field');
+    // update all log fist
+    $dblogs = $DB->get_records('log_display', array('component'=>$component));
+    foreach ($dblogs as $dblog) {
+        $name = $dblog->module.'-'.$dblog->action;
+
+        if (empty($logs[$name])) {
+            $DB->delete_records('log_display', array('id'=>$dblog->id));
+            continue;
+        }
+
+        $log = $logs[$name];
+        unset($logs[$name]);
+
+        $update = false;
+        foreach ($fields as $field) {
+            if ($dblog->$field != $log[$field]) {
+                $dblog->$field = $log[$field];
+                $update = true;
+            }
+        }
+        if ($update) {
+            $DB->update_record('log_display', $dblog);
+        }
+    }
+    foreach ($logs as $log) {
+        $dblog = (object)$log;
+        $dblog->component = $component;
+        $DB->insert_record('log_display', $dblog);
+    }
+}
+
 /**
  * Web service discovery function used during install and upgrade.
  * @param string $component name of component (moodle, mod_assignment, etc.)
@@ -741,6 +778,8 @@ function external_update_descriptions($component) {
             $DB->delete_records('external_functions', array('id'=>$dbfunction->id));
             // do not delete functions from external_services_functions, beacuse
             // we want to notify admins when functions used in custom services disappear
+
+            //TODO: this looks wrong, we have to delete it eventually (skodak)
             continue;
         }
 
@@ -1199,12 +1238,14 @@ function install_core($version, $verbose) {
 
         // set all core default records and default settings
         require_once("$CFG->libdir/db/install.php");
-        xmldb_main_install();
+        xmldb_main_install(); // installs the capabilities too
 
         // store version
         upgrade_main_savepoint(true, $version, false);
 
         // Continue with the installation
+        log_update_descriptions('moodle');
+        external_update_descriptions('moodle');
         events_update_definition('moodle');
         message_update_providers('moodle');
 
@@ -1260,6 +1301,7 @@ function upgrade_core($version, $verbose) {
 
         // perform all other component upgrade routines
         update_capabilities('moodle');
+        log_update_descriptions('moodle');
         external_update_descriptions('moodle');
         events_update_definition('moodle');
         message_update_providers('moodle');
diff --git a/mod/assignment/db/install.php b/mod/assignment/db/install.php
deleted file mode 100644 (file)
index b8e9a7b..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-
-// 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
-    update_log_display_entry('assignment', 'view', 'assignment', 'name');
-    update_log_display_entry('assignment', 'add', 'assignment', 'name');
-    update_log_display_entry('assignment', 'update', 'assignment', 'name');
-    update_log_display_entry('assignment', 'view submission', 'assignment', 'name');
-    update_log_display_entry('assignment', 'upload', 'assignment', 'name');
-
-}
diff --git a/mod/assignment/db/log.php b/mod/assignment/db/log.php
new file mode 100644 (file)
index 0000000..09e6c56
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Definition of log events
+ *
+ * @package    mod
+ * @subpackage assignment
+ * @copyright  2010 Petr Skoda (http://skodak.org)
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$logs = array(
+    array('module'=>'assignment', 'action'=>'view', 'mtable'=>'assignment', 'field'=>'name'),
+    array('module'=>'assignment', 'action'=>'add', 'mtable'=>'assignment', 'field'=>'name'),
+    array('module'=>'assignment', 'action'=>'update', 'mtable'=>'assignment', 'field'=>'name'),
+    array('module'=>'assignment', 'action'=>'view submission', 'mtable'=>'assignment', 'field'=>'name'),
+    array('module'=>'assignment', 'action'=>'upload', 'mtable'=>'assignment', 'field'=>'name'),
+);
\ No newline at end of file
index 7c3351c..7807f5a 100644 (file)
@@ -5,8 +5,8 @@
 //  This fragment is called by /admin/index.php
 ////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2009062500;
-$module->requires = 2009041700;  // Requires this Moodle version
+$module->version  = 2010080300;
+$module->requires = 2010080300;  // Requires this Moodle version
 $module->cron     = 60;
 
 
diff --git a/mod/chat/db/install.php b/mod/chat/db/install.php
deleted file mode 100644 (file)
index db920e2..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<?php
-
-// 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
-    update_log_display_entry('chat', 'view', 'chat', 'name');
-    update_log_display_entry('chat', 'add', 'chat', 'name');
-    update_log_display_entry('chat', 'update', 'chat', 'name');
-    update_log_display_entry('chat', 'report', 'chat', 'name');
-    update_log_display_entry('chat', 'talk', 'chat', 'name');
-}
diff --git a/mod/chat/db/log.php b/mod/chat/db/log.php
new file mode 100644 (file)
index 0000000..4355e30
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Definition of log events
+ *
+ * @package    mod
+ * @subpackage chat
+ * @copyright  2010 Petr Skoda (http://skodak.org)
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$logs = array(
+    array('module'=>'chat', 'action'=>'view', 'mtable'=>'chat', 'field'=>'name'),
+    array('module'=>'chat', 'action'=>'add', 'mtable'=>'chat', 'field'=>'name'),
+    array('module'=>'chat', 'action'=>'update', 'mtable'=>'chat', 'field'=>'name'),
+    array('module'=>'chat', 'action'=>'report', 'mtable'=>'chat', 'field'=>'name'),
+    array('module'=>'chat', 'action'=>'talk', 'mtable'=>'chat', 'field'=>'name'),
+);
\ No newline at end of file
index 15d1d16..7e15f3a 100644 (file)
@@ -5,8 +5,8 @@
 ///  This fragment is called by moodle_needs_upgrading() and /admin/index.php
 /////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2010050102;   // The (date) version of this module
-$module->requires = 2009041700;  // Requires this Moodle version
+$module->version  = 2010080300;   // The (date) version of this module
+$module->requires = 2010080300;  // Requires this Moodle version
 $module->cron     = 300;          // How often should cron check this module (seconds)?
 
 
diff --git a/mod/choice/db/install.php b/mod/choice/db/install.php
deleted file mode 100644 (file)
index c3caa11..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
-
-// 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
-    update_log_display_entry('choice', 'view', 'choice', 'name');
-    update_log_display_entry('choice', 'update', 'choice', 'name');
-    update_log_display_entry('choice', 'add', 'choice', 'name');
-    update_log_display_entry('choice', 'report', 'choice', 'name');
-    update_log_display_entry('choice', 'choose', 'choice', 'name');
-    update_log_display_entry('choice', 'choose again', 'choice', 'name');
-
-}
diff --git a/mod/choice/db/log.php b/mod/choice/db/log.php
new file mode 100644 (file)
index 0000000..e048776
--- /dev/null
@@ -0,0 +1,36 @@
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Definition of log events
+ *
+ * @package    mod
+ * @subpackage choice
+ * @copyright  2010 Petr Skoda (http://skodak.org)
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$logs = array(
+    array('module'=>'choice', 'action'=>'view', 'mtable'=>'choice', 'field'=>'name'),
+    array('module'=>'choice', 'action'=>'update', 'mtable'=>'choice', 'field'=>'name'),
+    array('module'=>'choice', 'action'=>'add', 'mtable'=>'choice', 'field'=>'name'),
+    array('module'=>'choice', 'action'=>'report', 'mtable'=>'choice', 'field'=>'name'),
+    array('module'=>'choice', 'action'=>'choose', 'mtable'=>'choice', 'field'=>'name'),
+    array('module'=>'choice', 'action'=>'choose again', 'mtable'=>'choice', 'field'=>'name'),
+);
\ No newline at end of file
index d83882e..3b5acd4 100644 (file)
@@ -5,8 +5,8 @@
 //  This fragment is called by /admin/index.php
 ////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2009042001;
-$module->requires = 2009041700;  // Requires this Moodle version
+$module->version  = 2010080300;
+$module->requires = 2010080300;  // Requires this Moodle version
 $module->cron     = 0;
 
 
diff --git a/mod/data/db/install.php b/mod/data/db/install.php
deleted file mode 100644 (file)
index 2295c57..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-
-// 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
-    update_log_display_entry('data', 'view', 'data', 'name');
-    update_log_display_entry('data', 'add', 'data', 'name');
-    update_log_display_entry('data', 'update', 'data', 'name');
-    update_log_display_entry('data', 'record delete', 'data', 'name');
-    update_log_display_entry('data', 'fields add', 'data_fields', 'name');
-    update_log_display_entry('data', 'fields update', 'data_fields', 'name');
-    update_log_display_entry('data', 'templates saved', 'data', 'name');
-    update_log_display_entry('data', 'templates def', 'data', 'name');
-
-}
diff --git a/mod/data/db/log.php b/mod/data/db/log.php
new file mode 100644 (file)
index 0000000..3f32f53
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Definition of log events
+ *
+ * @package    mod
+ * @subpackage data
+ * @copyright  2010 Petr Skoda (http://skodak.org)
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$logs = array(
+    array('module'=>'data', 'action'=>'view', 'mtable'=>'data', 'field'=>'name'),
+    array('module'=>'data', 'action'=>'add', 'mtable'=>'data', 'field'=>'name'),
+    array('module'=>'data', 'action'=>'update', 'mtable'=>'data', 'field'=>'name'),
+    array('module'=>'data', 'action'=>'record delete', 'mtable'=>'data', 'field'=>'name'),
+    array('module'=>'data', 'action'=>'fields add', 'mtable'=>'data_fields', 'field'=>'name'),
+    array('module'=>'data', 'action'=>'fields update', 'mtable'=>'data_fields', 'field'=>'name'),
+    array('module'=>'data', 'action'=>'templates saved', 'mtable'=>'data', 'field'=>'name'),
+    array('module'=>'data', 'action'=>'templates def', 'mtable'=>'data', 'field'=>'name'),
+);
\ No newline at end of file
index 20581ff..7807f5a 100644 (file)
@@ -5,8 +5,8 @@
 //  This fragment is called by /admin/index.php
 ////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2010042800;
-$module->requires = 2010042800;  // Requires this Moodle version
+$module->version  = 2010080300;
+$module->requires = 2010080300;  // Requires this Moodle version
 $module->cron     = 60;
 
 
index 2a25511..696d3f3 100644 (file)
@@ -6,11 +6,4 @@ function xmldb_feedback_install() {
 /// Disable this module by default (because it's not technically part of Moodle 2.0)
     $DB->set_field('modules', 'visible', 0, array('name'=>'feedback'));
 
-/// Install logging support
-    update_log_display_entry('feedback', 'startcomplete', 'feedback', 'name');
-    update_log_display_entry('feedback', 'submit', 'feedback', 'name');
-    update_log_display_entry('feedback', 'delete', 'feedback', 'name');
-    update_log_display_entry('feedback', 'view', 'feedback', 'name');
-    update_log_display_entry('feedback', 'view all', 'course', 'shortname');
-
 }
diff --git a/mod/feedback/db/log.php b/mod/feedback/db/log.php
new file mode 100644 (file)
index 0000000..79f1891
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Definition of log events
+ *
+ * @package    mod
+ * @subpackage feedback
+ * @copyright  2010 Petr Skoda (http://skodak.org)
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$logs = array(
+    array('module'=>'feedback', 'action'=>'startcomplete', 'mtable'=>'feedback', 'field'=>'name'),
+    array('module'=>'feedback', 'action'=>'submit', 'mtable'=>'feedback', 'field'=>'name'),
+    array('module'=>'feedback', 'action'=>'delete', 'mtable'=>'feedback', 'field'=>'name'),
+    array('module'=>'feedback', 'action'=>'view', 'mtable'=>'feedback', 'field'=>'name'),
+    array('module'=>'feedback', 'action'=>'view all', 'mtable'=>'course', 'field'=>'shortname'),
+);
\ No newline at end of file
index e0cdecb..29c52c6 100644 (file)
@@ -9,8 +9,8 @@
 */
 
 
-    $module->version = 2010051601; // The current module version (Date: YYYYMMDDXX)
-    $module->requires = 2010050414;  // Requires this Moodle version
+    $module->version = 2010080300; // The current module version (Date: YYYYMMDDXX)
+    $module->requires = 2010080300;  // Requires this Moodle version
     $feedback_version_intern = 1; //this version is used for restore older backups
     $module->cron = 0; // Period for cron to check this module (secs)
 
index b9b6759..bb12b6b 100644 (file)
@@ -34,12 +34,6 @@ defined('MOODLE_INTERNAL') || die();
 function xmldb_folder_install() {
     global $CFG;
 
-    // Install logging support
-    update_log_display_entry('folder', 'view', 'folder', 'name');
-    update_log_display_entry('folder', 'view all', 'folder', 'name');
-    update_log_display_entry('folder', 'update', 'folder', 'name');
-    update_log_display_entry('folder', 'add', 'folder', 'name');
-
     // Upgrade from old resource module type if needed
     require_once("$CFG->dirroot/mod/folder/db/upgradelib.php");
     folder_20_migrate();
diff --git a/mod/folder/db/log.php b/mod/folder/db/log.php
new file mode 100644 (file)
index 0000000..37b6017
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Definition of log events
+ *
+ * @package    mod
+ * @subpackage folder
+ * @copyright  2010 Petr Skoda (http://skodak.org)
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$logs = array(
+    array('module'=>'folder', 'action'=>'view', 'mtable'=>'folder', 'field'=>'name'),
+    array('module'=>'folder', 'action'=>'view all', 'mtable'=>'folder', 'field'=>'name'),
+    array('module'=>'folder', 'action'=>'update', 'mtable'=>'folder', 'field'=>'name'),
+    array('module'=>'folder', 'action'=>'add', 'mtable'=>'folder', 'field'=>'name'),
+);
\ No newline at end of file
index bd1ac1f..517232c 100644 (file)
@@ -26,7 +26,7 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$module->version  = 2010072200;
-$module->requires = 2009073101;  // Requires this Moodle version
+$module->version  = 2010080300;
+$module->requires = 2010080300;  // Requires this Moodle version
 $module->cron     = 0;
 
diff --git a/mod/forum/db/install.php b/mod/forum/db/install.php
deleted file mode 100644 (file)
index ff0eebf..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-
-/**
- * This file replaces:
- *  - STATEMENTS section in db/install.xml
- *  - lib.php/modulename_install() post installation hook
- *  - partially defaults.php
- *
- * @package mod-forum
- * @copyright  2009 Petr Skoda (http://skodak.org)
- * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-function xmldb_forum_install() {
-    global $DB;
-
-/// Install logging support
-    update_log_display_entry('forum', 'add', 'forum', 'name');
-    update_log_display_entry('forum', 'update', 'forum', 'name');
-    update_log_display_entry('forum', 'add discussion', 'forum_discussions', 'name');
-    update_log_display_entry('forum', 'add post', 'forum_posts', 'subject');
-    update_log_display_entry('forum', 'update post', 'forum_posts', 'subject');
-    update_log_display_entry('forum', 'user report', 'user', 'CONCAT(firstname,\' \',lastname)');
-    update_log_display_entry('forum', 'move discussion', 'forum_discussions', 'name');
-    update_log_display_entry('forum', 'view subscribers', 'forum', 'name');
-    update_log_display_entry('forum', 'view discussion', 'forum_discussions', 'name');
-    update_log_display_entry('forum', 'view forum', 'forum', 'name');
-    update_log_display_entry('forum', 'subscribe', 'forum', 'name');
-    update_log_display_entry('forum', 'unsubscribe', 'forum', 'name');
-
-}
diff --git a/mod/forum/db/log.php b/mod/forum/db/log.php
new file mode 100644 (file)
index 0000000..b39f898
--- /dev/null
@@ -0,0 +1,44 @@
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Definition of log events
+ *
+ * @package    mod
+ * @subpackage forum
+ * @copyright  2010 Petr Skoda (http://skodak.org)
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+global $DB; // TODO: this is a hack, we should really do something with the SQL in SQL tables
+
+$logs = array(
+    array('module'=>'forum', 'action'=>'add', 'mtable'=>'forum', 'field'=>'name'),
+    array('module'=>'forum', 'action'=>'update', 'mtable'=>'forum', 'field'=>'name'),
+    array('module'=>'forum', 'action'=>'add discussion', 'mtable'=>'forum_discussions', 'field'=>'name'),
+    array('module'=>'forum', 'action'=>'add post', 'mtable'=>'forum_posts', 'field'=>'subject'),
+    array('module'=>'forum', 'action'=>'update post', 'mtable'=>'forum_posts', 'field'=>'subject'),
+    array('module'=>'forum', 'action'=>'user report', 'mtable'=>'user', 'field'=>$DB->sql_concat('firstname', "' '" , 'lastname')),
+    array('module'=>'forum', 'action'=>'move discussion', 'mtable'=>'forum_discussions', 'field'=>'name'),
+    array('module'=>'forum', 'action'=>'view subscribers', 'mtable'=>'forum', 'field'=>'name'),
+    array('module'=>'forum', 'action'=>'view discussion', 'mtable'=>'forum_discussions', 'field'=>'name'),
+    array('module'=>'forum', 'action'=>'view forum', 'mtable'=>'forum', 'field'=>'name'),
+    array('module'=>'forum', 'action'=>'subscribe', 'mtable'=>'forum', 'field'=>'name'),
+    array('module'=>'forum', 'action'=>'unsubscribe', 'mtable'=>'forum', 'field'=>'name'),
+);
\ No newline at end of file
index 31501a2..9b5d277 100644 (file)
@@ -24,8 +24,8 @@
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
-$module->version  = 2010070800;
-$module->requires = 2010070800;  // Requires this Moodle version
+$module->version  = 2010080300;
+$module->requires = 2010080300;  // Requires this Moodle version
 $module->cron     = 60;
 
 
diff --git a/mod/glossary/db/install.php b/mod/glossary/db/install.php
deleted file mode 100644 (file)
index e5e9828..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-// 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
-    update_log_display_entry('glossary', 'add', 'glossary', 'name');
-    update_log_display_entry('glossary', 'update', 'glossary', 'name');
-    update_log_display_entry('glossary', 'view', 'glossary', 'name');
-    update_log_display_entry('glossary', 'view all', 'glossary', 'name');
-    update_log_display_entry('glossary', 'add entry', 'glossary', 'name');
-    update_log_display_entry('glossary', 'update entry', 'glossary', 'name');
-    update_log_display_entry('glossary', 'add category', 'glossary', 'name');
-    update_log_display_entry('glossary', 'update category', 'glossary', 'name');
-    update_log_display_entry('glossary', 'delete category', 'glossary', 'name');
-    update_log_display_entry('glossary', 'approve entry', 'glossary', 'name');
-    update_log_display_entry('glossary', 'view entry', 'glossary_entries', 'concept');
-
-}
diff --git a/mod/glossary/db/log.php b/mod/glossary/db/log.php
new file mode 100644 (file)
index 0000000..19d77d5
--- /dev/null
@@ -0,0 +1,41 @@
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Definition of log events
+ *
+ * @package    mod
+ * @subpackage glossary
+ * @copyright  2010 Petr Skoda (http://skodak.org)
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$logs = array(
+    array('module'=>'glossary', 'action'=>'add', 'mtable'=>'glossary', 'field'=>'name'),
+    array('module'=>'glossary', 'action'=>'update', 'mtable'=>'glossary', 'field'=>'name'),
+    array('module'=>'glossary', 'action'=>'view', 'mtable'=>'glossary', 'field'=>'name'),
+    array('module'=>'glossary', 'action'=>'view all', 'mtable'=>'glossary', 'field'=>'name'),
+    array('module'=>'glossary', 'action'=>'add entry', 'mtable'=>'glossary', 'field'=>'name'),
+    array('module'=>'glossary', 'action'=>'update entry', 'mtable'=>'glossary', 'field'=>'name'),
+    array('module'=>'glossary', 'action'=>'add category', 'mtable'=>'glossary', 'field'=>'name'),
+    array('module'=>'glossary', 'action'=>'update category', 'mtable'=>'glossary', 'field'=>'name'),
+    array('module'=>'glossary', 'action'=>'delete category', 'mtable'=>'glossary', 'field'=>'name'),
+    array('module'=>'glossary', 'action'=>'approve entry', 'mtable'=>'glossary', 'field'=>'name'),
+    array('module'=>'glossary', 'action'=>'view entry', 'mtable'=>'glossary_entries', 'field'=>'concept'),
+);
\ No newline at end of file
index 14401b8..34de91d 100644 (file)
@@ -5,8 +5,8 @@
 ///  This fragment is called by moodle_needs_upgrading() and /admin/index.php
 /////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2010042800;
-$module->requires = 2010042800;  // Requires this Moodle version
+$module->version  = 2010080300;
+$module->requires = 2010080300;  // Requires this Moodle version
 $module->cron     = 0;           // Period for cron to check this module (secs)
 
 
index a960f2f..c7a23ba 100644 (file)
@@ -34,12 +34,6 @@ defined('MOODLE_INTERNAL') || die();
 function xmldb_imscp_install() {
     global $CFG;
 
-    // Install logging support
-    update_log_display_entry('imscp', 'view', 'imscp', 'name');
-    update_log_display_entry('imscp', 'view all', 'imscp', 'name');
-    update_log_display_entry('imscp', 'update', 'imscp', 'name');
-    update_log_display_entry('imscp', 'add', 'imscp', 'name');
-
     // Upgrade from old resource module type if needed
     require_once("$CFG->dirroot/mod/imscp/db/upgradelib.php");
     imscp_20_migrate();
diff --git a/mod/imscp/db/log.php b/mod/imscp/db/log.php
new file mode 100644 (file)
index 0000000..599b40d
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Definition of log events
+ *
+ * @package    mod
+ * @subpackage imscp
+ * @copyright  2010 Petr Skoda (http://skodak.org)
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$logs = array(
+    array('module'=>'imscp', 'action'=>'view', 'mtable'=>'imscp', 'field'=>'name'),
+    array('module'=>'imscp', 'action'=>'view all', 'mtable'=>'imscp', 'field'=>'name'),
+    array('module'=>'imscp', 'action'=>'update', 'mtable'=>'imscp', 'field'=>'name'),
+    array('module'=>'imscp', 'action'=>'add', 'mtable'=>'imscp', 'field'=>'name'),
+);
\ No newline at end of file
index d56417a..4a23d15 100644 (file)
@@ -26,7 +26,7 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$module->version  = 2009080500;
-$module->requires = 2009073101;  // Requires this Moodle version
+$module->version  = 2010080300;
+$module->requires = 2010080300;  // Requires this Moodle version
 $module->cron     = 0;
 
similarity index 62%
rename from mod/label/db/install.php
rename to mod/label/db/log.php
index c40cf7d..bc98f86 100644 (file)
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Label module post install
+ * Definition of log events
  *
  * @package    mod
  * @subpackage label
- * @copyright  2009 Petr Skoda  {@link http://skodak.org}
+ * @copyright  2010 Petr Skoda (http://skodak.org)
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
-defined('MOODLE_INTERNAL') || die;
+defined('MOODLE_INTERNAL') || die();
 
-// 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
-    update_log_display_entry('label', 'add', 'label', 'name');
-    update_log_display_entry('label', 'update', 'label', 'name');
-
-}
+$logs = array(
+    array('module'=>'label', 'action'=>'add', 'mtable'=>'label', 'field'=>'name'),
+    array('module'=>'label', 'action'=>'update', 'mtable'=>'label', 'field'=>'name'),
+);
\ No newline at end of file
index 0f3632c..9e7e77b 100644 (file)
@@ -26,8 +26,8 @@
 
 defined('MOODLE_INTERNAL') || die;
 
-$module->version  = 2009080400;  // The current module version (Date: YYYYMMDDXX)
-$module->requires = 2009041700;  // Requires this Moodle version
+$module->version  = 2010080300;  // The current module version (Date: YYYYMMDDXX)
+$module->requires = 2010080300;  // Requires this Moodle version
 $module->cron     = 0;           // Period for cron to check this module (secs)
 
 
similarity index 62%
rename from mod/lesson/db/install.php
rename to mod/lesson/db/log.php
index b8703d4..c77cceb 100644 (file)
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * This file replaces:
- *   * STATEMENTS section in db/install.xml
- *   * lib.php/modulename_install() post installation hook
- *   * partially defaults.php
+ * Definition of log events
  *
  * @package    mod
  * @subpackage lesson
- * @copyright  1999 onwards Martin Dougiamas  {@link http://moodle.com}
- * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 o
+ * @copyright  2010 Petr Skoda (http://skodak.org)
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
 defined('MOODLE_INTERNAL') || die();
 
-function xmldb_lesson_install() {
-    global $DB;
-
-/// Install logging support
-    update_log_display_entry('lesson', 'start', 'lesson', 'name');
-    update_log_display_entry('lesson', 'end', 'lesson', 'name');
-    update_log_display_entry('lesson', 'view', 'lesson_pages', 'title');
-
-}
+$logs = array(
+    array('module'=>'lesson', 'action'=>'start', 'mtable'=>'lesson', 'field'=>'name'),
+    array('module'=>'lesson', 'action'=>'end', 'mtable'=>'lesson', 'field'=>'name'),
+    array('module'=>'lesson', 'action'=>'view', 'mtable'=>'lesson_pages', 'field'=>'title'),
+);
\ No newline at end of file
index 3c108d9..9695d41 100644 (file)
@@ -27,8 +27,8 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$module->version  = 2010072003;  // The current module version (Date: YYYYMMDDXX)
-$module->requires = 2010071800;  // Requires this Moodle version
+$module->version  = 2010080300;  // The current module version (Date: YYYYMMDDXX)
+$module->requires = 2010080300;  // Requires this Moodle version
 $module->cron     = 0;           // Period for cron to check this module (secs)
 
 
index 08b7033..cb9b327 100644 (file)
@@ -34,12 +34,6 @@ defined('MOODLE_INTERNAL') || die;
 function xmldb_page_install() {
     global $CFG;
 
-    // Install logging support
-    update_log_display_entry('page', 'view', 'page', 'name');
-    update_log_display_entry('page', 'view all', 'page', 'name');
-    update_log_display_entry('page', 'update', 'page', 'name');
-    update_log_display_entry('page', 'add', 'page', 'name');
-
     // Upgrade from old resource module type if needed
     require_once("$CFG->dirroot/mod/page/db/upgradelib.php");
     page_20_migrate();
diff --git a/mod/page/db/log.php b/mod/page/db/log.php
new file mode 100644 (file)
index 0000000..e321dc2
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Definition of log events
+ *
+ * @package    mod
+ * @subpackage page
+ * @copyright  2010 Petr Skoda (http://skodak.org)
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$logs = array(
+    array('module'=>'page', 'action'=>'view', 'mtable'=>'page', 'field'=>'name'),
+    array('module'=>'page', 'action'=>'view all', 'mtable'=>'page', 'field'=>'name'),
+    array('module'=>'page', 'action'=>'update', 'mtable'=>'page', 'field'=>'name'),
+    array('module'=>'page', 'action'=>'add', 'mtable'=>'page', 'field'=>'name'),
+);
\ No newline at end of file
index fecb773..d0bd5ce 100644 (file)
@@ -26,7 +26,7 @@
 
 defined('MOODLE_INTERNAL') || die;
 
-$module->version  = 2009080500;
-$module->requires = 2009073101;  // Requires this Moodle version
+$module->version  = 2010080300;
+$module->requires = 2010080300;  // Requires this Moodle version
 $module->cron     = 0;
 
index 1266488..85c9ca4 100644 (file)
@@ -8,22 +8,6 @@
 function xmldb_quiz_install() {
     global $DB;
 
-/// Install logging support
-    update_log_display_entry('quiz', 'add', 'quiz', 'name');
-    update_log_display_entry('quiz', 'update', 'quiz', 'name');
-    update_log_display_entry('quiz', 'view', 'quiz', 'name');
-    update_log_display_entry('quiz', 'report', 'quiz', 'name');
-    update_log_display_entry('quiz', 'attempt', 'quiz', 'name');
-    update_log_display_entry('quiz', 'submit', 'quiz', 'name');
-    update_log_display_entry('quiz', 'review', 'quiz', 'name');
-    update_log_display_entry('quiz', 'editquestions', 'quiz', 'name');
-    update_log_display_entry('quiz', 'preview', 'quiz', 'name');
-    update_log_display_entry('quiz', 'start attempt', 'quiz', 'name');
-    update_log_display_entry('quiz', 'close attempt', 'quiz', 'name');
-    update_log_display_entry('quiz', 'continue attempt', 'quiz', 'name');
-    update_log_display_entry('quiz', 'edit override', 'quiz', 'name');
-    update_log_display_entry('quiz', 'delete override', 'quiz', 'name');
-
     $record = new object();
     $record->name         = 'overview';
     $record->displayorder = '10000';
diff --git a/mod/quiz/db/log.php b/mod/quiz/db/log.php
new file mode 100644 (file)
index 0000000..8db9d26
--- /dev/null
@@ -0,0 +1,44 @@
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Definition of log events
+ *
+ * @package    mod
+ * @subpackage quiz
+ * @copyright  2010 Petr Skoda (http://skodak.org)
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$logs = array(
+    array('module'=>'quiz', 'action'=>'add', 'mtable'=>'quiz', 'field'=>'name'),
+    array('module'=>'quiz', 'action'=>'update', 'mtable'=>'quiz', 'field'=>'name'),
+    array('module'=>'quiz', 'action'=>'view', 'mtable'=>'quiz', 'field'=>'name'),
+    array('module'=>'quiz', 'action'=>'report', 'mtable'=>'quiz', 'field'=>'name'),
+    array('module'=>'quiz', 'action'=>'attempt', 'mtable'=>'quiz', 'field'=>'name'),
+    array('module'=>'quiz', 'action'=>'submit', 'mtable'=>'quiz', 'field'=>'name'),
+    array('module'=>'quiz', 'action'=>'review', 'mtable'=>'quiz', 'field'=>'name'),
+    array('module'=>'quiz', 'action'=>'editquestions', 'mtable'=>'quiz', 'field'=>'name'),
+    array('module'=>'quiz', 'action'=>'preview', 'mtable'=>'quiz', 'field'=>'name'),
+    array('module'=>'quiz', 'action'=>'start attempt', 'mtable'=>'quiz', 'field'=>'name'),
+    array('module'=>'quiz', 'action'=>'close attempt', 'mtable'=>'quiz', 'field'=>'name'),
+    array('module'=>'quiz', 'action'=>'continue attempt', 'mtable'=>'quiz', 'field'=>'name'),
+    array('module'=>'quiz', 'action'=>'edit override', 'mtable'=>'quiz', 'field'=>'name'),
+    array('module'=>'quiz', 'action'=>'delete override', 'mtable'=>'quiz', 'field'=>'name'),
+);
\ No newline at end of file
index 18cf550..80667d3 100644 (file)
@@ -297,10 +297,6 @@ function xmldb_quiz_upgrade($oldversion) {
     }
 
     if ($oldversion < 2010030501) {
-    /// fix log actions
-        update_log_display_entry('quiz', 'edit override', 'quiz', 'name');
-        update_log_display_entry('quiz', 'delete override', 'quiz', 'name');
-
     /// Define table quiz_overrides to be created
         $table = new xmldb_table('quiz_overrides');
 
index e631dde..42c59ba 100644 (file)
@@ -5,8 +5,8 @@
 //  This fragment is called by moodle_needs_upgrading() and /admin/index.php
 ////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2010051800;   // The (date) version of this module
-$module->requires = 2009041700;   // Requires this Moodle version
+$module->version  = 2010051801;   // The (date) version of this module
+$module->requires = 2010080300;   // Requires this Moodle version
 $module->cron     = 0;            // How often should cron check this module (seconds)?
 
 
similarity index 55%
rename from mod/resource/db/install.php
rename to mod/resource/db/log.php
index 028882f..687bc0c 100644 (file)
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Resource module post install function
- *
- * This file replaces:
- *  - STATEMENTS section in db/install.xml
- *  - lib.php/modulename_install() post installation hook
- *  - partially defaults.php
+ * Definition of log events
  *
  * @package    mod
  * @subpackage resource
- * @copyright  2009 Petr Skoda  {@link http://skodak.org}
+ * @copyright  2010 Petr Skoda (http://skodak.org)
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
-defined('MOODLE_INTERNAL') || die;
-
-function xmldb_resource_install() {
-    global $DB;
-
-    // Install logging support
-    update_log_display_entry('resource', 'view', 'resource', 'name');
-    update_log_display_entry('resource', 'view all', 'resource', 'name');
-    update_log_display_entry('resource', 'update', 'resource', 'name');
-    update_log_display_entry('resource', 'add', 'resource', 'name');
+defined('MOODLE_INTERNAL') || die();
 
-}
+$logs = array(
+    array('module'=>'resource', 'action'=>'view', 'mtable'=>'resource', 'field'=>'name'),
+    array('module'=>'resource', 'action'=>'view all', 'mtable'=>'resource', 'field'=>'name'),
+    array('module'=>'resource', 'action'=>'update', 'mtable'=>'resource', 'field'=>'name'),
+    array('module'=>'resource', 'action'=>'add', 'mtable'=>'resource', 'field'=>'name'),
+);
\ No newline at end of file
index f8859e4..33e52e7 100644 (file)
@@ -98,13 +98,6 @@ function xmldb_resource_upgrade($oldversion) {
         upgrade_mod_savepoint(true, 2009042001, 'resource');
     }
 
-    if ($oldversion < 2009062500) {
-        // fix log actions
-        update_log_display_entry('resource', 'view all', 'resource', 'name');
-        // resource savepoint reached
-        upgrade_mod_savepoint(true, 2009062500, 'resource');
-    }
-
     if ($oldversion < 2009062600) {
         $res_count = $DB->count_records('resource');
         $old_count = $DB->count_records('resource_old', array('migrated'=>0));
index 9311db6..3450c67 100644 (file)
@@ -26,7 +26,7 @@
 
 defined('MOODLE_INTERNAL') || die;
 
-$module->version  = 2009080501;
-$module->requires = 2009073101;  // Requires this Moodle version
+$module->version  = 2010080300;
+$module->requires = 2010080300;  // Requires this Moodle version
 $module->cron     = 0;
 
diff --git a/mod/scorm/db/install.php b/mod/scorm/db/install.php
deleted file mode 100644 (file)
index c9feba3..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<?php
-
-// 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
-    update_log_display_entry('scorm', 'view', 'scorm', 'name');
-    update_log_display_entry('scorm', 'review', 'scorm', 'name');
-    update_log_display_entry('scorm', 'update', 'scorm', 'name');
-    update_log_display_entry('scorm', 'add', 'scorm', 'name');
-
-}
diff --git a/mod/scorm/db/log.php b/mod/scorm/db/log.php
new file mode 100644 (file)
index 0000000..bcc14f8
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Definition of log events
+ *
+ * @package    mod
+ * @subpackage scorm
+ * @copyright  2010 Petr Skoda (http://skodak.org)
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$logs = array(
+    array('module'=>'scorm', 'action'=>'view', 'mtable'=>'scorm', 'field'=>'name'),
+    array('module'=>'scorm', 'action'=>'review', 'mtable'=>'scorm', 'field'=>'name'),
+    array('module'=>'scorm', 'action'=>'update', 'mtable'=>'scorm', 'field'=>'name'),
+    array('module'=>'scorm', 'action'=>'add', 'mtable'=>'scorm', 'field'=>'name'),
+);
\ No newline at end of file
index 00de20b..f75d723 100755 (executable)
@@ -6,7 +6,7 @@
 /////////////////////////////////////////////////////////////////////////////////
 
 
-$module->version  = 2010070800;   // The (date) version of this module
-$module->requires = 2009041700;   // The version of Moodle that is required
+$module->version  = 2010080300;   // The (date) version of this module
+$module->requires = 2010080300;   // The version of Moodle that is required
 $module->cron     = 300;            // How often should cron check this module (seconds)?
 
index 00add77..8d31a0b 100644 (file)
@@ -8,16 +8,6 @@
 function xmldb_survey_install() {
     global $DB;
 
-/// Install logging support
-    update_log_display_entry('survey', 'add', 'survey', 'name');
-    update_log_display_entry('survey', 'update', 'survey', 'name');
-    update_log_display_entry('survey', 'download', 'survey', 'name');
-    update_log_display_entry('survey', 'view form', 'survey', 'name');
-    update_log_display_entry('survey', 'view graph', 'survey', 'name');
-    update_log_display_entry('survey', 'view report', 'survey', 'name');
-    update_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')),
diff --git a/mod/survey/db/log.php b/mod/survey/db/log.php
new file mode 100644 (file)
index 0000000..293ffe0
--- /dev/null
@@ -0,0 +1,37 @@
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Definition of log events
+ *
+ * @package    mod
+ * @subpackage survey
+ * @copyright  2010 Petr Skoda (http://skodak.org)
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$logs = array(
+    array('module'=>'survey', 'action'=>'add', 'mtable'=>'survey', 'field'=>'name'),
+    array('module'=>'survey', 'action'=>'update', 'mtable'=>'survey', 'field'=>'name'),
+    array('module'=>'survey', 'action'=>'download', 'mtable'=>'survey', 'field'=>'name'),
+    array('module'=>'survey', 'action'=>'view form', 'mtable'=>'survey', 'field'=>'name'),
+    array('module'=>'survey', 'action'=>'view graph', 'mtable'=>'survey', 'field'=>'name'),
+    array('module'=>'survey', 'action'=>'view report', 'mtable'=>'survey', 'field'=>'name'),
+    array('module'=>'survey', 'action'=>'submit', 'mtable'=>'survey', 'field'=>'name'),
+);
\ No newline at end of file
index f623c4d..3b5acd4 100644 (file)
@@ -5,8 +5,8 @@
 //  This fragment is called by /admin/index.php
 ////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2009042002;
-$module->requires = 2009041700;  // Requires this Moodle version
+$module->version  = 2010080300;
+$module->requires = 2010080300;  // Requires this Moodle version
 $module->cron     = 0;
 
 
index 471e4c0..90de4aa 100644 (file)
@@ -34,12 +34,6 @@ defined('MOODLE_INTERNAL') || die;
 function xmldb_url_install() {
     global $CFG;
 
-    // Install logging support
-    update_log_display_entry('url', 'view', 'url', 'name');
-    update_log_display_entry('url', 'view all', 'url', 'name');
-    update_log_display_entry('url', 'update', 'url', 'name');
-    update_log_display_entry('url', 'add', 'url', 'name');
-
     // migrate settings if present
     if (!empty($CFG->resource_secretphrase)) {
         set_config('secretphrase', $CFG->resource_secretphrase, 'url');
diff --git a/mod/url/db/log.php b/mod/url/db/log.php
new file mode 100644 (file)
index 0000000..9edde72
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Definition of log events
+ *
+ * @package    mod
+ * @subpackage url
+ * @copyright  2010 Petr Skoda (http://skodak.org)
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$logs = array(
+    array('module'=>'url', 'action'=>'view', 'mtable'=>'url', 'field'=>'name'),
+    array('module'=>'url', 'action'=>'view all', 'mtable'=>'url', 'field'=>'name'),
+    array('module'=>'url', 'action'=>'update', 'mtable'=>'url', 'field'=>'name'),
+    array('module'=>'url', 'action'=>'add', 'mtable'=>'url', 'field'=>'name'),
+);
\ No newline at end of file
index 29b3a1b..a30afa2 100644 (file)
@@ -26,7 +26,7 @@
 
 defined('MOODLE_INTERNAL') || die;
 
-$module->version  = 2009080500;
-$module->requires = 2009073101;  // Requires this Moodle version
+$module->version  = 2010080300;
+$module->requires = 2010080300;  // Requires this Moodle version
 $module->cron     = 0;
 
index e422c74..9669922 100644 (file)
@@ -32,5 +32,6 @@
  * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
-$module->version = 2010080201; // The current module version (Date: YYYYMMDDXX)
-$module->cron = 0; // Period for cron to check this module (secs)
+$module->version  = 2010080300; // The current module version (Date: YYYYMMDDXX)
+$module->requires = 2010080300;
+$module->cron     = 0; // Period for cron to check this module (secs)
diff --git a/mod/workshop/db/install.php b/mod/workshop/db/install.php
deleted file mode 100644 (file)
index 7d3719d..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-
-/**
- * This file replaces the legacy STATEMENTS section in db/install.xml,
- * lib.php/modulename_install() post installation hook and partially defaults.php
- *
- * @package   mod-workshop
- * @copyright 2009 David Mudrak <david.mudrak@gmail.com>
- * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-/**
- * Post installation procedure
- */
-function xmldb_workshop_install() {
-    global $DB;
-
-    // Install logging support todo
-    //update_log_display_entry('workshop', 'add', 'workshop', 'name');
-    //update_log_display_entry('workshop', 'update', 'workshop', 'name');
-    //update_log_display_entry('workshop', 'view', 'workshop', 'name');
-    //update_log_display_entry('workshop', 'view all', 'workshop', 'name');
-}
diff --git a/mod/workshop/db/log.php b/mod/workshop/db/log.php
new file mode 100644 (file)
index 0000000..968dee7
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Definition of log events
+ *
+ * @package    mod
+ * @subpackage workshop
+ * @copyright  2010 Petr Skoda (http://skodak.org)
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$logs = array(
+    //TODO copied from old install.php
+    //array('module'=>'workshop', 'action'=>'add', 'mtable'=>'workshop', 'field'=>'name'),
+    //array('module'=>'workshop', 'action'=>'update', 'mtable'=>'workshop', 'field'=>'name'),
+    //array('module'=>'workshop', 'action'=>'view', 'mtable'=>'workshop', 'field'=>'name'),
+    //array('module'=>'workshop', 'action'=>'view all', 'mtable'=>'workshop', 'field'=>'name'),
+);
\ No newline at end of file
index d73426a..c658c56 100644 (file)
@@ -28,6 +28,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$module->version  = 2010072300;
-$module->requires = 2010070604;  // Requires this Moodle version
+$module->version  = 2010080300;
+$module->requires = 2010080300;  // Requires this Moodle version
 //$module->cron     = 60;
index c6304d0..23d230f 100644 (file)
@@ -6,7 +6,7 @@
 // This is compared against the values stored in the database to determine
 // whether upgrades should be performed (see lib/db/*.php)
 
-    $version = 2010080303;  // YYYYMMDD   = date of the last version bump
+    $version = 2010080307;  // YYYYMMDD   = date of the last version bump
                             //         XX = daily increments
 
     $release = '2.0 Preview 4+ (Build: 20100803)';  // Human-friendly version name