Back to InstallerAdapter class

Method createExtensionRoot

protected void
createExtensionRoot
()
Method to create the extension root path if necessary
Returns
  • void
Since
  • 3.4
-
  • \RuntimeException

Method createExtensionRoot - Source code

/**
 * Method to create the extension root path if necessary
 *
 * @return  void
 *
 * @since   3.4
 * @throws  \RuntimeException
 */
protected function createExtensionRoot()
{
    // If the extension directory does not exist, lets create it
    $created = false;
    if (!file_exists($this->parent->getPath('extension_root'))) {
        if (!($created = Folder::create($this->parent->getPath('extension_root')))) {
            throw new \RuntimeException(Text::sprintf('JLIB_INSTALLER_ABORT_CREATE_DIRECTORY', Text::_('JLIB_INSTALLER_' . $this->route), $this->parent->getPath('extension_root')));
        }
    }
    /*
     * Since we created the extension directory and 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_root')));
    }
}