/**
* Method to check if the extension is present in the filesystem, flags the route as update if so
*
* @return void
*
* @since 3.4
* @throws \RuntimeException
*/
protected function checkExtensionInFilesystem()
{
// If the package manifest already exists, then we will assume that the package is already installed.
if (file_exists(JPATH_MANIFESTS . '/packages/' . basename($this->parent->getPath('manifest')))) {
// Look for an update function or update tag
$updateElement = $this->manifest->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')) {
// Force this one
$this->parent->setOverwrite(true);
$this->parent->setUpgrade(true);
if ($this->currentExtensionId) {
// 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
throw new \RuntimeException(Text::sprintf('JLIB_INSTALLER_ABORT_DIRECTORY', Text::_('JLIB_INSTALLER_' . $this->route), $this->type, $this->parent->getPath('extension_root')));
}
}
}