@@ -46,6 +46,17 @@ class ModuleAdapter extends InstallerAdapter
4646 */
4747 protected $ scriptElement = null ;
4848
49+ /**
50+ * The list of current files that are installed and is read
51+ * from the manifest on disk in the update area to handle doing a diff
52+ * and deleting files that are in the old files list and not in the new
53+ * files list.
54+ *
55+ * @var array
56+ * @since 5.4
57+ * */
58+ protected $ oldFiles = null ;
59+
4960 /**
5061 * Method to check if the extension is already present in the database
5162 *
@@ -89,7 +100,7 @@ protected function checkExistingExtension()
89100 protected function copyBaseFiles ()
90101 {
91102 // Copy all necessary files
92- if ($ this ->parent ->parseFiles ($ this ->getManifest ()->files , -1 ) === false ) {
103+ if ($ this ->parent ->parseFiles ($ this ->getManifest ()->files , -1 , $ this -> oldFiles ) === false ) {
93104 throw new \RuntimeException (Text::_ ('JLIB_INSTALLER_ABORT_MOD_COPY_FILES ' ));
94105 }
95106
@@ -527,6 +538,29 @@ protected function setupUninstall()
527538 $ this ->loadLanguage (($ this ->extension ->client_id ? JPATH_ADMINISTRATOR : JPATH_SITE ) . '/modules/ ' . $ element );
528539 }
529540
541+ /**
542+ * Method to setup the update routine for the adapter
543+ *
544+ * @return void
545+ *
546+ * @since 5.4
547+ */
548+ protected function setupUpdates ()
549+ {
550+ // Create a new installer because findManifest sets stuff; side effects!
551+ $ tmpInstaller = new Installer ();
552+ $ tmpInstaller ->setDatabase ($ this ->getDatabase ());
553+
554+ // Look in the extension root
555+ $ tmpInstaller ->setPath ('source ' , $ this ->parent ->getPath ('extension_root ' ));
556+
557+ if ($ tmpInstaller ->findManifest ())
558+ {
559+ $ old_manifest = $ tmpInstaller ->getManifest ();
560+ $ this ->oldFiles = $ old_manifest ->files ;
561+ }
562+ }
563+
530564 /**
531565 * Method to store the extension to the database
532566 *
0 commit comments