/**
* Method to check if the extension is present in the filesystem
*
* @return boolean
*
* @since 3.4
* @throws \RuntimeException
*/
protected function checkExtensionInFilesystem()
{
/*
* If the component site or admin directory already exists, then we will assume that the component is already
* installed or another component is using that directory.
*/
if (file_exists($this->parent->getPath('extension_site')) || file_exists($this->parent->getPath('extension_administrator')) || file_exists($this->parent->getPath('extension_api'))) {
// Look for an update function or update tag
$updateElement = $this->getManifest()->update;
// Upgrade manually set or update function available or update tag detected
if ($updateElement || $this->parent->isUpgrade() || $this->parent->manifestClass && method_exists($this->parent->manifestClass, 'update')) {
// If there is a matching extension mark this as an update
$this->setRoute('update');
} elseif (!$this->parent->isOverwrite()) {
// We didn't have overwrite set, find an update function or find an update tag so lets call it safe
if (file_exists($this->parent->getPath('extension_site'))) {
// If the site exists say so.
throw new \RuntimeException(Text::sprintf('JLIB_INSTALLER_ERROR_COMP_INSTALL_DIR_SITE', $this->parent->getPath('extension_site')));
}
if (file_exists($this->parent->getPath('extension_administrator'))) {
// If the admin exists say so
throw new \RuntimeException(Text::sprintf('JLIB_INSTALLER_ERROR_COMP_INSTALL_DIR_ADMIN', $this->parent->getPath('extension_administrator')));
}
// If the API exists say so
throw new \RuntimeException(Text::sprintf('JLIB_INSTALLER_ERROR_COMP_INSTALL_DIR_API', $this->parent->getPath('extension_api')));
}
}
return false;
}