Elgg  Version 3.0
UpgradeController.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Upgrade;
4 
7 use Elgg\Loggable;
8 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  return $response;
50  }
51 }
Generic HTTP exception.
__invoke(Request $request)
Execute system upgrades.
if(!$entity->delete()) $forward_url
Definition: delete.php:30
$request
Page handler for autocomplete endpoint.
Definition: livesearch.php:9
elgg_normalize_site_url($unsafe_url)
From untrusted input, get a site URL safe for forwarding.
Definition: output.php:232
trait Loggable
Enables adding a logger.
Definition: Loggable.php:12
getParam($key, $default=null, $filter=true)
Get an element of the params array.
Definition: Request.php:80
elgg_echo($message_key, array $args=[], $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
$upgrade
Definition: upgrade.php:8
$error
Bad request error.
Definition: 400.php:6
$exception
log($level, $message, array $context=[])
Log a message.
Definition: Loggable.php:55
elgg_ok_response($content= '', $message= '', $forward_url=null, $status_code=ELGG_HTTP_OK)
Prepares a successful response to be returned by a page or an action handler.
const ELGG_HTTP_INTERNAL_SERVER_ERROR
Definition: constants.php:106
Request container.
Definition: Request.php:13
_elgg_services()
Get the global service provider.
Definition: elgglib.php:1292
elgg ajax ERROR
Definition: ajax.js:33