Back to LibraryAdapter class

Method setupInstallPaths

protected void
setupInstallPaths
()
Method to do any prechecks and setup the install paths for the extension
Returns
  • void
Since
  • 3.4
-
  • \RuntimeException

Method setupInstallPaths - Source code

/**
 * Method to do any prechecks and setup the install paths for the extension
 *
 * @return  void
 *
 * @since   3.4
 * @throws  \RuntimeException
 */
protected function setupInstallPaths()
{
    $group = (string) $this->getManifest()->libraryname;
    if (!$group) {
        throw new \RuntimeException(Text::_('JLIB_INSTALLER_ABORT_LIB_INSTALL_NOFILE'));
    }
    // Don't install libraries which would override core folders
    $restrictedFolders = array('php-encryption', 'phpass', 'src', 'vendor');
    if (in_array($group, $restrictedFolders)) {
        throw new \RuntimeException(Text::_('JLIB_INSTALLER_ABORT_LIB_INSTALL_CORE_FOLDER'));
    }
    $this->parent->setPath('extension_root', JPATH_PLATFORM . '/' . implode(DIRECTORY_SEPARATOR, explode('/', $group)));
}