<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.sandbox.joomla.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Miguel</id>
	<title>Joomla! Documentation - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.sandbox.joomla.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Miguel"/>
	<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/Special:Contributions/Miguel"/>
	<updated>2026-10-11T19:52:51Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Adding_an_install-uninstall-update_script_file&amp;diff=127877</id>
		<title>J3.x:Developing an MVC Component/Adding an install-uninstall-update script file</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J3.x:Developing_an_MVC_Component/Adding_an_install-uninstall-update_script_file&amp;diff=127877"/>
		<updated>2014-10-17T18:47:35Z</updated>

		<summary type="html">&lt;p&gt;Miguel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{:J3.1:Developing a MVC Component}}&lt;br /&gt;
&lt;br /&gt;
{{review}}&lt;br /&gt;
&lt;br /&gt;
This is a multiple-article series of tutorials on how to develop a Model-View-Contoller [[Component]] for Joomla! Version {{JVer|{{CurrentSTSVer|minor}}}}.&lt;br /&gt;
&lt;br /&gt;
[[Category:Joomla! 3.0]]&lt;br /&gt;
[[Category:Joomla! 3.1]]&lt;br /&gt;
[[Category:Joomla! 3.2]]&lt;br /&gt;
[[Category:Beginner Development]]&lt;br /&gt;
[[Category:Component Development]]&lt;br /&gt;
== Creating the extension script file ==&lt;br /&gt;
Installing, updating and uninstalling a component may require additional operations that cannot be achieved by the basic operations described in the main xml file. Joomla offers a new approach to solve this problem. It consists in using a php script file containing a class using five methods:&lt;br /&gt;
&lt;br /&gt;
* preflight which is executed before install and update&lt;br /&gt;
* install&lt;br /&gt;
* update&lt;br /&gt;
* uninstall&lt;br /&gt;
* postflight which is executed after install and update&lt;br /&gt;
&lt;br /&gt;
Writing an extension script consists in declaring an class whose name is com_ComponentNameInstallerScript with these 5 methods.&lt;br /&gt;
For plugins you need to add the group. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
// No direct access to this file&lt;br /&gt;
defined(&#039;_JEXEC&#039;) or die;&lt;br /&gt;
 &lt;br /&gt;
/**&lt;br /&gt;
 * Script file of HelloWorld plugin&lt;br /&gt;
 * Group: Universe&lt;br /&gt;
 */&lt;br /&gt;
class plgUniverseHelloWorldInstallerScript&lt;br /&gt;
{&lt;br /&gt;
        /**&lt;br /&gt;
         * Method to install the extension&lt;br /&gt;
         * $parent is the class calling this method&lt;br /&gt;
         *&lt;br /&gt;
         * @return void&lt;br /&gt;
         */&lt;br /&gt;
        function install($parent) &lt;br /&gt;
        {&lt;br /&gt;
                echo &#039;&amp;lt;p&amp;gt;The module has been installed&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
        }&lt;br /&gt;
 &lt;br /&gt;
        /**&lt;br /&gt;
         * Method to uninstall the extension&lt;br /&gt;
         * $parent is the class calling this method&lt;br /&gt;
         *&lt;br /&gt;
         * @return void&lt;br /&gt;
         */&lt;br /&gt;
        function uninstall($parent) &lt;br /&gt;
        {&lt;br /&gt;
                echo &#039;&amp;lt;p&amp;gt;The module has been uninstalled&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
        }&lt;br /&gt;
 &lt;br /&gt;
        /**&lt;br /&gt;
         * Method to update the extension&lt;br /&gt;
         * $parent is the class calling this method&lt;br /&gt;
         *&lt;br /&gt;
         * @return void&lt;br /&gt;
         */&lt;br /&gt;
        function update($parent) &lt;br /&gt;
        {&lt;br /&gt;
                echo &#039;&amp;lt;p&amp;gt;The module has been updated to version&#039; . $parent-&amp;gt;get(&#039;manifest&#039;)-&amp;gt;version) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
        }&lt;br /&gt;
 &lt;br /&gt;
        /**&lt;br /&gt;
         * Method to run before an install/update/uninstall method&lt;br /&gt;
         * $parent is the class calling this method&lt;br /&gt;
         * $type is the type of change (install, update or discover_install)&lt;br /&gt;
         *&lt;br /&gt;
         * @return void&lt;br /&gt;
         */&lt;br /&gt;
        function preflight($type, $parent) &lt;br /&gt;
        {&lt;br /&gt;
                echo &#039;&amp;lt;p&amp;gt;Anything here happens before the installation/update/uninstallation of the module&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
        }&lt;br /&gt;
 &lt;br /&gt;
        /**&lt;br /&gt;
         * Method to run after an install/update/uninstall method&lt;br /&gt;
         * $parent is the class calling this method&lt;br /&gt;
         * $type is the type of change (install, update or discover_install)&lt;br /&gt;
         *&lt;br /&gt;
         * @return void&lt;br /&gt;
         */&lt;br /&gt;
        function postflight($type, $parent) &lt;br /&gt;
        {&lt;br /&gt;
                echo &#039;&amp;lt;p&amp;gt;Anything here happens after the installation/update/uninstallation of the module&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
        }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Miguel</name></author>
	</entry>
</feed>