/**
* Method to finalise the installation processing
*
* @return void
*
* @since 3.4
* @throws \RuntimeException
*/
protected function finaliseInstall()
{
// Clobber any possible pending updates
$update = Table::getInstance('update');
$uid = $update->find(array('element' => $this->element, 'type' => $this->type));
if ($uid) {
$update->delete($uid);
}
// Lastly, we will copy the manifest file to its appropriate place.
$manifest = array();
$manifest['src'] = $this->parent->getPath('manifest');
$manifest['dest'] = JPATH_MANIFESTS . '/files/' . basename($this->parent->getPath('manifest'));
if (!$this->parent->copyFiles(array($manifest), true)) {
// Install failed, rollback changes
throw new \RuntimeException(Text::sprintf('JLIB_INSTALLER_ABORT_COPY_SETUP', Text::_('JLIB_INSTALLER_' . strtoupper($this->route))));
}
// If there is a manifest script, let's copy it.
if ($this->manifest_script) {
// First, we have to create a folder for the script if one isn't present
if (!file_exists($this->parent->getPath('extension_root'))) {
Folder::create($this->parent->getPath('extension_root'));
}
$path['src'] = $this->parent->getPath('source') . '/' . $this->manifest_script;
$path['dest'] = $this->parent->getPath('extension_root') . '/' . $this->manifest_script;
if ($this->parent->isOverwrite() || !file_exists($path['dest'])) {
if (!$this->parent->copyFiles(array($path))) {
// Install failed, rollback changes
throw new \RuntimeException(Text::sprintf('JLIB_INSTALLER_ABORT_MANIFEST', Text::_('JLIB_INSTALLER_' . strtoupper($this->route))));
}
}
}
}