Elgg  Version master
UpgradeController.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Upgrade;
4 
7 use Elgg\Request;
8 use Elgg\Traits\Loggable;
9 use Psr\Log\LogLevel;
10 
15 
16  use Loggable;
17 
27  $response = null;
28 
29  $forward_url = $request->getParam('forward', 'admin');
31 
32  $upgrade = _elgg_services()->upgrades->run();
33 
34  $upgrade->then(
35  function () use (&$response, $forward_url) {
36  $response = elgg_ok_response('', elgg_echo('upgrade:core'), $forward_url);
37  },
38  function ($error) use ($forward_url) {
39  $this->log(LogLevel::ERROR, $error);
40 
42  $exception->setRedirectUrl($forward_url);
43 
44  throw $exception;
45  }
46  );
47 
48  _elgg_services()->plugins->generateEntities();
49 
50  return $response;
51  }
52 }
$error
Bad request error.
Definition: 400.php:6
if(empty($guid)) $upgrade
Definition: upgrade.php:11
if(! $entity->delete(true, true)) $forward_url
Definition: delete.php:30
Thrown when the server encountered a generic error.
Request container.
Definition: Request.php:12
__invoke(Request $request)
Execute system upgrades.
_elgg_services()
Get the global service provider.
Definition: elgglib.php:353
HTTP response builder interface.
elgg_echo(string $message_key, array $args=[], string $language='')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
$request
Definition: livesearch.php:12
elgg_normalize_site_url(string $unsafe_url)
From untrusted input, get a site URL safe for forwarding.
Definition: output.php:175
elgg_ok_response($content='', string|array $message='', ?string $forward_url=null, int $status_code=ELGG_HTTP_OK)
Prepares a successful response to be returned by a page or an action handler.
$exception
Definition: error.php:15
$response
Definition: content.php:10