Elgg  Version 3.0
upgrade.php
Go to the documentation of this file.
1 <?php
2 
4 $site_host = parse_url($site_url, PHP_URL_HOST) . '/';
5 
6 // turn any full in-site URLs into absolute paths
7 $forward_url = get_input('forward', '/admin', false);
8 $forward_url = str_replace([$site_url, $site_host], '/', $forward_url);
9 
10 if (strpos($forward_url, '/') !== 0) {
11  $forward_url = '/' . $forward_url;
12 }
13 
14 $refresh_url = elgg_generate_url('upgrade:run', [
15  'upgrade' => 'upgrade',
16  'forward' => $forward_url,
17 ]);
18 
19 // sign the url in order to get past the protection
21 
22 // render content before head so that JavaScript and CSS can be loaded. See #4032
23 $body = "<div style='margin-top:200px'>" . elgg_view('graphics/ajax_loader', ['hidden' => false]) . "</div>";
24 
25 $head = elgg_view('page/elements/head', [
26  'title' => elgg_echo('upgrading'),
27 ]);
28 
30  '#tag_name' => 'meta',
31  '#options' => ['is_xml' => true],
32  'http-equiv' => 'refresh',
33  'content' => '1;url=' . $refresh_url,
34 ]);
35 
36 echo elgg_view("page/elements/html", ["head" => $head, "body" => $body]);
$head
Definition: upgrade.php:25
$body
Definition: upgrade.php:23
$site_host
Definition: upgrade.php:4
elgg parse_url
Parse a URL into its parts.
Definition: elgglib.js:442
elgg_echo($message_key, array $args=[], $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
elgg_format_element($tag_name, array $attributes=[], $text= '', array $options=[])
Format an HTML element.
Definition: output.php:168
elgg_generate_url($name, array $parameters=[])
Generate a URL for named route.
Definition: pagehandler.php:58
elgg echo
Translates a string.
Definition: languages.js:43
$forward_url
Definition: upgrade.php:7
_elgg_config()
Get the Elgg config service.
if(strpos($forward_url, '/')!==0) $refresh_url
Definition: upgrade.php:14
$site_url
Definition: upgrade.php:3
elgg_http_get_signed_url($url, $expires=false)
Signs provided URL with a SHA256 HMAC key.
Definition: elgglib.php:1084
elgg_view($view, $vars=[], $viewtype= '')
Return a parsed view.
Definition: views.php:246