From 741c4d0b0441d5d511eb007b2d16c498b306a801 Mon Sep 17 00:00:00 2001 From: vyshane Date: Wed, 20 Sep 2006 17:46:20 +0000 Subject: [PATCH] Upgrade to roles code for data module. --- mod/data/db/mysql.php | 7 +++---- mod/data/db/mysql.sql | 2 -- mod/data/db/postgres7.php | 7 +++---- mod/data/db/postgres7.sql | 2 -- mod/data/lib.php | 4 ++-- mod/data/version.php | 2 +- 6 files changed, 9 insertions(+), 15 deletions(-) diff --git a/mod/data/db/mysql.php b/mod/data/db/mysql.php index 69eaa359e9..541a62ef70 100644 --- a/mod/data/db/mysql.php +++ b/mod/data/db/mysql.php @@ -71,7 +71,7 @@ function data_upgrade($oldversion) { if ($oldversion < 2006081700) { table_column('data', '', 'jstemplate', 'text', '', '', '', 'not null', 'csstemplate'); } - /* + if ($oldversion < 2006092000) { // Upgrades for new roles and capabilities support. require_once($CFG->dirroot.'/mod/data/lib.php'); @@ -104,11 +104,10 @@ function data_upgrade($oldversion) { modify_database('', 'ALTER TABLE prefix_data DROP COLUMN participants;'); modify_database('', 'ALTER TABLE prefix_data DROP COLUMN assesspublic;'); - modify_database('', 'ALTER TABLE prefix_data DROP COLUMN groupmode;'); } - */ + return true; } -?> +?> \ No newline at end of file diff --git a/mod/data/db/mysql.sql b/mod/data/db/mysql.sql index 8b2397118b..31dabf659b 100755 --- a/mod/data/db/mysql.sql +++ b/mod/data/db/mysql.sql @@ -21,7 +21,6 @@ CREATE TABLE prefix_data ( timeavailableto int(10) unsigned NOT NULL default '0', timeviewfrom int(10) unsigned NOT NULL default '0', timeviewto int(10) unsigned NOT NULL default '0', - participants int(4) unsigned NOT NULL default '0', requiredentries int(8) unsigned NOT NULL default '0', requiredentriestoview int(8) unsigned NOT NULL default '0', maxentries int(8) unsigned NOT NULL default '0', @@ -38,7 +37,6 @@ CREATE TABLE prefix_data ( approval tinyint(4) unsigned NOT NULL default '0', scale int(10) NOT NULL default '0', assessed int(10) unsigned NOT NULL default '0', - assesspublic int(4) unsigned NOT NULL default '0', defaultsort int(10) unsigned NOT NULL default '0', defaultsortdir tinyint(4) unsigned NOT NULL default '0', editany tinyint(4) unsigned NOT NULL default '0', diff --git a/mod/data/db/postgres7.php b/mod/data/db/postgres7.php index 7c883c5622..beebfab51c 100644 --- a/mod/data/db/postgres7.php +++ b/mod/data/db/postgres7.php @@ -155,7 +155,7 @@ function data_upgrade($oldversion) { if ($oldversion < 2006081700) { table_column('data', '', 'jstemplate', 'text', '', '', '', 'not null', 'csstemplate'); } - /* + if ($oldversion < 2006092000) { // Upgrades for new roles and capabilities support. require_once($CFG->dirroot.'/mod/data/lib.php'); @@ -175,7 +175,7 @@ function data_upgrade($oldversion) { 'this upgrade.'); } foreach ($data as $d) { - if (!data_convert_to_roles($d $teacherroles, $studentroles)) { + if (!data_convert_to_roles($d, $teacherroles, $studentroles)) { notify('Data with id '.$d->id.' was not upgraded'); } } @@ -188,10 +188,9 @@ function data_upgrade($oldversion) { modify_database('', 'ALTER TABLE prefix_data DROP COLUMN participants;'); modify_database('', 'ALTER TABLE prefix_data DROP COLUMN assesspublic;'); - modify_database('', 'ALTER TABLE prefix_data DROP COLUMN groupmode;'); } - */ + return true; } diff --git a/mod/data/db/postgres7.sql b/mod/data/db/postgres7.sql index e3f735786b..30711a475f 100755 --- a/mod/data/db/postgres7.sql +++ b/mod/data/db/postgres7.sql @@ -10,7 +10,6 @@ CREATE TABLE prefix_data ( timeavailableto integer NOT NULL default '0', timeviewfrom integer NOT NULL default '0', timeviewto integer NOT NULL default '0', - participants integer NOT NULL default '0', requiredentries integer NOT NULL default '0', requiredentriestoview integer NOT NULL default '0', maxentries integer NOT NULL default '0', @@ -27,7 +26,6 @@ CREATE TABLE prefix_data ( approval integer NOT NULL default '0', scale integer NOT NULL default '0', assessed integer NOT NULL default '0', - assesspublic integer NOT NULL default '0', defaultsort integer NOT NULL default '0', defaultsortdir integer NOT NULL default '0', editany integer NOT NULL default '0' diff --git a/mod/data/lib.php b/mod/data/lib.php index 05422278dd..1e3ef59791 100755 --- a/mod/data/lib.php +++ b/mod/data/lib.php @@ -1316,8 +1316,8 @@ function data_convert_to_roles($data, $teacherroles=array(), $studentroles=array if (empty($cmid)) { // We were not given the course_module id. Try to find it. - if (!$cm = get_coursemodule_from_instance('forum', $forum->id)) { - notify('Could not get the course module for the forum'); + if (!$cm = get_coursemodule_from_instance('data', $data->id)) { + notify('Could not get the course module for the data'); return false; } else { $cmid = $cm->id; diff --git a/mod/data/version.php b/mod/data/version.php index 5fe726bab3..14812f454d 100644 --- a/mod/data/version.php +++ b/mod/data/version.php @@ -5,7 +5,7 @@ // This fragment is called by /admin/index.php //////////////////////////////////////////////////////////////////////////////// -$module->version = 2006091800; +$module->version = 2006092000; $module->requires = 2006080900; // Requires this Moodle version $module->cron = 60; -- 2.39.5