Runs this job.

First retrieves the handler fro the database. Then perform the job.

@return bool Whether or not the job succeeded.
186027
public function run() {
        # pull the handler from the db
        $handler = $this->getHandler();
        if (!is_object($handler)) {
            $msg = "[JOB] bad handler for job::{$this->job_id}";
            $this->finishWithError($msg);
            return false;
        }

        # run the handler
        try {

            if ($this->fail_on_output) {
                ob_start();                
            }

            $handler->perform();

            if ($this->fail_on_output) {
                $output = ob_get_contents();
                ob_end_clean();

                if (!empty($output)) {
                    throw new Exception("Job produced unexpected output: $output");
                }
            }

            # cleanup
            $this->finish();
            return true;

        } catch (DJRetryException $e) {
            if ($this->fail_on_output) {
                ob_end_flush();
            }
            
            # attempts hasn't been incremented yet.
            $attempts = $this->getAttempts()+1;

            $msg = "Caught DJRetryException \"{$e->getMessage()}\" on attempt $attempts/{$this->max_attempts}.";

            if($attempts == $this->max_attempts) {
                $msg = "[JOB] job::{$this->job_id} $msg Giving up.";
                $this->finishWithError($msg, $handler);
            } else {
                $this->log("[JOB] job::{$this->job_id} $msg Try again in {$e->getDelay()} seconds.", self::WARN);
                $this->retryLater($e->getDelay());
            }
            return false;

        } catch (Exception $e) {
            if ($this->fail_on_output) {
                ob_end_flush();
            }

            $this->finishWithError($e->getMessage(), $handler);
            return false;

        }
    }
1128317
protected function runJob() {
        if (isset($this->callbackChildren[$this->uid])) {
            $callback = $this->callbackChildren[$this->uid];
            $result = $callback->call($this->callbackParamChildren[$this->uid]);
        } else if ($this->callback) {
            $result = $this->callback->call($this->callbackParam);
        } else {
            $result = null; // no job
        }
        if ($this->getShareResult()) {
            $this->getStorage()->write($this->uid, $result);
        }
        posix_kill($this->pid, 9);
    }
130538
public final function run()
    {
        $this->registerServices();
        $this->registerCommands();
        return $this->symfonyApplication->run($this->input, $this->output);
    }
1238080
public function execute()
    {
        $success = true;
        foreach ($this->commandList as $command) {
            if (!$this->runSingleCommand($command)) {
                $success = false;
                break;
            }
        }
        return $success;
    }
533361
public function run() {
        $results = [
            $this->simulateDelete(),
            $this->simulateUpdate(),
            $this->simulateCreate()
        ];
        
        return array_search(false, $results, true) === false;
    }
625522
public function run()
    {
        try {
            $this->initWebSocketServer()->run();

            return true;
        } catch (Exception\Quit $e) {
            $this->getLogger()->success(
                $e->getMessage()
            );

            return true;
        } catch (\Exception $e) {
            $traces = array_reverse(explode(PHP_EOL, $e->getTraceAsString()));

            foreach ($traces as $key => $trace) {
                $trace = explode(' ', $trace, 2);

                $traces[$key] = sprintf(
                    '#%s > %s',
                    str_pad($key + 1, strlen(count($traces)), '0', STR_PAD_LEFT),
                    $trace[1]
                );
            }

            $this->getLogger()->error(
                "%s: %s\n%s",
                get_class($e),
                $e->getMessage(),
                implode("\n", $traces)
            );

            return false;
        }
    }
656953
public function run()
    {
        $this->_scanner->stdout('Detect DatabaseTable - BEGIN', Console::FG_GREY);
        if (is_array($this->_tables)) {
            foreach ($this->_tables as $tables) {
                $this->_scanningTable($tables);
            }
        }

        $this->_scanner->stdout('Detect DatabaseTable - END', Console::FG_GREY);
    }
1318385
public function run()
	{
		$this->say('Mapping ' . $this->getJConfig()->extension . " to " . $this->target);
		$this->say('OS: ' . $this->getOs() . " | Basedir: " . $this->getSourceFolder());

		if (!$this->checkFolders())
		{
			return false;
		}

		$dirHandle = opendir($this->getSourceFolder());

		// Get all main dirs
		while (false !== ($element = readdir($dirHandle)))
		{
			if (substr($element, 0, 1) == '.')
			{
				continue;
			}

			$method = 'process' . ucfirst($element);

			if (method_exists($this, $method))
			{
				$this->$method($this->getSourceFolder() . "/" . $element, $this->target);
			}
			else
			{
				$this->say('Missing method: ' . $method);
			}
		}

		closedir($dirHandle);

		$this->say("Finished symlinking into Joomla!");

		return true;
	}
584378
public function run()
    {
        $hasChanges = false;
        foreach ($this->tables as $table) {
            if (
                $table->getComparator()->hasChanges()
                || $table->getStatus() == AbstractTable::STATUS_DECLARED_DROPPED
            ) {
                $hasChanges = true;
                break;
            }
        }

        if (!$hasChanges) {
            //Nothing to do
            return;
        }

        $this->beginTransaction();

        try {
            //Drop not-needed foreign keys and alter everything else
            $this->dropForeignKeys();

            //Drop not-needed indexes
            $this->dropIndexes();

            //Other changes [NEW TABLES WILL BE CREATED HERE!]
            foreach ($this->commitChanges() as $table) {
                $table->save(HandlerInterface::CREATE_FOREIGN_KEYS, true);
            }
        } catch (\Throwable $e) {
            $this->rollbackTransaction();
            throw $e;
        }

        $this->commitTransaction();
    }
721061
public function executeJob()
    {
        // If the job's already running, don't try to restart it
        if ($this->getJobStatus() !== 'RUNNING') {
            $queue = $this->markStarted();

            // Prepare the queue for processing
            $this->start($queue);
        } else {
            $queue = $this->getQueueObject();
        }

        try {
            $batchSize = $this->getJobQueueBatchSize() ?: PHP_INT_MAX;

            // Loop over queue batches
            while (($messages = $queue->receive($batchSize)) && $messages->count() > 0) {
                // Run the batch
                $this->executeBatch($messages, $queue);
            }

            // Mark the queue as finished
            $output = $this->finish($queue);

            // Mark the job as completed
            $result = $this->markCompleted(0, $output);
        } catch (\Exception $e) {
            $result = $this->markCompleted(Job::JOB_ERROR_EXCEPTION_GENERAL, $e->getMessage());
            $result->message = $result->result; // needed for progressive library.
        }

        return $result;
    }
1084847
public function run()
	{
		return $this->style->getCharacter()->setIsStrikethrough(
			$this->parameter === null || (bool) $this->parameter
		);
	}
722416
public function run()
	{
		$context = $this->getContext();

		$jobManager = \Aimeos\MAdmin\Job\Manager\Factory::createManager( $context );
		$criteria = $jobManager->createSearch( true );

		$start = 0;

		do
		{
			$items = $jobManager->searchItems( $criteria );

			foreach( $items as $item )
			{
				try
				{
					$job = $item->getMethod();

					if( preg_match( '/^[a-zA-Z0-9\_]+\.[a-zA-Z0-9\_]+$/', $job ) !== 1 ) {
						throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in job name "%1$s"', $job ) );
					}

					$parts = explode( '.', $job );

					if( count( $parts ) !== 2 ) {
						throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid job method "%1$s"', $job ) );
					}

					$method = $parts[1];
					$class = str_replace( '_', '\\', $parts[0] );
					$name = '\\Aimeos\\Controller\\ExtJS\\' . $class . '\\Factory';

					if( class_exists( $name ) === false ) {
						throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not available', $name ) );
					}

					$name .= '::createController';

					if( ( $controller = call_user_func_array( $name, array( $context ) ) ) === false ) {
						throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Unable to call factory method "%1$s"', $name ) );
					}

					if( method_exists( $controller, $method ) === false ) {
						throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Method "%1$s" not available', $method ) );
					}

					$result = $controller->$method( (object) $item->getParameter() );

					$item->setResult( $result );
					$item->setStatus( -1 );
				}
				catch( \Exception $e )
				{
					$str = 'Error while processing job "%1$s": %2$s';
					$context->getLogger()->log( sprintf( $str, $item->getMethod(), $e->getMessage() ) );
					$item->setStatus( 0 );
				}

				$jobManager->saveItem( $item, false );
			}

			$count = count( $items );
			$start += $count;
			$criteria->setSlice( $start );
		}
		while( $count > 0 );
	}
1046163
public function execute()
    {
        $successful = true;
        try {
            // Dump all databases
            $this->databaseManager->dump();

            // Backup folders if specified
            $this->logger->info('[dizda-backup] Copying folders.');
            $this->processorManager->copyFolders();

            // Compress everything
            $this->logger->info(sprintf('[dizda-backup] Compressing to archive using %s', $this->processorManager->getName()));
            $this->processorManager->compress();

            // Transfer with all clients
            $this->clientManager->upload($this->processorManager->getArchivePath());
        } catch (\Exception $e) {
            // Write log
            $this->logger->critical('[dizda-backup] Unexpected exception.', array('exception' => $e));

            $successful = false;
        }

        try {
            // If we catch an exception or not, we would still like to try cleaning up after us
            $this->logger->info('[dizda-backup] Cleaning up after us.');
            $this->processorManager->cleanUp();
        } catch (IOException $e) {
            $this->logger->error('[dizda-backup] Cleaning up failed.', array('exception' => $e));

            return false;
        }

        if ($successful) {
            $this->eventDispatcher->dispatch(BackupEvent::BACKUP_COMPLETED, new BackupEvent());
        }

        return $successful;
    }
1070879
public function run(): bool
    {
        if ($this->startup) {
            $this->logger->debug('Calling startup callback');
            call_user_func($this->startup, $this);
        }

        $actions = implode(', ', array_keys($this->callbacks));
        $this->logger->info("Component running with callbacks for $actions");
        $this->executor->execute(
            $this->apiFactory,
            $this->input,
            $this->callbacks,
            $this->error
        );

        if ($this->shutdown) {
            $this->logger->debug('Calling shutdown callback');
            call_user_func($this->shutdown, $this);
        }

        return true;
    }
9944
public function run()
    {
        if (!isset($this->conditions)
            || !isset($this->callable)
        ) {

            $message = "You have called the run function but have not provided both a array of conditions";
            $message .= " and a callable function, which will be called if all the given conditions are met.";

            throw new \RuntimeException($message);
        }

        $this->conditions->rewind();
        while ($this->conditions->valid()) {

            $condition = $this->conditions->current();

            if (!call_user_func($condition)) {
                return false;
            }

            $this->conditions->next();
        }

        call_user_func($this->callable, $this->request);
        return true;

    }
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;
    }
6581
public function run()
    {
        if (!$this->beforeRun()) {
            return;
        }
        $result = null;
        if (is_callable($this->work)) {
            $result = call_user_func_array($this->work, [$this, $this->getData()]);
        }

        return $this->afterRun($result);
    }