/**
* Method to create the extension root path if necessary
*
* @return void
*
* @since 3.4
* @throws \RuntimeException
*/
protected function createExtensionRoot()
{
// If the component directory does not exist, let's create it
$created = false;
if (!file_exists($this->parent->getPath('extension_site'))) {
if (!($created = Folder::create($this->parent->getPath('extension_site')))) {
throw new \RuntimeException(Text::sprintf('JLIB_INSTALLER_ABORT_CREATE_DIRECTORY', Text::_('JLIB_INSTALLER_' . strtoupper($this->route)), $this->parent->getPath('extension_site')));
}
}
/*
* Since we created the component directory and we will want to remove it if we have to roll back
* the installation, let's add it to the installation step stack
*/
if ($created) {
$this->parent->pushStep(array('type' => 'folder', 'path' => $this->parent->getPath('extension_site')));
}
// If the component admin directory does not exist, let's create it
$created = false;
if (!file_exists($this->parent->getPath('extension_administrator'))) {
if (!($created = Folder::create($this->parent->getPath('extension_administrator')))) {
throw new \RuntimeException(Text::sprintf('JLIB_INSTALLER_ABORT_CREATE_DIRECTORY', Text::_('JLIB_INSTALLER_' . strtoupper($this->route)), $this->parent->getPath('extension_administrator')));
}
}
/*
* Since we created the component admin directory and we will want to remove it if we have to roll
* back the installation, let's add it to the installation step stack
*/
if ($created) {
$this->parent->pushStep(array('type' => 'folder', 'path' => $this->parent->getPath('extension_administrator')));
}
// If the component API directory does not exist, let's create it
$created = false;
if (!file_exists($this->parent->getPath('extension_api'))) {
if (!($created = Folder::create($this->parent->getPath('extension_api')))) {
throw new \RuntimeException(Text::sprintf('JLIB_INSTALLER_ABORT_CREATE_DIRECTORY', Text::_('JLIB_INSTALLER_' . strtoupper($this->route)), $this->parent->getPath('extension_api')));
}
}
/*
* Since we created the component API directory and we will want to remove it if we have to roll
* back the installation, let's add it to the installation step stack
*/
if ($created) {
$this->parent->pushStep(array('type' => 'folder', 'path' => $this->parent->getPath('extension_api')));
}
}