public function preflight($type, $parent)
{
// Check the minimum PHP version
if (!empty($this->minimumPHPVersion)) {
if (defined('PHP_VERSION')) {
$version = PHP_VERSION;
} elseif (function_exists('phpversion')) {
$version = phpversion();
} else {
$version = '5.0.0';
// all bets are off!
}
if (!version_compare($version, $this->minimumPHPVersion, 'ge')) {
$msg = "<p>You need PHP {$this->minimumPHPVersion} or later to install this component</p>";
JLog::add($msg, JLog::WARNING, 'jerror');
return false;
}
}
// Check the minimum Joomla! version
if (!empty($this->minimumJoomlaVersion) && !version_compare(JVERSION, $this->minimumJoomlaVersion, 'ge')) {
$msg = "<p>You need Joomla! {$this->minimumJoomlaVersion} or later to install this component</p>";
JLog::add($msg, JLog::WARNING, 'jerror');
return false;
}
// Check the maximum Joomla! version
if (!empty($this->maximumJoomlaVersion) && !version_compare(JVERSION, $this->maximumJoomlaVersion, 'le')) {
$msg = "<p>You need Joomla! {$this->maximumJoomlaVersion} or earlier to install this component</p>";
JLog::add($msg, JLog::WARNING, 'jerror');
return false;
}
// Always reset the OPcache if it's enabled. Otherwise there's a good chance the server will not know we are
// replacing .php scripts. This is a major concern since PHP 5.5 included and enabled OPcache by default.
if (function_exists('opcache_reset')) {
opcache_reset();
} elseif (function_exists('apc_clear_cache')) {
@apc_clear_cache();
}
// Workarounds for JInstaller issues.
if (in_array($type, array('install', 'discover_install'))) {
// Bugfix for "Database function returned no error"
$this->bugfixDBFunctionReturnedNoError();
} else {
// Bugfix for "Can not build admin menus"
$this->bugfixCantBuildAdminMenus();
}
return true;
}