Execute update application.

@return Response
174140
public function executeAction()
    {
        // update for Windows XP does not work
        if (strpos(php_uname('v'), 'Windows XP') !== false) {
            $this->redirect($this->generateUrl('update'));
        }

        // execute update
        file_put_contents($this->container->getParameter('kernel.root_dir').'/../web/update.log', '');
        $this->get('anime_db.command')
            ->send('php app/console animedb:update --env=prod --no-ansi >web/update.log 2>&1');

        return $this->render('AnimeDbCatalogBundle:Update:execute.html.twig', [
            'log_file' => '/update.log',
            'end_message' => self::END_MESSAGE,
        ]);
    }
239300
public function execute() {
        global $DB;

        $userid = $this->get_custom_data()->userid;

        // Get the user's preference.
        $hasbeenmigrated = get_user_preferences('core_message_migrate_data', false, $userid);

        if (!$hasbeenmigrated) {
            // To determine if we should update the preference.
            $updatepreference = true;

            // Get all the users the current user has received a message from.
            $sql = "SELECT DISTINCT(useridfrom)
                      FROM {message} m
                     WHERE useridto = ?
                     UNION
                    SELECT DISTINCT(useridfrom)
                      FROM {message_read} m
                     WHERE useridto = ?";
            $users = $DB->get_records_sql($sql, [$userid, $userid]);

            // Get all the users the current user has messaged.
            $sql = "SELECT DISTINCT(useridto)
                      FROM {message} m
                     WHERE useridfrom = ?
                     UNION
                    SELECT DISTINCT(useridto)
                      FROM {message_read} m
                     WHERE useridfrom = ?";
            $users = $users + $DB->get_records_sql($sql, [$userid, $userid]);
            if (!empty($users)) {
                // Loop through each user and migrate the data.
                foreach ($users as $otheruserid => $user) {
                    $ids = [$userid, $otheruserid];
                    sort($ids);
                    $key = implode('_', $ids);

                    // Set the lock data.
                    $timeout = 5; // In seconds.
                    $locktype = 'core_message_migrate_data';

                    // Get an instance of the currently configured lock factory.
                    $lockfactory = \core\lock\lock_config::get_lock_factory($locktype);

                    // See if we can grab this lock.
                    if ($lock = $lockfactory->get_lock($key, $timeout)) {
                        try {
                            $transaction = $DB->start_delegated_transaction();
                            $this->migrate_data($userid, $otheruserid);
                            $transaction->allow_commit();
                        } catch (\Throwable $e) {
                            throw $e;
                        } finally {
                            $lock->release();
                        }
                    } else {
                        // Couldn't get a lock, move on to next user but make sure we don't update user preference so
                        // we still try again.
                        $updatepreference = false;
                        continue;
                    }
                }
            }

            if ($updatepreference) {
                set_user_preference('core_message_migrate_data', true, $userid);
            } else {
                // Throwing an exception in the task will mean that it isn't removed from the queue and is tried again.
                throw new \moodle_exception('Task failed.');
            }
        }
    }
304205
public function execute()
    {
        $this->prepareExecute();

        // @event onBeforeExecute

        // Perform application routines.
        $response = $this->doExecute();

        // @event onAfterExecute

        $this->postExecute();

        // @event onBeforeRespond

        $this->server->getOutput()->respond($response);
        // @event onAfterRespond
    }
134759
public function update() {
		$message = new CRUDMessage ( "Modifications were successfully saved", "Updating" );
		$instance = $_SESSION ["instance"] ?? null;
		if (isset ( $instance )) {
			$isNew = $instance->_new;
			try {
				$updated = CRUDHelper::update ( $instance, $_POST );
				if ($updated) {
					$message->setType ( "success" )->setIcon ( "check circle outline" );
					$message = $this->_getEvents ()->onSuccessUpdateMessage ( $message, $instance );
					$this->refreshInstance ( $instance, $isNew );
				} else {
					$message->setMessage ( "An error has occurred. Can not save changes." )->setType ( "error" )->setIcon ( "warning circle" );
					$message = $this->_getEvents ()->onErrorUpdateMessage ( $message, $instance );
				}
			} catch ( \Exception $e ) {
				$instanceString = $this->getInstanceToString ( $instance );
				$message = new CRUDMessage ( "Exception : can not update `" . $instanceString . "`", "Exception", "warning", "warning" );
				$message = $this->_getEvents ()->onErrorUpdateMessage ( $message, $instance );
			}
			echo $this->_showSimpleMessage ( $message, "updateMsg" );
			echo $this->jquery->compile ( $this->view );
			return $instance;
		} else {
			throw new \Exception ( '$_SESSION["instance"] is null' );
		}
	}
129398
public function execute()
    {
        //Now load all patches, and save the resulting changed patches for later (not used yet)
        $changed  = $this->patcher->uploadPatches($this->loader->getVersions()->getBuild());


        if ($changed) {
            $this->getBatch()->addMessage(sprintf($this->_('%d new or changed patch(es).'), $changed));
        }
    }
763930
protected function handlePATCH()
    {
        $content = $this->getPayloadData();
        if (empty($this->folderPath)) {
            // update container properties
            $this->driver->updateContainerProperties($this->container, $content);
        } else {
            if (empty($this->filePath)) {
                // update folder properties
                $this->driver->updateFolderProperties($this->container, $this->folderPath, $content);
            } else {
                // update file properties?
                $this->driver->updateFileProperties($this->container, $this->filePath, $content);
            }
        }

        return ResponseFactory::create(['success' => true]);
    }
959036
public function executeAction(Update $message)
    {
        if (is_callable($this->action)) {
            return call_user_func($this->action, $message);
        }

        return false;
    }
1153274
public function execute() {
        if (!is_enabled_auth('db')) {
            mtrace('auth_db plugin is disabled, synchronisation stopped', 2);
            return;
        }

        $dbauth = get_auth_plugin('db');
        $config = get_config('auth_db');
        $trace = new \text_progress_trace();
        $update = !empty($config->updateusers);
        $dbauth->sync_users($trace, $update);
    }
525268
public function actionUpdate()
    {
        $data = [
            'f1' => $this->getContext()->getInput()->post('p1'),
            'f2' => $this->getContext()->getInput()->post('p2'),
            'id' => $this->getContext()->getInput()->get('id')
        ];

        $this->outputJson($data);
    }
1117533
private function executeExtraUpdates()
    {
        foreach ($this->extraUpdates as $oid => $update) {
            [$entity, $changeset] = $update;

            $this->entityChangeSets[$oid] = $changeset;

            $this->getEntityPersister(get_class($entity))->update($entity);
        }

        $this->extraUpdates = [];
    }
430085
protected function execute()
    {
        $response = $this->service->IPGApiAction($this);

        if ($response instanceof Error) {
            return $response;
        }

        if ($this->function === self::FUNCTION_INSTALL) {
            return new Sell($response);
        }

        return new ConfirmRecurring($response);
    }
1260714
public function processUpdateAction()
    {
        // Check current user authorization
        if (null !== $response = $this->checkAuth(AdminResources::MODULE, Team::getModuleCode(),
                AccessManager::UPDATE)
        ) {
            return $response;
        }

        // Error (Default: false)
        $error_msg = false;

        // Create the Form from the request
        $changeForm = $this->getUpdateForm($this->getRequest());


        $con = Propel::getConnection();
        $con->beginTransaction();

        try {
            // Check the form against constraints violations
            $form = $this->validateForm($changeForm, "POST");

            // Get the form field values
            $data = $form->getData();

            $updatedObject = $this->getService()->updateFromArray($data, $this->getCurrentEditionLocale());

            // Check if object exist
            if (!$updatedObject) {
                throw new \LogicException(
                    $this->getTranslator()->trans("No %obj was updated.", ['%obj' => static::CONTROLLER_ENTITY_NAME])
                );
            }

            $con->commit();
            // If we have to stay on the same page, do not redirect to the successUrl,
            // just redirect to the edit page again.
            if ($this->getRequest()->get('save_mode') == 'stay') {
                return $this->redirectToEditionTemplate($this->getRequest());
            }

            // Redirect to the success URL
            return $this->generateSuccessRedirect($changeForm);

        } catch (FormValidationException $ex) {
            $con->rollBack();
            // Form cannot be validated
            $error_msg = $this->createStandardFormValidationErrorMessage($ex);
        } catch (\Exception $ex) {
            $con->rollBack();
            // Any other error
            $error_msg = $ex->getMessage();
        }

        if (false !== $error_msg) {
            // At this point, the form has errors, and should be redisplayed.
            $this->setupFormErrorContext(
                $this->getTranslator()->trans("%obj modification", ['%obj' => static::CONTROLLER_ENTITY_NAME]),
                $error_msg,
                $changeForm,
                $ex
            );

            return $this->getEditRenderTemplate();
        }
    }
715290
private function buildUpdateAction() {
        $api = new Swagger\Api();
        $api->setPath('/' . $this->getClassName() . '/{id}');
        $operation = new Swagger\Operation();
        $operation->setMethod('PUT');
        $operation->setSummary('Update ' . $this->singularModelA_Or_An() . '.');
        $operation->setNotes('Update ' . $this->singularModelA_Or_An() . '.');

        $operation->addParameter($this->buildIdParameter());
        $operation->addParameter($this->buildFieldsParameter());

        $parameter = new Swagger\Parameter();
        $parameter->setName('body');
        $parameter->setDescription($this->getPutPostBodyDescription(false));
        $parameter->setParamType('body');
        $parameter->setType($this->getClassName());
        $operation->addParameter($parameter);

        $responseMessage = new Swagger\ResponseMessage();
        $responseMessage->setCode(200);
        $responseMessage->setMessage(ucfirst($this->getModel()->getSource()) . ' was updated.');
        $responseMessage->setResponseModel($this->getClassName());
        $operation->addResponseMessage($responseMessage);

        $responseMessage = new Swagger\ResponseMessage();
        $responseMessage->setCode(304);
        $responseMessage->setMessage(ucfirst($this->getModel()->getSource()) . ' was not changed.');
        $operation->addResponseMessage($responseMessage);

        $responseMessage = $this->invalidFieldSpecifiedError();
        $operation->addResponseMessage($responseMessage);

        $responseMessage = $this->notAuthorizedResponse();
        $operation->addResponseMessage($responseMessage);

        $responseMessage = $this->notFoundResponse();
        $operation->addResponseMessage($responseMessage);

        $responseMessage = $this->invalidValuePassed();
        $operation->addResponseMessage($responseMessage);

        $api->addOperation($operation);
        $method = new Object\Method();
        $method->setDescription($api->__toString());
        $method->setReturnType('void');
        $method->setAccess('public');
        $method->setName('updateAction');
        $method->setContent('parent::updateAction();');
        $this->getObject()->addMethod($method);
    }
460251
public function actionUpdate()
	{
		$post=$this->loadPost();
		if(Yii::app()->request->isPostRequest)
		{
			if(isset($_POST['Post']))
				$post->setAttributes($_POST['Post']);
			if($post->save())
				$this->redirect(array('show','id'=>$post->id));
		}
		$this->render('update',array('post'=>$post));
	}
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');
		}
	}
981254
public function execute() {
        $accessrecords = access::get_records();
        $expires = new DateTime();
        $expires->sub(new DateInterval("P7D"));
        $timestamp = $expires->getTimestamp();

        $issuerid = get_config('onedrive', 'issuerid');
        $issuer = \core\oauth2\api::get_issuer($issuerid);

        // Add the current user as an OAuth writer.
        $systemauth = \core\oauth2\api::get_system_oauth_client($issuer);

        if ($systemauth === false) {
            $details = 'Cannot connect as system user';
            throw new repository_exception('errorwhilecommunicatingwith', 'repository', '', $details);
        }
        $systemservice = new \repository_onedrive\rest($systemauth);

        foreach ($accessrecords as $access) {
            if ($access->get('timemodified') < $timestamp) {
                $params = ['permissionid' => $access->get('permissionid'), 'itemid' => $access->get('itemid')];
                try {
                    $systemservice->call('delete_permission', $params);
                } catch (rest_exception $re) {
                    // We log and give up here or we will always fail for eternity.
                    mtrace('Failed to remove access from file: ' . $access->get('itemid'));
                }
                $access->delete();
            }
        }
    }
947171
public function execute()
    {
        /**
         * Migrate encrypted app settings to use new Encryption library
         */
        $oResult  = $this->query('SELECT id, value FROM {{NAILS_DB_PREFIX}}app_setting WHERE `is_encrypted` = 1');
        $oEncrypt = Factory::service('Encrypt');
        while ($oRow = $oResult->fetch(\PDO::FETCH_OBJ)) {

            $sNewCipher = $oEncrypt->migrate($oRow->value, APP_PRIVATE_KEY);

            //  Update the record
            $sQuery = '
                UPDATE `{{NAILS_DB_PREFIX}}app_setting`
                SET
                    `value` = :newValue
                WHERE
                    `id` = :id
            ';

            $oSth = $this->prepare($sQuery);

            $oSth->bindParam(':newValue', $sNewCipher, \PDO::PARAM_STR);
            $oSth->bindParam(':id', $oRow->id, \PDO::PARAM_INT);

            $oSth->execute();
        }
    }