Back to FileAdapter 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: FileAdapter
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()
{
    // Populate File and Folder List to copy
    $this->populateFilesAndFolderList();
    // Now that we have folder list, lets start creating them
    foreach ($this->folderList as $folder) {
        if (!Folder::exists($folder)) {
            if (!($created = Folder::create($folder))) {
                throw new \RuntimeException(Text::sprintf('JLIB_INSTALLER_ABORT_FILE_INSTALL_FAIL_SOURCE_DIRECTORY', $folder));
            }
            // Since we created a directory and will want to remove it if we have to roll back.
            // The installation due to some errors, let's add it to the installation step stack.
            if ($created) {
                $this->parent->pushStep(array('type' => 'folder', 'path' => $folder));
            }
        }
    }
    // Now that we have file list, let's start copying them
    $this->parent->copyFiles($this->fileList);
}