Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion libraries/src/Installer/Adapter/ModuleAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@ class ModuleAdapter extends InstallerAdapter
*/
protected $scriptElement = null;

/**
* The list of current files that are installed and is read
* from the manifest on disk in the update area to handle doing a diff
* and deleting files that are in the old files list and not in the new
* files list.
*
* @var array
* @since __DEPLOY_VERSION__
* */
protected $oldFiles = null;

/**
* Method to check if the extension is already present in the database
*
Expand Down Expand Up @@ -91,7 +102,7 @@ protected function checkExistingExtension()
protected function copyBaseFiles()
{
// Copy all necessary files
if ($this->parent->parseFiles($this->getManifest()->files, -1) === false) {
if ($this->parent->parseFiles($this->getManifest()->files, -1, $this->oldFiles) === false) {
throw new \RuntimeException(Text::_('JLIB_INSTALLER_ABORT_MOD_COPY_FILES'));
}

Expand Down Expand Up @@ -528,6 +539,28 @@ protected function setupUninstall()
$this->loadLanguage(($this->extension->client_id ? JPATH_ADMINISTRATOR : JPATH_SITE) . '/modules/' . $element);
}

/**
* Method to setup the update routine for the adapter
*
* @return void
*
* @since __DEPLOY_VERSION__
*/
protected function setupUpdates()
{
// Create a new installer because findManifest sets stuff; side effects!
$tmpInstaller = new Installer();
$tmpInstaller->setDatabase($this->getDatabase());

// Look in the extension root
$tmpInstaller->setPath('source', $this->parent->getPath('extension_root'));

if ($tmpInstaller->findManifest()) {
$old_manifest = $tmpInstaller->getManifest();
$this->oldFiles = $old_manifest->files;
}
}

/**
* Method to store the extension to the database
*
Expand Down