From a13f59b70cadc2689e8cdc6b398dacd4ac47213b Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Tue, 14 Aug 2018 17:01:48 -0400 Subject: [PATCH 1/2] Convert deprecated legacy cron task to Tasks API --- classes/task/update_dirty_sets.php | 18 ++++++++++++++++++ db/tasks.php | 15 +++++++++++++++ lib.php | 19 ------------------- version.php | 3 +-- 4 files changed, 34 insertions(+), 21 deletions(-) create mode 100644 classes/task/update_dirty_sets.php create mode 100644 db/tasks.php diff --git a/classes/task/update_dirty_sets.php b/classes/task/update_dirty_sets.php new file mode 100644 index 0000000..e70fc47 --- /dev/null +++ b/classes/task/update_dirty_sets.php @@ -0,0 +1,18 @@ +dirroot . '/mod/wwassignment/locallib.php'); + + _wwassignment_update_dirty_sets(); + } +} diff --git a/db/tasks.php b/db/tasks.php new file mode 100644 index 0000000..ea1c4a4 --- /dev/null +++ b/db/tasks.php @@ -0,0 +1,15 @@ + 'mod_wwassignment\task\updatedirtysets', + 'blocking' => 0, + 'minute' => 'R', + 'hour' => '4', + 'day' => '*', + 'month' => '*', + 'dayofweek' => '*' + ) +); diff --git a/lib.php b/lib.php index d1144b6..e870b5f 100644 --- a/lib.php +++ b/lib.php @@ -508,25 +508,6 @@ function wwassignment_print_recent_activity($course, $isteacher, $timestart) { return false; // True if anything was printed, otherwise false } -/** -* @desc Function that is run by the cron job. This makes sure that -* the grades and all other data are pulled from webwork. -* returns true if successful -*/ -function wwassignment_cron() { - traceLog("-------------Begin wwassignment_cron-------------------------"); - - //FIXME: Add a call that updates all events with dates (in case people forgot to push) - //wwassignment_refresh_events(); - //FIXME: Add a call that updates all grades in all courses - //wwassignment_update_grades(null,0); - //try { // try didn't work on some php systems -- leave it out. - _wwassignment_update_dirty_sets(); - traceLog("---------------------End wwassignment_cron------------------------"); - return true; -} - - // reference material for improving update dirty sets: // from wiki/lib /print_recent_activity // $sql = "SELECT l.*, cm.instance FROM {$CFG->prefix}log l diff --git a/version.php b/version.php index c99f386..ad0accb 100644 --- a/version.php +++ b/version.php @@ -24,9 +24,8 @@ // 3.0+ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2015030918; // The current module version (Date: YYYYMMDDXX) +$plugin->version = 2015030919; // The current module version (Date: YYYYMMDDXX) $plugin->requires = 2014110400; // Requires this Moodle version -$plugin->cron = 300; // Period for cron to check this module (secs) -- every 5 minutes $plugin->component = 'mod_wwassignment'; $plugin->maturity = MATURITY_STABLE; From 6f9c3c7aceb7ae985ceac748822628bc50035d74 Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Tue, 14 Aug 2018 17:52:41 -0400 Subject: [PATCH 2/2] Fix tasks.php and add missing language string --- db/tasks.php | 2 +- lang/en/wwassignment.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/db/tasks.php b/db/tasks.php index ea1c4a4..2294168 100644 --- a/db/tasks.php +++ b/db/tasks.php @@ -4,7 +4,7 @@ $tasks = array( array( - 'classname' => 'mod_wwassignment\task\updatedirtysets', + 'classname' => 'mod_wwassignment\task\update_dirty_sets', 'blocking' => 0, 'minute' => 'R', 'hour' => '4', diff --git a/lang/en/wwassignment.php b/lang/en/wwassignment.php index 4544a93..3e51561 100644 --- a/lang/en/wwassignment.php +++ b/lang/en/wwassignment.php @@ -78,3 +78,4 @@ $string['writing'] = 'WWASSIGN:writing'; $string['writing_help'] = 'WWASSIGN:writing_help'; +$string['updatedirtysets'] = 'Synchronise grades from WebWorK';