Retrieves the info about the latest available information.
The effective request to the remote server is done just once per request.

@return RemoteApplicationUpdate|null
181150
public static function getApplicationUpdateInformation()
    {
        $app = Application::getFacadeApplication();
        $cache = $app->make('cache');
        $r = $cache->getItem('APP_UPDATE_INFO');
        if ($r->isMiss()) {
            $r->lock();
            $result = static::getLatestAvailableUpdate();
            $r->set($result)->save();
        } else {
            $result = $r->get();
        }

        return $result;
    }
940640
private function getUpdateQuery()
	{
		$result = $this->getUpdateClause();

		if ($where = $this->getWhereClause()) {
			$result .= ' ' . $where;
		}

		if ($limit = $this->getLimitClause()) {
			$result .= ' ' . $limit;
		}

		return $result;
	}
1158100
public function update()
    {
        // convert to criteria.
        $args = func_get_args();
        $attributes = array_shift($args);
        $criteria = call_user_func_array(array($this, 'argsToCriteria'), $args);

        // to SQL.
        $sql = $criteria->toUpdateSQL($attributes);

        // query.
        $sth = $this->query($sql, $criteria->getParams(), Database::TARGET_MASTER);
        return $sth->isSuccess();
    }
776278
public function getUpdatedAt() : ?string 
    {
        if ( ! $this->hasUpdatedAt()) {
            $this->setUpdatedAt($this->getDefaultUpdatedAt());
        }
        return $this->updatedAt;
    }
720533
protected function getFreshApplication()
    {
        if (method_exists($this->laravel, 'bootstrapPath')) {
            $app = require $this->laravel->bootstrapPath().'/app.php';
        } else {
            $app = require $this->laravel->basePath().'/bootstrap/app.php';
        }

        $app->make(Kernel::class)->bootstrap();

        return $app;
    }
433530
protected function getFreshApplication()
    {
        return tap(require $this->laravel->bootstrapPath().'/app.php', function ($app) {
            $app->make(ConsoleKernelContract::class)->bootstrap();
        });
    }
621419
private function getRequest()
    {
        if ($this->requestStack instanceof Request) {
            $request = $this->requestStack;
        } elseif ($this->requestStack instanceof RequestStack) {
            $request = $this->requestStack->getCurrentRequest();
        }

        if ($request !== null) {
            return $request;
        }

        throw new \RuntimeException('There is no current request.');
    }
1301747
public function remoteAddress(): ?string
    {
        $serverParams = $this->request()->getServerParams();

        return isset($serverParams['REMOTE_ADDR']) ? $serverParams['REMOTE_ADDR'] : null;
    }
1082865
public function newAction()
        {

            $oRemoteApp = new RemoteApp();
            $oRemoteApp->setApiUrl("swControl/");
            $oRemoteApp->setActivated(true);
            $oRemoteApp->setIncludelog(true);
            $oRemoteApp->setNotificationRecipient($this->getUser()->getEmail());
            $oRemoteApp->setNotificationSender($this->getUser()->getEmail());
            $oRemoteApp->setNotificationChange(true);
            $oRemoteApp->setNotificationError(true);
            $form = $this->createCreateForm($oRemoteApp);

            return $this->render('SlashworksAppBundle:RemoteApp:new.html.twig', array(
                'entity' => $oRemoteApp,
                'form'   => $form->createView(),
            ));
        }
979705
public static function getActive()
    {
        $app = Facade::getFacadeApplication();
        $db = $app->make('database')->connection();
        $sclHandle = $db->fetchColumn('select sclHandle from SystemCaptchaLibraries where sclIsActive = 1');

        return ($sclHandle === false) ? null : static::getByHandle($sclHandle);
    }
826672
public function updateAction()
    {
        $this->checkAuth($this->resources, $this->modules, AccessManager::UPDATE);

        $baseForm = $this->getUpdateForm();

        $baseForm->getFormBuilder()
            ->addEventListener(
                FormEvents::PRE_SUBMIT,
                [$this, "hydrateUpdateForm"]
            )
        ;

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

        try {
            $form = $this->validateForm($baseForm);
            $data = $form->getData();
            $event = $this->getUpdateEvent($data);

            $dispatcher = $this->getDispatcher();
            foreach ($this->updateEvents as $eventName) {
                $dispatcher->dispatch($eventName, $event);
            }

            $this->afterUpdateEvents($event, $data);

            $con->commit();
        } catch (HttpException $e) {
            $con->rollBack();

            return new JsonResponse(["error" => $e->getMessage()], $e->getStatusCode());
        } catch (\Exception $e) {
            $con->rollBack();

            return new JsonResponse(["error" => $e->getMessage()], 500);
        }

        $obj = $this->extractObjectFromEvent($event);
        $id = $this->extractIdFromObject($obj);

        return new JsonResponse(
            $this->getLoopResults(
                array_merge(
                    $this->getRequest()->query->all(),
                    [$this->idParameterName => $id]
                )
            ),
            201
        );
    }
491936
public function refresh()
    {
        $client = new UriClient($this->base, $this->curlOptions, $this->byteLimit);
        $effective = $client->getEffectiveUri();
        if ($effective == $this->base) {
            $effective = null;
        }
        $statusCode = $client->getStatusCode();
        $nextUpdate = $client->nextUpdate();
        if (strpos($this->base, 'http') === 0 &&
            (
                $statusCode === null ||
                (
                    $statusCode >= 500 &&
                    $statusCode < 600
                )
            ) &&
            $this->displacePush($nextUpdate)
        ) {
            return $client;
        }
        $validUntil = $client->validUntil();
        $content = $client->render()->compressed(self::RENDER_LINE_SEPARATOR);
        $query = $this->pdo->prepare(<<<SQL
INSERT INTO robotstxt__cache1 (base, content, statusCode, validUntil, nextUpdate, effective)
VALUES (:base, :content, :statusCode, :validUntil, :nextUpdate, :effective)
ON DUPLICATE KEY UPDATE content = :content, statusCode = :statusCode, validUntil = :validUntil,
  nextUpdate = :nextUpdate, effective = :effective, worker = 0;
SQL
        );
        $query->bindValue('base', $this->base, \PDO::PARAM_STR);
        $query->bindValue('content', $content, \PDO::PARAM_STR);
        $query->bindValue('statusCode', $statusCode, \PDO::PARAM_INT | \PDO::PARAM_NULL);
        $query->bindValue('validUntil', $validUntil, \PDO::PARAM_INT);
        $query->bindValue('nextUpdate', $nextUpdate, \PDO::PARAM_INT);
        $query->bindValue('effective', $effective, \PDO::PARAM_STR | \PDO::PARAM_NULL);
        $query->execute();
        return $client;
    }
1339955
protected function redirectAfterUpdate()
    {
        merchant_toastr(trans('merchant.update_succeeded'));

        $url = Input::get(Builder::PREVIOUS_URL_KEY) ?: $this->resource(-1);

        return redirect($url);
    }
1293713
public function getApproverName()
    {
        if ($this->fvApproverUID) {
            $app = Application::getFacadeApplication();
            $ui = $app->make(UserInfoRepository::class)->getByID($this->fvApproverUID);
        } else {
            $ui = null;
        }

        return $ui === null ? t('(Unknown)') : $ui->getUserDisplayName();
    }
90101
public function get_lastQuery() {
		$retval = null;
		if(is_object($this->sth)) {
			$retval = $this->sth->queryString;
		}
		else {
			throw new \Exception(__METHOD__ .': statement handle not set');
		}
		return($retval);
	}
709264
public function getCountry()
    {
        try {
            $address = $this->remoteAddress->getRemoteAddress();
            return $this->getReader()->country($address)->country->isoCode;
        } catch (\Exception $e) {
            return null;
        }
    }
1159245
public function getUpdatedAt() : ?int 
    {
        if ( ! $this->hasUpdatedAt()) {
            $this->setUpdatedAt($this->getDefaultUpdatedAt());
        }
        return $this->updatedAt;
    }