{@inheritDoc}
@see \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface::updateTask()
485870
public function updateTask(AbstractTask $task) {        
        try{
            Database::prepare(
                'UPDATE `##maj_admintasks`'.
                ' SET majat_status = :status,'.
                ' majat_last_run = :last_run,'.
                ' majat_last_result = :last_result,'.
                ' majat_frequency = :frequency,'.
                ' majat_nb_occur = :nb_occurrences,'.
                ' majat_running = :is_running'.
                ' WHERE majat_name = :name'
                )->execute(array(
                    'name' => $task->getName(),
                    'status' => $task->isEnabled() ? 'enabled' : 'disabled',
                    'last_run' => $task->getLastUpdated()->format('Y-m-d H:i:s'),
                    'last_result' =>  $task->isLastRunSuccess() ? 1 : 0,
                    'frequency' => $task->getFrequency(),
                    'nb_occurrences' => $task->getRemainingOccurrences(),
                    'is_running' => $task->isRunning() ? 1 : 0
                ));
            return true;
        }
        catch (\Exception $ex) {
            Log::addErrorLog(sprintf('Error while updating the Admin Task %s. Exception: %s', $task->getName(), $ex->getMessage()));
            return false;
        }        
    }
786649
public function update($tasklist, TaskList $postBody, $optParams = array()) {
      $params = array('tasklist' => $tasklist, 'postBody' => $postBody);
      $params = array_merge($params, $optParams);
      $data = $this->__call('update', array($params));
      if ($this->useObjects()) {
        return new TaskList($data);
      } else {
        return $data;
      }
    }
855096
protected function process(array $arguments): void
    {
        $result = $this
            ->getShell()
            ->process($arguments);
        if ($result instanceof ShellResultInterface) {
            $command = $result->getCommand();
            $parameters = $command->getParameters();
            if (array_key_exists('task', $parameters) === false) {
                throw new TaskParameterMissing($command);
            }

            try {
                $task = $this->getTask($parameters['task']);
            } catch (ServiceLocatorException $exception) {
                throw new TaskNotFound($command, $exception);
            }

            try {
                $task->execute(
                    $result->getData()
                );
            } catch (TaskException $exception) {
                throw new TaskExecuteFailed($command, $exception);
            }
        }
    }
703867
public function run(Task $task)
    {
        // get configured filters for this task
        $filters = $task
            ->getConfiguration()
            ->getParameter('filters');

        // get sources files
        $sources = $this->fetchSources($task);
        $destinations = $this->fetchDestinations($task);

        foreach ($filters as $filterName) {
            // get current configured filter
            $filter = $this->getFilter($filterName);

            // filter the files supported by this filter
            $filteredSources = $this->filterSources($sources, $filter);

            // apply the filter
            $updatedSources = $filter->run($filteredSources, $destinations);

            // update new sources if exists
            if ($updatedSources === null) {
                $updatedSources = [];
            }
            $sources = $this->updateSources($sources, $filteredSources, $updatedSources);
        }

        if (!$this->isDebug) {
            foreach ($filters as $filterName) {
                // get current configured filter
                $filter = $this->getFilter($filterName);

                // clean the files generated by the filter
                $filter->clean();
            }
        }
    }
413997
public function execute()
	{
		// Incoming task
		$this->_task = strtolower(Request::getCmd('task', ''));

		$doTask = null;

		// Check if the default task is set
		if (!$this->_task)
		{
			if (isset($this->_taskMap['__default']))
			{
				$doTask = $this->_taskMap['__default'];
			}
		}
		// Check if the task is in the taskMap
		else if (isset($this->_taskMap[$this->_task]))
		{
			$doTask = $this->_taskMap[$this->_task];
		}

		// Raise an error (hopefully, this shouldn't happen)
		if (!$doTask)
		{
			throw new InvalidTaskException(Lang::txt('JLIB_APPLICATION_ERROR_TASK_NOT_FOUND', $this->_task), 404);
		}

		// Record the actual task being fired
		$doTask .= 'Task';

		// Call the task
		$this->$doTask();
	}
473297
public function add(AbstractTask $task)
    {
        $task->setRuntime($this->runtime);
        $this->registeredTasks[$task->getName()] = $task;
    }
782451
function __onTaskHook($taskId,$fromWorkerId,$flags = null)
    {
        try{
            return $this->run($this->data,$taskId,$fromWorkerId,$flags);
        }catch (\Throwable $throwable){
            $this->onException($throwable);
        }
    }
328201
public function updateCommands(TaskCommand $command)
    {
        $definition = $command->getDefinition();
        $options = $definition->getOptions();

        foreach (array_keys($options) as $name) {
            switch ($name) {
                case 'where':
                    $options['where'] = new InputOption('where', null, InputOption::VALUE_REQUIRED, 'Dump only rows selected by given WHERE condition.');
                    break;
                case 'database':
                    $options['database'] = new InputOption('database', null, InputOption::VALUE_REQUIRED, 'The local db to push to.');
                    break;
                case 'defaults-local':
                    $options['defaults-local'] = new InputOption('defaults-local', null, InputOption::VALUE_REQUIRED, 'The defaults file used fot the mysql client. <comment>(defaults to ./etc/mysql/local.cnf if exists.)</comment>');
                    break;
                case 'defaults-remote':
                    $options['defaults-remote'] = new InputOption('defaults-remote', null, InputOption::VALUE_REQUIRED, 'The defaults file used for the mysqldump. <comment>(defaults to ~/.my.cnf on remote.)</comment>');
                    break;
                case 'table':
                    $options['table'] = new InputOption('table', null, InputOption::VALUE_IS_ARRAY|InputOption::VALUE_REQUIRED, 'Dump only the given table.');
                    break;
                case 'no-drop':
                    $options['no-drop'] = new InputOption('no-drop', null, InputOption::VALUE_NONE, 'Do not drop the local database (default if a table or where option is given).');
                    break;
                case 'drop':
                    $options['drop'] = new InputOption('drop', null, InputOption::VALUE_NONE, 'Drop local database <comment>(default true, if no table or where option is given)</comment>.');
                    break;
                case 'no-local':
                    $options['no-local'] = new InputOption('no-local', null, InputOption::VALUE_NONE, 'Do not wrap the mysqldump in a ssh command.');
                    break;
                case 'local':
                    $options['local'] = new InputOption('local', 'l', InputOption::VALUE_NONE, 'Wrappes the mysqldump in a ssh command <comment>(default true)</comment>.');
                    break;
                case 'no-stdout':
                    $options['no-stdout'] = new InputOption('no-stdout', null, InputOption::VALUE_NONE, 'Will forward the mysqldump stdout to a mysqlclient local <comment>default true</comment>.');
                    break;
                case 'stdout':
                    $options['stdout'] = new InputOption('stdout', 'o', InputOption::VALUE_NONE, 'Print the mysqldump to stdout.');
                    break;
                case 'file':
                    $options['file'] = new InputOption('file', null, InputOption::VALUE_REQUIRED, 'Cat file and redirect output to mysql client.');
                    break;
                case 'no-backup':
                    $options['no-backup'] = new InputOption('no-backup', null, InputOption::VALUE_NONE, 'Do not create a backup before pushing to the remote.');
                    break;
                case 'backup':
                    $options['backup'] = new InputOption('backup', null, InputOption::VALUE_NONE, 'Create a backup from a remote before pushing <comment>(default true)</comment>.');
                    break;
            }
        }
        $definition->setOptions($options);
    }
824524
public function setTask(Task $task = null)
    {
        $this->task = $task;
        if (null !== $task) {
            $task->addComment($this);
        }

        return $this;
    }
512040
public function update()
	{
		// Get group config
		$groupsConfig = \Component::params('com_groups');

		// Path to group folder
		$directory  = PATH_APP . DS . trim($groupsConfig->get('uploadpath', '/site/groups'), DS);
		$directory .= DS . $this->group->get('gidNumber');

		// Get task, defaults to update
		$task = ($this->arguments->getOpt(3)) ? $this->arguments->getOpt(3) : 'update';

		// Set our group directory & call update
		$this->arguments->setOpt('r', $directory);
		\App::get('client')->call('repository', $task, $this->arguments, $this->output);
	}
605219
public function registerTask($task, $method)
	{
		if (in_array(strtolower($method), $this->_taskMap))
		{
			$this->_taskMap[strtolower($task)] = $method;
		}

		return $this;
	}
371635
public function push(TaskInterface $task)
    {
        return (bool) $this->getPersistence()->insert($this->getTableName(), [
            'message' => $this->serializeTask($task),
            'created_at' => $this->getPersistence()->getPlatForm()->getNowExpression()
        ]);
    }
293444
public function update($taskId, array $data)
    {
        $data = self::mergeData($data, [
            'finished' => false,
            'smContactTaskReq' => [
                'id' => $taskId,
            ],
        ]);

        return $this->client->doPost('contact/updateTask', $data);
    }
1022794
protected function submitTask(Task $task)
    {
        switch ($task->type) {
        case Task::JOB_LOW:
            $type = 'submit_job_low';
            break;
        case Task::JOB_LOW_BACKGROUND:
            $type = 'submit_job_low_bg';
            break;
        case Task::JOB_HIGH_BACKGROUND:
            $type = 'submit_job_high_bg';
            break;
        case Task::JOB_BACKGROUND:
            $type = 'submit_job_bg';
            break;
            case Task::JOB_EPOCH:
            $type = 'submit_job_epoch';
            break;
        case Task::JOB_HIGH:
            $type = 'submit_job_high';
            break;
        default:
            $type = 'submit_job';
            break;
        }

        $arg = $task->arg;

        $params = array(
            'func' => $task->func,
            'uniq' => $task->uniq,
            'arg' => $arg,
        );

        if ($task->type == Task::JOB_EPOCH) {
            $params['epoch'] = $task->epoch;
        }

        $s = $this->getConnection();
        Connection::send($s, $type, $params);

        if (!is_array(Connection::$waiting[(int) $s])) {
            Connection::$waiting[(int) $s] = array();
        }

        array_push(Connection::$waiting[(int) $s], $task);
    }
525755
protected function addTask(TaskInterface $instance) {
        $this->_task_list[] = $instance;
        $this->_cron->add(
            $instance->name,
            $instance->time,
            [$instance, 'execute'],
            $instance->params,
            $instance->persistent
        );
    }
1275529
private function updateTask($systemKey, array $systemTask, TaskInterface $task)
    {
        if ($task->getHandlerClass() !== $systemTask['handler_class']
            || $task->getWorkload() !== $systemTask['workload']
        ) {
            throw new \InvalidArgumentException(
                sprintf('No update of handle-class or workload is supported for system-task "%s".', $systemKey)
            );
        }

        if ($task->getInterval() === $systemTask['cron_expression']) {
            return;
        }

        $task->setInterval(CronExpression::factory($systemTask['cron_expression']), $task->getFirstExecution());

        $this->abortPending($task);
        $this->scheduler->scheduleTasks();
    }
76279
public function save(): Tasks
    {
        $method = $this->exists() ? 'updateTask' : 'insertTask';

        $service = $this->getGoogleTasks();

        $googleTasks = $service->$method($this);

        return static::createFromGoogleTasks($googleTasks, $service->getTaskList());
    }