Set execution

@param \Minibus\Model\Entity\Execution $execution
@return Alert
778186
public function setExecution(\Minibus\Model\Entity\Execution $execution)
    {
        $this->execution = $execution;
        
        return $this;
    }
850588
public function execute(PDO $pdo)
    {
        try {
            $stmt = $pdo->prepare($this->getSql());
            $this->statementExecute($stmt, $this->getWhereData());
            $this->checkAffected($stmt, new NoRecordsAffectedSelectException());
            $data = $this->fetchData(
                $stmt,
                $this->getFetchFlat(),
                $this->getFetchStyle()
            );
            $this->setData($data ?: $this->getDefaultValue());
            return $this->getData();
        } catch (NoRecordsAffectedException $exc) {
            throw $exc;
        } catch (\Exception $exc) {
            throw new ExecutionErrorException($exc->getMessage());
        }
    }
273099
public function execute()
    {
        $queue = $this->container->getDelayedExecutionTaskQueue();
        if($queue->length() == 0){
            return;
        }
        ignore_user_abort(true);
        $queue->execute();
    }
219840
public function query($sql, $execute = FALSE)
    {

        $query = (empty($sql)) ? $this->query : $sql;
        $this->transactions[] = $this->replacePrefix($query); //just for reference

        //@TODO;
        if ($execute) {
            $this->exec($query);
        }

        return true;
    }
694091
protected function exec($query)
    {
        try {
            Connect::getConn()->exec($query);
        } catch (Exception $e) {
            static::$response["status"] = "error";
            static::$response["response"] = $e->getMessage();
            static::$response["code"] = $e->getCode();

            return static::terminate(static::$response);
        }
        return null;
    }
793131
protected function define_execution() {
        // A block in the restore list may be skipped because a duplicate is detected.
        // In this case, there is no new blockid (or context) to get.
        if (!empty($this->task->get_blockid())) {
            $context = \context_block::instance($this->task->get_blockid());
            \core_search\manager::request_index($context);
        }
    }
1143895
public function setExecutableByHandler($handler)
    {
        list($controller_name, $action_name) = $this->app->getControllerByHandler($handler);
        $controller = $this->app->createController($controller_name);

        $this->setExecutable([$controller, $action_name]);

        return $this;
    }
655301
protected function setOperation($query, string $operation)
	{
		if(($query instanceof Subquery) === false)
		{
			$query = new Subquery($query);
		}

		$this->setOperations[] =
		[
			'query'     => $query,
			'operation' => $operation,
		];

		return $this;
	}
1122755
private void setExecutionTypeIfNotSet(ExecutionType executionType) {
        if (this.executionType == null) {
            logger.finer("Setting initial execution type value");
            this.executionType = executionType;
        } else {
            logger.finer("Not setting execution type value since it's already set");
        }
    }
458184
protected function _execute()
    {
        $this->triggerBeforeFind();
        if ($this->__resultSet) {
            $decorator = $this->_decoratorClass();

            return new $decorator($this->__resultSet);
        }

        return $this->__resultSet = $this->_webservice->execute($this);
    }
347975
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->setInputAndOutput($input, $output);

        return $this->doExecute();
    }
558325
public function execute($method=null) {
    $isDebugEnabled = $this->logger->isDebugEnabled();
    if ($isDebugEnabled) {
      $this->logger->debug('Executing: '.get_class($this).($method ? '::'.$method: ''));
      $this->logger->debug('Request: '.$this->request);
    }

    // validate controller data
    $validationFailed = false;
    if (!$this->validate()) {
      $validationFailed = true;
    }

    // execute controller logic
    if (!$validationFailed) {
      try {
        $this->doExecute($method);
        $this->endTransaction(true);
      }
      catch (\Exception $ex) {
        if ($ex instanceof ApplicationException) {
          $error = $ex->getError();
          $this->response->addError($error);
          $this->response->setStatus($error->getStatusCode());
        }
        else {
          $this->getLogger()->error($ex);
          $error = ApplicationError::fromException($ex);
          $this->response->addError($error);
          $this->response->setStatus($error->getStatusCode());
        }
        $this->endTransaction(false);
      }
    }

    // return the last error
    $errors = array_merge($this->request->getErrors(), $this->response->getErrors());
    if (sizeof($errors) > 0) {
      $error = array_pop($errors);
      $this->response->setValue('errorCode', $error->getCode());
      $this->response->setValue('errorMessage', $error->getMessage());
      $this->response->setValue('errorData', $error->getData());
      $this->response->setStatus($error->getStatusCode());
    }

    // log errors
    for ($i=0,$count=sizeof($errors); $i<$count; $i++) {
      $error = $errors[$i];
      $message = $error->__toString();
      switch ($error->getLevel()) {
        case ApplicationError::LEVEL_WARNING:
          $this->logger->warn($message);
          break;
        default:
          $this->logger->error($message);
      }
    }

    if ($isDebugEnabled) {
      $this->logger->debug('Response: '.$this->response);
    }
  }
1136429
private function configTools(ExecuteInterface $execute)
    {
        $tools = $execute->execute();
        $tools[0] = ComposerConfigurator::configure($this->io, $tools[0]);
        $tools[1] = JsonLintConfigurator::configure($this->io, $tools[1]);
        $tools[2] = PhpLintConfigurator::configure($this->io, $tools[2]);
        $tools[3] = PhpMdConfigurator::configure($this->io, $tools[3]);
        $tools[4] = PhpCsConfigurator::configure($this->io, $tools[4]);
        $tools[5] = PhpCsFixerConfigurator::configure($this->io, $tools[5]);
        $tools[6] = PhpUnitConfigurator::configure($this->io, $tools[6]);
        $tools[7] = PhpUnitStrictCoverageConfigurator::configure($this->io, $tools[7]);
        $tools[8] = $this->phpUnitGuardCoverageConfigurator->configure($this->io, $tools[8]);

        return new Execute($tools);
    }
1054836
public function execute()
    {
        // Update the build in the database, ping any external services.
        $this->build->setStatus(Build::STATUS_RUNNING);
        $this->build->setStarted(new \DateTime());
        $this->store->save($this->build);
        $this->build->sendStatusPostback();
        $success = true;

        $previous_build = $this->build->getProject()->getPreviousBuild($this->build->getBranch());

        $previous_state = Build::STATUS_NEW;

        if ($previous_build) {
            $previous_state = $previous_build->getStatus();
        }

        try {
            // Set up the build:
            $this->setupBuild();

            // Run the core plugin stages:
            foreach (array('setup', 'test') as $stage) {
                $success &= $this->pluginExecutor->executePlugins($this->config, $stage);
            }

            // Set the status so this can be used by complete, success and failure
            // stages.
            if ($success) {
                $this->build->setStatus(Build::STATUS_SUCCESS);
            } else {
                $this->build->setStatus(Build::STATUS_FAILED);
            }


            if ($success) {
                $this->pluginExecutor->executePlugins($this->config, 'success');

                if ($previous_state == Build::STATUS_FAILED) {
                    $this->pluginExecutor->executePlugins($this->config, 'fixed');
                }

                $this->buildLogger->logSuccess(Lang::get('build_success'));
            } else {
                $this->pluginExecutor->executePlugins($this->config, 'failure');

                if ($previous_state == Build::STATUS_SUCCESS || $previous_state == Build::STATUS_NEW) {
                    $this->pluginExecutor->executePlugins($this->config, 'broken');
                }

                $this->buildLogger->logFailure(Lang::get('build_failed'));
            }
        } catch (\Exception $ex) {
            $this->build->setStatus(Build::STATUS_FAILED);
            $this->buildLogger->logFailure(Lang::get('exception') . $ex->getMessage());
        }finally{
            // Complete stage plugins are always run
            $this->pluginExecutor->executePlugins($this->config, 'complete');
        }


        // Update the build in the database, ping any external services, etc.
        $this->build->sendStatusPostback();
        $this->build->setFinished(new \DateTime());

        // Clean up:
        $this->buildLogger->log(Lang::get('removing_build'));
        $this->build->removeBuildDirectory();

        $this->store->save($this->build);
    }
599230
public function setMaxExecutionTime(int $maxExecutionTime = NULL) : self
	{
		if ($maxExecutionTime !== NULL && $maxExecutionTime <= 0) {
			throw new InvalidArgumentException("Max execution time must be NULL or non negative number.");
		}
		$this->maxExecutionTime = $maxExecutionTime;

		return $this;
	}
374025
protected function define_execution() {
        global $DB;

        $this->log('processing file aliases queue', backup::LOG_DEBUG);

        $fs = get_file_storage();

        // Load the queue.
        $rs = $DB->get_recordset('backup_ids_temp',
            array('backupid' => $this->get_restoreid(), 'itemname' => 'file_aliases_queue'),
            '', 'info');

        // Iterate over aliases in the queue.
        foreach ($rs as $record) {
            $info = backup_controller_dbops::decode_backup_temp_info($record->info);

            // Try to pick a repository instance that should serve the alias.
            $repository = $this->choose_repository($info);

            if (is_null($repository)) {
                $this->notify_failure($info, 'unable to find a matching repository instance');
                continue;
            }

            if ($info->oldfile->repositorytype === 'local' or $info->oldfile->repositorytype === 'coursefiles') {
                // Aliases to Server files and Legacy course files may refer to a file
                // contained in the backup file or to some existing file (if we are on the
                // same site).
                try {
                    $reference = file_storage::unpack_reference($info->oldfile->reference);
                } catch (Exception $e) {
                    $this->notify_failure($info, 'invalid reference field format');
                    continue;
                }

                // Let's see if the referred source file was also included in the backup.
                $candidates = $DB->get_recordset('backup_files_temp', array(
                        'backupid' => $this->get_restoreid(),
                        'contextid' => $reference['contextid'],
                        'component' => $reference['component'],
                        'filearea' => $reference['filearea'],
                        'itemid' => $reference['itemid'],
                    ), '', 'info, newcontextid, newitemid');

                $source = null;

                foreach ($candidates as $candidate) {
                    $candidateinfo = backup_controller_dbops::decode_backup_temp_info($candidate->info);
                    if ($candidateinfo->filename === $reference['filename']
                            and $candidateinfo->filepath === $reference['filepath']
                            and !is_null($candidate->newcontextid)
                            and !is_null($candidate->newitemid) ) {
                        $source = $candidateinfo;
                        $source->contextid = $candidate->newcontextid;
                        $source->itemid = $candidate->newitemid;
                        break;
                    }
                }
                $candidates->close();

                if ($source) {
                    // We have an alias that refers to another file also included in
                    // the backup. Let us change the reference field so that it refers
                    // to the restored copy of the original file.
                    $reference = file_storage::pack_reference($source);

                    // Send the new alias to the filepool.
                    $fs->create_file_from_reference($info->newfile, $repository->id, $reference);
                    $this->notify_success($info);
                    continue;

                } else {
                    // This is a reference to some moodle file that was not contained in the backup
                    // file. If we are restoring to the same site, keep the reference untouched
                    // and restore the alias as is if the referenced file exists.
                    if ($this->task->is_samesite()) {
                        if ($fs->file_exists($reference['contextid'], $reference['component'], $reference['filearea'],
                                $reference['itemid'], $reference['filepath'], $reference['filename'])) {
                            $reference = file_storage::pack_reference($reference);
                            $fs->create_file_from_reference($info->newfile, $repository->id, $reference);
                            $this->notify_success($info);
                            continue;
                        } else {
                            $this->notify_failure($info, 'referenced file not found');
                            continue;
                        }

                    // If we are at other site, we can't restore this alias.
                    } else {
                        $this->notify_failure($info, 'referenced file not included');
                        continue;
                    }
                }

            } else if ($info->oldfile->repositorytype === 'user') {
                if ($this->task->is_samesite()) {
                    // For aliases to user Private files at the same site, we have a chance to check
                    // if the referenced file still exists.
                    try {
                        $reference = file_storage::unpack_reference($info->oldfile->reference);
                    } catch (Exception $e) {
                        $this->notify_failure($info, 'invalid reference field format');
                        continue;
                    }
                    if ($fs->file_exists($reference['contextid'], $reference['component'], $reference['filearea'],
                            $reference['itemid'], $reference['filepath'], $reference['filename'])) {
                        $reference = file_storage::pack_reference($reference);
                        $fs->create_file_from_reference($info->newfile, $repository->id, $reference);
                        $this->notify_success($info);
                        continue;
                    } else {
                        $this->notify_failure($info, 'referenced file not found');
                        continue;
                    }

                // If we are at other site, we can't restore this alias.
                } else {
                    $this->notify_failure($info, 'restoring at another site');
                    continue;
                }

            } else {
                // This is a reference to some external file such as in boxnet or dropbox.
                // If we are restoring to the same site, keep the reference untouched and
                // restore the alias as is.
                if ($this->task->is_samesite()) {
                    $fs->create_file_from_reference($info->newfile, $repository->id, $info->oldfile->reference);
                    $this->notify_success($info);
                    continue;

                // If we are at other site, we can't restore this alias.
                } else {
                    $this->notify_failure($info, 'restoring at another site');
                    continue;
                }
            }
        }
        $rs->close();
    }
165723
public void setExecutions(java.util.Collection<ExecutionListItem> executions) {
        if (executions == null) {
            this.executions = null;
            return;
        }

        this.executions = new java.util.ArrayList<ExecutionListItem>(executions);
    }