Project

General

Profile

« Previous | Next » 

Revision 925

Added by doc over 15 years ago

Added option to perform pre-installation checks to test requirements of Add-Ons

View differences:

install.php
29 29
	exit(0);
30 30
}
31 31

  
32
// do not display notices and warnings during installation
33
error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);
34

  
32 35
// Setup admin object
33 36
require('../../config.php');
34 37
require_once(WB_PATH.'/framework/class.admin.php');
......
57 60
$archive = new PclZip($temp_file);
58 61
// Unzip the files to the temp unzip folder
59 62
$list = $archive->extract(PCLZIP_OPT_PATH, $temp_unzip);
63

  
64
// Check if uploaded file is a valid Add-On zip file
65
if (!($list && file_exists($temp_unzip . 'index.php'))) $admin->print_error($MESSAGE['GENERIC']['INVALID_ADDON_FILE']);
66

  
60 67
// Include the templates info file
61 68
require($temp_unzip.'info.php');
69

  
70
// Perform Add-on requirement checks before proceeding
71
require(WB_PATH . '/framework/addon.precheck.inc.php');
72
preCheckAddon($temp_file);
73

  
62 74
// Delete the temp unzip directory
63 75
rm_full_dir($temp_unzip);
64 76

  
......
75 87
	if(file_exists(WB_PATH.'/templates/'.$template_directory.'/info.php')) {
76 88
		require(WB_PATH.'/templates/'.$template_directory.'/info.php');
77 89
		// Version to be installed is older than currently installed version
78
		if ($template_version>$new_template_version) {
90
		if (versionCompare($template_version, $new_template_version, '>=')) {
79 91
			if(file_exists($temp_file)) { unlink($temp_file); } // Remove temp file
80 92
			$admin->print_error($MESSAGE['GENERIC']['ALREADY_INSTALLED']);
81 93
		}

Also available in: Unified diff