MDL-46138 tasks: The adhoc task is being too helpful with json_encoding/decoding.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user