Executes the job.

@throws Controller_Jobs_Exception If an error occurs
160868
public function run()
	{
		$context = $this->_getContext();
		$serviceManager = MShop_Factory::createManager( $context, 'service' );

		$search = $serviceManager->createSearch();
		$start = 0;

		do
		{
			$serviceItems = $serviceManager->searchItems( $search );

			foreach( $serviceItems as $serviceItem )
			{
				try
				{
					$serviceManager->getProvider( $serviceItem )->updateAsync();
				}
				catch( Exception $e )
				{
					$msg = 'Executing updateAsyc() of "%1$s" failed: %2$s';
					$context->getLogger()->log( sprintf( $msg, $serviceItem->getProvider(), $e->getMessage() ) );
				}
			}

			$count = count( $serviceItems );
			$start += $count;
			$search->setSlice( $start );
		}
		while( $count >= $search->getSliceSize() );
	}
684292
public function executeJob()
    {
        $this->markStarted();
        try {
            $resultMsg = $this->run();
            if (strlen($resultMsg) == 0) {
                $resultMsg = t('The Job was run successfully.');
            }
            $error = static::JOB_SUCCESS;
        } catch (\Exception $e) {
            $resultMsg = $e->getMessage();
            $error = static::JOB_ERROR_EXCEPTION_GENERAL;
        }

        $je = new Event($this);
        Events::dispatch('on_job_execute', $je);

        $obj = $this->markCompleted($error, $resultMsg);

        return $obj;
    }
400932
protected function job(): void
    {
        while (true) {

            $logs = $this->retrieve([
                'corporation_id' => $this->getCorporationId(),
            ]);

            if ($logs->isCachedLoad()) return;

            collect($logs)->each(function ($log) {

                CorporationContainerLog::firstOrNew([
                    'corporation_id' => $this->getCorporationId(),
                    'container_id'   => $log->container_id,
                    'logged_at'      => carbon($log->logged_at),
                ])->fill([
                    'container_type_id'  => $log->container_type_id,
                    'character_id'       => $log->character_id,
                    'location_id'        => $log->location_id,
                    'action'             => $log->action,
                    'location_flag'      => $log->location_flag,
                    'password_type'      => $log->password_type ?? null,
                    'type_id'            => $log->type_id ?? null,
                    'quantity'           => $log->quantity ?? null,
                    'old_config_bitmask' => $log->old_config_bitmask ?? null,
                    'new_config_bitmask' => $log->new_config_bitmask ?? null,
                ])->save();

            });

            if (! $this->nextPage($logs->pages))
                break;
        }
    }
201602
public function run(): void
    {
        try {
            /** @var \Ffcms\Core\Arch\Controller $callClass */
            $callClass = $this->getCallbackClass();
            $callMethod = 'action' . self::$Request->getAction();
            $arguments = self::$Request->getArguments();

            // check if callback method (action) is exist in class object
            if (!method_exists($callClass, $callMethod)) {
                throw new NotFoundException('Method "' . App::$Security->strip_tags($callMethod) . '()" not founded in "' . get_class($callClass) . '"');
            }

            // check if method arguments counts equals passed count
            $requiredArgCount = $this->getMethodRequiredArgCount($callClass, $callMethod);

            // compare method arg count with passed
            if (count($arguments) < $requiredArgCount) {
                throw new NotFoundException(__('Arguments for method %method% is not enough. Expected: %required%, got: %current%.', [
                    'method' => $callMethod,
                    'required' => $requiredArgCount,
                    'current' => count($arguments)
                ]));
            }

            // make callback call to action in controller and get response
            $response = call_user_func_array([$callClass, $callMethod], $arguments);

            // if no response - throw 404 not found
            if (!$response) {
                throw new NotFoundException('Page not found: 404 error');
            }
        } catch (\Exception $e) {
            // check if exception is system-based throw
            if ($e instanceof TemplateException) {
                $response = $e->display();
            } else { // or hook exception to system based :)))
                if (App::$Debug) {
                    $msg = $e->getMessage() . $e->getTraceAsString();
                    $response = (new NativeException($msg))->display();
                } else {
                    $response = (new NativeException($e->getMessage()))->display();
                }
            }
        }

        // set full rendered content to response builder
        self::$Response->setContent($response);
        // echo full response to user via symfony http foundation
        self::$Response->send();
    }
1277323
public function execute()
    {
        $this->response = curl_exec($this->curlHandle);

        $this->checkForErrors();

        list($this->responseHeaders, $this->responseBody) = explode("\r\n\r\n", $this->response, 2);
    }
709134
public function execute()
    {
        // If the jobset is finished or failed
        // the jobset may need to be dispatched
        // so we return true
        if ($this->isFinished() || $this->isFailed()) {
            return true;
        }
        // Just return false to tell to terminate the process
        if (!$this->isInTime()) {
            return false;
        }
        // return false means the jobset is done
        // and the process should be terminated
        if ($this->isDispatched() || $this->isCanceled()) {
            return false;
        }

        try {
            if (!$this->jobs) {
                $this->initJobs();
            }

            $this->doUnorderedJobs();
            $this->doOrderedJobs();

            $status = $this->getJobsetExecutionStatus();
            if ($status === JobsConst::JOB_SET_STATUS_FAILED) {
                $this->failed();
            } else {
                $this->updateStatus($status);
            }
        } catch (\Exception $e) {
            // just throw it
            throw $e;
        }

        return true;
    }
1244052
protected function run()
    {
        $this->silentRunActionTrigger(Action::EVENT_START);
        try {
            $event = $this->action->execute($this->control, $this->context) ?: Action::EVENT_SUCCESS;
            $this->context->exitCode = 0;
        } catch (ErrorException $errorException) {
            $event = Action::EVENT_ERROR;
            $this->context->exception = $errorException;
            $this->context->exitCode = 2;
        } catch (Exception $exception) {
            $event = Action::EVENT_FAILURE;
            $this->context->exception = $exception;
            $this->context->exitCode = 1;
        }
        $this->context->finishTime = time();
        $this->silentRunActionTrigger($event);
        $this->silentRunActionTrigger(Action::EVENT_FINISH);
    }
961796
public function run()
    {
        $this->config->setParams($this->buildParams($this->config));

        $parentId = $this->getParentId();

        $request = $this->firstPage($this->config);
        while ($request !== false) {
            $response = $this->download($request);

            $responseHash = sha1(serialize($response));
            if ($responseHash == $this->lastResponseHash) {
                $this->logger->debug(sprintf(
                    "Job '%s' finished when last response matched the previous!",
                    $this->getJobId()
                ));
                $this->scroller->reset();
                break;
            } else {
                $data = $this->runResponseModules($response, $this->config);
                $data = $this->filterResponse($this->config, $data);
                $this->parse($data, $parentId);

                $this->lastResponseHash = $responseHash;
            }

            $request = $this->nextPage($this->config, $response, $data);
        }
    }
130676
private function runController(): void
    {
        //get route information
        $action = $this->routeAction;
        $param = $this->routeParam;

        //action - call controller passing params
        if (!empty($param)) {
            \call_user_func_array([$this->controller, $action], $param);
            return;
        }

        //action - call controller
        if ($action) {
            \call_user_func([$this->controller, $action]);
        }
    }
191037
public function run()
    {
        $data       = $this->parseRequestUri();
        $controller = $data['controller'];
        $method     = $data['method'];
        $params     = $data['params'];

        $subModule  = $this->subModule;
        if ("" != $subModule) {
            $subModule = "\\" . $subModule;
        }

        $class      = sprintf("%s\\Controller%s\\%sController", $this->appNameSpace, $subModule, $controller);
        if (!(class_exists($class) && method_exists($class, $method))) {
            $this->fileNotFound();
        } else {
            $class  = new $class;
            $pipe = new Pipeline();
            $pipe->through($class->getMiddleWare())->then(function () use ($class, $method, $params) {
                call_user_func_array(array($class, $method), $params);
            });

            //call_user_func_array(array($class, $method), $params);
        }
    }
465288
public function run()
    {
        // Get and instantiate the reporter class, load files
        $reporterClass = self::$console->getReporterClass();
        $this->reporter = new $reporterClass(self::$console);

        $this->reporter->beforeRun();
        foreach ($this->suites as $suite) {
            $this->runSuite($suite);
        }
        $this->reporter->afterRun();

        if (self::$console->options['watch']) {
            $this->watch();
        }
    }
522123
public function run()
    {
        // choosing which controller action must be executed
        $sAction = $this->_chooseCurrentAction();

        // executing action which returns name of template to render
        /** @var Controller $oController */
        $oController = $this->getInstance("Controller");

        $view = $oController->getView();
        $view->sendHeaders();

        try {
            $oController->$sAction();
        } catch (SetupControllerExitException $exception) {
        } finally {
            $view->display();
        }
    }
867658
public function run()
    {
        Assertion::notEmpty(
            $this->loaders,
            'No loader attached.',
            DataAggregatorException::NO_LOADER_ATTACHED
        );

        foreach ($this->loaders as $identifier => $loader) {
            $this->executeLoader($loader);
        }
    }
110264
public function execute()
    {
        foreach ($this->getJobs() as $key => $job) {
            try {
                $this->console($job, $key + 1);
                $task = $this->createTask($job);
                $return = $task->run();
                $this->getAdapter()->history(HistoryInterface::STATUS_OK, $job, is_string($return) ? $return : null);
            } catch (\Exception $exc) {
                $this->log($job, $exc);
            }
        }

        $this->getAdapter()->finishProcessing($this->getJobs());
    }
951953
public function handle()
    {
        $exception = $this->getException();

        Log::logger('ErrorHandler')->error($exception->getMessage(), [
            'exception' => get_class($exception),
            'file' => sprintf(
                "%s on line %d",
                $exception->getFile(),
                $exception->getLine()
            )
        ]);

        $template = new Template();

        $template = $template->initialize();
        $view = 'errors/500.html.twig';
        $code = 500;
        if (
            ($exception instanceof ControllerNotFoundException) ||
            ($exception instanceof ActionNotFoundException)
        ) {
            $view = 'errors/404.html.twig';
            $code = 404;
        }

        $data = ['exception' => $exception];
        $html = $template->parse($view)
            ->process($data);

        $this->app->response->setStatusCode($code)
            ->setContent($html);

        $this->app->response->send();
    }
858506
protected function job(): void
    {
        while (true) {

            $industry_jobs = $this->retrieve([
                'corporation_id' => $this->getCorporationId(),
            ]);

            if ($industry_jobs->isCachedLoad()) return;

            collect($industry_jobs)->each(function ($job) {

                CorporationIndustryJob::firstOrNew([
                    'corporation_id' => $this->getCorporationId(),
                    'job_id'         => $job->job_id,
                ])->fill([
                    'installer_id'           => $job->installer_id,
                    'facility_id'            => $job->facility_id,
                    'location_id'            => $job->location_id,
                    'activity_id'            => $job->activity_id,
                    'blueprint_id'           => $job->blueprint_id,
                    'blueprint_type_id'      => $job->blueprint_type_id,
                    'blueprint_location_id'  => $job->blueprint_location_id,
                    'output_location_id'     => $job->output_location_id,
                    'runs'                   => $job->runs,
                    'cost'                   => $job->cost ?? null,
                    'licensed_runs'          => $job->licensed_runs ?? null,
                    'probability'            => $job->probability ?? null,
                    'product_type_id'        => $job->product_type_id ?? null,
                    'status'                 => $job->status,
                    'duration'               => $job->duration,
                    'start_date'             => carbon($job->start_date),
                    'end_date'               => carbon($job->end_date),
                    'pause_date'             => property_exists($job, 'pause_date') ?
                        carbon($job->pause_date) : null,
                    'completed_date'         => property_exists($job, 'completed_date') ?
                        carbon($job->completed_date) : null,
                    'completed_character_id' => $job->completed_character_id ?? null,
                    'successful_runs'        => $job->successful_runs ?? null,
                ])->save();
            });

            if (! $this->nextPage($industry_jobs->pages))
                return;
        }
    }
1304040
protected function job(): void
    {
        $members = $this->retrieve([
            'corporation_id' => $this->getCorporationId(),
        ]);

        if ($members->isCachedLoad()) return;

        collect($members)->each(function ($member) {

            CorporationMemberTracking::firstOrNew([
                'corporation_id' => $this->getCorporationId(),
                'character_id'   => $member->character_id,
            ])->fill([
                'start_date'   => property_exists($member, 'start_date') ?
                    carbon($member->start_date) : null,
                'base_id'      => $member->base_id ?? null,
                'logon_date'   => property_exists($member, 'logon_date') ?
                    carbon($member->logon_date) : null,
                'logoff_date'  => property_exists($member, 'logoff_date') ?
                    carbon($member->logoff_date) : null,
                'location_id'  => $member->location_id ?? null,
                'ship_type_id' => $member->ship_type_id ?? null,
            ])->save();
        });

        CorporationMemberTracking::where('corporation_id', $this->getCorporationId())
            ->whereNotIn('character_id', collect($members)->pluck('character_id')->all())
            ->delete();
    }