MDL-23628 improved log action support - now similar to handling of capabilities

This commit is contained in:
Petr Skoda 2010-08-03 10:07:18 +00:00
parent 4cab1150ea
commit c6d75bffa5
62 changed files with 779 additions and 430 deletions

View 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);

View 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(

View 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"
>
@ -560,7 +560,8 @@
<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"/>

51
lib/db/log.php Normal file
View File

@ -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'),
);

View 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;
}

View File

@ -31,6 +31,24 @@
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.

View 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');

View File

@ -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');
}

35
mod/assignment/db/log.php Normal file
View File

@ -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'),
);

View 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;

View File

@ -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');
}

35
mod/chat/db/log.php Normal file
View File

@ -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'),
);

View 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)?

View File

@ -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');
}

36
mod/choice/db/log.php Normal file
View File

@ -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'),
);

View 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;

View File

@ -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');
}

38
mod/data/db/log.php Normal file
View File

@ -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'),
);

View 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;

View 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');
}

35
mod/feedback/db/log.php Normal file
View File

@ -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'),
);

View 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)

View 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();

34
mod/folder/db/log.php Normal file
View File

@ -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'),
);

View 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;

View File

@ -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');
}

44
mod/forum/db/log.php Normal file
View File

@ -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'),
);

View 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;

View File

@ -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');
}

41
mod/glossary/db/log.php Normal file
View File

@ -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'),
);

View 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)

View 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();

34
mod/imscp/db/log.php Normal file
View File

@ -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'),
);

View 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;

View File

@ -16,26 +16,17 @@
// 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'),
);

View 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)

View File

@ -16,25 +16,18 @@
// 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'),
);

View 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)

View 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();

34
mod/page/db/log.php Normal file
View File

@ -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'),
);

View 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;

View 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';

44
mod/quiz/db/log.php Normal file
View File

@ -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'),
);

View 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');

View 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)?

View File

@ -16,28 +16,19 @@
// 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;
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');
}
$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'),
);

View 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));

View 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;

View File

@ -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');
}

34
mod/scorm/db/log.php Normal file
View File

@ -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'),
);

View File

@ -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)?

View 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')),

37
mod/survey/db/log.php Normal file
View File

@ -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'),
);

View 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;

View 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');

34
mod/url/db/log.php Normal file
View File

@ -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'),
);

View 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;

View 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)

View File

@ -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');
}

35
mod/workshop/db/log.php Normal file
View File

@ -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'),
);

View 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;

View 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