Elgg  Version 4.3
UpgradeController.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Upgrade;
4 
7 use Elgg\Request;
10 
15 
16  use Loggable;
17 
26  public function __invoke(Request $request) {
27 
28  $response = null;
29 
30  $forward_url = $request->getParam('forward', 'admin');
32 
33  $upgrade = _elgg_services()->upgrades->run();
34 
35  $upgrade->done(
36  function () use (&$response, $forward_url) {
37  $response = elgg_ok_response('', elgg_echo('upgrade:core'), $forward_url);
38  },
39  function ($error) use ($forward_url) {
40  $this->log(LogLevel::ERROR, $error);
41 
43  $exception->setRedirectUrl($forward_url);
44 
45  throw $exception;
46  }
47  );
48 
49  _elgg_services()->plugins->generateEntities();
50 
51  return $response;
52  }
53 }
__invoke(Request $request)
Execute system upgrades.
$request
Definition: livesearch.php:11
elgg_normalize_site_url($unsafe_url)
From untrusted input, get a site URL safe for forwarding.
Definition: output.php:166
getParam($key, $default=null, $filter=true)
Get an element of the params array.
Definition: Request.php:79
elgg_echo($message_key, array $args=[], $language="")
Elgg language module Functions to manage language and translations.
Definition: languages.php:18
trait Loggable
Enables adding a logger.
Definition: Loggable.php:14
$error
Bad request error.
Definition: 400.php:6
if(empty($guid)) $upgrade
Definition: upgrade.php:11
if(!$entity->delete()) $forward_url
Definition: delete.php:30
log($level, $message, array $context=[])
Log a message.
Definition: Loggable.php:58
Generic HTTP exception.
const ELGG_HTTP_INTERNAL_SERVER_ERROR
Definition: constants.php:106
Request container.
Definition: Request.php:12
$exception
Definition: error.php:15
elgg_ok_response($content= '', $message= '', $forward_url=null, int $status_code=ELGG_HTTP_OK)
Prepares a successful response to be returned by a page or an action handler.
_elgg_services()
Get the global service provider.
Definition: elgglib.php:638