Back to ModuleAdapter class

Method copyBaseFiles

protected void
copyBaseFiles
()
Method to copy the extension's base files from the `<files>` tag(s) and the manifest file
Returns
  • void
Since
  • 3.4
-
  • \RuntimeException
Class: ModuleAdapter
Project: Joomla

Method copyBaseFiles - Source code

/**
 * Method to copy the extension's base files from the `<files>` tag(s) and the manifest file
 *
 * @return  void
 *
 * @since   3.4
 * @throws  \RuntimeException
 */
protected function copyBaseFiles()
{
    // Copy all necessary files
    if ($this->parent->parseFiles($this->getManifest()->files, -1) === false) {
        throw new \RuntimeException(Text::_('JLIB_INSTALLER_ABORT_MOD_COPY_FILES'));
    }
    // If there is a manifest script, let's copy it.
    if ($this->manifest_script) {
        $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))));
            }
        }
    }
}