In my Joomla component I have a bunch of Javascript files in media that change on update ( basically a compiled Angular app ) and because of the way the system is structured, I need to only have the current files in the folder. However when I install my component as an update, it leaves the old files in the media/com_mycomponent folder.

What is the best way to clear out the old files during installation?

1 Answer 1


Create a installer script for your component (com_your_component_name/script.php) and add the following code:

defined('_JEXEC') or die;

class com_your_component_nameInstallerScript
  function update($parent) 

The installer script file allows you to run code when your component is installed, uninstalled, or updated, and also before and after the component is installed.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.