mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 04:30:15 +01:00
Merge branch 'MDL-46138-master' of git://github.com/damyon/moodle
This commit is contained in:
commit
b7a9846a26
@ -64,6 +64,14 @@ abstract class adhoc_task extends task_base {
|
||||
$this->customdata = json_encode($customdata);
|
||||
}
|
||||
|
||||
/**
|
||||
* Alternate setter for $customdata. Expects the data as a json_encoded string.
|
||||
* @param string json_encoded string
|
||||
*/
|
||||
public function set_custom_data_as_string($customdata) {
|
||||
$this->customdata = $customdata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for $customdata.
|
||||
* @return mixed (anything that can be handled by json_decode).
|
||||
@ -72,4 +80,13 @@ abstract class adhoc_task extends task_base {
|
||||
return json_decode($this->customdata);
|
||||
}
|
||||
|
||||
/**
|
||||
* Alternate getter for $customdata.
|
||||
* @return string (this is the raw json encoded version).
|
||||
*/
|
||||
public function get_custom_data_as_string() {
|
||||
return $this->customdata;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ class manager {
|
||||
$record->blocking = $task->is_blocking();
|
||||
$record->nextruntime = $task->get_next_run_time();
|
||||
$record->faildelay = $task->get_fail_delay();
|
||||
$record->customdata = $task->get_custom_data();
|
||||
$record->customdata = $task->get_custom_data_as_string();
|
||||
|
||||
return $record;
|
||||
}
|
||||
@ -254,7 +254,7 @@ class manager {
|
||||
$task->set_fail_delay($record->faildelay);
|
||||
}
|
||||
if (isset($record->customdata)) {
|
||||
$task->set_custom_data($record->customdata);
|
||||
$task->set_custom_data_as_string($record->customdata);
|
||||
}
|
||||
|
||||
return $task;
|
||||
|
Loading…
x
Reference in New Issue
Block a user