Executes the job.

@throws \Aimeos\Controller\Jobs\Exception If an error occurs
775269
public function run()
	{
		$context = $this->getContext();
		$config = $context->getConfig();


		/** controller/jobs/product/bought/max-items
		 * Maximum number of suggested items per product
		 *
		 * Each product can contain zero or more suggested products based on
		 * the used algorithm. The maximum number of items limits the quantity
		 * of products that are associated as suggestions to one product.
		 * Usually, you don't need more products than shown in the product
		 * detail view as suggested products.
		 *
		 * @param integer Number of suggested products
		 * @since 2014.09
		 * @category Developer
		 * @category User
		 * @see controller/jobs/product/bought/min-support
		 * @see controller/jobs/product/bought/min-confidence
		 * @see controller/jobs/product/bought/limit-days
		 */
		$maxItems = $config->get( 'controller/jobs/product/bought/max-items', 5 );

		/** controller/jobs/product/bought/min-support
		 * Minimum support value to sort out all irrelevant combinations
		 *
		 * A minimum support value of 0.02 requires the combination of two
		 * products to be in at least 2% of all orders to be considered relevant
		 * enough as product suggestion.
		 *
		 * You can tune this value for your needs, e.g. if you sell several
		 * thousands different products and you have only a few suggestions for
		 * all products, a lower value might work better for you. The other way
		 * round, if you sell less than thousand different products, you may
		 * have a lot of product suggestions of low quality. In this case it's
		 * better to increase this value, e.g. to 0.05 or higher.
		 *
		 * Caution: Decreasing the support to lower values than 0.01 exponentially
		 * increases the time for generating the suggestions. If your database
		 * contains a lot of orders, the time to complete the job may rise from
		 * hours to days!
		 *
		 * @param float Minimum support value from 0 to 1
		 * @since 2014.09
		 * @category Developer
		 * @category User
		 * @see controller/jobs/product/bought/max-items
		 * @see controller/jobs/product/bought/min-confidence
		 * @see controller/jobs/product/bought/limit-days
		 */
		$minSupport = $config->get( 'controller/jobs/product/bought/min-support', 0.02 );

		/** controller/jobs/product/bought/min-confidence
		 * Minimum confidence value for high quality suggestions
		 *
		 * The confidence value is used to remove low quality suggestions. Using
		 * a confidence value of 0.95 would only suggest product combinations
		 * that are almost always bought together. Contrary, a value of 0.1 would
		 * yield a lot of combinations that are bought together only in very rare
		 * cases.
		 *
		 * To get good product suggestions, the value should be at least above
		 * 0.5 and the higher the value, the better the suggestions. You can
		 * either increase the default value to get better suggestions or lower
		 * the value to get more suggestions per product if you have only a few
		 * ones in total.
		 *
		 * @param float Minimum confidence value from 0 to 1
		 * @since 2014.09
		 * @category Developer
		 * @category User
		 * @see controller/jobs/product/bought/max-items
		 * @see controller/jobs/product/bought/min-support
		 * @see controller/jobs/product/bought/limit-days
		 */
		$minConfidence = $config->get( 'controller/jobs/product/bought/min-confidence', 0.66 );

		/** controller/jobs/product/bought/limit-days
		 * Only use orders placed in the past within the configured number of days for calculating bought together products
		 *
		 * This option limits the orders that are evaluated for calculating the
		 * bought together products. Only ordered products that were bought by
		 * customers within the configured number of days are used.
		 *
		 * Limiting the orders taken into account to the last ones increases the
		 * quality of suggestions if customer interests shifts to new products.
		 * If you only have a few orders per month, you can also increase this
		 * value to several years to get enough suggestions. Please keep in mind
		 * that the more orders are evaluated, the longer the it takes to
		 * calculate the product combinations.
		 *
		 * @param integer Number of days
		 * @since 2014.09
		 * @category User
		 * @category Developer
		 * @see controller/jobs/product/bought/max-items
		 * @see controller/jobs/product/bought/min-support
		 * @see controller/jobs/product/bought/min-confidence
		 */
		$days = $config->get( 'controller/jobs/product/bought/limit-days', 180 );
		$date = date( 'Y-m-d H:i:s', time() - $days * 86400 );


		$baseManager = \Aimeos\MShop::create( $context, 'order/base' );
		$search = $baseManager->createSearch();
		$search->setConditions( $search->compare( '>', 'order.base.ctime', $date ) );
		$search->setSlice( 0, 0 );
		$totalOrders = 0;
		$baseManager->searchItems( $search, [], $totalOrders );

		$baseProductManager = \Aimeos\MShop::create( $context, 'order/base/product' );
		$search = $baseProductManager->createSearch();
		$search->setConditions( $search->compare( '>', 'order.base.product.ctime', $date ) );
		$start = 0;

		do
		{
			$totalCounts = $baseProductManager->aggregate( $search, 'order.base.product.productid' );
			$prodIds = array_keys( $totalCounts );

			foreach( $totalCounts as $id => $count )
			{
				$this->removeListItems( $id );

				if( $count / $totalOrders > $minSupport )
				{
					$productIds = $this->getSuggestions( $id, $prodIds, $count, $totalOrders, $maxItems, $minSupport, $minConfidence, $date );
					$this->addListItems( $id, $productIds );
				}
			}

			$count = count( $totalCounts );
			$start += $count;
			$search->setSlice( $start );
		}
		while( $count >= $search->getSliceSize() );
	}
1368446
public function handle()
    {
        $input = $this->getCommandInput();

        if ($this->isRouteNameExists($this->getDotNotationName($this->getModelName($input->modelName), $input->prefix, 'index'))) {
            $this->warn("The routes already registered!");
            return;
        }

        $routesFile = $this->getRoutesFileName();

        if (!$this->isFileExists($routesFile)) {
            throw new Exception("The routes file does not exists. The expected location was " . $routesFile);
        }

        $stub = $this->getStubContent('routes');

        $controllnerName = $this->getControllerName($input->controllerName, $input->controllerDirectory);

        $this->replaceModelName($stub, $input->modelName)
            ->replaceControllerName($stub, $controllnerName)
            ->replaceRouteNames($stub, $this->getModelName($input->modelName), $input->prefix)
            ->processRoutesGroup($stub, $input->prefix, $input->controllerDirectory)
            ->appendToRoutesFile($stub, $routesFile)
            ->info('The routes were added successfully.');
    }
625435
public function handle()
    {
        // It's possible for the developer to specify the collections to modify in this
        // schema operation. The developer may also specify if this collection needs
        // to be freshly created so we can create the appropriate migrations.
        $name = Str::snake(trim($this->input->getArgument('name')));

        // Now we are ready to write the migration out to disk. Once we've written
        // the migration out, we will dump-autoload for the entire framework to
        // make sure that the migrations are registered by the class loaders.
        $this->writeMigration($name);

        $this->composer->dumpAutoloads();
    }
600982
public function execute()
    {
        foreach (array_unique($this->bootstrappers->all()) as $class) {
            $bootstrapper = $this->create($class);

            if (!method_exists($bootstrapper, 'run')) {
                throw new \RuntimeException("$class must have run() method");
            }

            $bootstrapper->run();
        }
    }
456428
public function execute()
    {
        $row = $this->_stmt->fetch();

        $batch = $this->getBatch();
        $count = $batch->getCounter('inserted_token_replacements');

        if ($row['gtrp_id_token_new'] == $this->_lastTokenId) {
            if (! $count) {
                $batch->addMessage($this->_('No token replacements to create'));
            }
            $this->_stopped = true;
            return;
        }

        $this->db->insert('gems__token_replacements', $row);

        $count = $batch->addToCounter('inserted_token_replacements');
        $batch->setMessage('inserted_replacements', sprintf(
                $this->plural('Created %d token replacement', 'Created %d token replacements', $count),
                $count
                ));

        $this->_lastTokenId = $row['gtrp_id_token_new'];
    }
656303
public function execute()
    {
        // Init the retry times
        if ($this->retries && is_null($this->leftRetries)) {
            $this->leftRetries = $this->retries;
        }

        // Prepare request
        $ch = $this->ch = curl_init();
        curl_setopt_array($ch, $this->prepareCurlOptions());
        $this->beforeSend && call_user_func($this->beforeSend, $this, $ch);

        // Execute request
        $response = curl_exec($ch);

        // Handle response
        $this->handleResponse($response);
        $this->complete && call_user_func($this->complete, $this, $ch);

        // Retry if response error
        if ($this->result === false && $this->leftRetries > 0) {
            $this->leftRetries--;
            $this->execute();
            return;
        }

        if ($this->throwException && $this->errorException) {
            throw $this->errorException;
        }
    }
327278
public function run()
    {
        $this->tryAssignController();
        if (!$this->isControllerAssigned()) {
            throw new Exception("It's unable to assign controller to this route path.");
        }
        $oCtrl = $this->createCtrl();
        $oCtrl->{$this->actionName}($this->actionArgs);
    }
1168991
public function execute() {
        global $DB;
        $started = time();

        $backupid = $this->get_custom_data()->backupid;
        $backuprecordid = $DB->get_field('backup_controllers', 'id', array('backupid' => $backupid), MUST_EXIST);
        mtrace('Processing asynchronous backup for backup: ' . $backupid);

        // Get the backup controller by backup id.
        $bc = \backup_controller::load_controller($backupid);
        $bc->set_progress(new \core\progress\db_updater($backuprecordid, 'backup_controllers', 'progress'));

        // Do some preflight checks on the backup.
        $status = $bc->get_status();
        $execution = $bc->get_execution();

        // Check that the backup is in the correct status and
        // that is set for asynchronous execution.
        if ($status == \backup::STATUS_AWAITING && $execution == \backup::EXECUTION_DELAYED) {
            // Execute the backup.
            $bc->execute_plan();

            // Send message to user if enabled.
            $messageenabled = (bool)get_config('backup', 'backup_async_message_users');
            if ($messageenabled && $bc->get_status() == \backup::STATUS_FINISHED_OK) {
                $asynchelper = new async_helper('backup', $backupid);
                $asynchelper->send_message();
            }

        } else {
            // If status isn't 700, it means the process has failed.
            // Retrying isn't going to fix it, so marked operation as failed.
            $bc->set_status(\backup::STATUS_FINISHED_ERR);
            mtrace('Bad backup controller status, is: ' . $status . ' should be 700, marking job as failed.');

        }

        // Cleanup.
        $bc->destroy();

        $duration = time() - $started;
        mtrace('Backup completed in: ' . $duration . ' seconds');
    }
60101
public function handle()
    {
        $exportPath = $this->option('path');

        if($exportPath) {
            if(!file_exists($exportPath)) {
                throw new \Exception('Path '.$exportPath. ' does not exists!');
            }
        }else{
            $exportPath = storage_path('app/dumper');

            // create dumper directory
            if(!file_exists($exportPath)) {
                File::makeDirectory($exportPath, 0755);
            }
        }

        $filePath = $exportPath.'/'.date("Ymdhisi").'.sql';
      
        $this->comment("Starting database dump...");

        switch (config('database.default')){
        case 'mysql':
            MySql::create()
                ->setDbName(config('database.connections.mysql.database'))
                ->setHost(config('database.connections.mysql.host'))
                ->setUserName(config('database.connections.mysql.username'))
                ->setPassword(config('database.connections.mysql.password'))
                ->dumpToFile($filePath);
            break;

        case 'pgsql':
            PostgreSql::create()
                ->setDbName(config('database.connections.pgsql.database'))
                ->setUserName(config('database.connections.pgsql.username'))
                ->setPassword(config('database.connections.pgsql.password'))
                ->dumpToFile($filePath);
            break;

        case 'sqlite':
            Sqlite::create()
                ->setDbName(config('database.connections.sqlite.database'))
                ->dumpToFile($filePath);
            break;

        case 'mongodb':
            MongoDb::create()
                ->setDbName(config('database.connections.mongodb.database'))
                ->setUserName(config('database.connections.mongodb.username'))
                ->setPassword(config('database.connections.mongodb.password'))
                ->dumpToFile($filePath);
            break;
        }

        $this->info("Database successfully dumped to ".$filePath);
    }
427549
public function execute()
    {
        //authenticate
        if ($this->authenticate()) {
            if ($this->helper->getFeefoLogon()) {
                $this->_view->loadLayout();
                $this->_view->renderLayout();
            }
        }
    }
85862
public function execute() {
        global $CFG, $DB;

        $timenow = time();

        // Cleanup read and unread notifications.
        if (!empty($CFG->messagingdeleteallnotificationsdelay)) {
            $notificationdeletetime = $timenow - $CFG->messagingdeleteallnotificationsdelay;
            $params = array('notificationdeletetime' => $notificationdeletetime);
            $DB->delete_records_select('notifications', 'timecreated < :notificationdeletetime', $params);
        }

        // Cleanup read notifications.
        if (!empty($CFG->messagingdeletereadnotificationsdelay)) {
            $notificationdeletetime = $timenow - $CFG->messagingdeletereadnotificationsdelay;
            $params = array('notificationdeletetime' => $notificationdeletetime);
            $DB->delete_records_select('notifications', 'timeread < :notificationdeletetime', $params);
        }
    }
1159702
public function handle()
    {
        // Next, we will check to see if a path option has been defined. If it has
        // we will use the path relative to the root of this installation folder
        // so that migrations may be run for any path within the applications.
        $this->migrator->run($this->getMigrationPaths(), []);

        // Once the migrator has run we will grab the note output and send it out to
        // the console screen, since the migrator itself functions without having
        // any instances of the OutputInterface contract passed into the class.
        foreach ($this->migrator->getNotes() as $note) {
            $this->output->writeln($note);
        }
    }
518055
public function handle()
    {
        foreach ($this->getJobIds() as $id) {
            $job = $this->laravel['queue.failer']->find($id);

            if (is_null($job)) {
                $this->error("Unable to find failed job with ID [{$id}].");
            } else {
                $this->retryJob($job);

                $this->info("The failed job [{$id}] has been pushed back onto the queue!");

                $this->laravel['queue.failer']->forget($id);
            }
        }
    }
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;
    }
1182808
public function execute() {
		$this->out(__d('cake_ldap', 'Synchronization with LDAP server in progress...'), 1, Shell::NORMAL);
		if ($this->QueuedTask->createJob('SyncEmployee', null, null, 'sync')) {
			$this->out(__d('cake_ldap', 'Synchronization with LDAP server set in queue successfully.'), 1, Shell::NORMAL);
		} else {
			$this->out('<error>' . __d('cake_ldap', 'Synchronization with LDAP server set in queue unsuccessfully.') . '</error>');
		}
	}
1178062
public function execute()
	{
		$query  = $this->factory->builder($this->update)->process();
		$result = $this->pdo->query($query);
		if(!$result)
		{
			throw new \Exception('An error while updating is occurred');
		}
	}
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());
    }