// Adapter functions
/**
* Package installation method
*
* @param string $path Path to package source folder
*
* @return boolean True if successful
*
* @since 3.1
*/
public function install($path = null)
{
if ($path && Folder::exists($path)) {
$this->setPath('source', $path);
} else {
$this->abort(Text::_('JLIB_INSTALLER_ABORT_NOINSTALLPATH'));
return false;
}
if (!($adapter = $this->setupInstall('install', true))) {
$this->abort(Text::_('JLIB_INSTALLER_ABORT_DETECTMANIFEST'));
return false;
}
if (!\is_object($adapter)) {
return false;
}
// Add the languages from the package itself
if (method_exists($adapter, 'loadLanguage')) {
$adapter->loadLanguage($path);
}
// Fire the onExtensionBeforeInstall event.
PluginHelper::importPlugin('extension');
Factory::getApplication()->triggerEvent('onExtensionBeforeInstall', array('method' => 'install', 'type' => $this->manifest->attributes()->type, 'manifest' => $this->manifest, 'extension' => 0));
// Run the install
$result = $adapter->install();
// Make sure Joomla can figure out what has changed
clearstatcache();
// Fire the onExtensionAfterInstall
Factory::getApplication()->triggerEvent('onExtensionAfterInstall', array('installer' => clone $this, 'eid' => $result));
if ($result !== false) {
// Refresh versionable assets cache
Factory::getApplication()->flushAssets();
return true;
}
return false;
}