Merge branch 'MDL-46138-master' of git://github.com/damyon/moodle

This commit is contained in:
Sam Hemelryk 2014-07-14 10:39:54 +12:00
commit b7a9846a26
2 changed files with 19 additions and 2 deletions

View File

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

View File

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