MDL-44639 fix some phpdocs issues in tasks classes

There is also one extra () to improve code readability.
This commit is contained in:
Petr Škoda
2014-03-20 17:32:56 +08:00
parent 9b8555fbea
commit b7f7c3bcf2
4 changed files with 30 additions and 26 deletions
+2 -2
View File
@@ -58,7 +58,7 @@ abstract class adhoc_task extends task_base {
/**
* Setter for $customdata.
* @param object $customdata (anything that can be handled by json_encode)
* @param mixed $customdata (anything that can be handled by json_encode)
*/
public function set_custom_data($customdata) {
$this->customdata = json_encode($customdata);
@@ -66,7 +66,7 @@ abstract class adhoc_task extends task_base {
/**
* Getter for $customdata.
* @return object (anything that can be handled by json_decode).
* @return mixed (anything that can be handled by json_decode).
*/
public function get_custom_data() {
return json_decode($this->customdata);
+25 -21
View File
@@ -40,7 +40,7 @@ class manager {
* Given a component name, will load the list of tasks in the db/tasks.php file for that component.
*
* @param string $componentname - The name of the component to fetch the tasks for.
* @return array(core\task\scheduled_task) - List of scheduled tasks for this component.
* @return \core\task\scheduled_task[] - List of scheduled tasks for this component.
*/
public static function load_default_scheduled_tasks_for_component($componentname) {
$dir = \core_component::get_component_directory($componentname);
@@ -179,7 +179,7 @@ class manager {
* Utility method to create a DB record from a scheduled task.
*
* @param \core\task\scheduled_task $task
* @return stdClass
* @return \stdClass
*/
public static function record_from_scheduled_task($task) {
$record = new \stdClass();
@@ -206,7 +206,7 @@ class manager {
* Utility method to create a DB record from an adhoc task.
*
* @param \core\task\adhoc_task $task
* @return stdClass
* @return \stdClass
*/
public static function record_from_adhoc_task($task) {
$record = new \stdClass();
@@ -227,7 +227,7 @@ class manager {
/**
* Utility method to create an adhoc task from a DB record.
*
* @param stdClass $record
* @param \stdClass $record
* @return \core\task\adhoc_task
*/
public static function adhoc_task_from_record($record) {
@@ -262,7 +262,7 @@ class manager {
/**
* Utility method to create a task from a DB record.
*
* @param stdClass $record
* @param \stdClass $record
* @return \core\task\scheduled_task
*/
public static function scheduled_task_from_record($record) {
@@ -273,6 +273,7 @@ class manager {
if (!class_exists($classname)) {
return false;
}
/** @var \core\task\scheduled_task $task */
$task = new $classname;
if (isset($record->lastruntime)) {
$task->set_last_run_time($record->lastruntime);
@@ -313,7 +314,7 @@ class manager {
* Given a component name, will load the list of tasks from the scheduled_tasks table for that component.
* Do not execute tasks loaded from this function - they have not been locked.
* @param string $componentname - The name of the component to load the tasks for.
* @return array(core\task\scheduled_task)
* @return \core\task\scheduled_task[]
*/
public static function load_scheduled_tasks_for_component($componentname) {
global $DB;
@@ -332,7 +333,8 @@ class manager {
/**
* This function load the scheduled task details for a given classname.
*
* @return core\task\scheduled_task or false
* @param string $classname
* @return \core\task\scheduled_task or false
*/
public static function get_scheduled_task($classname) {
global $DB;
@@ -351,7 +353,8 @@ class manager {
/**
* This function load the default scheduled task details for a given classname.
*
* @return core\task\scheduled_task or false
* @param string $classname
* @return \core\task\scheduled_task or false
*/
public static function get_default_scheduled_task($classname) {
$task = self::get_scheduled_task($classname);
@@ -370,7 +373,7 @@ class manager {
/**
* This function will return a list of all the scheduled tasks that exist in the database.
*
* @return array(core\task\scheduled_task) or null
* @return \core\task\scheduled_task[]
*/
public static function get_all_scheduled_tasks() {
global $DB;
@@ -391,7 +394,8 @@ class manager {
* with an open lock - possibly on the entire cron process. Make sure you call either
* {@link adhoc_task_failed} or {@link adhoc_task_complete} to release the lock and reschedule the task.
*
* @return core\task\adhoc_task or null
* @param int $timestart
* @return \core\task\adhoc_task or null if not found
*/
public static function get_next_adhoc_task($timestart) {
global $DB;
@@ -432,7 +436,7 @@ class manager {
* {@link scheduled_task_failed} or {@link scheduled_task_complete} to release the lock and reschedule the task.
*
* @param int $timestart - The start of the cron process - do not repeat any tasks that have been run more recently than this.
* @return core\task\scheduled_task or null
* @return \core\task\scheduled_task or null
*/
public static function get_next_scheduled_task($timestart) {
global $DB;
@@ -468,9 +472,9 @@ class manager {
}
/**
* This function indicates that an adhoc task was not completed succesfully and should be retried.
* This function indicates that an adhoc task was not completed successfully and should be retried.
*
* @param core\task\adhoc_task $task
* @param \core\task\adhoc_task $task
*/
public static function adhoc_task_failed(adhoc_task $task) {
global $DB;
@@ -505,9 +509,9 @@ class manager {
}
/**
* This function indicates that an adhoc task was completed succesfully.
* This function indicates that an adhoc task was completed successfully.
*
* @param core\task\adhoc_task $task
* @param \core\task\adhoc_task $task
*/
public static function adhoc_task_complete(adhoc_task $task) {
global $DB;
@@ -523,9 +527,9 @@ class manager {
}
/**
* This function indicates that a scheduled task was not completed succesfully and should be retried.
* This function indicates that a scheduled task was not completed successfully and should be retried.
*
* @param core\task\scheduled_task $task
* @param \core\task\scheduled_task $task
*/
public static function scheduled_task_failed(scheduled_task $task) {
global $DB;
@@ -561,9 +565,9 @@ class manager {
}
/**
* This function indicates that a scheduled task was completed succesfully and should be rescheduled.
* This function indicates that a scheduled task was completed successfully and should be rescheduled.
*
* @param core\task\scheduled_task $task
* @param \core\task\scheduled_task $task
*/
public static function scheduled_task_complete(scheduled_task $task) {
global $DB;
@@ -611,11 +615,11 @@ class manager {
/**
* Return true if the static caches have been cleared since $starttime.
* @param int $starttime The time this process started.
* @return boolean True if static caches need reseting.
* @return boolean True if static caches need resetting.
*/
public static function static_caches_cleared_since($starttime) {
global $DB;
$record = $DB->get_record('config', array('name'=>'scheduledtaskreset'));
return $record && intval($record->value) > $starttime;
return $record && (intval($record->value) > $starttime);
}
}
+2 -2
View File
@@ -62,7 +62,7 @@ abstract class scheduled_task extends task_base {
/**
* Set the last run time for this scheduled task.
* @return int
* @param int $lastruntime
*/
public function set_last_run_time($lastruntime) {
$this->lastruntime = $lastruntime;
@@ -251,7 +251,7 @@ abstract class scheduled_task extends task_base {
* If list is empty, this function will return 0.
*
* @param int $current The current value
* @param array(int) $list The list of valid items.
* @param int[] $list The list of valid items.
* @return int $next.
*/
private function next_in_list($current, $list) {
+1 -1
View File
@@ -84,7 +84,7 @@ abstract class task_base {
/**
* Set the next run time for this task.
* @return int
* @param int $nextruntime
*/
public function set_next_run_time($nextruntime) {
$this->nextruntime = $nextruntime;