/
unified-installer-finalize.php
43 lines (36 loc) · 1.63 KB
/
unified-installer-finalize.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
defined('PCL_DIR') or die('illegal or unauthorized access to unified-installer-finalize file');
require_once(PCL_DIR. "/ini.php");
SessionManipulator::start_session();
$plugins_to_install = Util::unstringify($_SESSION['plugins_to_install']);
$current_plugin = array_shift($plugins_to_install);
if(file_exists('unified-installer-check.php'))
{
unlink('unified-installer-check.php');
}
if( empty($plugins_to_install) )
{
$final_redirect_url = $_SESSION['installation_complete_url'];
unset($_SESSION['plugins_to_install']);
unset($_SESSION['installation_complete_url']);
UrlManipulator::redirect($final_redirect_url);
}
$_SESSION['plugins_to_install'] = Util::stringify($plugins_to_install);
$plugins_to_install = Util::unstringify($_SESSION['plugins_to_install']);
$next_plugin = !empty($plugins_to_install) ? $plugins_to_install[0] : null;
$unified_installer_dir = dirname(__FILE__);
$plugins_dir = str_replace( '\\', '/', dirname($unified_installer_dir) );
$plugin_directory_full_path = $plugins_dir. '/'. $next_plugin;
$plugin_install_directory = $plugin_directory_full_path. '/install';
$plugin_config_file = $next_plugin. '-app-config.php';
$plugin_is_installed = file_exists($plugin_directory_full_path. '/'. $plugin_config_file);
if( !$plugin_is_installed )
{
$plugin_install_paths = UrlInspector::get_path($plugin_directory_full_path. '/install');
$plugin_install_url = $plugin_install_paths['http_path'];
if(UrlInspector::url_exists($plugin_install_url))
{
UrlManipulator::redirect($plugin_install_url);
}
}
?>