@@ -48,6 +48,17 @@ class ModuleAdapter extends InstallerAdapter
4848 */
4949 protected $ scriptElement = null ;
5050
51+ /**
52+ * The list of current files that are installed and is read
53+ * from the manifest on disk in the update area to handle doing a diff
54+ * and deleting files that are in the old files list and not in the new
55+ * files list.
56+ *
57+ * @var array
58+ * @since 5.4
59+ * */
60+ protected $ oldFiles = null ;
61+
5162 /**
5263 * Method to check if the extension is already present in the database
5364 *
@@ -91,7 +102,7 @@ protected function checkExistingExtension()
91102 protected function copyBaseFiles ()
92103 {
93104 // Copy all necessary files
94- if ($ this ->parent ->parseFiles ($ this ->getManifest ()->files , -1 ) === false ) {
105+ if ($ this ->parent ->parseFiles ($ this ->getManifest ()->files , -1 , $ this -> oldFiles ) === false ) {
95106 throw new \RuntimeException (Text::_ ('JLIB_INSTALLER_ABORT_MOD_COPY_FILES ' ));
96107 }
97108
@@ -528,6 +539,28 @@ protected function setupUninstall()
528539 $ this ->loadLanguage (($ this ->extension ->client_id ? JPATH_ADMINISTRATOR : JPATH_SITE ) . '/modules/ ' . $ element );
529540 }
530541
542+ /**
543+ * Method to setup the update routine for the adapter
544+ *
545+ * @return void
546+ *
547+ * @since 5.4
548+ */
549+ protected function setupUpdates ()
550+ {
551+ // Create a new installer because findManifest sets stuff; side effects!
552+ $ tmpInstaller = new Installer ();
553+ $ tmpInstaller ->setDatabase ($ this ->getDatabase ());
554+
555+ // Look in the extension root
556+ $ tmpInstaller ->setPath ('source ' , $ this ->parent ->getPath ('extension_root ' ));
557+
558+ if ($ tmpInstaller ->findManifest ()) {
559+ $ old_manifest = $ tmpInstaller ->getManifest ();
560+ $ this ->oldFiles = $ old_manifest ->files ;
561+ }
562+ }
563+
531564 /**
532565 * Method to store the extension to the database
533566 *
0 commit comments