<?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=Sm990</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=Sm990"/>
	<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/Special:Contributions/Sm990"/>
	<updated>2026-08-07T23:49:07Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=76056</id>
		<title>Archived:Managing Component Updates (Manifest file)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=76056"/>
		<updated>2012-09-29T22:12:41Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* The entire manifest file */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{version/tutor|1.6,1.7,2.5}}{{Chunk:Managing Component Updates - Contents}}{{review}}&lt;br /&gt;
&lt;br /&gt;
== Manifest File (democompupdate.xml) ==&lt;br /&gt;
The manifest file in this example is very similar to that of normal components.  Important contents for this example include:&lt;br /&gt;
&lt;br /&gt;
=== sql folder ===&lt;br /&gt;
Note the inclusion of the SQL folder in the administration files section.  This tells Joomla to copy the contents of this folder to the web site during install or update.  The &#039;&#039;schemapath&#039;&#039; declaration below depends on Joomla copying these files during the install or update process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;administration&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt; &lt;br /&gt;
		&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt; &lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== name ===&lt;br /&gt;
This is the name of the component.  The &#039;getParam($key)&#039; method in the &#039;&#039;script.php&#039;&#039; file uses this value to identify the correct row in the extensions table.  The &#039;&#039;manifest_cache&#039;&#039; field in the &#039;&#039;extensions&#039;&#039; table has the version string for the currently installed component.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== version ===&lt;br /&gt;
Joomla stores this value in the &#039;&#039;manifest_cache&#039;&#039; field of the &#039;&#039;extensions&#039;&#039; table.  The &#039;&#039;extensions&#039;&#039; table is where the custom code in the &#039;&#039;script.php&#039;&#039; file reads the version string of the currently installed component, and compares it to the version string of the update.&lt;br /&gt;
&lt;br /&gt;
The custom component code uses this comparison to abort an update if the version sequence is not allowed.  Joomla also compares this string to the SQL update file names, to determine which SQL commands to execute.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Joomla version ===&lt;br /&gt;
The component developer records in the manifest file the version of Joomla that is required to run the component. &lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your component installation script.php file can use this value to control whether a component installation or update should be allowed or not allowed.&lt;br /&gt;
&lt;br /&gt;
=== schemapath ===&lt;br /&gt;
This defines the directory that contains SQL files for component incremental database updates.&lt;br /&gt;
You may choose to put the SQL files somewhere else in your component release, but make sure their location is documented here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;update&amp;gt; &lt;br /&gt;
	&amp;lt;schemas&amp;gt; &lt;br /&gt;
		&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt; &lt;br /&gt;
	&amp;lt;/schemas&amp;gt; &lt;br /&gt;
&amp;lt;/update&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== #__schemas table ===&lt;br /&gt;
The SQL files have a second function.&lt;br /&gt;
In addition to potentially modifying the MySQL database, Joomla uses the names of these SQL files to enable updates to the &#039;&#039;version_id&#039;&#039; field in the &#039;&#039;#__schemas&#039;&#039; table for your component.&lt;br /&gt;
It is important to have an SQL file for EVERY version of your component.&lt;br /&gt;
The file should be empty if you have no SQL code to execute when updating to that version.&lt;br /&gt;
You must have a file or the &#039;&#039;version_id&#039;&#039; will not get updated correctly.&lt;br /&gt;
Joomla uses the &#039;&#039;version_id&#039;&#039; in the &#039;&#039;#__schemas&#039;&#039; table as the &#039;&#039;from&#039;&#039; version when calculating updates &#039;&#039;from&#039;&#039; an older version &#039;&#039;to&#039;&#039; a new version.&lt;br /&gt;
&lt;br /&gt;
It is important to include these &#039;&#039;schemapath&#039;&#039; lines in your manifest file, even if you have no SQL commands to execute.&lt;br /&gt;
By including these lines and including empty SQL files, the &#039;&#039;version_id&#039;&#039; value will be correctly maintained in the &#039;&#039;#__schemas&#039;&#039; table.&lt;br /&gt;
&lt;br /&gt;
If your new component version is not executing the SQL file as expected, check the &#039;&#039;#__schemas&#039;&#039; table to see if the previous version was correctly recorded.&lt;br /&gt;
If it is not, then your update will not execute the SQL file when updating from that version to a newer version.&lt;br /&gt;
&lt;br /&gt;
== The entire manifest file ==&lt;br /&gt;
Here is the entire manifest file for democompupdate version 1.0.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;2011 05 11&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;Your Name Here&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Free to copy&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;none&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Test the Install and Update Process&amp;lt;/description&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Runs on install/uninstall/update; New in 1.6 --&amp;gt;&lt;br /&gt;
	&amp;lt;scriptfile&amp;gt;script.php&amp;lt;/scriptfile&amp;gt;&lt;br /&gt;
	&amp;lt;install&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install_data.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;democompupdate.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Joomla! 1.6]]&lt;br /&gt;
[[Category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Joomla! 2.5]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=76055</id>
		<title>Archived:Managing Component Updates (Manifest file)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=76055"/>
		<updated>2012-09-29T22:12:06Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* #__schemas table */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{version/tutor|1.6,1.7,2.5}}{{Chunk:Managing Component Updates - Contents}}{{review}}&lt;br /&gt;
&lt;br /&gt;
== Manifest File (democompupdate.xml) ==&lt;br /&gt;
The manifest file in this example is very similar to that of normal components.  Important contents for this example include:&lt;br /&gt;
&lt;br /&gt;
=== sql folder ===&lt;br /&gt;
Note the inclusion of the SQL folder in the administration files section.  This tells Joomla to copy the contents of this folder to the web site during install or update.  The &#039;&#039;schemapath&#039;&#039; declaration below depends on Joomla copying these files during the install or update process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;administration&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt; &lt;br /&gt;
		&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt; &lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== name ===&lt;br /&gt;
This is the name of the component.  The &#039;getParam($key)&#039; method in the &#039;&#039;script.php&#039;&#039; file uses this value to identify the correct row in the extensions table.  The &#039;&#039;manifest_cache&#039;&#039; field in the &#039;&#039;extensions&#039;&#039; table has the version string for the currently installed component.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== version ===&lt;br /&gt;
Joomla stores this value in the &#039;&#039;manifest_cache&#039;&#039; field of the &#039;&#039;extensions&#039;&#039; table.  The &#039;&#039;extensions&#039;&#039; table is where the custom code in the &#039;&#039;script.php&#039;&#039; file reads the version string of the currently installed component, and compares it to the version string of the update.&lt;br /&gt;
&lt;br /&gt;
The custom component code uses this comparison to abort an update if the version sequence is not allowed.  Joomla also compares this string to the SQL update file names, to determine which SQL commands to execute.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Joomla version ===&lt;br /&gt;
The component developer records in the manifest file the version of Joomla that is required to run the component. &lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your component installation script.php file can use this value to control whether a component installation or update should be allowed or not allowed.&lt;br /&gt;
&lt;br /&gt;
=== schemapath ===&lt;br /&gt;
This defines the directory that contains SQL files for component incremental database updates.&lt;br /&gt;
You may choose to put the SQL files somewhere else in your component release, but make sure their location is documented here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;update&amp;gt; &lt;br /&gt;
	&amp;lt;schemas&amp;gt; &lt;br /&gt;
		&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt; &lt;br /&gt;
	&amp;lt;/schemas&amp;gt; &lt;br /&gt;
&amp;lt;/update&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== #__schemas table ===&lt;br /&gt;
The SQL files have a second function.&lt;br /&gt;
In addition to potentially modifying the MySQL database, Joomla uses the names of these SQL files to enable updates to the &#039;&#039;version_id&#039;&#039; field in the &#039;&#039;#__schemas&#039;&#039; table for your component.&lt;br /&gt;
It is important to have an SQL file for EVERY version of your component.&lt;br /&gt;
The file should be empty if you have no SQL code to execute when updating to that version.&lt;br /&gt;
You must have a file or the &#039;&#039;version_id&#039;&#039; will not get updated correctly.&lt;br /&gt;
Joomla uses the &#039;&#039;version_id&#039;&#039; in the &#039;&#039;#__schemas&#039;&#039; table as the &#039;&#039;from&#039;&#039; version when calculating updates &#039;&#039;from&#039;&#039; an older version &#039;&#039;to&#039;&#039; a new version.&lt;br /&gt;
&lt;br /&gt;
It is important to include these &#039;&#039;schemapath&#039;&#039; lines in your manifest file, even if you have no SQL commands to execute.&lt;br /&gt;
By including these lines and including empty SQL files, the &#039;&#039;version_id&#039;&#039; value will be correctly maintained in the &#039;&#039;#__schemas&#039;&#039; table.&lt;br /&gt;
&lt;br /&gt;
If your new component version is not executing the SQL file as expected, check the &#039;&#039;#__schemas&#039;&#039; table to see if the previous version was correctly recorded.&lt;br /&gt;
If it is not, then your update will not execute the SQL file when updating from that version to a newer version.&lt;br /&gt;
&lt;br /&gt;
== The entire manifest file ==&lt;br /&gt;
Here is the entire manifest file for version 1.0.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;2011 05 11&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;Your Name Here&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Free to copy&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;none&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Test the Install and Update Process&amp;lt;/description&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Runs on install/uninstall/update; New in 1.6 --&amp;gt;&lt;br /&gt;
	&amp;lt;scriptfile&amp;gt;script.php&amp;lt;/scriptfile&amp;gt;&lt;br /&gt;
	&amp;lt;install&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install_data.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;democompupdate.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Joomla! 1.6]]&lt;br /&gt;
[[Category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Joomla! 2.5]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Update_SQL_files)&amp;diff=74171</id>
		<title>Archived:Managing Component Updates (Update SQL files)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Update_SQL_files)&amp;diff=74171"/>
		<updated>2012-09-09T21:27:56Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* Update SQL files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}} {{JVer|2.5}}&lt;br /&gt;
&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Update SQL files ==&lt;br /&gt;
The update SQL file(s) are located in a directory that is listed in the manifest file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;update&amp;gt; &lt;br /&gt;
	&amp;lt;schemas&amp;gt; &lt;br /&gt;
		&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt; &lt;br /&gt;
	&amp;lt;/schemas&amp;gt; &lt;br /&gt;
&amp;lt;/update&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is an SQL file for each component version.  Each file name must match the version string in the manifest file for that version.  Joomla uses this string to determine which SQL files(s) to execute, and in what order they will be executed.  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Important Note:&#039;&#039; These files are also used to set the version number in the &amp;lt;code&amp;gt;#__schemas&amp;lt;/code&amp;gt; table. This version number must be present in the current version of the component in order for the new SQL files to be run during the update. For example, if you have version 1.0 and are updating to version 1.1, the &amp;lt;code&amp;gt;1.1.sql&amp;lt;/code&amp;gt; file will not be executed if there was no &amp;lt;code&amp;gt;1.0.sql&amp;lt;/code&amp;gt; file in the 1.0 release. For this reason, it is good practice to have a SQL update file for each version, even if there is no SQL change in that version. You can just use an empty file or a file with a comment line.&lt;br /&gt;
&lt;br /&gt;
Joomla uses the PHP &#039;&#039;version_compare&#039;&#039; function to execute the correct SQL files..  Familiarize yourself with this function.  Your version strings need to adhere to the conventions of this function.&lt;br /&gt;
For example, the SQL files for version 1.3 of this example include:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
1.0.sql&lt;br /&gt;
  (empty) OR&lt;br /&gt;
  # Dummy SQL file to set schema version to 1.0 so next update will work&lt;br /&gt;
&lt;br /&gt;
1.1.sql&lt;br /&gt;
  UPDATE `#__democompupdate_mytable` SET myvalue=&#039;Version 1.1 text&#039; WHERE id=1;&lt;br /&gt;
&lt;br /&gt;
1.1.1.sql&lt;br /&gt;
  UPDATE `#__democompupdate_mytable` SET myvalue=&#039;Version 1.1.1 text&#039; WHERE id=1;&lt;br /&gt;
&lt;br /&gt;
1.2.sql&lt;br /&gt;
  INSERT INTO `#__democompupdate_mytable` (id,myvalue) VALUES (2,&#039;Version 1.2 text&#039;);&lt;br /&gt;
&lt;br /&gt;
1.2.1.sql&lt;br /&gt;
  UPDATE `#__democompupdate_mytable` SET myvalue=&#039;Version 1.2.1 text&#039; WHERE id=2;&lt;br /&gt;
&lt;br /&gt;
1.3.sql&lt;br /&gt;
  INSERT INTO `#__democompupdate_mytable` (id,myvalue) VALUES (3,&#039;Version 1.3 text&#039;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example has complete install files for component versions 1.0 (initial), 1.1.1 and 1.3.  Update SQL files are included for additional incremental component versions (1.1, 1.2 and 1.2.1) between these three versions.  These extra versions illustrate the process for updates that span more than one incremental version.&lt;br /&gt;
&lt;br /&gt;
* When updating from version 1.0 to version 1.1.1, both files 1.1.sql and 1.1.1.sql are executed.  The SQL commands update the value of the first, and only, row in the database table.  The command in 1.1.1.sql over-writes the value that was written by 1.1.sql.&lt;br /&gt;
* When updating from version 1.1.1 to version 1.3, files 1.2.sql, 1.2.1.sql and 1.3.sql are executed.  The commands in 1.2.sql and 1.3.sql each create a new row in the database table.&lt;br /&gt;
* When updating from version 1.0 directly to 1.3, files 1.1.sql, 1.1.1.sql, 1.2.sql, 1.2.1.sql and 1.3.sql are all executed.  You can see the cumulative effect of the table changes in the component front-end.&lt;br /&gt;
&lt;br /&gt;
Joomla executes the database updates in the sequence that would occur, as if the user had updated each version separately.  This would be necessary if an incremental database update depended on the correct update from the previous version.  An example would be: if a modification of a table value during one update depended on the addition of a new table field during a previous update.&lt;br /&gt;
&lt;br /&gt;
Joomla uses the PHP function &#039;&#039;version_compare&#039;&#039; to define the execution order of the SQL files.  The sequencing of your component version string must adhere to that defined by the &#039;&#039;version_compare&#039;&#039; function.&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(How_to_use_this_example)&amp;diff=68106</id>
		<title>Archived:Managing Component Updates (How to use this example)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(How_to_use_this_example)&amp;diff=68106"/>
		<updated>2012-07-01T02:06:54Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* Summary */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}} {{JVer|2.5}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
You will need to download all four versions of this example to exercise all of the features.&lt;br /&gt;
&lt;br /&gt;
== Normal update sequence ==&lt;br /&gt;
&lt;br /&gt;
You can use the following sequence of installs, updates and uninstalls to show the effects of this example.  You may also try installs, updates and uninstalls in any sequence that you desire.&lt;br /&gt;
&lt;br /&gt;
* Previous state: no com_democompupdate component installed.&lt;br /&gt;
* Install democompupdate_10.zip.&lt;br /&gt;
** Verify the install is good by the text echoed in back-end.&lt;br /&gt;
** Front-end: verify database, files and parameter setting.&lt;br /&gt;
** optional: phpMyAdmin: verify:&lt;br /&gt;
*** jos_democompupdate_mytable exists and has one row, myvalue = &#039;1.0&#039;.&lt;br /&gt;
*** jos_extensions table has entry for com_democompupdate.&lt;br /&gt;
**** params field (JSON), has three values.&lt;br /&gt;
**** manifest_cache field (JSON) shows version &#039;1.0&#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Previous state: version 1.0 installed.&lt;br /&gt;
* Install democompupdate_111.zip.&lt;br /&gt;
** Verify the update is good by the text echoed in back-end.&lt;br /&gt;
** Front-end: verify database, files and parameter setting.&lt;br /&gt;
** optional: phpMyAdmin: verify:&lt;br /&gt;
*** jos_democompupdate_mytable exists and has one row, value &#039;1.1.1&#039;.&lt;br /&gt;
*** jos_extensions table has entry for com_democompupdate.&lt;br /&gt;
**** params field (JSON), has three values.&lt;br /&gt;
**** manifest_cache field (JSON) shows version &#039;1.1.1&#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Previous state: version 1.1.1 installed.&lt;br /&gt;
* Install democompupdate_13.zip.&lt;br /&gt;
** Verify the update is good by the text echoed in back-end.&lt;br /&gt;
** Front-end: verify database, files and parameter setting.&lt;br /&gt;
*** There should be three rows in the table.&lt;br /&gt;
** optional: phpMyAdmin: verify:&lt;br /&gt;
*** jos_democompupdate_mytable exists and has three rows, values &#039;1.1.1&#039;, &#039;1.2.1&#039; and &#039;1.3&#039;.&lt;br /&gt;
*** jos_extensions table has entry for com_democompupdate.&lt;br /&gt;
**** params field (JSON), has three values.&lt;br /&gt;
**** manifest_cache field (JSON) shows version &#039;1.3&#039;.&lt;br /&gt;
&lt;br /&gt;
== Try a reverse-sequence update ==&lt;br /&gt;
&lt;br /&gt;
* Previous state: version 1.3 installed.&lt;br /&gt;
* Install democompupdate_10.zip.&lt;br /&gt;
** Update should fail, give useful information in the back-end.&lt;br /&gt;
** No change should be seen in the front-end, back-end or MySqlAdmin.&lt;br /&gt;
&lt;br /&gt;
== Make sure that uninstall works ==&lt;br /&gt;
&lt;br /&gt;
* Previous state: version 1.3 installed.&lt;br /&gt;
* Uninstall com_democompupdate&lt;br /&gt;
** Verify the component does not exist in Joomla extension manager or front-end.&lt;br /&gt;
** optional: phpMyAdmin: verify that democompupdate elements are gone.&lt;br /&gt;
&lt;br /&gt;
== Verify full installs of each revision work correctly ==&lt;br /&gt;
&lt;br /&gt;
* Previous state: no democompupdate component installed.&lt;br /&gt;
* Install democompupdate_111.zip.&lt;br /&gt;
** Verify that the full install created the same database and file state as the update to 1.1.1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Previous state: version 1.1.1 installed.&lt;br /&gt;
* Uninstall com_democompupdate&lt;br /&gt;
** Verify the component does not exist in Joomla extension manager or front-end.&lt;br /&gt;
** optional: phpMyAdmin: verify that democompupdate elements are gone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Previous state: no democompupdate component installed.&lt;br /&gt;
* Install democompupdate_13.zip.&lt;br /&gt;
** Verify that the full install created the same database and file state as the update to 1.3.&lt;br /&gt;
&lt;br /&gt;
== Verify that Joomla version check works ==&lt;br /&gt;
&lt;br /&gt;
* Previous state: version 1.3 installed.&lt;br /&gt;
* Uninstall com_democompupdate&lt;br /&gt;
* Install democompupdate_10j3.zip.&lt;br /&gt;
** The update should fail, give useful information in the back-end.&lt;br /&gt;
** No evidence of the installed component should exist in front-end, back-end or MySqlAdmin.&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
You can use the update features in Joomla 1.6 (and greater) to ensure that the web site administrator installs your component properly.&lt;br /&gt;
* Your component version string sequence must follow the requirements shown in the PHP &#039;&#039;version_compare&#039;&#039; function.&lt;br /&gt;
* Create update SQL files for component revisions.  The file names must match your version strings.&lt;br /&gt;
* Update the version string in the manifest file for each version.&lt;br /&gt;
* Update the required Joomla version in the manifest file, if you will use it in the script.php file to enable installs and updates.&lt;br /&gt;
* Modify the custom PHP code in the script.php file, if needed, for each version.&lt;br /&gt;
&lt;br /&gt;
If your component requires non-standard update handling, you can implement it in the script.php file.  You can disable the normal update SQL file execution and implement your own code.  You can implement custom checks and custom install and update actions.  You can, and should create confirmation messages and error messages to help the web site administrator understand what your code is doing.&lt;br /&gt;
&lt;br /&gt;
I intentionally made this example simple, to make debugging easier. You can implement your custom code in this example, verify that it works correctly, then implement it in your component.  Share your successes with the Joomla community.&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Script.php)&amp;diff=68105</id>
		<title>Archived:Managing Component Updates (Script.php)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Script.php)&amp;diff=68105"/>
		<updated>2012-07-01T01:56:33Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* Script.php */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}} {{JVer|2.5}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Script.php ==&lt;br /&gt;
This file contains the component-specific methods preflight, install, update, postflight and uninstall.  This file is where the component developer implements all of the unique code for these actions.&lt;br /&gt;
For this example, in addition to various checks, HTML is inserted into the back-end output to show which code has been executed and several component parameters are created and maintained.  You may choose to display different HTML, or to display none for your component.&lt;br /&gt;
&lt;br /&gt;
=== preflight ===&lt;br /&gt;
This is where most of the checking should be done before install, update or discover_install.  Preflight is executed prior to any Joomla install, update or discover_install actions.  Preflight is not executed on uninstall.  A string denoting the type of action (install, update or discover_install) is passed to preflight in the $type operand.  Your code can use this string to execute different checks and responses for the three cases.&lt;br /&gt;
&lt;br /&gt;
It is appropriate to check the Joomla version and the existing component version in the preflight module.  A failure of either of these two should cause an abort of the action.  An abort is triggered by returning a false value from this preflight method.  On receiving a false return value, Joomla will reverse any actions already completed.&lt;br /&gt;
&lt;br /&gt;
The PHP function &#039;&#039;version_compare&#039;&#039; is useful to compare version strings.  Joomla also uses &#039;&#039;version_compare&#039;&#039; to define the sequence of SQL file execution, when an update is being executed that spans multiple versions.&lt;br /&gt;
&lt;br /&gt;
In this example, the preflight method checks that Joomla version is equal to or greater than the value in the manifest file.  If an earlier Joomla version is in use, the install or update will abort.  Try changing the version string in the manifest file file to a value greater than the Joomla version that you are using.  Installs and updates should fail. This is what the version &#039;&#039;democompupdate_10j3.zip&#039;&#039; demonstrates.&lt;br /&gt;
&lt;br /&gt;
In addition to failing, it is important to give the web site administrator useful information as to why the component installation failed. See the example below.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function preflight( $type, $parent ) {&lt;br /&gt;
	$jversion = new JVersion();&lt;br /&gt;
&lt;br /&gt;
	// Installing component manifest file version&lt;br /&gt;
	$this-&amp;gt;release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;version;&lt;br /&gt;
		&lt;br /&gt;
	// Manifest file minimum Joomla version&lt;br /&gt;
	$this-&amp;gt;minimum_joomla_release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;attributes()-&amp;gt;version;   &lt;br /&gt;
&lt;br /&gt;
	// Show the essential information at the install/update back-end&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;Installing component manifest file version = &#039; . $this-&amp;gt;release;&lt;br /&gt;
	echo &#039;&amp;lt;br /&amp;gt;Current manifest cache commponent version = &#039; . $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
	echo &#039;&amp;lt;br /&amp;gt;Installing component manifest file minimum Joomla version = &#039; . $this-&amp;gt;minimum_joomla_release;&lt;br /&gt;
	echo &#039;&amp;lt;br /&amp;gt;Current Joomla version = &#039; . $jversion-&amp;gt;getShortVersion();&lt;br /&gt;
&lt;br /&gt;
	// abort if the current Joomla release is older&lt;br /&gt;
	if( version_compare( $jversion-&amp;gt;getShortVersion(), $this-&amp;gt;minimum_joomla_release, &#039;lt&#039; ) ) {&lt;br /&gt;
		Jerror::raiseWarning(null, &#039;Cannot install com_democompupdate in a Joomla release prior to &#039;.$this-&amp;gt;minimum_joomla_release);&lt;br /&gt;
		return false;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// abort if the component being installed is not newer than the currently installed version&lt;br /&gt;
	if ( $type == &#039;update&#039; ) {&lt;br /&gt;
		$oldRelease = $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
		$rel = $oldRelease . &#039; to &#039; . $this-&amp;gt;release;&lt;br /&gt;
		if ( version_compare( $this-&amp;gt;release, $oldRelease, &#039;le&#039; ) ) {&lt;br /&gt;
			Jerror::raiseWarning(null, &#039;Incorrect version sequence. Cannot upgrade &#039; . $rel);&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	else { $rel = $this-&amp;gt;release; }&lt;br /&gt;
 &lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_PREFLIGHT_&#039; . $type . &#039; &#039; . $rel) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== install ===&lt;br /&gt;
Install is executed after the Joomla install database scripts have completed. Returning &#039;false&#039; will abort the install and undo any changes already made.&lt;br /&gt;
It is cleaner to abort the install during preflight, if possible.  Since fewer install actions have occurred at preflight, there is less risk that that their reversal may be done incorrectly.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function install( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_INSTALL to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	// You can have the backend jump directly to the newly installed component configuration page&lt;br /&gt;
	// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== update ===&lt;br /&gt;
Update is executed after the Joomla update database scripts have completed.  Returning &#039;false&#039; will abort the update and undo any changes already made.&lt;br /&gt;
It is cleaner to abort the update during preflight, if possible.  Since fewer update actions have occurred at preflight, there is less risk that that their reversal may be done incorrectly.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function update( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UPDATE_ to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	// You can have the backend jump directly to the newly updated component configuration page&lt;br /&gt;
	// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== postflight ===&lt;br /&gt;
Postflight is executed after the Joomla install, update or discover_update actions have completed.  It is not executed after uninstall.  Postflight is executed after the extension is registered in the database.  The type of action (install, update or discover_install) is passed to postflight in the $type operand. Postflight cannot cause an abort of the Joomla install, update or discover_install action.&lt;br /&gt;
&lt;br /&gt;
The postflight method is a good place to set the default values of component parameters during installs, and to set the values of hidden component parameters during installs and updates.  Postflight can be used for any other action that must follow the install, update or discover_install actions.&lt;br /&gt;
&lt;br /&gt;
This example defines component parameters in postflight.  The value of &#039;&#039;my_param0&#039;&#039; is displayed in the component front-end.  Both &#039;&#039;my_param0&#039;&#039; and &#039;&#039;my_param1&#039;&#039; are overwritten in all updates. This is how you would change revision-specific values during an update. The examples &#039;&#039;myparam2&#039;&#039; and &#039;&#039;myparam3&#039;&#039; represent component configuration parameters that you expect users to set, and you do not want to overwrite during an update. This example sets these two values only on a new install, not on an update. Parameters that control component operation would be treated this way.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function postflight( $type, $parent ) {&lt;br /&gt;
	// always create or modify these parameters&lt;br /&gt;
	$params[&#039;my_param0&#039;] = &#039;Component version &#039; . $this-&amp;gt;release;&lt;br /&gt;
	$params[&#039;my_param1&#039;] = &#039;Another value&#039;;&lt;br /&gt;
 &lt;br /&gt;
	// define the following parameters only if it is an original install&lt;br /&gt;
	if ( $type == &#039;install&#039; ) {&lt;br /&gt;
		$params[&#039;my_param2&#039;] = &#039;4&#039;;&lt;br /&gt;
		$params[&#039;my_param3&#039;] = &#039;Star&#039;;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	$this-&amp;gt;setParams( $params );&lt;br /&gt;
 &lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_POSTFLIGHT &#039; . $type . &#039; to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== uninstall ===&lt;br /&gt;
The uninstall method is executed before any Joomla uninstall action, such as file removal or database changes.  Uninstall cannot cause an abort of the Joomla uninstall action, so returning false would be a waste of time.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function uninstall( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UNINSTALL &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The entire script.php file ==&lt;br /&gt;
This is the entire script.php file.  It is the same for all versions of com_democompupdate.&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(&#039;Restricted access&#039;);&lt;br /&gt;
 &lt;br /&gt;
//the name of the class must be the name of your component + InstallerScript&lt;br /&gt;
//for example: com_contentInstallerScript for com_content.&lt;br /&gt;
class com_democompupdateInstallerScript&lt;br /&gt;
{&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * $type is the type of change (install, update or discover_install, not uninstall).&lt;br /&gt;
	 * preflight runs before anything else and while the extracted files are in the uploaded temp folder.&lt;br /&gt;
	 * If preflight returns false, Joomla will abort the update and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function preflight( $type, $parent ) {&lt;br /&gt;
		$jversion = new JVersion();&lt;br /&gt;
&lt;br /&gt;
		// Installing component manifest file version&lt;br /&gt;
		$this-&amp;gt;release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;version;&lt;br /&gt;
		&lt;br /&gt;
		// Manifest file minimum Joomla version&lt;br /&gt;
		$this-&amp;gt;minimum_joomla_release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;attributes()-&amp;gt;version;   &lt;br /&gt;
&lt;br /&gt;
		// Show the essential information at the install/update back-end&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;Installing component manifest file version = &#039; . $this-&amp;gt;release;&lt;br /&gt;
		echo &#039;&amp;lt;br /&amp;gt;Current manifest cache commponent version = &#039; . $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
		echo &#039;&amp;lt;br /&amp;gt;Installing component manifest file minimum Joomla version = &#039; . $this-&amp;gt;minimum_joomla_release;&lt;br /&gt;
		echo &#039;&amp;lt;br /&amp;gt;Current Joomla version = &#039; . $jversion-&amp;gt;getShortVersion();&lt;br /&gt;
&lt;br /&gt;
		// abort if the current Joomla release is older&lt;br /&gt;
		if( version_compare( $jversion-&amp;gt;getShortVersion(), $this-&amp;gt;minimum_joomla_release, &#039;lt&#039; ) ) {&lt;br /&gt;
			Jerror::raiseWarning(null, &#039;Cannot install com_democompupdate in a Joomla release prior to &#039;.$this-&amp;gt;minimum_joomla_release);&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
 &lt;br /&gt;
		// abort if the component being installed is not newer than the currently installed version&lt;br /&gt;
		if ( $type == &#039;update&#039; ) {&lt;br /&gt;
			$oldRelease = $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
			$rel = $oldRelease . &#039; to &#039; . $this-&amp;gt;release;&lt;br /&gt;
			if ( version_compare( $this-&amp;gt;release, $oldRelease, &#039;le&#039; ) ) {&lt;br /&gt;
				Jerror::raiseWarning(null, &#039;Incorrect version sequence. Cannot upgrade &#039; . $rel);&lt;br /&gt;
				return false;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
		else { $rel = $this-&amp;gt;release; }&lt;br /&gt;
 &lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_PREFLIGHT_&#039; . $type . &#039; &#039; . $rel) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * install runs after the database scripts are executed.&lt;br /&gt;
	 * If the extension is new, the install method is run.&lt;br /&gt;
	 * If install returns false, Joomla will abort the install and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function install( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_INSTALL to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
		// You can have the backend jump directly to the newly installed component configuration page&lt;br /&gt;
		// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * update runs after the database scripts are executed.&lt;br /&gt;
	 * If the extension exists, then the update method is run.&lt;br /&gt;
	 * If this returns false, Joomla will abort the update and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function update( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UPDATE_ to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
		// You can have the backend jump directly to the newly updated component configuration page&lt;br /&gt;
		// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * $type is the type of change (install, update or discover_install, not uninstall).&lt;br /&gt;
	 * postflight is run after the extension is registered in the database.&lt;br /&gt;
	 */&lt;br /&gt;
	function postflight( $type, $parent ) {&lt;br /&gt;
		// always create or modify these parameters&lt;br /&gt;
		$params[&#039;my_param0&#039;] = &#039;Component version &#039; . $this-&amp;gt;release;&lt;br /&gt;
		$params[&#039;my_param1&#039;] = &#039;Another value&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// define the following parameters only if it is an original install&lt;br /&gt;
		if ( $type == &#039;install&#039; ) {&lt;br /&gt;
			$params[&#039;my_param2&#039;] = &#039;4&#039;;&lt;br /&gt;
			$params[&#039;my_param3&#039;] = &#039;Star&#039;;&lt;br /&gt;
		}&lt;br /&gt;
 &lt;br /&gt;
		$this-&amp;gt;setParams( $params );&lt;br /&gt;
 &lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_POSTFLIGHT &#039; . $type . &#039; to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method&lt;br /&gt;
	 * uninstall runs before any other action is taken (file removal or database processing).&lt;br /&gt;
	 */&lt;br /&gt;
	function uninstall( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UNINSTALL &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	/*&lt;br /&gt;
	 * get a variable from the manifest file (actually, from the manifest cache).&lt;br /&gt;
	 */&lt;br /&gt;
	function getParam( $name ) {&lt;br /&gt;
		$db = JFactory::getDbo();&lt;br /&gt;
		$db-&amp;gt;setQuery(&#039;SELECT manifest_cache FROM #__extensions WHERE name = &amp;quot;com_democompupdate&amp;quot;&#039;);&lt;br /&gt;
		$manifest = json_decode( $db-&amp;gt;loadResult(), true );&lt;br /&gt;
		return $manifest[ $name ];&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	/*&lt;br /&gt;
	 * sets parameter values in the component&#039;s row of the extension table&lt;br /&gt;
	 */&lt;br /&gt;
	function setParams($param_array) {&lt;br /&gt;
		if ( count($param_array) &amp;gt; 0 ) {&lt;br /&gt;
			// read the existing component value(s)&lt;br /&gt;
			$db = JFactory::getDbo();&lt;br /&gt;
			$db-&amp;gt;setQuery(&#039;SELECT params FROM #__extensions WHERE name = &amp;quot;com_democompupdate&amp;quot;&#039;);&lt;br /&gt;
			$params = json_decode( $db-&amp;gt;loadResult(), true );&lt;br /&gt;
			// add the new variable(s) to the existing one(s)&lt;br /&gt;
			foreach ( $param_array as $name =&amp;gt; $value ) {&lt;br /&gt;
				$params[ (string) $name ] = (string) $value;&lt;br /&gt;
			}&lt;br /&gt;
			// store the combined new and existing values back as a JSON string&lt;br /&gt;
			$paramsString = json_encode( $params );&lt;br /&gt;
			$db-&amp;gt;setQuery(&#039;UPDATE #__extensions SET params = &#039; .&lt;br /&gt;
				$db-&amp;gt;quote( $paramsString ) .&lt;br /&gt;
				&#039; WHERE name = &amp;quot;com_democompupdate&amp;quot;&#039; );&lt;br /&gt;
				$db-&amp;gt;query();&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
*[[User:tapaccos|Alex Tapaccos]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Joomla! 1.6]]&lt;br /&gt;
[[Category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Joomla! 2.5]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Portal:Component_Development&amp;diff=68103</id>
		<title>Portal:Component Development</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Portal:Component_Development&amp;diff=68103"/>
		<updated>2012-07-01T01:43:37Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* Other component topics */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
== Recommended Reading ==&lt;br /&gt;
=== General ===&lt;br /&gt;
* [[Joomla Beginning Developer Course]]&lt;br /&gt;
* [[Setting up your workstation for Joomla! development]]&lt;br /&gt;
* [[Secure coding guidelines]]&lt;br /&gt;
=== Specific ===&lt;br /&gt;
&amp;lt;onlyinclude&amp;gt;&lt;br /&gt;
====Developing a Model-View-Controller (MVC) Component {{JVer|1.5}}====&lt;br /&gt;
* [[Developing a Model-View-Controller Component - Part 1]]&lt;br /&gt;
* [[Developing a Model-View-Controller Component - Part 2 - Adding a Model]]&lt;br /&gt;
* [[Developing a Model-View-Controller Component - Part 3 - Using the Database]]&lt;br /&gt;
* [[Developing a Model-View-Controller Component - Part 4 - Creating an Administrator Interface]]&lt;br /&gt;
* [[Developing a Model-View-Controller Component - Part 5 - Basic Backend Framework]]&lt;br /&gt;
* [[Developing a Model-View-Controller Component - Part 6 - Adding Backend Actions]]&lt;br /&gt;
&lt;br /&gt;
====Developing a Model-View-Controller (MVC) Component {{JVer|1.6}}====&lt;br /&gt;
* [[Developing a Model-View-Controller (MVC) Component for Joomla!1.6|Introduction]]&lt;br /&gt;
{{Chunk:Developing a Model-View-Controller (MVC) Component for Joomla!1.6 - Contents}}&lt;br /&gt;
&lt;br /&gt;
====Other component topics====&lt;br /&gt;
* [[File Structure and Naming Conventions]]&lt;br /&gt;
* [[Component Program Flow]]. UML sequence diagrams showing the control flow for a component. {{JVer|1.5}}&lt;br /&gt;
* [[Component parameters]]&lt;br /&gt;
* [[Components:xml installfile]].  An example component XML installation file. {{JVer|1.5}}&lt;br /&gt;
* [[Manifest files]] for the installation of extensions {{JVer|1.6}}&lt;br /&gt;
* [[Supporting SEF URLs in your component]]&lt;br /&gt;
* [[Supporting plugins in your component]]&lt;br /&gt;
* [[Using JPagination in your component]]&lt;br /&gt;
* [[Adding sortable columns to a table in a component]]&lt;br /&gt;
* [[How to use the JPane classes in a component]] {{JVer|1.5}}&lt;br /&gt;
* [[How to use the JHtmlTabs in a component]]&lt;br /&gt;
* [[How to use the editor in a component]]&lt;br /&gt;
* [[Adding AJAX to your component]]&lt;br /&gt;
* [[Ajax using MooTools]]&lt;br /&gt;
* [[How to add breadcrumbs]]&lt;br /&gt;
* [[How to send email from components]]&lt;br /&gt;
* [[How to use the JToolBar class in the frontend]]&lt;br /&gt;
* [[Creating a toolbar for your component]]&lt;br /&gt;
* [[Creating a file uploader in your component]]&lt;br /&gt;
* [[Adding Javascript moo.fx to your component]]&lt;br /&gt;
* [[Adding view layout configuration parameters]]&lt;br /&gt;
* [[Using a custom image in the menu bar title]]&lt;br /&gt;
* [[How to implement XML-RPC in a component]]&lt;br /&gt;
* [[Using multiple models in an MVC component]]&lt;br /&gt;
* [[Adding ACL rules to your component]] {{JVer|1.7}}&lt;br /&gt;
* [[How to create a modal form field in 1.6/1.7]] {{JVer|1.6}} {{JVer|1.7}}&lt;br /&gt;
* [[JController and its subclass usage overview]] {{JVer|1.6}} {{JVer|1.7}}&lt;br /&gt;
* [[Managing Component Updates with Joomla!1.6 - Part 1]] {{JVer|1.6}} {{JVer|1.7}} {{JVer|2.5}}&lt;br /&gt;
* [[Xml-rpc changes in Joomla! 1.6]] {{JVer|1.6}}&lt;br /&gt;
* [[How to create PDF views]]{{JVer|2.5}}&lt;br /&gt;
* [[Components:jform fields]]. and their usage {{JVer|2.5}}&lt;br /&gt;
&amp;lt;/onlyinclude&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Tutorials ==&lt;br /&gt;
&amp;lt;small&amp;gt;List of all articles belonging to the categories &amp;quot;Tutorials&amp;quot; AND &amp;quot;Component Development&amp;quot;&amp;lt;/small&amp;gt;&lt;br /&gt;
&amp;lt;DPL&amp;gt;&lt;br /&gt;
noresultsheader=\n  &lt;br /&gt;
format   = ,\n* [[%PAGE%|%TITLE%]],,&lt;br /&gt;
category=Tutorials&lt;br /&gt;
category=Component Development&lt;br /&gt;
&amp;lt;/DPL&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==FAQ==&lt;br /&gt;
&amp;lt;small&amp;gt;List of all articles belonging to the categories &amp;quot;FAQ&amp;quot; AND &amp;quot;Component Development&amp;quot;&amp;lt;/small&amp;gt;&lt;br /&gt;
&amp;lt;DPL&amp;gt;&lt;br /&gt;
noresultsheader=\n  &lt;br /&gt;
format   = ,\n* [[%PAGE%|%TITLE%]],,&lt;br /&gt;
category=FAQ&lt;br /&gt;
category=Component Development&lt;br /&gt;
&amp;lt;/DPL&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(How_to_use_this_example)&amp;diff=67577</id>
		<title>Archived:Managing Component Updates (How to use this example)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(How_to_use_this_example)&amp;diff=67577"/>
		<updated>2012-06-10T21:47:39Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* Summary */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}} {{JVer|2.5}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
You will need to download all four versions of this example to exercise all of the features.&lt;br /&gt;
&lt;br /&gt;
== Normal update sequence ==&lt;br /&gt;
&lt;br /&gt;
You can use the following sequence of installs, updates and uninstalls to show the effects of this example.  You may also try installs, updates and uninstalls in any sequence that you desire.&lt;br /&gt;
&lt;br /&gt;
* Previous state: no com_democompupdate component installed.&lt;br /&gt;
* Install democompupdate_10.zip.&lt;br /&gt;
** Verify the install is good by the text echoed in back-end.&lt;br /&gt;
** Front-end: verify database, files and parameter setting.&lt;br /&gt;
** optional: phpMyAdmin: verify:&lt;br /&gt;
*** jos_democompupdate_mytable exists and has one row, myvalue = &#039;1.0&#039;.&lt;br /&gt;
*** jos_extensions table has entry for com_democompupdate.&lt;br /&gt;
**** params field (JSON), has three values.&lt;br /&gt;
**** manifest_cache field (JSON) shows version &#039;1.0&#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Previous state: version 1.0 installed.&lt;br /&gt;
* Install democompupdate_111.zip.&lt;br /&gt;
** Verify the update is good by the text echoed in back-end.&lt;br /&gt;
** Front-end: verify database, files and parameter setting.&lt;br /&gt;
** optional: phpMyAdmin: verify:&lt;br /&gt;
*** jos_democompupdate_mytable exists and has one row, value &#039;1.1.1&#039;.&lt;br /&gt;
*** jos_extensions table has entry for com_democompupdate.&lt;br /&gt;
**** params field (JSON), has three values.&lt;br /&gt;
**** manifest_cache field (JSON) shows version &#039;1.1.1&#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Previous state: version 1.1.1 installed.&lt;br /&gt;
* Install democompupdate_13.zip.&lt;br /&gt;
** Verify the update is good by the text echoed in back-end.&lt;br /&gt;
** Front-end: verify database, files and parameter setting.&lt;br /&gt;
*** There should be three rows in the table.&lt;br /&gt;
** optional: phpMyAdmin: verify:&lt;br /&gt;
*** jos_democompupdate_mytable exists and has three rows, values &#039;1.1.1&#039;, &#039;1.2.1&#039; and &#039;1.3&#039;.&lt;br /&gt;
*** jos_extensions table has entry for com_democompupdate.&lt;br /&gt;
**** params field (JSON), has three values.&lt;br /&gt;
**** manifest_cache field (JSON) shows version &#039;1.3&#039;.&lt;br /&gt;
&lt;br /&gt;
== Try a reverse-sequence update ==&lt;br /&gt;
&lt;br /&gt;
* Previous state: version 1.3 installed.&lt;br /&gt;
* Install democompupdate_10.zip.&lt;br /&gt;
** Update should fail, give useful information in the back-end.&lt;br /&gt;
** No change should be seen in the front-end, back-end or MySqlAdmin.&lt;br /&gt;
&lt;br /&gt;
== Make sure that uninstall works ==&lt;br /&gt;
&lt;br /&gt;
* Previous state: version 1.3 installed.&lt;br /&gt;
* Uninstall com_democompupdate&lt;br /&gt;
** Verify the component does not exist in Joomla extension manager or front-end.&lt;br /&gt;
** optional: phpMyAdmin: verify that democompupdate elements are gone.&lt;br /&gt;
&lt;br /&gt;
== Verify full installs of each revision work correctly ==&lt;br /&gt;
&lt;br /&gt;
* Previous state: no democompupdate component installed.&lt;br /&gt;
* Install democompupdate_111.zip.&lt;br /&gt;
** Verify that the full install created the same database and file state as the update to 1.1.1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Previous state: version 1.1.1 installed.&lt;br /&gt;
* Uninstall com_democompupdate&lt;br /&gt;
** Verify the component does not exist in Joomla extension manager or front-end.&lt;br /&gt;
** optional: phpMyAdmin: verify that democompupdate elements are gone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Previous state: no democompupdate component installed.&lt;br /&gt;
* Install democompupdate_13.zip.&lt;br /&gt;
** Verify that the full install created the same database and file state as the update to 1.3.&lt;br /&gt;
&lt;br /&gt;
== Verify that Joomla version check works ==&lt;br /&gt;
&lt;br /&gt;
* Previous state: version 1.3 installed.&lt;br /&gt;
* Uninstall com_democompupdate&lt;br /&gt;
* Install democompupdate_10j3.zip.&lt;br /&gt;
** The update should fail, give useful information in the back-end.&lt;br /&gt;
** No evidence of the installed component should exist in front-end, back-end or MySqlAdmin.&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
You can use the update features in Joomla 1.6 (and greater) to ensure that the web site administrator installs your component properly.&lt;br /&gt;
* Your component version string sequence must follow the requirements shown in the PHP &#039;&#039;version_compare&#039;&#039; function.&lt;br /&gt;
* Create update SQL files for component revisions.  The file names must match your version strings.&lt;br /&gt;
* Update the version string in the manifest file for each version.&lt;br /&gt;
* Update the required Joomla version in the manifest file, if you will use it in the script.php file to enable installs and updates.&lt;br /&gt;
* Modify the custom PHP code in the script.php file, if needed, for each version.&lt;br /&gt;
&lt;br /&gt;
If your component requires non-standard update handling, you can implement it in the script.php file.  You can disable the normal update SQL file execution and implement your own code.  You can implement custom checks and custom install and update actions.  You can, and should, create confirmation messages and error messages to help the web site administrator understand what your code is doing.&lt;br /&gt;
&lt;br /&gt;
I intentionally made this example simple, to make debugging easier. You can implement your custom code in this example, verify that it works correctly, then implement it in your component.  Share your successes with the Joomla community.&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Component_release_files)&amp;diff=67576</id>
		<title>Archived:Managing Component Updates (Component release files)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Component_release_files)&amp;diff=67576"/>
		<updated>2012-06-10T21:42:50Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* Version 1.3 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}} {{JVer|2.5}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Component Release Files ==&lt;br /&gt;
Included in this example are zip files for four releases. You will need to download all four to exercise the features of this example.&lt;br /&gt;
&lt;br /&gt;
=== Version 1.0 ===&lt;br /&gt;
The zip file can be downloaded from &lt;br /&gt;
[http://joomlacode.org/gf/download/frsrelease/16495/74511/democompupdate_10.zip democompupdate_10.zip].&lt;br /&gt;
It contains files:&lt;br /&gt;
* democompupdate_10/democompupdate.xml&lt;br /&gt;
* democompupdate_10/script.php&lt;br /&gt;
* democompupdate_10/admin/sql/install_data.sql&lt;br /&gt;
* democompupdate_10/admin/sql/uninstall.sql&lt;br /&gt;
* democompupdate_10/admin/sql/updates/1.0.sql&lt;br /&gt;
* democompupdate_10/site/controller.php&lt;br /&gt;
* democompupdate_10/site/democompupdate.php&lt;br /&gt;
* democompupdate_10/site/models/democompupdate.php&lt;br /&gt;
* democompupdate_10/site/views/democompupdate/view.html.php&lt;br /&gt;
* democompupdate_10/site/views/democompupdate/tmpl/default.php&lt;br /&gt;
&lt;br /&gt;
=== Version 1.0.j3 ===&lt;br /&gt;
The zip file can be downloaded from &lt;br /&gt;
[http://joomlacode.org/gf/download/frsrelease/16495/74512/democompupdate_10j3.zip democompupdate_10j3.zip].  It is identical to version 1.0, except that is requires Joomla 30.0.  The intent is that this will cause an abort of the install or update.&lt;br /&gt;
Diff&#039;s of &#039;&#039;democompupdate_10&#039;&#039; and &#039;&#039;democompupdate_10j3&#039;&#039; show how files have changed.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff -r democompupdate_10/democompupdate.xml democompupdate_10j3/democompupdate.xml&lt;br /&gt;
2c2&lt;br /&gt;
&amp;lt; &amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; &amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;30.0&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Version 1.1.1 ===&lt;br /&gt;
&lt;br /&gt;
The zip file can be downloaded from &lt;br /&gt;
[http://joomlacode.org/gf/download/frsrelease/16495/74513/democompupdate_111.zip democompupdate_111.zip].&lt;br /&gt;
Diff&#039;s of &#039;&#039;democompupdate_10&#039;&#039; and &#039;&#039;democompupdate_111&#039;&#039; show how files have changed.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff -r democompupdate_10/admin/sql/install_data.sql democompupdate_111/admin/sql/install_data.sql&lt;br /&gt;
10c10&lt;br /&gt;
&amp;lt; (1,&#039;1.0&#039;);&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; (1,&#039;1.1.1&#039;);&lt;br /&gt;
Only in democompupdate_111/admin/sql/updates: 1.1.1.sql&lt;br /&gt;
Only in democompupdate_111/admin/sql/updates: 1.1.sql&lt;br /&gt;
diff -r democompupdate_10/democompupdate.xml democompupdate_111/democompupdate.xml&lt;br /&gt;
2c2&lt;br /&gt;
&amp;lt; &amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; &amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
8c8&lt;br /&gt;
&amp;lt; 	&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 	&amp;lt;version&amp;gt;1.1.1&amp;lt;/version&amp;gt;&lt;br /&gt;
diff -r democompupdate_10/site/views/democompupdate/view.html.php democompupdate_111/site/views/democompupdate/view.html.php&lt;br /&gt;
25c25&lt;br /&gt;
&amp;lt; 		$myRev = &#039;1.0&#039;;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 		$myRev = &#039;1.1.1&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Version 1.3 ===&lt;br /&gt;
The zip file can be downloaded from &lt;br /&gt;
[http://joomlacode.org/gf/download/frsrelease/16495/74514/democompupdate_13.zip democompupdate_13.zip].&lt;br /&gt;
Diff&#039;s of &#039;&#039;democompupdate_111&#039;&#039; and &#039;&#039;democompupdate_13&#039;&#039; show how files have changed.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff -r democompupdate_111/admin/sql/install_data.sql democompupdate_13/admin/sql/install_data.sql&lt;br /&gt;
10c10,12&lt;br /&gt;
&amp;lt; (1,&#039;1.1.1&#039;);&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; (1,&#039;1.1.1&#039;),&lt;br /&gt;
&amp;gt; (2,&#039;1.2.1&#039;),&lt;br /&gt;
&amp;gt; (3,&#039;1.3&#039;);&lt;br /&gt;
Only in democompupdate_13/admin/sql/updates: 1.2.1.sql&lt;br /&gt;
Only in democompupdate_13/admin/sql/updates: 1.2.sql&lt;br /&gt;
Only in democompupdate_13/admin/sql/updates: 1.3.sql&lt;br /&gt;
diff -r democompupdate_111/democompupdate.xml democompupdate_13/democompupdate.xml&lt;br /&gt;
8c8&lt;br /&gt;
&amp;lt; 	&amp;lt;version&amp;gt;1.1.1&amp;lt;/version&amp;gt;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 	&amp;lt;version&amp;gt;1.3&amp;lt;/version&amp;gt;&lt;br /&gt;
diff -r democompupdate_111/site/views/democompupdate/view.html.php democompupdate_13/site/views/democompupdate/view.html.php&lt;br /&gt;
25c25&lt;br /&gt;
&amp;lt; 		$myRev = &#039;1.1.1&#039;;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 		$myRev = &#039;1.3&#039;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Component_release_files)&amp;diff=67575</id>
		<title>Archived:Managing Component Updates (Component release files)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Component_release_files)&amp;diff=67575"/>
		<updated>2012-06-10T21:41:27Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* Version 1.1.1 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}} {{JVer|2.5}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Component Release Files ==&lt;br /&gt;
Included in this example are zip files for four releases. You will need to download all four to exercise the features of this example.&lt;br /&gt;
&lt;br /&gt;
=== Version 1.0 ===&lt;br /&gt;
The zip file can be downloaded from &lt;br /&gt;
[http://joomlacode.org/gf/download/frsrelease/16495/74511/democompupdate_10.zip democompupdate_10.zip].&lt;br /&gt;
It contains files:&lt;br /&gt;
* democompupdate_10/democompupdate.xml&lt;br /&gt;
* democompupdate_10/script.php&lt;br /&gt;
* democompupdate_10/admin/sql/install_data.sql&lt;br /&gt;
* democompupdate_10/admin/sql/uninstall.sql&lt;br /&gt;
* democompupdate_10/admin/sql/updates/1.0.sql&lt;br /&gt;
* democompupdate_10/site/controller.php&lt;br /&gt;
* democompupdate_10/site/democompupdate.php&lt;br /&gt;
* democompupdate_10/site/models/democompupdate.php&lt;br /&gt;
* democompupdate_10/site/views/democompupdate/view.html.php&lt;br /&gt;
* democompupdate_10/site/views/democompupdate/tmpl/default.php&lt;br /&gt;
&lt;br /&gt;
=== Version 1.0.j3 ===&lt;br /&gt;
The zip file can be downloaded from &lt;br /&gt;
[http://joomlacode.org/gf/download/frsrelease/16495/74512/democompupdate_10j3.zip democompupdate_10j3.zip].  It is identical to version 1.0, except that is requires Joomla 30.0.  The intent is that this will cause an abort of the install or update.&lt;br /&gt;
Diff&#039;s of &#039;&#039;democompupdate_10&#039;&#039; and &#039;&#039;democompupdate_10j3&#039;&#039; show how files have changed.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff -r democompupdate_10/democompupdate.xml democompupdate_10j3/democompupdate.xml&lt;br /&gt;
2c2&lt;br /&gt;
&amp;lt; &amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; &amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;30.0&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Version 1.1.1 ===&lt;br /&gt;
&lt;br /&gt;
The zip file can be downloaded from &lt;br /&gt;
[http://joomlacode.org/gf/download/frsrelease/16495/74513/democompupdate_111.zip democompupdate_111.zip].&lt;br /&gt;
Diff&#039;s of &#039;&#039;democompupdate_10&#039;&#039; and &#039;&#039;democompupdate_111&#039;&#039; show how files have changed.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff -r democompupdate_10/admin/sql/install_data.sql democompupdate_111/admin/sql/install_data.sql&lt;br /&gt;
10c10&lt;br /&gt;
&amp;lt; (1,&#039;1.0&#039;);&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; (1,&#039;1.1.1&#039;);&lt;br /&gt;
Only in democompupdate_111/admin/sql/updates: 1.1.1.sql&lt;br /&gt;
Only in democompupdate_111/admin/sql/updates: 1.1.sql&lt;br /&gt;
diff -r democompupdate_10/democompupdate.xml democompupdate_111/democompupdate.xml&lt;br /&gt;
2c2&lt;br /&gt;
&amp;lt; &amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; &amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
8c8&lt;br /&gt;
&amp;lt; 	&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 	&amp;lt;version&amp;gt;1.1.1&amp;lt;/version&amp;gt;&lt;br /&gt;
diff -r democompupdate_10/site/views/democompupdate/view.html.php democompupdate_111/site/views/democompupdate/view.html.php&lt;br /&gt;
25c25&lt;br /&gt;
&amp;lt; 		$myRev = &#039;1.0&#039;;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 		$myRev = &#039;1.1.1&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Version 1.3 ===&lt;br /&gt;
The zip file can be downloaded from &lt;br /&gt;
[http://joomlacode.org/gf/download/frsrelease/16495/72059/democompupdate_13.zip democompupdate_13.zip].&lt;br /&gt;
Diff&#039;s of &#039;&#039;democompupdate_111&#039;&#039; and &#039;&#039;democompupdate_13&#039;&#039; show how files have changed.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff -r democompupdate_111/ democompupdate_13/&lt;br /&gt;
diff -r democompupdate_111/admin/sql/install_data.sql democompupdate_13/admin/sql/install_data.sql&lt;br /&gt;
10c10,12&lt;br /&gt;
&amp;lt; (1,&#039;1.1.1&#039;);&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; (1,&#039;1.1.1&#039;),&lt;br /&gt;
&amp;gt; (2,&#039;1.2.1&#039;),&lt;br /&gt;
&amp;gt; (3,&#039;1.3&#039;);&lt;br /&gt;
Only in democompupdate_13/admin/sql/updates: 1.2.1.sql&lt;br /&gt;
Only in democompupdate_13/admin/sql/updates: 1.2.sql&lt;br /&gt;
Only in democompupdate_13/admin/sql/updates: 1.3.sql&lt;br /&gt;
diff -r democompupdate_111/democompupdate.xml democompupdate_13/democompupdate.xml&lt;br /&gt;
8c8&lt;br /&gt;
&amp;lt; 	&amp;lt;version&amp;gt;1.1.1&amp;lt;/version&amp;gt;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 	&amp;lt;version&amp;gt;1.3&amp;lt;/version&amp;gt;&lt;br /&gt;
diff -r democompupdate_111/script.php democompupdate_13/script.php&lt;br /&gt;
12c12&lt;br /&gt;
&amp;lt; 	private $release = &#039;1.1.1&#039;;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 	private $release = &#039;1.3&#039;;&lt;br /&gt;
diff -r democompupdate_111/site/views/democompupdate/view.html.php democompupdate_13/site/views/democompupdate/view.html.php&lt;br /&gt;
25c25&lt;br /&gt;
&amp;lt; 		$myRev = &#039;1.1.1&#039;;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 		$myRev = &#039;1.3&#039;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Component_release_files)&amp;diff=67574</id>
		<title>Archived:Managing Component Updates (Component release files)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Component_release_files)&amp;diff=67574"/>
		<updated>2012-06-10T21:39:55Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* Version 1.0.j3 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}} {{JVer|2.5}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Component Release Files ==&lt;br /&gt;
Included in this example are zip files for four releases. You will need to download all four to exercise the features of this example.&lt;br /&gt;
&lt;br /&gt;
=== Version 1.0 ===&lt;br /&gt;
The zip file can be downloaded from &lt;br /&gt;
[http://joomlacode.org/gf/download/frsrelease/16495/74511/democompupdate_10.zip democompupdate_10.zip].&lt;br /&gt;
It contains files:&lt;br /&gt;
* democompupdate_10/democompupdate.xml&lt;br /&gt;
* democompupdate_10/script.php&lt;br /&gt;
* democompupdate_10/admin/sql/install_data.sql&lt;br /&gt;
* democompupdate_10/admin/sql/uninstall.sql&lt;br /&gt;
* democompupdate_10/admin/sql/updates/1.0.sql&lt;br /&gt;
* democompupdate_10/site/controller.php&lt;br /&gt;
* democompupdate_10/site/democompupdate.php&lt;br /&gt;
* democompupdate_10/site/models/democompupdate.php&lt;br /&gt;
* democompupdate_10/site/views/democompupdate/view.html.php&lt;br /&gt;
* democompupdate_10/site/views/democompupdate/tmpl/default.php&lt;br /&gt;
&lt;br /&gt;
=== Version 1.0.j3 ===&lt;br /&gt;
The zip file can be downloaded from &lt;br /&gt;
[http://joomlacode.org/gf/download/frsrelease/16495/74512/democompupdate_10j3.zip democompupdate_10j3.zip].  It is identical to version 1.0, except that is requires Joomla 30.0.  The intent is that this will cause an abort of the install or update.&lt;br /&gt;
Diff&#039;s of &#039;&#039;democompupdate_10&#039;&#039; and &#039;&#039;democompupdate_10j3&#039;&#039; show how files have changed.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff -r democompupdate_10/democompupdate.xml democompupdate_10j3/democompupdate.xml&lt;br /&gt;
2c2&lt;br /&gt;
&amp;lt; &amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; &amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;30.0&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Version 1.1.1 ===&lt;br /&gt;
&lt;br /&gt;
The zip file can be downloaded from &lt;br /&gt;
[http://joomlacode.org/gf/download/frsrelease/16495/72058/democompupdate_111.zip democompupdate_111.zip].&lt;br /&gt;
Diff&#039;s of &#039;&#039;democompupdate_10&#039;&#039; and &#039;&#039;democompupdate_111&#039;&#039; show how files have changed.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff -r democompupdate_10/ democompupdate_111/&lt;br /&gt;
diff -r democompupdate_10/admin/sql/install_data.sql democompupdate_111/admin/sql/install_data.sql&lt;br /&gt;
10c10&lt;br /&gt;
&amp;lt; (1,&#039;1.0&#039;);&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; (1,&#039;1.1.1&#039;);&lt;br /&gt;
Only in democompupdate_111/admin/sql/updates: 1.1.1.sql&lt;br /&gt;
Only in democompupdate_111/admin/sql/updates: 1.1.sql&lt;br /&gt;
diff -r democompupdate_10/democompupdate.xml democompupdate_111/democompupdate.xml&lt;br /&gt;
2c2&lt;br /&gt;
&amp;lt; &amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; &amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
8c8&lt;br /&gt;
&amp;lt; 	&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 	&amp;lt;version&amp;gt;1.1.1&amp;lt;/version&amp;gt;&lt;br /&gt;
diff -r democompupdate_10/script.php democompupdate_111/script.php&lt;br /&gt;
12c12&lt;br /&gt;
&amp;lt; 	private $release = &#039;1.0&#039;;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 	private $release = &#039;1.1.1&#039;;&lt;br /&gt;
diff -r democompupdate_10/site/views/democompupdate/view.html.php democompupdate_111/site/views/democompupdate/view.html.php&lt;br /&gt;
25c25&lt;br /&gt;
&amp;lt; 		$myRev = &#039;1.0&#039;;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 		$myRev = &#039;1.1.1&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Version 1.3 ===&lt;br /&gt;
The zip file can be downloaded from &lt;br /&gt;
[http://joomlacode.org/gf/download/frsrelease/16495/72059/democompupdate_13.zip democompupdate_13.zip].&lt;br /&gt;
Diff&#039;s of &#039;&#039;democompupdate_111&#039;&#039; and &#039;&#039;democompupdate_13&#039;&#039; show how files have changed.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff -r democompupdate_111/ democompupdate_13/&lt;br /&gt;
diff -r democompupdate_111/admin/sql/install_data.sql democompupdate_13/admin/sql/install_data.sql&lt;br /&gt;
10c10,12&lt;br /&gt;
&amp;lt; (1,&#039;1.1.1&#039;);&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; (1,&#039;1.1.1&#039;),&lt;br /&gt;
&amp;gt; (2,&#039;1.2.1&#039;),&lt;br /&gt;
&amp;gt; (3,&#039;1.3&#039;);&lt;br /&gt;
Only in democompupdate_13/admin/sql/updates: 1.2.1.sql&lt;br /&gt;
Only in democompupdate_13/admin/sql/updates: 1.2.sql&lt;br /&gt;
Only in democompupdate_13/admin/sql/updates: 1.3.sql&lt;br /&gt;
diff -r democompupdate_111/democompupdate.xml democompupdate_13/democompupdate.xml&lt;br /&gt;
8c8&lt;br /&gt;
&amp;lt; 	&amp;lt;version&amp;gt;1.1.1&amp;lt;/version&amp;gt;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 	&amp;lt;version&amp;gt;1.3&amp;lt;/version&amp;gt;&lt;br /&gt;
diff -r democompupdate_111/script.php democompupdate_13/script.php&lt;br /&gt;
12c12&lt;br /&gt;
&amp;lt; 	private $release = &#039;1.1.1&#039;;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 	private $release = &#039;1.3&#039;;&lt;br /&gt;
diff -r democompupdate_111/site/views/democompupdate/view.html.php democompupdate_13/site/views/democompupdate/view.html.php&lt;br /&gt;
25c25&lt;br /&gt;
&amp;lt; 		$myRev = &#039;1.1.1&#039;;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 		$myRev = &#039;1.3&#039;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Component_release_files)&amp;diff=67573</id>
		<title>Archived:Managing Component Updates (Component release files)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Component_release_files)&amp;diff=67573"/>
		<updated>2012-06-10T21:38:03Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* Version 1.0 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}} {{JVer|2.5}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Component Release Files ==&lt;br /&gt;
Included in this example are zip files for four releases. You will need to download all four to exercise the features of this example.&lt;br /&gt;
&lt;br /&gt;
=== Version 1.0 ===&lt;br /&gt;
The zip file can be downloaded from &lt;br /&gt;
[http://joomlacode.org/gf/download/frsrelease/16495/74511/democompupdate_10.zip democompupdate_10.zip].&lt;br /&gt;
It contains files:&lt;br /&gt;
* democompupdate_10/democompupdate.xml&lt;br /&gt;
* democompupdate_10/script.php&lt;br /&gt;
* democompupdate_10/admin/sql/install_data.sql&lt;br /&gt;
* democompupdate_10/admin/sql/uninstall.sql&lt;br /&gt;
* democompupdate_10/admin/sql/updates/1.0.sql&lt;br /&gt;
* democompupdate_10/site/controller.php&lt;br /&gt;
* democompupdate_10/site/democompupdate.php&lt;br /&gt;
* democompupdate_10/site/models/democompupdate.php&lt;br /&gt;
* democompupdate_10/site/views/democompupdate/view.html.php&lt;br /&gt;
* democompupdate_10/site/views/democompupdate/tmpl/default.php&lt;br /&gt;
&lt;br /&gt;
=== Version 1.0.j3 ===&lt;br /&gt;
The zip file can be downloaded from &lt;br /&gt;
[http://joomlacode.org/gf/download/frsrelease/16495/72057/democompupdate_10j3.zip democompupdate_10j3.zip].  It is identical to version 1.0, except that is requires Joomla 30.0.  The intent is that this will cause an abort of the install or update.&lt;br /&gt;
Diff&#039;s of &#039;&#039;democompupdate_10&#039;&#039; and &#039;&#039;democompupdate_10j3&#039;&#039; show how files have changed.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff -r democompupdate_10/ democompupdate_10j3/&lt;br /&gt;
diff -r democompupdate_10/democompupdate.xml democompupdate_10j3/democompupdate.xml&lt;br /&gt;
2c2&lt;br /&gt;
&amp;lt; &amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; &amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;30.0&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
diff -r democompupdate_10/script.php democompupdate_10j3/script.php&lt;br /&gt;
17c17&lt;br /&gt;
&amp;lt;         private $minimum_joomla_release = &#039;1.6.0&#039;;    &lt;br /&gt;
---&lt;br /&gt;
&amp;gt;         private $minimum_joomla_release = &#039;30.0&#039;;    &lt;br /&gt;
26c26&lt;br /&gt;
&amp;lt; 		// this component does not work with Joomla releases prior to 1.6&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 		// this component does not work with Joomla releases prior to 30.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Version 1.1.1 ===&lt;br /&gt;
&lt;br /&gt;
The zip file can be downloaded from &lt;br /&gt;
[http://joomlacode.org/gf/download/frsrelease/16495/72058/democompupdate_111.zip democompupdate_111.zip].&lt;br /&gt;
Diff&#039;s of &#039;&#039;democompupdate_10&#039;&#039; and &#039;&#039;democompupdate_111&#039;&#039; show how files have changed.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff -r democompupdate_10/ democompupdate_111/&lt;br /&gt;
diff -r democompupdate_10/admin/sql/install_data.sql democompupdate_111/admin/sql/install_data.sql&lt;br /&gt;
10c10&lt;br /&gt;
&amp;lt; (1,&#039;1.0&#039;);&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; (1,&#039;1.1.1&#039;);&lt;br /&gt;
Only in democompupdate_111/admin/sql/updates: 1.1.1.sql&lt;br /&gt;
Only in democompupdate_111/admin/sql/updates: 1.1.sql&lt;br /&gt;
diff -r democompupdate_10/democompupdate.xml democompupdate_111/democompupdate.xml&lt;br /&gt;
2c2&lt;br /&gt;
&amp;lt; &amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; &amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
8c8&lt;br /&gt;
&amp;lt; 	&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 	&amp;lt;version&amp;gt;1.1.1&amp;lt;/version&amp;gt;&lt;br /&gt;
diff -r democompupdate_10/script.php democompupdate_111/script.php&lt;br /&gt;
12c12&lt;br /&gt;
&amp;lt; 	private $release = &#039;1.0&#039;;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 	private $release = &#039;1.1.1&#039;;&lt;br /&gt;
diff -r democompupdate_10/site/views/democompupdate/view.html.php democompupdate_111/site/views/democompupdate/view.html.php&lt;br /&gt;
25c25&lt;br /&gt;
&amp;lt; 		$myRev = &#039;1.0&#039;;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 		$myRev = &#039;1.1.1&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Version 1.3 ===&lt;br /&gt;
The zip file can be downloaded from &lt;br /&gt;
[http://joomlacode.org/gf/download/frsrelease/16495/72059/democompupdate_13.zip democompupdate_13.zip].&lt;br /&gt;
Diff&#039;s of &#039;&#039;democompupdate_111&#039;&#039; and &#039;&#039;democompupdate_13&#039;&#039; show how files have changed.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff -r democompupdate_111/ democompupdate_13/&lt;br /&gt;
diff -r democompupdate_111/admin/sql/install_data.sql democompupdate_13/admin/sql/install_data.sql&lt;br /&gt;
10c10,12&lt;br /&gt;
&amp;lt; (1,&#039;1.1.1&#039;);&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; (1,&#039;1.1.1&#039;),&lt;br /&gt;
&amp;gt; (2,&#039;1.2.1&#039;),&lt;br /&gt;
&amp;gt; (3,&#039;1.3&#039;);&lt;br /&gt;
Only in democompupdate_13/admin/sql/updates: 1.2.1.sql&lt;br /&gt;
Only in democompupdate_13/admin/sql/updates: 1.2.sql&lt;br /&gt;
Only in democompupdate_13/admin/sql/updates: 1.3.sql&lt;br /&gt;
diff -r democompupdate_111/democompupdate.xml democompupdate_13/democompupdate.xml&lt;br /&gt;
8c8&lt;br /&gt;
&amp;lt; 	&amp;lt;version&amp;gt;1.1.1&amp;lt;/version&amp;gt;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 	&amp;lt;version&amp;gt;1.3&amp;lt;/version&amp;gt;&lt;br /&gt;
diff -r democompupdate_111/script.php democompupdate_13/script.php&lt;br /&gt;
12c12&lt;br /&gt;
&amp;lt; 	private $release = &#039;1.1.1&#039;;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 	private $release = &#039;1.3&#039;;&lt;br /&gt;
diff -r democompupdate_111/site/views/democompupdate/view.html.php democompupdate_13/site/views/democompupdate/view.html.php&lt;br /&gt;
25c25&lt;br /&gt;
&amp;lt; 		$myRev = &#039;1.1.1&#039;;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 		$myRev = &#039;1.3&#039;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Script.php)&amp;diff=67571</id>
		<title>Archived:Managing Component Updates (Script.php)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Script.php)&amp;diff=67571"/>
		<updated>2012-06-10T21:20:12Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* The entire script.php file */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}} {{JVer|2.5}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Script.php ==&lt;br /&gt;
This file contains the component-specific methods preflight, install, update, postflight and uninstall.  This file is where the component developer implements all of the unique code for these actions.&lt;br /&gt;
For this example, in addition to various checks, HTML is inserted into the back-end output to show which code has been executed.  You may choose to display different HTML, or to display none for your component.&lt;br /&gt;
&lt;br /&gt;
=== preflight ===&lt;br /&gt;
This is where most of the checking should be done before install, update or discover_install.  Preflight is executed prior to any Joomla install, update or discover_install actions.  Preflight is not executed on uninstall.  A string denoting the type of action (install, update or discover_install) is passed to preflight in the $type operand.  Your code can use this string to execute different checks and responses for the three cases.&lt;br /&gt;
&lt;br /&gt;
It is appropriate to check the Joomla version and the existing component version in the preflight module.  A failure of either of these two should cause an abort of the action.  An abort is triggered by returning a false value from this preflight method.  On receiving a false return value, Joomla will reverse any actions already completed.&lt;br /&gt;
&lt;br /&gt;
The PHP function &#039;&#039;version_compare&#039;&#039; is useful to compare version strings.  Joomla also uses &#039;&#039;version_compare&#039;&#039; to define the sequence of SQL file execution, when an update is being executed that spans multiple versions.&lt;br /&gt;
&lt;br /&gt;
In this example, the preflight method checks that Joomla version is equal to or greater than the value in the manifest file.  If an earlier Joomla version is in use, the install or update will abort.  Try changing the version string in the manifest file file to a value greater than the Joomla version that you are using.  Installs and updates should fail. This is what the version &#039;&#039;democompupdate_10j3.zip&#039;&#039; demonstrates.&lt;br /&gt;
&lt;br /&gt;
In addition to failing, it is important to give the web site administrator useful information as to why the component installation failed. See the example below.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function preflight( $type, $parent ) {&lt;br /&gt;
	$jversion = new JVersion();&lt;br /&gt;
&lt;br /&gt;
	// Installing component manifest file version&lt;br /&gt;
	$this-&amp;gt;release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;version;&lt;br /&gt;
		&lt;br /&gt;
	// Manifest file minimum Joomla version&lt;br /&gt;
	$this-&amp;gt;minimum_joomla_release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;attributes()-&amp;gt;version;   &lt;br /&gt;
&lt;br /&gt;
	// Show the essential information at the install/update back-end&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;Installing component manifest file version = &#039; . $this-&amp;gt;release;&lt;br /&gt;
	echo &#039;&amp;lt;br /&amp;gt;Current manifest cache commponent version = &#039; . $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
	echo &#039;&amp;lt;br /&amp;gt;Installing component manifest file minimum Joomla version = &#039; . $this-&amp;gt;minimum_joomla_release;&lt;br /&gt;
	echo &#039;&amp;lt;br /&amp;gt;Current Joomla version = &#039; . $jversion-&amp;gt;getShortVersion();&lt;br /&gt;
&lt;br /&gt;
	// abort if the current Joomla release is older&lt;br /&gt;
	if( version_compare( $jversion-&amp;gt;getShortVersion(), $this-&amp;gt;minimum_joomla_release, &#039;lt&#039; ) ) {&lt;br /&gt;
		Jerror::raiseWarning(null, &#039;Cannot install com_democompupdate in a Joomla release prior to &#039;.$this-&amp;gt;minimum_joomla_release);&lt;br /&gt;
		return false;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// abort if the component being installed is not newer than the currently installed version&lt;br /&gt;
	if ( $type == &#039;update&#039; ) {&lt;br /&gt;
		$oldRelease = $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
		$rel = $oldRelease . &#039; to &#039; . $this-&amp;gt;release;&lt;br /&gt;
		if ( version_compare( $this-&amp;gt;release, $oldRelease, &#039;le&#039; ) ) {&lt;br /&gt;
			Jerror::raiseWarning(null, &#039;Incorrect version sequence. Cannot upgrade &#039; . $rel);&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	else { $rel = $this-&amp;gt;release; }&lt;br /&gt;
 &lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_PREFLIGHT_&#039; . $type . &#039; &#039; . $rel) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== install ===&lt;br /&gt;
Install is executed after the Joomla install database scripts have completed. Returning &#039;false&#039; will abort the install and undo any changes already made.&lt;br /&gt;
It is cleaner to abort the install during preflight, if possible.  Since fewer install actions have occurred at preflight, there is less risk that that their reversal may be done incorrectly.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function install( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_INSTALL to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	// You can have the backend jump directly to the newly installed component configuration page&lt;br /&gt;
	// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== update ===&lt;br /&gt;
Update is executed after the Joomla update database scripts have completed.  Returning &#039;false&#039; will abort the update and undo any changes already made.&lt;br /&gt;
It is cleaner to abort the update during preflight, if possible.  Since fewer update actions have occurred at preflight, there is less risk that that their reversal may be done incorrectly.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function update( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UPDATE_ to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	// You can have the backend jump directly to the newly updated component configuration page&lt;br /&gt;
	// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== postflight ===&lt;br /&gt;
Postflight is executed after the Joomla install, update or discover_update actions have completed.  It is not executed after uninstall.  Postflight is executed after the extension is registered in the database.  The type of action (install, update or discover_install) is passed to postflight in the $type operand. Postflight cannot cause an abort of the Joomla install, update or discover_install action.&lt;br /&gt;
&lt;br /&gt;
The postflight method is a good place to set the default values of component parameters during installs, and to set the values of hidden component parameters during installs and updates.  Postflight can be used for any other action that must follow the install, update or discover_install actions.&lt;br /&gt;
&lt;br /&gt;
This example defines component parameters in postflight.  The value of &#039;&#039;my_param0&#039;&#039; is displayed in the component front-end.  Both &#039;&#039;my_param0&#039;&#039; and &#039;&#039;my_param1&#039;&#039; are overwritten in all updates. This is how you would change revision-specific values during an update. The examples &#039;&#039;myparam2&#039;&#039; and &#039;&#039;myparam3&#039;&#039; represent component configuration parameters that you expect users to set, and you do not want to overwrite during an update. This example sets these two values only on a new install, not on an update. Parameters that control component operation would be treated this way.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function postflight( $type, $parent ) {&lt;br /&gt;
	// always create or modify these parameters&lt;br /&gt;
	$params[&#039;my_param0&#039;] = &#039;Component version &#039; . $this-&amp;gt;release;&lt;br /&gt;
	$params[&#039;my_param1&#039;] = &#039;Another value&#039;;&lt;br /&gt;
 &lt;br /&gt;
	// define the following parameters only if it is an original install&lt;br /&gt;
	if ( $type == &#039;install&#039; ) {&lt;br /&gt;
		$params[&#039;my_param2&#039;] = &#039;4&#039;;&lt;br /&gt;
		$params[&#039;my_param3&#039;] = &#039;Star&#039;;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	$this-&amp;gt;setParams( $params );&lt;br /&gt;
 &lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_POSTFLIGHT &#039; . $type . &#039; to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== uninstall ===&lt;br /&gt;
The uninstall method is executed before any Joomla uninstall action, such as file removal or database changes.  Uninstall cannot cause an abort of the Joomla uninstall action, so returning false would be a waste of time.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function uninstall( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UNINSTALL &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The entire script.php file ==&lt;br /&gt;
This is the entire script.php file.  It is the same for all versions of com_democompupdate.&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(&#039;Restricted access&#039;);&lt;br /&gt;
 &lt;br /&gt;
//the name of the class must be the name of your component + InstallerScript&lt;br /&gt;
//for example: com_contentInstallerScript for com_content.&lt;br /&gt;
class com_democompupdateInstallerScript&lt;br /&gt;
{&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * $type is the type of change (install, update or discover_install, not uninstall).&lt;br /&gt;
	 * preflight runs before anything else and while the extracted files are in the uploaded temp folder.&lt;br /&gt;
	 * If preflight returns false, Joomla will abort the update and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function preflight( $type, $parent ) {&lt;br /&gt;
		$jversion = new JVersion();&lt;br /&gt;
&lt;br /&gt;
		// Installing component manifest file version&lt;br /&gt;
		$this-&amp;gt;release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;version;&lt;br /&gt;
		&lt;br /&gt;
		// Manifest file minimum Joomla version&lt;br /&gt;
		$this-&amp;gt;minimum_joomla_release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;attributes()-&amp;gt;version;   &lt;br /&gt;
&lt;br /&gt;
		// Show the essential information at the install/update back-end&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;Installing component manifest file version = &#039; . $this-&amp;gt;release;&lt;br /&gt;
		echo &#039;&amp;lt;br /&amp;gt;Current manifest cache commponent version = &#039; . $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
		echo &#039;&amp;lt;br /&amp;gt;Installing component manifest file minimum Joomla version = &#039; . $this-&amp;gt;minimum_joomla_release;&lt;br /&gt;
		echo &#039;&amp;lt;br /&amp;gt;Current Joomla version = &#039; . $jversion-&amp;gt;getShortVersion();&lt;br /&gt;
&lt;br /&gt;
		// abort if the current Joomla release is older&lt;br /&gt;
		if( version_compare( $jversion-&amp;gt;getShortVersion(), $this-&amp;gt;minimum_joomla_release, &#039;lt&#039; ) ) {&lt;br /&gt;
			Jerror::raiseWarning(null, &#039;Cannot install com_democompupdate in a Joomla release prior to &#039;.$this-&amp;gt;minimum_joomla_release);&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
 &lt;br /&gt;
		// abort if the component being installed is not newer than the currently installed version&lt;br /&gt;
		if ( $type == &#039;update&#039; ) {&lt;br /&gt;
			$oldRelease = $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
			$rel = $oldRelease . &#039; to &#039; . $this-&amp;gt;release;&lt;br /&gt;
			if ( version_compare( $this-&amp;gt;release, $oldRelease, &#039;le&#039; ) ) {&lt;br /&gt;
				Jerror::raiseWarning(null, &#039;Incorrect version sequence. Cannot upgrade &#039; . $rel);&lt;br /&gt;
				return false;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
		else { $rel = $this-&amp;gt;release; }&lt;br /&gt;
 &lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_PREFLIGHT_&#039; . $type . &#039; &#039; . $rel) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * install runs after the database scripts are executed.&lt;br /&gt;
	 * If the extension is new, the install method is run.&lt;br /&gt;
	 * If install returns false, Joomla will abort the install and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function install( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_INSTALL to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
		// You can have the backend jump directly to the newly installed component configuration page&lt;br /&gt;
		// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * update runs after the database scripts are executed.&lt;br /&gt;
	 * If the extension exists, then the update method is run.&lt;br /&gt;
	 * If this returns false, Joomla will abort the update and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function update( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UPDATE_ to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
		// You can have the backend jump directly to the newly updated component configuration page&lt;br /&gt;
		// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * $type is the type of change (install, update or discover_install, not uninstall).&lt;br /&gt;
	 * postflight is run after the extension is registered in the database.&lt;br /&gt;
	 */&lt;br /&gt;
	function postflight( $type, $parent ) {&lt;br /&gt;
		// always create or modify these parameters&lt;br /&gt;
		$params[&#039;my_param0&#039;] = &#039;Component version &#039; . $this-&amp;gt;release;&lt;br /&gt;
		$params[&#039;my_param1&#039;] = &#039;Another value&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// define the following parameters only if it is an original install&lt;br /&gt;
		if ( $type == &#039;install&#039; ) {&lt;br /&gt;
			$params[&#039;my_param2&#039;] = &#039;4&#039;;&lt;br /&gt;
			$params[&#039;my_param3&#039;] = &#039;Star&#039;;&lt;br /&gt;
		}&lt;br /&gt;
 &lt;br /&gt;
		$this-&amp;gt;setParams( $params );&lt;br /&gt;
 &lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_POSTFLIGHT &#039; . $type . &#039; to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method&lt;br /&gt;
	 * uninstall runs before any other action is taken (file removal or database processing).&lt;br /&gt;
	 */&lt;br /&gt;
	function uninstall( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UNINSTALL &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	/*&lt;br /&gt;
	 * get a variable from the manifest file (actually, from the manifest cache).&lt;br /&gt;
	 */&lt;br /&gt;
	function getParam( $name ) {&lt;br /&gt;
		$db = JFactory::getDbo();&lt;br /&gt;
		$db-&amp;gt;setQuery(&#039;SELECT manifest_cache FROM #__extensions WHERE name = &amp;quot;com_democompupdate&amp;quot;&#039;);&lt;br /&gt;
		$manifest = json_decode( $db-&amp;gt;loadResult(), true );&lt;br /&gt;
		return $manifest[ $name ];&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	/*&lt;br /&gt;
	 * sets parameter values in the component&#039;s row of the extension table&lt;br /&gt;
	 */&lt;br /&gt;
	function setParams($param_array) {&lt;br /&gt;
		if ( count($param_array) &amp;gt; 0 ) {&lt;br /&gt;
			// read the existing component value(s)&lt;br /&gt;
			$db = JFactory::getDbo();&lt;br /&gt;
			$db-&amp;gt;setQuery(&#039;SELECT params FROM #__extensions WHERE name = &amp;quot;com_democompupdate&amp;quot;&#039;);&lt;br /&gt;
			$params = json_decode( $db-&amp;gt;loadResult(), true );&lt;br /&gt;
			// add the new variable(s) to the existing one(s)&lt;br /&gt;
			foreach ( $param_array as $name =&amp;gt; $value ) {&lt;br /&gt;
				$params[ (string) $name ] = (string) $value;&lt;br /&gt;
			}&lt;br /&gt;
			// store the combined new and existing values back as a JSON string&lt;br /&gt;
			$paramsString = json_encode( $params );&lt;br /&gt;
			$db-&amp;gt;setQuery(&#039;UPDATE #__extensions SET params = &#039; .&lt;br /&gt;
				$db-&amp;gt;quote( $paramsString ) .&lt;br /&gt;
				&#039; WHERE name = &amp;quot;com_democompupdate&amp;quot;&#039; );&lt;br /&gt;
				$db-&amp;gt;query();&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
*[[User:tapaccos|Alex Tapaccos]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Joomla! 1.6]]&lt;br /&gt;
[[Category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Joomla! 2.5]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Script.php)&amp;diff=67570</id>
		<title>Archived:Managing Component Updates (Script.php)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Script.php)&amp;diff=67570"/>
		<updated>2012-06-10T21:19:59Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* The entire script.php file */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}} {{JVer|2.5}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Script.php ==&lt;br /&gt;
This file contains the component-specific methods preflight, install, update, postflight and uninstall.  This file is where the component developer implements all of the unique code for these actions.&lt;br /&gt;
For this example, in addition to various checks, HTML is inserted into the back-end output to show which code has been executed.  You may choose to display different HTML, or to display none for your component.&lt;br /&gt;
&lt;br /&gt;
=== preflight ===&lt;br /&gt;
This is where most of the checking should be done before install, update or discover_install.  Preflight is executed prior to any Joomla install, update or discover_install actions.  Preflight is not executed on uninstall.  A string denoting the type of action (install, update or discover_install) is passed to preflight in the $type operand.  Your code can use this string to execute different checks and responses for the three cases.&lt;br /&gt;
&lt;br /&gt;
It is appropriate to check the Joomla version and the existing component version in the preflight module.  A failure of either of these two should cause an abort of the action.  An abort is triggered by returning a false value from this preflight method.  On receiving a false return value, Joomla will reverse any actions already completed.&lt;br /&gt;
&lt;br /&gt;
The PHP function &#039;&#039;version_compare&#039;&#039; is useful to compare version strings.  Joomla also uses &#039;&#039;version_compare&#039;&#039; to define the sequence of SQL file execution, when an update is being executed that spans multiple versions.&lt;br /&gt;
&lt;br /&gt;
In this example, the preflight method checks that Joomla version is equal to or greater than the value in the manifest file.  If an earlier Joomla version is in use, the install or update will abort.  Try changing the version string in the manifest file file to a value greater than the Joomla version that you are using.  Installs and updates should fail. This is what the version &#039;&#039;democompupdate_10j3.zip&#039;&#039; demonstrates.&lt;br /&gt;
&lt;br /&gt;
In addition to failing, it is important to give the web site administrator useful information as to why the component installation failed. See the example below.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function preflight( $type, $parent ) {&lt;br /&gt;
	$jversion = new JVersion();&lt;br /&gt;
&lt;br /&gt;
	// Installing component manifest file version&lt;br /&gt;
	$this-&amp;gt;release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;version;&lt;br /&gt;
		&lt;br /&gt;
	// Manifest file minimum Joomla version&lt;br /&gt;
	$this-&amp;gt;minimum_joomla_release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;attributes()-&amp;gt;version;   &lt;br /&gt;
&lt;br /&gt;
	// Show the essential information at the install/update back-end&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;Installing component manifest file version = &#039; . $this-&amp;gt;release;&lt;br /&gt;
	echo &#039;&amp;lt;br /&amp;gt;Current manifest cache commponent version = &#039; . $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
	echo &#039;&amp;lt;br /&amp;gt;Installing component manifest file minimum Joomla version = &#039; . $this-&amp;gt;minimum_joomla_release;&lt;br /&gt;
	echo &#039;&amp;lt;br /&amp;gt;Current Joomla version = &#039; . $jversion-&amp;gt;getShortVersion();&lt;br /&gt;
&lt;br /&gt;
	// abort if the current Joomla release is older&lt;br /&gt;
	if( version_compare( $jversion-&amp;gt;getShortVersion(), $this-&amp;gt;minimum_joomla_release, &#039;lt&#039; ) ) {&lt;br /&gt;
		Jerror::raiseWarning(null, &#039;Cannot install com_democompupdate in a Joomla release prior to &#039;.$this-&amp;gt;minimum_joomla_release);&lt;br /&gt;
		return false;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// abort if the component being installed is not newer than the currently installed version&lt;br /&gt;
	if ( $type == &#039;update&#039; ) {&lt;br /&gt;
		$oldRelease = $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
		$rel = $oldRelease . &#039; to &#039; . $this-&amp;gt;release;&lt;br /&gt;
		if ( version_compare( $this-&amp;gt;release, $oldRelease, &#039;le&#039; ) ) {&lt;br /&gt;
			Jerror::raiseWarning(null, &#039;Incorrect version sequence. Cannot upgrade &#039; . $rel);&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	else { $rel = $this-&amp;gt;release; }&lt;br /&gt;
 &lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_PREFLIGHT_&#039; . $type . &#039; &#039; . $rel) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== install ===&lt;br /&gt;
Install is executed after the Joomla install database scripts have completed. Returning &#039;false&#039; will abort the install and undo any changes already made.&lt;br /&gt;
It is cleaner to abort the install during preflight, if possible.  Since fewer install actions have occurred at preflight, there is less risk that that their reversal may be done incorrectly.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function install( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_INSTALL to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	// You can have the backend jump directly to the newly installed component configuration page&lt;br /&gt;
	// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== update ===&lt;br /&gt;
Update is executed after the Joomla update database scripts have completed.  Returning &#039;false&#039; will abort the update and undo any changes already made.&lt;br /&gt;
It is cleaner to abort the update during preflight, if possible.  Since fewer update actions have occurred at preflight, there is less risk that that their reversal may be done incorrectly.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function update( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UPDATE_ to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	// You can have the backend jump directly to the newly updated component configuration page&lt;br /&gt;
	// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== postflight ===&lt;br /&gt;
Postflight is executed after the Joomla install, update or discover_update actions have completed.  It is not executed after uninstall.  Postflight is executed after the extension is registered in the database.  The type of action (install, update or discover_install) is passed to postflight in the $type operand. Postflight cannot cause an abort of the Joomla install, update or discover_install action.&lt;br /&gt;
&lt;br /&gt;
The postflight method is a good place to set the default values of component parameters during installs, and to set the values of hidden component parameters during installs and updates.  Postflight can be used for any other action that must follow the install, update or discover_install actions.&lt;br /&gt;
&lt;br /&gt;
This example defines component parameters in postflight.  The value of &#039;&#039;my_param0&#039;&#039; is displayed in the component front-end.  Both &#039;&#039;my_param0&#039;&#039; and &#039;&#039;my_param1&#039;&#039; are overwritten in all updates. This is how you would change revision-specific values during an update. The examples &#039;&#039;myparam2&#039;&#039; and &#039;&#039;myparam3&#039;&#039; represent component configuration parameters that you expect users to set, and you do not want to overwrite during an update. This example sets these two values only on a new install, not on an update. Parameters that control component operation would be treated this way.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function postflight( $type, $parent ) {&lt;br /&gt;
	// always create or modify these parameters&lt;br /&gt;
	$params[&#039;my_param0&#039;] = &#039;Component version &#039; . $this-&amp;gt;release;&lt;br /&gt;
	$params[&#039;my_param1&#039;] = &#039;Another value&#039;;&lt;br /&gt;
 &lt;br /&gt;
	// define the following parameters only if it is an original install&lt;br /&gt;
	if ( $type == &#039;install&#039; ) {&lt;br /&gt;
		$params[&#039;my_param2&#039;] = &#039;4&#039;;&lt;br /&gt;
		$params[&#039;my_param3&#039;] = &#039;Star&#039;;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	$this-&amp;gt;setParams( $params );&lt;br /&gt;
 &lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_POSTFLIGHT &#039; . $type . &#039; to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== uninstall ===&lt;br /&gt;
The uninstall method is executed before any Joomla uninstall action, such as file removal or database changes.  Uninstall cannot cause an abort of the Joomla uninstall action, so returning false would be a waste of time.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function uninstall( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UNINSTALL &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The entire script.php file ==&lt;br /&gt;
This is the entire script.php file.  It is the same for al versions of com_democompupdate.&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(&#039;Restricted access&#039;);&lt;br /&gt;
 &lt;br /&gt;
//the name of the class must be the name of your component + InstallerScript&lt;br /&gt;
//for example: com_contentInstallerScript for com_content.&lt;br /&gt;
class com_democompupdateInstallerScript&lt;br /&gt;
{&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * $type is the type of change (install, update or discover_install, not uninstall).&lt;br /&gt;
	 * preflight runs before anything else and while the extracted files are in the uploaded temp folder.&lt;br /&gt;
	 * If preflight returns false, Joomla will abort the update and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function preflight( $type, $parent ) {&lt;br /&gt;
		$jversion = new JVersion();&lt;br /&gt;
&lt;br /&gt;
		// Installing component manifest file version&lt;br /&gt;
		$this-&amp;gt;release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;version;&lt;br /&gt;
		&lt;br /&gt;
		// Manifest file minimum Joomla version&lt;br /&gt;
		$this-&amp;gt;minimum_joomla_release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;attributes()-&amp;gt;version;   &lt;br /&gt;
&lt;br /&gt;
		// Show the essential information at the install/update back-end&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;Installing component manifest file version = &#039; . $this-&amp;gt;release;&lt;br /&gt;
		echo &#039;&amp;lt;br /&amp;gt;Current manifest cache commponent version = &#039; . $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
		echo &#039;&amp;lt;br /&amp;gt;Installing component manifest file minimum Joomla version = &#039; . $this-&amp;gt;minimum_joomla_release;&lt;br /&gt;
		echo &#039;&amp;lt;br /&amp;gt;Current Joomla version = &#039; . $jversion-&amp;gt;getShortVersion();&lt;br /&gt;
&lt;br /&gt;
		// abort if the current Joomla release is older&lt;br /&gt;
		if( version_compare( $jversion-&amp;gt;getShortVersion(), $this-&amp;gt;minimum_joomla_release, &#039;lt&#039; ) ) {&lt;br /&gt;
			Jerror::raiseWarning(null, &#039;Cannot install com_democompupdate in a Joomla release prior to &#039;.$this-&amp;gt;minimum_joomla_release);&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
 &lt;br /&gt;
		// abort if the component being installed is not newer than the currently installed version&lt;br /&gt;
		if ( $type == &#039;update&#039; ) {&lt;br /&gt;
			$oldRelease = $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
			$rel = $oldRelease . &#039; to &#039; . $this-&amp;gt;release;&lt;br /&gt;
			if ( version_compare( $this-&amp;gt;release, $oldRelease, &#039;le&#039; ) ) {&lt;br /&gt;
				Jerror::raiseWarning(null, &#039;Incorrect version sequence. Cannot upgrade &#039; . $rel);&lt;br /&gt;
				return false;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
		else { $rel = $this-&amp;gt;release; }&lt;br /&gt;
 &lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_PREFLIGHT_&#039; . $type . &#039; &#039; . $rel) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * install runs after the database scripts are executed.&lt;br /&gt;
	 * If the extension is new, the install method is run.&lt;br /&gt;
	 * If install returns false, Joomla will abort the install and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function install( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_INSTALL to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
		// You can have the backend jump directly to the newly installed component configuration page&lt;br /&gt;
		// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * update runs after the database scripts are executed.&lt;br /&gt;
	 * If the extension exists, then the update method is run.&lt;br /&gt;
	 * If this returns false, Joomla will abort the update and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function update( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UPDATE_ to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
		// You can have the backend jump directly to the newly updated component configuration page&lt;br /&gt;
		// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * $type is the type of change (install, update or discover_install, not uninstall).&lt;br /&gt;
	 * postflight is run after the extension is registered in the database.&lt;br /&gt;
	 */&lt;br /&gt;
	function postflight( $type, $parent ) {&lt;br /&gt;
		// always create or modify these parameters&lt;br /&gt;
		$params[&#039;my_param0&#039;] = &#039;Component version &#039; . $this-&amp;gt;release;&lt;br /&gt;
		$params[&#039;my_param1&#039;] = &#039;Another value&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// define the following parameters only if it is an original install&lt;br /&gt;
		if ( $type == &#039;install&#039; ) {&lt;br /&gt;
			$params[&#039;my_param2&#039;] = &#039;4&#039;;&lt;br /&gt;
			$params[&#039;my_param3&#039;] = &#039;Star&#039;;&lt;br /&gt;
		}&lt;br /&gt;
 &lt;br /&gt;
		$this-&amp;gt;setParams( $params );&lt;br /&gt;
 &lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_POSTFLIGHT &#039; . $type . &#039; to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method&lt;br /&gt;
	 * uninstall runs before any other action is taken (file removal or database processing).&lt;br /&gt;
	 */&lt;br /&gt;
	function uninstall( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UNINSTALL &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	/*&lt;br /&gt;
	 * get a variable from the manifest file (actually, from the manifest cache).&lt;br /&gt;
	 */&lt;br /&gt;
	function getParam( $name ) {&lt;br /&gt;
		$db = JFactory::getDbo();&lt;br /&gt;
		$db-&amp;gt;setQuery(&#039;SELECT manifest_cache FROM #__extensions WHERE name = &amp;quot;com_democompupdate&amp;quot;&#039;);&lt;br /&gt;
		$manifest = json_decode( $db-&amp;gt;loadResult(), true );&lt;br /&gt;
		return $manifest[ $name ];&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	/*&lt;br /&gt;
	 * sets parameter values in the component&#039;s row of the extension table&lt;br /&gt;
	 */&lt;br /&gt;
	function setParams($param_array) {&lt;br /&gt;
		if ( count($param_array) &amp;gt; 0 ) {&lt;br /&gt;
			// read the existing component value(s)&lt;br /&gt;
			$db = JFactory::getDbo();&lt;br /&gt;
			$db-&amp;gt;setQuery(&#039;SELECT params FROM #__extensions WHERE name = &amp;quot;com_democompupdate&amp;quot;&#039;);&lt;br /&gt;
			$params = json_decode( $db-&amp;gt;loadResult(), true );&lt;br /&gt;
			// add the new variable(s) to the existing one(s)&lt;br /&gt;
			foreach ( $param_array as $name =&amp;gt; $value ) {&lt;br /&gt;
				$params[ (string) $name ] = (string) $value;&lt;br /&gt;
			}&lt;br /&gt;
			// store the combined new and existing values back as a JSON string&lt;br /&gt;
			$paramsString = json_encode( $params );&lt;br /&gt;
			$db-&amp;gt;setQuery(&#039;UPDATE #__extensions SET params = &#039; .&lt;br /&gt;
				$db-&amp;gt;quote( $paramsString ) .&lt;br /&gt;
				&#039; WHERE name = &amp;quot;com_democompupdate&amp;quot;&#039; );&lt;br /&gt;
				$db-&amp;gt;query();&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
*[[User:tapaccos|Alex Tapaccos]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Joomla! 1.6]]&lt;br /&gt;
[[Category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Joomla! 2.5]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Script.php)&amp;diff=67569</id>
		<title>Archived:Managing Component Updates (Script.php)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Script.php)&amp;diff=67569"/>
		<updated>2012-06-10T21:19:07Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* The entire script.php file */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}} {{JVer|2.5}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Script.php ==&lt;br /&gt;
This file contains the component-specific methods preflight, install, update, postflight and uninstall.  This file is where the component developer implements all of the unique code for these actions.&lt;br /&gt;
For this example, in addition to various checks, HTML is inserted into the back-end output to show which code has been executed.  You may choose to display different HTML, or to display none for your component.&lt;br /&gt;
&lt;br /&gt;
=== preflight ===&lt;br /&gt;
This is where most of the checking should be done before install, update or discover_install.  Preflight is executed prior to any Joomla install, update or discover_install actions.  Preflight is not executed on uninstall.  A string denoting the type of action (install, update or discover_install) is passed to preflight in the $type operand.  Your code can use this string to execute different checks and responses for the three cases.&lt;br /&gt;
&lt;br /&gt;
It is appropriate to check the Joomla version and the existing component version in the preflight module.  A failure of either of these two should cause an abort of the action.  An abort is triggered by returning a false value from this preflight method.  On receiving a false return value, Joomla will reverse any actions already completed.&lt;br /&gt;
&lt;br /&gt;
The PHP function &#039;&#039;version_compare&#039;&#039; is useful to compare version strings.  Joomla also uses &#039;&#039;version_compare&#039;&#039; to define the sequence of SQL file execution, when an update is being executed that spans multiple versions.&lt;br /&gt;
&lt;br /&gt;
In this example, the preflight method checks that Joomla version is equal to or greater than the value in the manifest file.  If an earlier Joomla version is in use, the install or update will abort.  Try changing the version string in the manifest file file to a value greater than the Joomla version that you are using.  Installs and updates should fail. This is what the version &#039;&#039;democompupdate_10j3.zip&#039;&#039; demonstrates.&lt;br /&gt;
&lt;br /&gt;
In addition to failing, it is important to give the web site administrator useful information as to why the component installation failed. See the example below.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function preflight( $type, $parent ) {&lt;br /&gt;
	$jversion = new JVersion();&lt;br /&gt;
&lt;br /&gt;
	// Installing component manifest file version&lt;br /&gt;
	$this-&amp;gt;release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;version;&lt;br /&gt;
		&lt;br /&gt;
	// Manifest file minimum Joomla version&lt;br /&gt;
	$this-&amp;gt;minimum_joomla_release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;attributes()-&amp;gt;version;   &lt;br /&gt;
&lt;br /&gt;
	// Show the essential information at the install/update back-end&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;Installing component manifest file version = &#039; . $this-&amp;gt;release;&lt;br /&gt;
	echo &#039;&amp;lt;br /&amp;gt;Current manifest cache commponent version = &#039; . $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
	echo &#039;&amp;lt;br /&amp;gt;Installing component manifest file minimum Joomla version = &#039; . $this-&amp;gt;minimum_joomla_release;&lt;br /&gt;
	echo &#039;&amp;lt;br /&amp;gt;Current Joomla version = &#039; . $jversion-&amp;gt;getShortVersion();&lt;br /&gt;
&lt;br /&gt;
	// abort if the current Joomla release is older&lt;br /&gt;
	if( version_compare( $jversion-&amp;gt;getShortVersion(), $this-&amp;gt;minimum_joomla_release, &#039;lt&#039; ) ) {&lt;br /&gt;
		Jerror::raiseWarning(null, &#039;Cannot install com_democompupdate in a Joomla release prior to &#039;.$this-&amp;gt;minimum_joomla_release);&lt;br /&gt;
		return false;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// abort if the component being installed is not newer than the currently installed version&lt;br /&gt;
	if ( $type == &#039;update&#039; ) {&lt;br /&gt;
		$oldRelease = $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
		$rel = $oldRelease . &#039; to &#039; . $this-&amp;gt;release;&lt;br /&gt;
		if ( version_compare( $this-&amp;gt;release, $oldRelease, &#039;le&#039; ) ) {&lt;br /&gt;
			Jerror::raiseWarning(null, &#039;Incorrect version sequence. Cannot upgrade &#039; . $rel);&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	else { $rel = $this-&amp;gt;release; }&lt;br /&gt;
 &lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_PREFLIGHT_&#039; . $type . &#039; &#039; . $rel) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== install ===&lt;br /&gt;
Install is executed after the Joomla install database scripts have completed. Returning &#039;false&#039; will abort the install and undo any changes already made.&lt;br /&gt;
It is cleaner to abort the install during preflight, if possible.  Since fewer install actions have occurred at preflight, there is less risk that that their reversal may be done incorrectly.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function install( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_INSTALL to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	// You can have the backend jump directly to the newly installed component configuration page&lt;br /&gt;
	// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== update ===&lt;br /&gt;
Update is executed after the Joomla update database scripts have completed.  Returning &#039;false&#039; will abort the update and undo any changes already made.&lt;br /&gt;
It is cleaner to abort the update during preflight, if possible.  Since fewer update actions have occurred at preflight, there is less risk that that their reversal may be done incorrectly.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function update( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UPDATE_ to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	// You can have the backend jump directly to the newly updated component configuration page&lt;br /&gt;
	// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== postflight ===&lt;br /&gt;
Postflight is executed after the Joomla install, update or discover_update actions have completed.  It is not executed after uninstall.  Postflight is executed after the extension is registered in the database.  The type of action (install, update or discover_install) is passed to postflight in the $type operand. Postflight cannot cause an abort of the Joomla install, update or discover_install action.&lt;br /&gt;
&lt;br /&gt;
The postflight method is a good place to set the default values of component parameters during installs, and to set the values of hidden component parameters during installs and updates.  Postflight can be used for any other action that must follow the install, update or discover_install actions.&lt;br /&gt;
&lt;br /&gt;
This example defines component parameters in postflight.  The value of &#039;&#039;my_param0&#039;&#039; is displayed in the component front-end.  Both &#039;&#039;my_param0&#039;&#039; and &#039;&#039;my_param1&#039;&#039; are overwritten in all updates. This is how you would change revision-specific values during an update. The examples &#039;&#039;myparam2&#039;&#039; and &#039;&#039;myparam3&#039;&#039; represent component configuration parameters that you expect users to set, and you do not want to overwrite during an update. This example sets these two values only on a new install, not on an update. Parameters that control component operation would be treated this way.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function postflight( $type, $parent ) {&lt;br /&gt;
	// always create or modify these parameters&lt;br /&gt;
	$params[&#039;my_param0&#039;] = &#039;Component version &#039; . $this-&amp;gt;release;&lt;br /&gt;
	$params[&#039;my_param1&#039;] = &#039;Another value&#039;;&lt;br /&gt;
 &lt;br /&gt;
	// define the following parameters only if it is an original install&lt;br /&gt;
	if ( $type == &#039;install&#039; ) {&lt;br /&gt;
		$params[&#039;my_param2&#039;] = &#039;4&#039;;&lt;br /&gt;
		$params[&#039;my_param3&#039;] = &#039;Star&#039;;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	$this-&amp;gt;setParams( $params );&lt;br /&gt;
 &lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_POSTFLIGHT &#039; . $type . &#039; to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== uninstall ===&lt;br /&gt;
The uninstall method is executed before any Joomla uninstall action, such as file removal or database changes.  Uninstall cannot cause an abort of the Joomla uninstall action, so returning false would be a waste of time.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function uninstall( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UNINSTALL &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The entire script.php file ==&lt;br /&gt;
This is the entire script.php file for version 1.0.&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(&#039;Restricted access&#039;);&lt;br /&gt;
 &lt;br /&gt;
//the name of the class must be the name of your component + InstallerScript&lt;br /&gt;
//for example: com_contentInstallerScript for com_content.&lt;br /&gt;
class com_democompupdateInstallerScript&lt;br /&gt;
{&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * $type is the type of change (install, update or discover_install, not uninstall).&lt;br /&gt;
	 * preflight runs before anything else and while the extracted files are in the uploaded temp folder.&lt;br /&gt;
	 * If preflight returns false, Joomla will abort the update and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function preflight( $type, $parent ) {&lt;br /&gt;
		$jversion = new JVersion();&lt;br /&gt;
&lt;br /&gt;
		// Installing component manifest file version&lt;br /&gt;
		$this-&amp;gt;release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;version;&lt;br /&gt;
		&lt;br /&gt;
		// Manifest file minimum Joomla version&lt;br /&gt;
		$this-&amp;gt;minimum_joomla_release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;attributes()-&amp;gt;version;   &lt;br /&gt;
&lt;br /&gt;
		// Show the essential information at the install/update back-end&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;Installing component manifest file version = &#039; . $this-&amp;gt;release;&lt;br /&gt;
		echo &#039;&amp;lt;br /&amp;gt;Current manifest cache commponent version = &#039; . $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
		echo &#039;&amp;lt;br /&amp;gt;Installing component manifest file minimum Joomla version = &#039; . $this-&amp;gt;minimum_joomla_release;&lt;br /&gt;
		echo &#039;&amp;lt;br /&amp;gt;Current Joomla version = &#039; . $jversion-&amp;gt;getShortVersion();&lt;br /&gt;
&lt;br /&gt;
		// abort if the current Joomla release is older&lt;br /&gt;
		if( version_compare( $jversion-&amp;gt;getShortVersion(), $this-&amp;gt;minimum_joomla_release, &#039;lt&#039; ) ) {&lt;br /&gt;
			Jerror::raiseWarning(null, &#039;Cannot install com_democompupdate in a Joomla release prior to &#039;.$this-&amp;gt;minimum_joomla_release);&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
 &lt;br /&gt;
		// abort if the component being installed is not newer than the currently installed version&lt;br /&gt;
		if ( $type == &#039;update&#039; ) {&lt;br /&gt;
			$oldRelease = $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
			$rel = $oldRelease . &#039; to &#039; . $this-&amp;gt;release;&lt;br /&gt;
			if ( version_compare( $this-&amp;gt;release, $oldRelease, &#039;le&#039; ) ) {&lt;br /&gt;
				Jerror::raiseWarning(null, &#039;Incorrect version sequence. Cannot upgrade &#039; . $rel);&lt;br /&gt;
				return false;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
		else { $rel = $this-&amp;gt;release; }&lt;br /&gt;
 &lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_PREFLIGHT_&#039; . $type . &#039; &#039; . $rel) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * install runs after the database scripts are executed.&lt;br /&gt;
	 * If the extension is new, the install method is run.&lt;br /&gt;
	 * If install returns false, Joomla will abort the install and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function install( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_INSTALL to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
		// You can have the backend jump directly to the newly installed component configuration page&lt;br /&gt;
		// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * update runs after the database scripts are executed.&lt;br /&gt;
	 * If the extension exists, then the update method is run.&lt;br /&gt;
	 * If this returns false, Joomla will abort the update and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function update( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UPDATE_ to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
		// You can have the backend jump directly to the newly updated component configuration page&lt;br /&gt;
		// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * $type is the type of change (install, update or discover_install, not uninstall).&lt;br /&gt;
	 * postflight is run after the extension is registered in the database.&lt;br /&gt;
	 */&lt;br /&gt;
	function postflight( $type, $parent ) {&lt;br /&gt;
		// always create or modify these parameters&lt;br /&gt;
		$params[&#039;my_param0&#039;] = &#039;Component version &#039; . $this-&amp;gt;release;&lt;br /&gt;
		$params[&#039;my_param1&#039;] = &#039;Another value&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// define the following parameters only if it is an original install&lt;br /&gt;
		if ( $type == &#039;install&#039; ) {&lt;br /&gt;
			$params[&#039;my_param2&#039;] = &#039;4&#039;;&lt;br /&gt;
			$params[&#039;my_param3&#039;] = &#039;Star&#039;;&lt;br /&gt;
		}&lt;br /&gt;
 &lt;br /&gt;
		$this-&amp;gt;setParams( $params );&lt;br /&gt;
 &lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_POSTFLIGHT &#039; . $type . &#039; to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method&lt;br /&gt;
	 * uninstall runs before any other action is taken (file removal or database processing).&lt;br /&gt;
	 */&lt;br /&gt;
	function uninstall( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UNINSTALL &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	/*&lt;br /&gt;
	 * get a variable from the manifest file (actually, from the manifest cache).&lt;br /&gt;
	 */&lt;br /&gt;
	function getParam( $name ) {&lt;br /&gt;
		$db = JFactory::getDbo();&lt;br /&gt;
		$db-&amp;gt;setQuery(&#039;SELECT manifest_cache FROM #__extensions WHERE name = &amp;quot;com_democompupdate&amp;quot;&#039;);&lt;br /&gt;
		$manifest = json_decode( $db-&amp;gt;loadResult(), true );&lt;br /&gt;
		return $manifest[ $name ];&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	/*&lt;br /&gt;
	 * sets parameter values in the component&#039;s row of the extension table&lt;br /&gt;
	 */&lt;br /&gt;
	function setParams($param_array) {&lt;br /&gt;
		if ( count($param_array) &amp;gt; 0 ) {&lt;br /&gt;
			// read the existing component value(s)&lt;br /&gt;
			$db = JFactory::getDbo();&lt;br /&gt;
			$db-&amp;gt;setQuery(&#039;SELECT params FROM #__extensions WHERE name = &amp;quot;com_democompupdate&amp;quot;&#039;);&lt;br /&gt;
			$params = json_decode( $db-&amp;gt;loadResult(), true );&lt;br /&gt;
			// add the new variable(s) to the existing one(s)&lt;br /&gt;
			foreach ( $param_array as $name =&amp;gt; $value ) {&lt;br /&gt;
				$params[ (string) $name ] = (string) $value;&lt;br /&gt;
			}&lt;br /&gt;
			// store the combined new and existing values back as a JSON string&lt;br /&gt;
			$paramsString = json_encode( $params );&lt;br /&gt;
			$db-&amp;gt;setQuery(&#039;UPDATE #__extensions SET params = &#039; .&lt;br /&gt;
				$db-&amp;gt;quote( $paramsString ) .&lt;br /&gt;
				&#039; WHERE name = &amp;quot;com_democompupdate&amp;quot;&#039; );&lt;br /&gt;
				$db-&amp;gt;query();&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
*[[User:tapaccos|Alex Tapaccos]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Joomla! 1.6]]&lt;br /&gt;
[[Category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Joomla! 2.5]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Script.php)&amp;diff=67568</id>
		<title>Archived:Managing Component Updates (Script.php)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Script.php)&amp;diff=67568"/>
		<updated>2012-06-10T21:18:47Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* The entire script.php file */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}} {{JVer|2.5}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Script.php ==&lt;br /&gt;
This file contains the component-specific methods preflight, install, update, postflight and uninstall.  This file is where the component developer implements all of the unique code for these actions.&lt;br /&gt;
For this example, in addition to various checks, HTML is inserted into the back-end output to show which code has been executed.  You may choose to display different HTML, or to display none for your component.&lt;br /&gt;
&lt;br /&gt;
=== preflight ===&lt;br /&gt;
This is where most of the checking should be done before install, update or discover_install.  Preflight is executed prior to any Joomla install, update or discover_install actions.  Preflight is not executed on uninstall.  A string denoting the type of action (install, update or discover_install) is passed to preflight in the $type operand.  Your code can use this string to execute different checks and responses for the three cases.&lt;br /&gt;
&lt;br /&gt;
It is appropriate to check the Joomla version and the existing component version in the preflight module.  A failure of either of these two should cause an abort of the action.  An abort is triggered by returning a false value from this preflight method.  On receiving a false return value, Joomla will reverse any actions already completed.&lt;br /&gt;
&lt;br /&gt;
The PHP function &#039;&#039;version_compare&#039;&#039; is useful to compare version strings.  Joomla also uses &#039;&#039;version_compare&#039;&#039; to define the sequence of SQL file execution, when an update is being executed that spans multiple versions.&lt;br /&gt;
&lt;br /&gt;
In this example, the preflight method checks that Joomla version is equal to or greater than the value in the manifest file.  If an earlier Joomla version is in use, the install or update will abort.  Try changing the version string in the manifest file file to a value greater than the Joomla version that you are using.  Installs and updates should fail. This is what the version &#039;&#039;democompupdate_10j3.zip&#039;&#039; demonstrates.&lt;br /&gt;
&lt;br /&gt;
In addition to failing, it is important to give the web site administrator useful information as to why the component installation failed. See the example below.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function preflight( $type, $parent ) {&lt;br /&gt;
	$jversion = new JVersion();&lt;br /&gt;
&lt;br /&gt;
	// Installing component manifest file version&lt;br /&gt;
	$this-&amp;gt;release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;version;&lt;br /&gt;
		&lt;br /&gt;
	// Manifest file minimum Joomla version&lt;br /&gt;
	$this-&amp;gt;minimum_joomla_release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;attributes()-&amp;gt;version;   &lt;br /&gt;
&lt;br /&gt;
	// Show the essential information at the install/update back-end&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;Installing component manifest file version = &#039; . $this-&amp;gt;release;&lt;br /&gt;
	echo &#039;&amp;lt;br /&amp;gt;Current manifest cache commponent version = &#039; . $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
	echo &#039;&amp;lt;br /&amp;gt;Installing component manifest file minimum Joomla version = &#039; . $this-&amp;gt;minimum_joomla_release;&lt;br /&gt;
	echo &#039;&amp;lt;br /&amp;gt;Current Joomla version = &#039; . $jversion-&amp;gt;getShortVersion();&lt;br /&gt;
&lt;br /&gt;
	// abort if the current Joomla release is older&lt;br /&gt;
	if( version_compare( $jversion-&amp;gt;getShortVersion(), $this-&amp;gt;minimum_joomla_release, &#039;lt&#039; ) ) {&lt;br /&gt;
		Jerror::raiseWarning(null, &#039;Cannot install com_democompupdate in a Joomla release prior to &#039;.$this-&amp;gt;minimum_joomla_release);&lt;br /&gt;
		return false;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// abort if the component being installed is not newer than the currently installed version&lt;br /&gt;
	if ( $type == &#039;update&#039; ) {&lt;br /&gt;
		$oldRelease = $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
		$rel = $oldRelease . &#039; to &#039; . $this-&amp;gt;release;&lt;br /&gt;
		if ( version_compare( $this-&amp;gt;release, $oldRelease, &#039;le&#039; ) ) {&lt;br /&gt;
			Jerror::raiseWarning(null, &#039;Incorrect version sequence. Cannot upgrade &#039; . $rel);&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	else { $rel = $this-&amp;gt;release; }&lt;br /&gt;
 &lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_PREFLIGHT_&#039; . $type . &#039; &#039; . $rel) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== install ===&lt;br /&gt;
Install is executed after the Joomla install database scripts have completed. Returning &#039;false&#039; will abort the install and undo any changes already made.&lt;br /&gt;
It is cleaner to abort the install during preflight, if possible.  Since fewer install actions have occurred at preflight, there is less risk that that their reversal may be done incorrectly.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function install( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_INSTALL to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	// You can have the backend jump directly to the newly installed component configuration page&lt;br /&gt;
	// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== update ===&lt;br /&gt;
Update is executed after the Joomla update database scripts have completed.  Returning &#039;false&#039; will abort the update and undo any changes already made.&lt;br /&gt;
It is cleaner to abort the update during preflight, if possible.  Since fewer update actions have occurred at preflight, there is less risk that that their reversal may be done incorrectly.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function update( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UPDATE_ to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	// You can have the backend jump directly to the newly updated component configuration page&lt;br /&gt;
	// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== postflight ===&lt;br /&gt;
Postflight is executed after the Joomla install, update or discover_update actions have completed.  It is not executed after uninstall.  Postflight is executed after the extension is registered in the database.  The type of action (install, update or discover_install) is passed to postflight in the $type operand. Postflight cannot cause an abort of the Joomla install, update or discover_install action.&lt;br /&gt;
&lt;br /&gt;
The postflight method is a good place to set the default values of component parameters during installs, and to set the values of hidden component parameters during installs and updates.  Postflight can be used for any other action that must follow the install, update or discover_install actions.&lt;br /&gt;
&lt;br /&gt;
This example defines component parameters in postflight.  The value of &#039;&#039;my_param0&#039;&#039; is displayed in the component front-end.  Both &#039;&#039;my_param0&#039;&#039; and &#039;&#039;my_param1&#039;&#039; are overwritten in all updates. This is how you would change revision-specific values during an update. The examples &#039;&#039;myparam2&#039;&#039; and &#039;&#039;myparam3&#039;&#039; represent component configuration parameters that you expect users to set, and you do not want to overwrite during an update. This example sets these two values only on a new install, not on an update. Parameters that control component operation would be treated this way.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function postflight( $type, $parent ) {&lt;br /&gt;
	// always create or modify these parameters&lt;br /&gt;
	$params[&#039;my_param0&#039;] = &#039;Component version &#039; . $this-&amp;gt;release;&lt;br /&gt;
	$params[&#039;my_param1&#039;] = &#039;Another value&#039;;&lt;br /&gt;
 &lt;br /&gt;
	// define the following parameters only if it is an original install&lt;br /&gt;
	if ( $type == &#039;install&#039; ) {&lt;br /&gt;
		$params[&#039;my_param2&#039;] = &#039;4&#039;;&lt;br /&gt;
		$params[&#039;my_param3&#039;] = &#039;Star&#039;;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	$this-&amp;gt;setParams( $params );&lt;br /&gt;
 &lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_POSTFLIGHT &#039; . $type . &#039; to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== uninstall ===&lt;br /&gt;
The uninstall method is executed before any Joomla uninstall action, such as file removal or database changes.  Uninstall cannot cause an abort of the Joomla uninstall action, so returning false would be a waste of time.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function uninstall( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UNINSTALL &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The entire script.php file ==&lt;br /&gt;
This is the entire script.php file for version 1.0.&lt;br /&gt;
Note the definition of the variable &#039;&#039;$release&#039;&#039;.&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(&#039;Restricted access&#039;);&lt;br /&gt;
 &lt;br /&gt;
//the name of the class must be the name of your component + InstallerScript&lt;br /&gt;
//for example: com_contentInstallerScript for com_content.&lt;br /&gt;
class com_democompupdateInstallerScript&lt;br /&gt;
{&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * $type is the type of change (install, update or discover_install, not uninstall).&lt;br /&gt;
	 * preflight runs before anything else and while the extracted files are in the uploaded temp folder.&lt;br /&gt;
	 * If preflight returns false, Joomla will abort the update and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function preflight( $type, $parent ) {&lt;br /&gt;
		$jversion = new JVersion();&lt;br /&gt;
&lt;br /&gt;
		// Installing component manifest file version&lt;br /&gt;
		$this-&amp;gt;release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;version;&lt;br /&gt;
		&lt;br /&gt;
		// Manifest file minimum Joomla version&lt;br /&gt;
		$this-&amp;gt;minimum_joomla_release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;attributes()-&amp;gt;version;   &lt;br /&gt;
&lt;br /&gt;
		// Show the essential information at the install/update back-end&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;Installing component manifest file version = &#039; . $this-&amp;gt;release;&lt;br /&gt;
		echo &#039;&amp;lt;br /&amp;gt;Current manifest cache commponent version = &#039; . $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
		echo &#039;&amp;lt;br /&amp;gt;Installing component manifest file minimum Joomla version = &#039; . $this-&amp;gt;minimum_joomla_release;&lt;br /&gt;
		echo &#039;&amp;lt;br /&amp;gt;Current Joomla version = &#039; . $jversion-&amp;gt;getShortVersion();&lt;br /&gt;
&lt;br /&gt;
		// abort if the current Joomla release is older&lt;br /&gt;
		if( version_compare( $jversion-&amp;gt;getShortVersion(), $this-&amp;gt;minimum_joomla_release, &#039;lt&#039; ) ) {&lt;br /&gt;
			Jerror::raiseWarning(null, &#039;Cannot install com_democompupdate in a Joomla release prior to &#039;.$this-&amp;gt;minimum_joomla_release);&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
 &lt;br /&gt;
		// abort if the component being installed is not newer than the currently installed version&lt;br /&gt;
		if ( $type == &#039;update&#039; ) {&lt;br /&gt;
			$oldRelease = $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
			$rel = $oldRelease . &#039; to &#039; . $this-&amp;gt;release;&lt;br /&gt;
			if ( version_compare( $this-&amp;gt;release, $oldRelease, &#039;le&#039; ) ) {&lt;br /&gt;
				Jerror::raiseWarning(null, &#039;Incorrect version sequence. Cannot upgrade &#039; . $rel);&lt;br /&gt;
				return false;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
		else { $rel = $this-&amp;gt;release; }&lt;br /&gt;
 &lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_PREFLIGHT_&#039; . $type . &#039; &#039; . $rel) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * install runs after the database scripts are executed.&lt;br /&gt;
	 * If the extension is new, the install method is run.&lt;br /&gt;
	 * If install returns false, Joomla will abort the install and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function install( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_INSTALL to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
		// You can have the backend jump directly to the newly installed component configuration page&lt;br /&gt;
		// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * update runs after the database scripts are executed.&lt;br /&gt;
	 * If the extension exists, then the update method is run.&lt;br /&gt;
	 * If this returns false, Joomla will abort the update and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function update( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UPDATE_ to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
		// You can have the backend jump directly to the newly updated component configuration page&lt;br /&gt;
		// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * $type is the type of change (install, update or discover_install, not uninstall).&lt;br /&gt;
	 * postflight is run after the extension is registered in the database.&lt;br /&gt;
	 */&lt;br /&gt;
	function postflight( $type, $parent ) {&lt;br /&gt;
		// always create or modify these parameters&lt;br /&gt;
		$params[&#039;my_param0&#039;] = &#039;Component version &#039; . $this-&amp;gt;release;&lt;br /&gt;
		$params[&#039;my_param1&#039;] = &#039;Another value&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// define the following parameters only if it is an original install&lt;br /&gt;
		if ( $type == &#039;install&#039; ) {&lt;br /&gt;
			$params[&#039;my_param2&#039;] = &#039;4&#039;;&lt;br /&gt;
			$params[&#039;my_param3&#039;] = &#039;Star&#039;;&lt;br /&gt;
		}&lt;br /&gt;
 &lt;br /&gt;
		$this-&amp;gt;setParams( $params );&lt;br /&gt;
 &lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_POSTFLIGHT &#039; . $type . &#039; to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method&lt;br /&gt;
	 * uninstall runs before any other action is taken (file removal or database processing).&lt;br /&gt;
	 */&lt;br /&gt;
	function uninstall( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UNINSTALL &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	/*&lt;br /&gt;
	 * get a variable from the manifest file (actually, from the manifest cache).&lt;br /&gt;
	 */&lt;br /&gt;
	function getParam( $name ) {&lt;br /&gt;
		$db = JFactory::getDbo();&lt;br /&gt;
		$db-&amp;gt;setQuery(&#039;SELECT manifest_cache FROM #__extensions WHERE name = &amp;quot;com_democompupdate&amp;quot;&#039;);&lt;br /&gt;
		$manifest = json_decode( $db-&amp;gt;loadResult(), true );&lt;br /&gt;
		return $manifest[ $name ];&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	/*&lt;br /&gt;
	 * sets parameter values in the component&#039;s row of the extension table&lt;br /&gt;
	 */&lt;br /&gt;
	function setParams($param_array) {&lt;br /&gt;
		if ( count($param_array) &amp;gt; 0 ) {&lt;br /&gt;
			// read the existing component value(s)&lt;br /&gt;
			$db = JFactory::getDbo();&lt;br /&gt;
			$db-&amp;gt;setQuery(&#039;SELECT params FROM #__extensions WHERE name = &amp;quot;com_democompupdate&amp;quot;&#039;);&lt;br /&gt;
			$params = json_decode( $db-&amp;gt;loadResult(), true );&lt;br /&gt;
			// add the new variable(s) to the existing one(s)&lt;br /&gt;
			foreach ( $param_array as $name =&amp;gt; $value ) {&lt;br /&gt;
				$params[ (string) $name ] = (string) $value;&lt;br /&gt;
			}&lt;br /&gt;
			// store the combined new and existing values back as a JSON string&lt;br /&gt;
			$paramsString = json_encode( $params );&lt;br /&gt;
			$db-&amp;gt;setQuery(&#039;UPDATE #__extensions SET params = &#039; .&lt;br /&gt;
				$db-&amp;gt;quote( $paramsString ) .&lt;br /&gt;
				&#039; WHERE name = &amp;quot;com_democompupdate&amp;quot;&#039; );&lt;br /&gt;
				$db-&amp;gt;query();&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
*[[User:tapaccos|Alex Tapaccos]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Joomla! 1.6]]&lt;br /&gt;
[[Category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Joomla! 2.5]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Script.php)&amp;diff=67567</id>
		<title>Archived:Managing Component Updates (Script.php)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Script.php)&amp;diff=67567"/>
		<updated>2012-06-10T21:17:23Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* postflight */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}} {{JVer|2.5}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Script.php ==&lt;br /&gt;
This file contains the component-specific methods preflight, install, update, postflight and uninstall.  This file is where the component developer implements all of the unique code for these actions.&lt;br /&gt;
For this example, in addition to various checks, HTML is inserted into the back-end output to show which code has been executed.  You may choose to display different HTML, or to display none for your component.&lt;br /&gt;
&lt;br /&gt;
=== preflight ===&lt;br /&gt;
This is where most of the checking should be done before install, update or discover_install.  Preflight is executed prior to any Joomla install, update or discover_install actions.  Preflight is not executed on uninstall.  A string denoting the type of action (install, update or discover_install) is passed to preflight in the $type operand.  Your code can use this string to execute different checks and responses for the three cases.&lt;br /&gt;
&lt;br /&gt;
It is appropriate to check the Joomla version and the existing component version in the preflight module.  A failure of either of these two should cause an abort of the action.  An abort is triggered by returning a false value from this preflight method.  On receiving a false return value, Joomla will reverse any actions already completed.&lt;br /&gt;
&lt;br /&gt;
The PHP function &#039;&#039;version_compare&#039;&#039; is useful to compare version strings.  Joomla also uses &#039;&#039;version_compare&#039;&#039; to define the sequence of SQL file execution, when an update is being executed that spans multiple versions.&lt;br /&gt;
&lt;br /&gt;
In this example, the preflight method checks that Joomla version is equal to or greater than the value in the manifest file.  If an earlier Joomla version is in use, the install or update will abort.  Try changing the version string in the manifest file file to a value greater than the Joomla version that you are using.  Installs and updates should fail. This is what the version &#039;&#039;democompupdate_10j3.zip&#039;&#039; demonstrates.&lt;br /&gt;
&lt;br /&gt;
In addition to failing, it is important to give the web site administrator useful information as to why the component installation failed. See the example below.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function preflight( $type, $parent ) {&lt;br /&gt;
	$jversion = new JVersion();&lt;br /&gt;
&lt;br /&gt;
	// Installing component manifest file version&lt;br /&gt;
	$this-&amp;gt;release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;version;&lt;br /&gt;
		&lt;br /&gt;
	// Manifest file minimum Joomla version&lt;br /&gt;
	$this-&amp;gt;minimum_joomla_release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;attributes()-&amp;gt;version;   &lt;br /&gt;
&lt;br /&gt;
	// Show the essential information at the install/update back-end&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;Installing component manifest file version = &#039; . $this-&amp;gt;release;&lt;br /&gt;
	echo &#039;&amp;lt;br /&amp;gt;Current manifest cache commponent version = &#039; . $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
	echo &#039;&amp;lt;br /&amp;gt;Installing component manifest file minimum Joomla version = &#039; . $this-&amp;gt;minimum_joomla_release;&lt;br /&gt;
	echo &#039;&amp;lt;br /&amp;gt;Current Joomla version = &#039; . $jversion-&amp;gt;getShortVersion();&lt;br /&gt;
&lt;br /&gt;
	// abort if the current Joomla release is older&lt;br /&gt;
	if( version_compare( $jversion-&amp;gt;getShortVersion(), $this-&amp;gt;minimum_joomla_release, &#039;lt&#039; ) ) {&lt;br /&gt;
		Jerror::raiseWarning(null, &#039;Cannot install com_democompupdate in a Joomla release prior to &#039;.$this-&amp;gt;minimum_joomla_release);&lt;br /&gt;
		return false;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// abort if the component being installed is not newer than the currently installed version&lt;br /&gt;
	if ( $type == &#039;update&#039; ) {&lt;br /&gt;
		$oldRelease = $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
		$rel = $oldRelease . &#039; to &#039; . $this-&amp;gt;release;&lt;br /&gt;
		if ( version_compare( $this-&amp;gt;release, $oldRelease, &#039;le&#039; ) ) {&lt;br /&gt;
			Jerror::raiseWarning(null, &#039;Incorrect version sequence. Cannot upgrade &#039; . $rel);&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	else { $rel = $this-&amp;gt;release; }&lt;br /&gt;
 &lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_PREFLIGHT_&#039; . $type . &#039; &#039; . $rel) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== install ===&lt;br /&gt;
Install is executed after the Joomla install database scripts have completed. Returning &#039;false&#039; will abort the install and undo any changes already made.&lt;br /&gt;
It is cleaner to abort the install during preflight, if possible.  Since fewer install actions have occurred at preflight, there is less risk that that their reversal may be done incorrectly.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function install( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_INSTALL to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	// You can have the backend jump directly to the newly installed component configuration page&lt;br /&gt;
	// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== update ===&lt;br /&gt;
Update is executed after the Joomla update database scripts have completed.  Returning &#039;false&#039; will abort the update and undo any changes already made.&lt;br /&gt;
It is cleaner to abort the update during preflight, if possible.  Since fewer update actions have occurred at preflight, there is less risk that that their reversal may be done incorrectly.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function update( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UPDATE_ to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	// You can have the backend jump directly to the newly updated component configuration page&lt;br /&gt;
	// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== postflight ===&lt;br /&gt;
Postflight is executed after the Joomla install, update or discover_update actions have completed.  It is not executed after uninstall.  Postflight is executed after the extension is registered in the database.  The type of action (install, update or discover_install) is passed to postflight in the $type operand. Postflight cannot cause an abort of the Joomla install, update or discover_install action.&lt;br /&gt;
&lt;br /&gt;
The postflight method is a good place to set the default values of component parameters during installs, and to set the values of hidden component parameters during installs and updates.  Postflight can be used for any other action that must follow the install, update or discover_install actions.&lt;br /&gt;
&lt;br /&gt;
This example defines component parameters in postflight.  The value of &#039;&#039;my_param0&#039;&#039; is displayed in the component front-end.  Both &#039;&#039;my_param0&#039;&#039; and &#039;&#039;my_param1&#039;&#039; are overwritten in all updates. This is how you would change revision-specific values during an update. The examples &#039;&#039;myparam2&#039;&#039; and &#039;&#039;myparam3&#039;&#039; represent component configuration parameters that you expect users to set, and you do not want to overwrite during an update. This example sets these two values only on a new install, not on an update. Parameters that control component operation would be treated this way.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function postflight( $type, $parent ) {&lt;br /&gt;
	// always create or modify these parameters&lt;br /&gt;
	$params[&#039;my_param0&#039;] = &#039;Component version &#039; . $this-&amp;gt;release;&lt;br /&gt;
	$params[&#039;my_param1&#039;] = &#039;Another value&#039;;&lt;br /&gt;
 &lt;br /&gt;
	// define the following parameters only if it is an original install&lt;br /&gt;
	if ( $type == &#039;install&#039; ) {&lt;br /&gt;
		$params[&#039;my_param2&#039;] = &#039;4&#039;;&lt;br /&gt;
		$params[&#039;my_param3&#039;] = &#039;Star&#039;;&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
	$this-&amp;gt;setParams( $params );&lt;br /&gt;
 &lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_POSTFLIGHT &#039; . $type . &#039; to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== uninstall ===&lt;br /&gt;
The uninstall method is executed before any Joomla uninstall action, such as file removal or database changes.  Uninstall cannot cause an abort of the Joomla uninstall action, so returning false would be a waste of time.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function uninstall( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UNINSTALL &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The entire script.php file ==&lt;br /&gt;
This is the entire script.php file for version 1.0.&lt;br /&gt;
Note the definition of the variable &#039;&#039;$release&#039;&#039;.&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(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
//the name of the class must be the name of your component + InstallerScript&lt;br /&gt;
//for example: com_contentInstallerScript for com_content.&lt;br /&gt;
class com_democompupdateInstallerScript&lt;br /&gt;
{&lt;br /&gt;
	/*&lt;br /&gt;
	 * The release value to be displayed and checked against throughout this file.&lt;br /&gt;
	 */&lt;br /&gt;
	private $release = &#039;1.0&#039;;&lt;br /&gt;
&lt;br /&gt;
        /*&lt;br /&gt;
         * Find mimimum required joomla version for this extension. It will be read from the version attribute (install tag) in the manifest file&lt;br /&gt;
         */&lt;br /&gt;
        private $minimum_joomla_release = &#039;1.6.0&#039;;    &lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * $type is the type of change (install, update or discover_install, not uninstall).&lt;br /&gt;
	 * preflight runs before anything else and while the extracted files are in the uploaded temp folder.&lt;br /&gt;
	 * If preflight returns false, Joomla will abort the update and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function preflight( $type, $parent ) {&lt;br /&gt;
		// this component does not work with Joomla releases prior to 1.6&lt;br /&gt;
		// abort if the current Joomla release is older&lt;br /&gt;
		$jversion = new JVersion();&lt;br /&gt;
&lt;br /&gt;
                // Extract the version number from the manifest. This will overwrite the 1.0 value set above &lt;br /&gt;
                $this-&amp;gt;release=$parent-&amp;gt;get(&amp;quot;manifest&amp;quot;)-&amp;gt;version;&lt;br /&gt;
                &lt;br /&gt;
                // Find mimimum required joomla version&lt;br /&gt;
                $this-&amp;gt;minimum_joomla_release=$parent-&amp;gt;get(&amp;quot;manifest&amp;quot;)-&amp;gt;attributes()-&amp;gt;version;    &lt;br /&gt;
&lt;br /&gt;
		if( version_compare( $jversion-&amp;gt;getShortVersion(), $this-&amp;gt;minimum_joomla_release, &#039;lt&#039; ) ) {&lt;br /&gt;
			Jerror::raiseWarning(null, &#039;Cannot install com_democompupdate in a Joomla release prior to &#039;.$this-&amp;gt;minimum_joomla_release);&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// abort if the component being installed is not newer than the currently installed version&lt;br /&gt;
		if ( $type == &#039;update&#039; ) {&lt;br /&gt;
			$oldRelease = $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
			$rel = $oldRelease . &#039; to &#039; . $this-&amp;gt;release;&lt;br /&gt;
			if ( version_compare( $this-&amp;gt;release, $oldRelease, &#039;le&#039; ) ) {&lt;br /&gt;
				Jerror::raiseWarning(null, &#039;Incorrect version sequence. Cannot upgrade &#039; . $rel);&lt;br /&gt;
				return false;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
		else { $rel = $this-&amp;gt;release; }&lt;br /&gt;
		&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_PREFLIGHT_&#039; . $type . &#039; &#039; . $rel) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * install runs after the database scripts are executed.&lt;br /&gt;
	 * If the extension is new, the install method is run.&lt;br /&gt;
	 * If install returns false, Joomla will abort the install and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function install( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_INSTALL to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
		// You can have the backend jump directly to the newly installed component configuration page&lt;br /&gt;
		// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * update runs after the database scripts are executed.&lt;br /&gt;
	 * If the extension exists, then the update method is run.&lt;br /&gt;
	 * If this returns false, Joomla will abort the update and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function update( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UPDATE_ to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * $type is the type of change (install, update or discover_install, not uninstall).&lt;br /&gt;
	 * postflight is run after the extension is registered in the database.&lt;br /&gt;
	 */&lt;br /&gt;
	function postflight( $type, $parent ) {&lt;br /&gt;
		// always create or modify these parameters&lt;br /&gt;
		$params[&#039;my_param0&#039;] = &#039;Component version &#039; . $this-&amp;gt;release;&lt;br /&gt;
		$params[&#039;my_param1&#039;] = &#039;Another value&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// define the following parameters only if it is an original install&lt;br /&gt;
		if ( $type == &#039;install&#039; ) {&lt;br /&gt;
			$params[&#039;my_param2&#039;] = &#039;4&#039;;&lt;br /&gt;
			$params[&#039;my_param3&#039;] = &#039;Star&#039;;&lt;br /&gt;
		}&lt;br /&gt;
 &lt;br /&gt;
		$this-&amp;gt;setParams( $params );&lt;br /&gt;
 &lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_POSTFLIGHT &#039; . $type . &#039; to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method&lt;br /&gt;
	 * uninstall runs before any other action is taken (file removal or database processing).&lt;br /&gt;
	 */&lt;br /&gt;
	function uninstall( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UNINSTALL &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * get a variable from the manifest file (actually, from the manifest cache).&lt;br /&gt;
	 */&lt;br /&gt;
	function getParam( $name ) {&lt;br /&gt;
		$db = JFactory::getDbo();&lt;br /&gt;
		$db-&amp;gt;setQuery(&#039;SELECT manifest_cache FROM #__extensions WHERE name = &#039;.$db-&amp;gt;quote(&#039;com_democompupdate&#039;));&lt;br /&gt;
		$manifest = json_decode( $db-&amp;gt;loadResult(), true );&lt;br /&gt;
		return $manifest[ $name ];&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * sets parameter values in the component&#039;s row of the extension table&lt;br /&gt;
	 */&lt;br /&gt;
	function setParams($param_array) {&lt;br /&gt;
		if ( count($param_array) &amp;gt; 0 ) {&lt;br /&gt;
			// read the existing component value(s)&lt;br /&gt;
			$db = JFactory::getDbo();&lt;br /&gt;
			$db-&amp;gt;setQuery(&#039;SELECT params FROM #__extensions WHERE name = &#039;.$db-&amp;gt;quote(&#039;com_democompupdate&#039;));&lt;br /&gt;
			$params = json_decode( $db-&amp;gt;loadResult(), true );&lt;br /&gt;
			// add the new variable(s) to the existing one(s)&lt;br /&gt;
			foreach ( $param_array as $name =&amp;gt; $value ) {&lt;br /&gt;
				$params[ (string) $name ] = (string) $value;&lt;br /&gt;
			}&lt;br /&gt;
			// store the combined new and existing values back as a JSON string&lt;br /&gt;
			$paramsString = json_encode( $params );&lt;br /&gt;
			$db-&amp;gt;setQuery(&#039;UPDATE #__extensions SET params = &#039; .&lt;br /&gt;
				$db-&amp;gt;quote( $paramsString ) .&lt;br /&gt;
				&#039; WHERE name = &#039;.$db-&amp;gt;quote(&#039;com_democompupdate&#039;));&lt;br /&gt;
				$db-&amp;gt;query();&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
*[[User:tapaccos|Alex Tapaccos]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Joomla! 1.6]]&lt;br /&gt;
[[Category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Joomla! 2.5]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Script.php)&amp;diff=67566</id>
		<title>Archived:Managing Component Updates (Script.php)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Script.php)&amp;diff=67566"/>
		<updated>2012-06-10T21:14:16Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* update */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}} {{JVer|2.5}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Script.php ==&lt;br /&gt;
This file contains the component-specific methods preflight, install, update, postflight and uninstall.  This file is where the component developer implements all of the unique code for these actions.&lt;br /&gt;
For this example, in addition to various checks, HTML is inserted into the back-end output to show which code has been executed.  You may choose to display different HTML, or to display none for your component.&lt;br /&gt;
&lt;br /&gt;
=== preflight ===&lt;br /&gt;
This is where most of the checking should be done before install, update or discover_install.  Preflight is executed prior to any Joomla install, update or discover_install actions.  Preflight is not executed on uninstall.  A string denoting the type of action (install, update or discover_install) is passed to preflight in the $type operand.  Your code can use this string to execute different checks and responses for the three cases.&lt;br /&gt;
&lt;br /&gt;
It is appropriate to check the Joomla version and the existing component version in the preflight module.  A failure of either of these two should cause an abort of the action.  An abort is triggered by returning a false value from this preflight method.  On receiving a false return value, Joomla will reverse any actions already completed.&lt;br /&gt;
&lt;br /&gt;
The PHP function &#039;&#039;version_compare&#039;&#039; is useful to compare version strings.  Joomla also uses &#039;&#039;version_compare&#039;&#039; to define the sequence of SQL file execution, when an update is being executed that spans multiple versions.&lt;br /&gt;
&lt;br /&gt;
In this example, the preflight method checks that Joomla version is equal to or greater than the value in the manifest file.  If an earlier Joomla version is in use, the install or update will abort.  Try changing the version string in the manifest file file to a value greater than the Joomla version that you are using.  Installs and updates should fail. This is what the version &#039;&#039;democompupdate_10j3.zip&#039;&#039; demonstrates.&lt;br /&gt;
&lt;br /&gt;
In addition to failing, it is important to give the web site administrator useful information as to why the component installation failed. See the example below.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function preflight( $type, $parent ) {&lt;br /&gt;
	$jversion = new JVersion();&lt;br /&gt;
&lt;br /&gt;
	// Installing component manifest file version&lt;br /&gt;
	$this-&amp;gt;release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;version;&lt;br /&gt;
		&lt;br /&gt;
	// Manifest file minimum Joomla version&lt;br /&gt;
	$this-&amp;gt;minimum_joomla_release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;attributes()-&amp;gt;version;   &lt;br /&gt;
&lt;br /&gt;
	// Show the essential information at the install/update back-end&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;Installing component manifest file version = &#039; . $this-&amp;gt;release;&lt;br /&gt;
	echo &#039;&amp;lt;br /&amp;gt;Current manifest cache commponent version = &#039; . $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
	echo &#039;&amp;lt;br /&amp;gt;Installing component manifest file minimum Joomla version = &#039; . $this-&amp;gt;minimum_joomla_release;&lt;br /&gt;
	echo &#039;&amp;lt;br /&amp;gt;Current Joomla version = &#039; . $jversion-&amp;gt;getShortVersion();&lt;br /&gt;
&lt;br /&gt;
	// abort if the current Joomla release is older&lt;br /&gt;
	if( version_compare( $jversion-&amp;gt;getShortVersion(), $this-&amp;gt;minimum_joomla_release, &#039;lt&#039; ) ) {&lt;br /&gt;
		Jerror::raiseWarning(null, &#039;Cannot install com_democompupdate in a Joomla release prior to &#039;.$this-&amp;gt;minimum_joomla_release);&lt;br /&gt;
		return false;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// abort if the component being installed is not newer than the currently installed version&lt;br /&gt;
	if ( $type == &#039;update&#039; ) {&lt;br /&gt;
		$oldRelease = $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
		$rel = $oldRelease . &#039; to &#039; . $this-&amp;gt;release;&lt;br /&gt;
		if ( version_compare( $this-&amp;gt;release, $oldRelease, &#039;le&#039; ) ) {&lt;br /&gt;
			Jerror::raiseWarning(null, &#039;Incorrect version sequence. Cannot upgrade &#039; . $rel);&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	else { $rel = $this-&amp;gt;release; }&lt;br /&gt;
 &lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_PREFLIGHT_&#039; . $type . &#039; &#039; . $rel) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== install ===&lt;br /&gt;
Install is executed after the Joomla install database scripts have completed. Returning &#039;false&#039; will abort the install and undo any changes already made.&lt;br /&gt;
It is cleaner to abort the install during preflight, if possible.  Since fewer install actions have occurred at preflight, there is less risk that that their reversal may be done incorrectly.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function install( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_INSTALL to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	// You can have the backend jump directly to the newly installed component configuration page&lt;br /&gt;
	// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== update ===&lt;br /&gt;
Update is executed after the Joomla update database scripts have completed.  Returning &#039;false&#039; will abort the update and undo any changes already made.&lt;br /&gt;
It is cleaner to abort the update during preflight, if possible.  Since fewer update actions have occurred at preflight, there is less risk that that their reversal may be done incorrectly.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function update( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UPDATE_ to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	// You can have the backend jump directly to the newly updated component configuration page&lt;br /&gt;
	// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== postflight ===&lt;br /&gt;
Postflight is executed after the Joomla install, update or discover_update actions have completed.  It is not executed after uninstall.  Postflight is executed after the extension is registered in the database.  The type of action (install, update or discover_install) is passed to postflight in the $type operand. Postflight cannot cause an abort of the Joomla install, update or discover_install action.&lt;br /&gt;
&lt;br /&gt;
The postflight method is a good place to set the default values of component parameters during installs, and to set the values of hidden component parameters during installs and updates.  Postflight can be used for any other action that must follow the install, update or discover_install actions.&lt;br /&gt;
&lt;br /&gt;
This example defines component parameters in postflight.  The value of &#039;&#039;my_param0&#039;&#039; is displayed in the component front-end.  Both &#039;&#039;my_param0&#039;&#039; and &#039;&#039;my_param1&#039;&#039; are overwritten in updates. This is how you would change revision-specific identification values during an update. The examples &#039;&#039;myparam2&#039;&#039; and &#039;&#039;myparam3&#039;&#039; represent component configuration parameters that you expect users to set, and you do not want to overwrite during an update. Parameters that control component operation would be treated this way.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function postflight( $type, $parent ) {&lt;br /&gt;
	// always create or modify these parameters&lt;br /&gt;
	$params[&#039;my_param0&#039;] = &#039;Component version &#039; . $this-&amp;gt;release;&lt;br /&gt;
	$params[&#039;my_param1&#039;] = &#039;Another value&#039;;&lt;br /&gt;
&lt;br /&gt;
	// define the following parameters only if it is an original install&lt;br /&gt;
	if ( $type == &#039;install&#039; ) {&lt;br /&gt;
		$params[&#039;my_param2&#039;] = &#039;4&#039;;&lt;br /&gt;
		$params[&#039;my_param3&#039;] = &#039;Star&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	$this-&amp;gt;setParams( $params );&lt;br /&gt;
&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_POSTFLIGHT &#039; . $type . &#039; to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== uninstall ===&lt;br /&gt;
The uninstall method is executed before any Joomla uninstall action, such as file removal or database changes.  Uninstall cannot cause an abort of the Joomla uninstall action, so returning false would be a waste of time.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function uninstall( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UNINSTALL &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The entire script.php file ==&lt;br /&gt;
This is the entire script.php file for version 1.0.&lt;br /&gt;
Note the definition of the variable &#039;&#039;$release&#039;&#039;.&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(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
//the name of the class must be the name of your component + InstallerScript&lt;br /&gt;
//for example: com_contentInstallerScript for com_content.&lt;br /&gt;
class com_democompupdateInstallerScript&lt;br /&gt;
{&lt;br /&gt;
	/*&lt;br /&gt;
	 * The release value to be displayed and checked against throughout this file.&lt;br /&gt;
	 */&lt;br /&gt;
	private $release = &#039;1.0&#039;;&lt;br /&gt;
&lt;br /&gt;
        /*&lt;br /&gt;
         * Find mimimum required joomla version for this extension. It will be read from the version attribute (install tag) in the manifest file&lt;br /&gt;
         */&lt;br /&gt;
        private $minimum_joomla_release = &#039;1.6.0&#039;;    &lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * $type is the type of change (install, update or discover_install, not uninstall).&lt;br /&gt;
	 * preflight runs before anything else and while the extracted files are in the uploaded temp folder.&lt;br /&gt;
	 * If preflight returns false, Joomla will abort the update and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function preflight( $type, $parent ) {&lt;br /&gt;
		// this component does not work with Joomla releases prior to 1.6&lt;br /&gt;
		// abort if the current Joomla release is older&lt;br /&gt;
		$jversion = new JVersion();&lt;br /&gt;
&lt;br /&gt;
                // Extract the version number from the manifest. This will overwrite the 1.0 value set above &lt;br /&gt;
                $this-&amp;gt;release=$parent-&amp;gt;get(&amp;quot;manifest&amp;quot;)-&amp;gt;version;&lt;br /&gt;
                &lt;br /&gt;
                // Find mimimum required joomla version&lt;br /&gt;
                $this-&amp;gt;minimum_joomla_release=$parent-&amp;gt;get(&amp;quot;manifest&amp;quot;)-&amp;gt;attributes()-&amp;gt;version;    &lt;br /&gt;
&lt;br /&gt;
		if( version_compare( $jversion-&amp;gt;getShortVersion(), $this-&amp;gt;minimum_joomla_release, &#039;lt&#039; ) ) {&lt;br /&gt;
			Jerror::raiseWarning(null, &#039;Cannot install com_democompupdate in a Joomla release prior to &#039;.$this-&amp;gt;minimum_joomla_release);&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// abort if the component being installed is not newer than the currently installed version&lt;br /&gt;
		if ( $type == &#039;update&#039; ) {&lt;br /&gt;
			$oldRelease = $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
			$rel = $oldRelease . &#039; to &#039; . $this-&amp;gt;release;&lt;br /&gt;
			if ( version_compare( $this-&amp;gt;release, $oldRelease, &#039;le&#039; ) ) {&lt;br /&gt;
				Jerror::raiseWarning(null, &#039;Incorrect version sequence. Cannot upgrade &#039; . $rel);&lt;br /&gt;
				return false;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
		else { $rel = $this-&amp;gt;release; }&lt;br /&gt;
		&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_PREFLIGHT_&#039; . $type . &#039; &#039; . $rel) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * install runs after the database scripts are executed.&lt;br /&gt;
	 * If the extension is new, the install method is run.&lt;br /&gt;
	 * If install returns false, Joomla will abort the install and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function install( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_INSTALL to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
		// You can have the backend jump directly to the newly installed component configuration page&lt;br /&gt;
		// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * update runs after the database scripts are executed.&lt;br /&gt;
	 * If the extension exists, then the update method is run.&lt;br /&gt;
	 * If this returns false, Joomla will abort the update and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function update( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UPDATE_ to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * $type is the type of change (install, update or discover_install, not uninstall).&lt;br /&gt;
	 * postflight is run after the extension is registered in the database.&lt;br /&gt;
	 */&lt;br /&gt;
	function postflight( $type, $parent ) {&lt;br /&gt;
		// always create or modify these parameters&lt;br /&gt;
		$params[&#039;my_param0&#039;] = &#039;Component version &#039; . $this-&amp;gt;release;&lt;br /&gt;
		$params[&#039;my_param1&#039;] = &#039;Another value&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// define the following parameters only if it is an original install&lt;br /&gt;
		if ( $type == &#039;install&#039; ) {&lt;br /&gt;
			$params[&#039;my_param2&#039;] = &#039;4&#039;;&lt;br /&gt;
			$params[&#039;my_param3&#039;] = &#039;Star&#039;;&lt;br /&gt;
		}&lt;br /&gt;
 &lt;br /&gt;
		$this-&amp;gt;setParams( $params );&lt;br /&gt;
 &lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_POSTFLIGHT &#039; . $type . &#039; to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method&lt;br /&gt;
	 * uninstall runs before any other action is taken (file removal or database processing).&lt;br /&gt;
	 */&lt;br /&gt;
	function uninstall( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UNINSTALL &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * get a variable from the manifest file (actually, from the manifest cache).&lt;br /&gt;
	 */&lt;br /&gt;
	function getParam( $name ) {&lt;br /&gt;
		$db = JFactory::getDbo();&lt;br /&gt;
		$db-&amp;gt;setQuery(&#039;SELECT manifest_cache FROM #__extensions WHERE name = &#039;.$db-&amp;gt;quote(&#039;com_democompupdate&#039;));&lt;br /&gt;
		$manifest = json_decode( $db-&amp;gt;loadResult(), true );&lt;br /&gt;
		return $manifest[ $name ];&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * sets parameter values in the component&#039;s row of the extension table&lt;br /&gt;
	 */&lt;br /&gt;
	function setParams($param_array) {&lt;br /&gt;
		if ( count($param_array) &amp;gt; 0 ) {&lt;br /&gt;
			// read the existing component value(s)&lt;br /&gt;
			$db = JFactory::getDbo();&lt;br /&gt;
			$db-&amp;gt;setQuery(&#039;SELECT params FROM #__extensions WHERE name = &#039;.$db-&amp;gt;quote(&#039;com_democompupdate&#039;));&lt;br /&gt;
			$params = json_decode( $db-&amp;gt;loadResult(), true );&lt;br /&gt;
			// add the new variable(s) to the existing one(s)&lt;br /&gt;
			foreach ( $param_array as $name =&amp;gt; $value ) {&lt;br /&gt;
				$params[ (string) $name ] = (string) $value;&lt;br /&gt;
			}&lt;br /&gt;
			// store the combined new and existing values back as a JSON string&lt;br /&gt;
			$paramsString = json_encode( $params );&lt;br /&gt;
			$db-&amp;gt;setQuery(&#039;UPDATE #__extensions SET params = &#039; .&lt;br /&gt;
				$db-&amp;gt;quote( $paramsString ) .&lt;br /&gt;
				&#039; WHERE name = &#039;.$db-&amp;gt;quote(&#039;com_democompupdate&#039;));&lt;br /&gt;
				$db-&amp;gt;query();&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
*[[User:tapaccos|Alex Tapaccos]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Joomla! 1.6]]&lt;br /&gt;
[[Category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Joomla! 2.5]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Script.php)&amp;diff=67565</id>
		<title>Archived:Managing Component Updates (Script.php)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Script.php)&amp;diff=67565"/>
		<updated>2012-06-10T21:12:44Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* install */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}} {{JVer|2.5}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Script.php ==&lt;br /&gt;
This file contains the component-specific methods preflight, install, update, postflight and uninstall.  This file is where the component developer implements all of the unique code for these actions.&lt;br /&gt;
For this example, in addition to various checks, HTML is inserted into the back-end output to show which code has been executed.  You may choose to display different HTML, or to display none for your component.&lt;br /&gt;
&lt;br /&gt;
=== preflight ===&lt;br /&gt;
This is where most of the checking should be done before install, update or discover_install.  Preflight is executed prior to any Joomla install, update or discover_install actions.  Preflight is not executed on uninstall.  A string denoting the type of action (install, update or discover_install) is passed to preflight in the $type operand.  Your code can use this string to execute different checks and responses for the three cases.&lt;br /&gt;
&lt;br /&gt;
It is appropriate to check the Joomla version and the existing component version in the preflight module.  A failure of either of these two should cause an abort of the action.  An abort is triggered by returning a false value from this preflight method.  On receiving a false return value, Joomla will reverse any actions already completed.&lt;br /&gt;
&lt;br /&gt;
The PHP function &#039;&#039;version_compare&#039;&#039; is useful to compare version strings.  Joomla also uses &#039;&#039;version_compare&#039;&#039; to define the sequence of SQL file execution, when an update is being executed that spans multiple versions.&lt;br /&gt;
&lt;br /&gt;
In this example, the preflight method checks that Joomla version is equal to or greater than the value in the manifest file.  If an earlier Joomla version is in use, the install or update will abort.  Try changing the version string in the manifest file file to a value greater than the Joomla version that you are using.  Installs and updates should fail. This is what the version &#039;&#039;democompupdate_10j3.zip&#039;&#039; demonstrates.&lt;br /&gt;
&lt;br /&gt;
In addition to failing, it is important to give the web site administrator useful information as to why the component installation failed. See the example below.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function preflight( $type, $parent ) {&lt;br /&gt;
	$jversion = new JVersion();&lt;br /&gt;
&lt;br /&gt;
	// Installing component manifest file version&lt;br /&gt;
	$this-&amp;gt;release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;version;&lt;br /&gt;
		&lt;br /&gt;
	// Manifest file minimum Joomla version&lt;br /&gt;
	$this-&amp;gt;minimum_joomla_release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;attributes()-&amp;gt;version;   &lt;br /&gt;
&lt;br /&gt;
	// Show the essential information at the install/update back-end&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;Installing component manifest file version = &#039; . $this-&amp;gt;release;&lt;br /&gt;
	echo &#039;&amp;lt;br /&amp;gt;Current manifest cache commponent version = &#039; . $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
	echo &#039;&amp;lt;br /&amp;gt;Installing component manifest file minimum Joomla version = &#039; . $this-&amp;gt;minimum_joomla_release;&lt;br /&gt;
	echo &#039;&amp;lt;br /&amp;gt;Current Joomla version = &#039; . $jversion-&amp;gt;getShortVersion();&lt;br /&gt;
&lt;br /&gt;
	// abort if the current Joomla release is older&lt;br /&gt;
	if( version_compare( $jversion-&amp;gt;getShortVersion(), $this-&amp;gt;minimum_joomla_release, &#039;lt&#039; ) ) {&lt;br /&gt;
		Jerror::raiseWarning(null, &#039;Cannot install com_democompupdate in a Joomla release prior to &#039;.$this-&amp;gt;minimum_joomla_release);&lt;br /&gt;
		return false;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// abort if the component being installed is not newer than the currently installed version&lt;br /&gt;
	if ( $type == &#039;update&#039; ) {&lt;br /&gt;
		$oldRelease = $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
		$rel = $oldRelease . &#039; to &#039; . $this-&amp;gt;release;&lt;br /&gt;
		if ( version_compare( $this-&amp;gt;release, $oldRelease, &#039;le&#039; ) ) {&lt;br /&gt;
			Jerror::raiseWarning(null, &#039;Incorrect version sequence. Cannot upgrade &#039; . $rel);&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	else { $rel = $this-&amp;gt;release; }&lt;br /&gt;
 &lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_PREFLIGHT_&#039; . $type . &#039; &#039; . $rel) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== install ===&lt;br /&gt;
Install is executed after the Joomla install database scripts have completed. Returning &#039;false&#039; will abort the install and undo any changes already made.&lt;br /&gt;
It is cleaner to abort the install during preflight, if possible.  Since fewer install actions have occurred at preflight, there is less risk that that their reversal may be done incorrectly.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function install( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_INSTALL to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	// You can have the backend jump directly to the newly installed component configuration page&lt;br /&gt;
	// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== update ===&lt;br /&gt;
Update is executed after the Joomla update database scripts have completed.  Returning &#039;false&#039; will abort the update and undo any changes already made.&lt;br /&gt;
It is cleaner to abort the update during preflight, if possible.  Since fewer update actions have occurred at preflight, there is less risk that that their reversal may be done incorrectly.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function update( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UPDATE_ to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	// Following an update, the backend can jump directly to the newly installed component configuration page&lt;br /&gt;
	$parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== postflight ===&lt;br /&gt;
Postflight is executed after the Joomla install, update or discover_update actions have completed.  It is not executed after uninstall.  Postflight is executed after the extension is registered in the database.  The type of action (install, update or discover_install) is passed to postflight in the $type operand. Postflight cannot cause an abort of the Joomla install, update or discover_install action.&lt;br /&gt;
&lt;br /&gt;
The postflight method is a good place to set the default values of component parameters during installs, and to set the values of hidden component parameters during installs and updates.  Postflight can be used for any other action that must follow the install, update or discover_install actions.&lt;br /&gt;
&lt;br /&gt;
This example defines component parameters in postflight.  The value of &#039;&#039;my_param0&#039;&#039; is displayed in the component front-end.  Both &#039;&#039;my_param0&#039;&#039; and &#039;&#039;my_param1&#039;&#039; are overwritten in updates. This is how you would change revision-specific identification values during an update. The examples &#039;&#039;myparam2&#039;&#039; and &#039;&#039;myparam3&#039;&#039; represent component configuration parameters that you expect users to set, and you do not want to overwrite during an update. Parameters that control component operation would be treated this way.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function postflight( $type, $parent ) {&lt;br /&gt;
	// always create or modify these parameters&lt;br /&gt;
	$params[&#039;my_param0&#039;] = &#039;Component version &#039; . $this-&amp;gt;release;&lt;br /&gt;
	$params[&#039;my_param1&#039;] = &#039;Another value&#039;;&lt;br /&gt;
&lt;br /&gt;
	// define the following parameters only if it is an original install&lt;br /&gt;
	if ( $type == &#039;install&#039; ) {&lt;br /&gt;
		$params[&#039;my_param2&#039;] = &#039;4&#039;;&lt;br /&gt;
		$params[&#039;my_param3&#039;] = &#039;Star&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	$this-&amp;gt;setParams( $params );&lt;br /&gt;
&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_POSTFLIGHT &#039; . $type . &#039; to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== uninstall ===&lt;br /&gt;
The uninstall method is executed before any Joomla uninstall action, such as file removal or database changes.  Uninstall cannot cause an abort of the Joomla uninstall action, so returning false would be a waste of time.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function uninstall( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UNINSTALL &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The entire script.php file ==&lt;br /&gt;
This is the entire script.php file for version 1.0.&lt;br /&gt;
Note the definition of the variable &#039;&#039;$release&#039;&#039;.&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(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
//the name of the class must be the name of your component + InstallerScript&lt;br /&gt;
//for example: com_contentInstallerScript for com_content.&lt;br /&gt;
class com_democompupdateInstallerScript&lt;br /&gt;
{&lt;br /&gt;
	/*&lt;br /&gt;
	 * The release value to be displayed and checked against throughout this file.&lt;br /&gt;
	 */&lt;br /&gt;
	private $release = &#039;1.0&#039;;&lt;br /&gt;
&lt;br /&gt;
        /*&lt;br /&gt;
         * Find mimimum required joomla version for this extension. It will be read from the version attribute (install tag) in the manifest file&lt;br /&gt;
         */&lt;br /&gt;
        private $minimum_joomla_release = &#039;1.6.0&#039;;    &lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * $type is the type of change (install, update or discover_install, not uninstall).&lt;br /&gt;
	 * preflight runs before anything else and while the extracted files are in the uploaded temp folder.&lt;br /&gt;
	 * If preflight returns false, Joomla will abort the update and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function preflight( $type, $parent ) {&lt;br /&gt;
		// this component does not work with Joomla releases prior to 1.6&lt;br /&gt;
		// abort if the current Joomla release is older&lt;br /&gt;
		$jversion = new JVersion();&lt;br /&gt;
&lt;br /&gt;
                // Extract the version number from the manifest. This will overwrite the 1.0 value set above &lt;br /&gt;
                $this-&amp;gt;release=$parent-&amp;gt;get(&amp;quot;manifest&amp;quot;)-&amp;gt;version;&lt;br /&gt;
                &lt;br /&gt;
                // Find mimimum required joomla version&lt;br /&gt;
                $this-&amp;gt;minimum_joomla_release=$parent-&amp;gt;get(&amp;quot;manifest&amp;quot;)-&amp;gt;attributes()-&amp;gt;version;    &lt;br /&gt;
&lt;br /&gt;
		if( version_compare( $jversion-&amp;gt;getShortVersion(), $this-&amp;gt;minimum_joomla_release, &#039;lt&#039; ) ) {&lt;br /&gt;
			Jerror::raiseWarning(null, &#039;Cannot install com_democompupdate in a Joomla release prior to &#039;.$this-&amp;gt;minimum_joomla_release);&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// abort if the component being installed is not newer than the currently installed version&lt;br /&gt;
		if ( $type == &#039;update&#039; ) {&lt;br /&gt;
			$oldRelease = $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
			$rel = $oldRelease . &#039; to &#039; . $this-&amp;gt;release;&lt;br /&gt;
			if ( version_compare( $this-&amp;gt;release, $oldRelease, &#039;le&#039; ) ) {&lt;br /&gt;
				Jerror::raiseWarning(null, &#039;Incorrect version sequence. Cannot upgrade &#039; . $rel);&lt;br /&gt;
				return false;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
		else { $rel = $this-&amp;gt;release; }&lt;br /&gt;
		&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_PREFLIGHT_&#039; . $type . &#039; &#039; . $rel) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * install runs after the database scripts are executed.&lt;br /&gt;
	 * If the extension is new, the install method is run.&lt;br /&gt;
	 * If install returns false, Joomla will abort the install and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function install( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_INSTALL to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
		// You can have the backend jump directly to the newly installed component configuration page&lt;br /&gt;
		// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * update runs after the database scripts are executed.&lt;br /&gt;
	 * If the extension exists, then the update method is run.&lt;br /&gt;
	 * If this returns false, Joomla will abort the update and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function update( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UPDATE_ to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * $type is the type of change (install, update or discover_install, not uninstall).&lt;br /&gt;
	 * postflight is run after the extension is registered in the database.&lt;br /&gt;
	 */&lt;br /&gt;
	function postflight( $type, $parent ) {&lt;br /&gt;
		// always create or modify these parameters&lt;br /&gt;
		$params[&#039;my_param0&#039;] = &#039;Component version &#039; . $this-&amp;gt;release;&lt;br /&gt;
		$params[&#039;my_param1&#039;] = &#039;Another value&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// define the following parameters only if it is an original install&lt;br /&gt;
		if ( $type == &#039;install&#039; ) {&lt;br /&gt;
			$params[&#039;my_param2&#039;] = &#039;4&#039;;&lt;br /&gt;
			$params[&#039;my_param3&#039;] = &#039;Star&#039;;&lt;br /&gt;
		}&lt;br /&gt;
 &lt;br /&gt;
		$this-&amp;gt;setParams( $params );&lt;br /&gt;
 &lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_POSTFLIGHT &#039; . $type . &#039; to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method&lt;br /&gt;
	 * uninstall runs before any other action is taken (file removal or database processing).&lt;br /&gt;
	 */&lt;br /&gt;
	function uninstall( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UNINSTALL &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * get a variable from the manifest file (actually, from the manifest cache).&lt;br /&gt;
	 */&lt;br /&gt;
	function getParam( $name ) {&lt;br /&gt;
		$db = JFactory::getDbo();&lt;br /&gt;
		$db-&amp;gt;setQuery(&#039;SELECT manifest_cache FROM #__extensions WHERE name = &#039;.$db-&amp;gt;quote(&#039;com_democompupdate&#039;));&lt;br /&gt;
		$manifest = json_decode( $db-&amp;gt;loadResult(), true );&lt;br /&gt;
		return $manifest[ $name ];&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * sets parameter values in the component&#039;s row of the extension table&lt;br /&gt;
	 */&lt;br /&gt;
	function setParams($param_array) {&lt;br /&gt;
		if ( count($param_array) &amp;gt; 0 ) {&lt;br /&gt;
			// read the existing component value(s)&lt;br /&gt;
			$db = JFactory::getDbo();&lt;br /&gt;
			$db-&amp;gt;setQuery(&#039;SELECT params FROM #__extensions WHERE name = &#039;.$db-&amp;gt;quote(&#039;com_democompupdate&#039;));&lt;br /&gt;
			$params = json_decode( $db-&amp;gt;loadResult(), true );&lt;br /&gt;
			// add the new variable(s) to the existing one(s)&lt;br /&gt;
			foreach ( $param_array as $name =&amp;gt; $value ) {&lt;br /&gt;
				$params[ (string) $name ] = (string) $value;&lt;br /&gt;
			}&lt;br /&gt;
			// store the combined new and existing values back as a JSON string&lt;br /&gt;
			$paramsString = json_encode( $params );&lt;br /&gt;
			$db-&amp;gt;setQuery(&#039;UPDATE #__extensions SET params = &#039; .&lt;br /&gt;
				$db-&amp;gt;quote( $paramsString ) .&lt;br /&gt;
				&#039; WHERE name = &#039;.$db-&amp;gt;quote(&#039;com_democompupdate&#039;));&lt;br /&gt;
				$db-&amp;gt;query();&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
*[[User:tapaccos|Alex Tapaccos]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Joomla! 1.6]]&lt;br /&gt;
[[Category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Joomla! 2.5]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Script.php)&amp;diff=67564</id>
		<title>Archived:Managing Component Updates (Script.php)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Script.php)&amp;diff=67564"/>
		<updated>2012-06-10T21:08:30Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* preflight */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}} {{JVer|2.5}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Script.php ==&lt;br /&gt;
This file contains the component-specific methods preflight, install, update, postflight and uninstall.  This file is where the component developer implements all of the unique code for these actions.&lt;br /&gt;
For this example, in addition to various checks, HTML is inserted into the back-end output to show which code has been executed.  You may choose to display different HTML, or to display none for your component.&lt;br /&gt;
&lt;br /&gt;
=== preflight ===&lt;br /&gt;
This is where most of the checking should be done before install, update or discover_install.  Preflight is executed prior to any Joomla install, update or discover_install actions.  Preflight is not executed on uninstall.  A string denoting the type of action (install, update or discover_install) is passed to preflight in the $type operand.  Your code can use this string to execute different checks and responses for the three cases.&lt;br /&gt;
&lt;br /&gt;
It is appropriate to check the Joomla version and the existing component version in the preflight module.  A failure of either of these two should cause an abort of the action.  An abort is triggered by returning a false value from this preflight method.  On receiving a false return value, Joomla will reverse any actions already completed.&lt;br /&gt;
&lt;br /&gt;
The PHP function &#039;&#039;version_compare&#039;&#039; is useful to compare version strings.  Joomla also uses &#039;&#039;version_compare&#039;&#039; to define the sequence of SQL file execution, when an update is being executed that spans multiple versions.&lt;br /&gt;
&lt;br /&gt;
In this example, the preflight method checks that Joomla version is equal to or greater than the value in the manifest file.  If an earlier Joomla version is in use, the install or update will abort.  Try changing the version string in the manifest file file to a value greater than the Joomla version that you are using.  Installs and updates should fail. This is what the version &#039;&#039;democompupdate_10j3.zip&#039;&#039; demonstrates.&lt;br /&gt;
&lt;br /&gt;
In addition to failing, it is important to give the web site administrator useful information as to why the component installation failed. See the example below.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function preflight( $type, $parent ) {&lt;br /&gt;
	$jversion = new JVersion();&lt;br /&gt;
&lt;br /&gt;
	// Installing component manifest file version&lt;br /&gt;
	$this-&amp;gt;release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;version;&lt;br /&gt;
		&lt;br /&gt;
	// Manifest file minimum Joomla version&lt;br /&gt;
	$this-&amp;gt;minimum_joomla_release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;attributes()-&amp;gt;version;   &lt;br /&gt;
&lt;br /&gt;
	// Show the essential information at the install/update back-end&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;Installing component manifest file version = &#039; . $this-&amp;gt;release;&lt;br /&gt;
	echo &#039;&amp;lt;br /&amp;gt;Current manifest cache commponent version = &#039; . $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
	echo &#039;&amp;lt;br /&amp;gt;Installing component manifest file minimum Joomla version = &#039; . $this-&amp;gt;minimum_joomla_release;&lt;br /&gt;
	echo &#039;&amp;lt;br /&amp;gt;Current Joomla version = &#039; . $jversion-&amp;gt;getShortVersion();&lt;br /&gt;
&lt;br /&gt;
	// abort if the current Joomla release is older&lt;br /&gt;
	if( version_compare( $jversion-&amp;gt;getShortVersion(), $this-&amp;gt;minimum_joomla_release, &#039;lt&#039; ) ) {&lt;br /&gt;
		Jerror::raiseWarning(null, &#039;Cannot install com_democompupdate in a Joomla release prior to &#039;.$this-&amp;gt;minimum_joomla_release);&lt;br /&gt;
		return false;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// abort if the component being installed is not newer than the currently installed version&lt;br /&gt;
	if ( $type == &#039;update&#039; ) {&lt;br /&gt;
		$oldRelease = $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
		$rel = $oldRelease . &#039; to &#039; . $this-&amp;gt;release;&lt;br /&gt;
		if ( version_compare( $this-&amp;gt;release, $oldRelease, &#039;le&#039; ) ) {&lt;br /&gt;
			Jerror::raiseWarning(null, &#039;Incorrect version sequence. Cannot upgrade &#039; . $rel);&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	else { $rel = $this-&amp;gt;release; }&lt;br /&gt;
 &lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_PREFLIGHT_&#039; . $type . &#039; &#039; . $rel) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== install ===&lt;br /&gt;
Install is executed after the Joomla install database scripts have completed. Returning &#039;false&#039; will abort the install and undo any changes already made.&lt;br /&gt;
It is cleaner to abort the install during preflight, if possible.  Since fewer install actions have occurred at preflight, there is less risk that that their reversal may be done incorrectly.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function install( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_INSTALL to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	// Following an install, the backend can jump directly to the newly installed component configuration page&lt;br /&gt;
	$parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== update ===&lt;br /&gt;
Update is executed after the Joomla update database scripts have completed.  Returning &#039;false&#039; will abort the update and undo any changes already made.&lt;br /&gt;
It is cleaner to abort the update during preflight, if possible.  Since fewer update actions have occurred at preflight, there is less risk that that their reversal may be done incorrectly.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function update( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UPDATE_ to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	// Following an update, the backend can jump directly to the newly installed component configuration page&lt;br /&gt;
	$parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== postflight ===&lt;br /&gt;
Postflight is executed after the Joomla install, update or discover_update actions have completed.  It is not executed after uninstall.  Postflight is executed after the extension is registered in the database.  The type of action (install, update or discover_install) is passed to postflight in the $type operand. Postflight cannot cause an abort of the Joomla install, update or discover_install action.&lt;br /&gt;
&lt;br /&gt;
The postflight method is a good place to set the default values of component parameters during installs, and to set the values of hidden component parameters during installs and updates.  Postflight can be used for any other action that must follow the install, update or discover_install actions.&lt;br /&gt;
&lt;br /&gt;
This example defines component parameters in postflight.  The value of &#039;&#039;my_param0&#039;&#039; is displayed in the component front-end.  Both &#039;&#039;my_param0&#039;&#039; and &#039;&#039;my_param1&#039;&#039; are overwritten in updates. This is how you would change revision-specific identification values during an update. The examples &#039;&#039;myparam2&#039;&#039; and &#039;&#039;myparam3&#039;&#039; represent component configuration parameters that you expect users to set, and you do not want to overwrite during an update. Parameters that control component operation would be treated this way.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function postflight( $type, $parent ) {&lt;br /&gt;
	// always create or modify these parameters&lt;br /&gt;
	$params[&#039;my_param0&#039;] = &#039;Component version &#039; . $this-&amp;gt;release;&lt;br /&gt;
	$params[&#039;my_param1&#039;] = &#039;Another value&#039;;&lt;br /&gt;
&lt;br /&gt;
	// define the following parameters only if it is an original install&lt;br /&gt;
	if ( $type == &#039;install&#039; ) {&lt;br /&gt;
		$params[&#039;my_param2&#039;] = &#039;4&#039;;&lt;br /&gt;
		$params[&#039;my_param3&#039;] = &#039;Star&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	$this-&amp;gt;setParams( $params );&lt;br /&gt;
&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_POSTFLIGHT &#039; . $type . &#039; to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== uninstall ===&lt;br /&gt;
The uninstall method is executed before any Joomla uninstall action, such as file removal or database changes.  Uninstall cannot cause an abort of the Joomla uninstall action, so returning false would be a waste of time.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function uninstall( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UNINSTALL &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The entire script.php file ==&lt;br /&gt;
This is the entire script.php file for version 1.0.&lt;br /&gt;
Note the definition of the variable &#039;&#039;$release&#039;&#039;.&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(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
//the name of the class must be the name of your component + InstallerScript&lt;br /&gt;
//for example: com_contentInstallerScript for com_content.&lt;br /&gt;
class com_democompupdateInstallerScript&lt;br /&gt;
{&lt;br /&gt;
	/*&lt;br /&gt;
	 * The release value to be displayed and checked against throughout this file.&lt;br /&gt;
	 */&lt;br /&gt;
	private $release = &#039;1.0&#039;;&lt;br /&gt;
&lt;br /&gt;
        /*&lt;br /&gt;
         * Find mimimum required joomla version for this extension. It will be read from the version attribute (install tag) in the manifest file&lt;br /&gt;
         */&lt;br /&gt;
        private $minimum_joomla_release = &#039;1.6.0&#039;;    &lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * $type is the type of change (install, update or discover_install, not uninstall).&lt;br /&gt;
	 * preflight runs before anything else and while the extracted files are in the uploaded temp folder.&lt;br /&gt;
	 * If preflight returns false, Joomla will abort the update and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function preflight( $type, $parent ) {&lt;br /&gt;
		// this component does not work with Joomla releases prior to 1.6&lt;br /&gt;
		// abort if the current Joomla release is older&lt;br /&gt;
		$jversion = new JVersion();&lt;br /&gt;
&lt;br /&gt;
                // Extract the version number from the manifest. This will overwrite the 1.0 value set above &lt;br /&gt;
                $this-&amp;gt;release=$parent-&amp;gt;get(&amp;quot;manifest&amp;quot;)-&amp;gt;version;&lt;br /&gt;
                &lt;br /&gt;
                // Find mimimum required joomla version&lt;br /&gt;
                $this-&amp;gt;minimum_joomla_release=$parent-&amp;gt;get(&amp;quot;manifest&amp;quot;)-&amp;gt;attributes()-&amp;gt;version;    &lt;br /&gt;
&lt;br /&gt;
		if( version_compare( $jversion-&amp;gt;getShortVersion(), $this-&amp;gt;minimum_joomla_release, &#039;lt&#039; ) ) {&lt;br /&gt;
			Jerror::raiseWarning(null, &#039;Cannot install com_democompupdate in a Joomla release prior to &#039;.$this-&amp;gt;minimum_joomla_release);&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// abort if the component being installed is not newer than the currently installed version&lt;br /&gt;
		if ( $type == &#039;update&#039; ) {&lt;br /&gt;
			$oldRelease = $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
			$rel = $oldRelease . &#039; to &#039; . $this-&amp;gt;release;&lt;br /&gt;
			if ( version_compare( $this-&amp;gt;release, $oldRelease, &#039;le&#039; ) ) {&lt;br /&gt;
				Jerror::raiseWarning(null, &#039;Incorrect version sequence. Cannot upgrade &#039; . $rel);&lt;br /&gt;
				return false;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
		else { $rel = $this-&amp;gt;release; }&lt;br /&gt;
		&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_PREFLIGHT_&#039; . $type . &#039; &#039; . $rel) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * install runs after the database scripts are executed.&lt;br /&gt;
	 * If the extension is new, the install method is run.&lt;br /&gt;
	 * If install returns false, Joomla will abort the install and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function install( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_INSTALL to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
		// You can have the backend jump directly to the newly installed component configuration page&lt;br /&gt;
		// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * update runs after the database scripts are executed.&lt;br /&gt;
	 * If the extension exists, then the update method is run.&lt;br /&gt;
	 * If this returns false, Joomla will abort the update and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function update( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UPDATE_ to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * $type is the type of change (install, update or discover_install, not uninstall).&lt;br /&gt;
	 * postflight is run after the extension is registered in the database.&lt;br /&gt;
	 */&lt;br /&gt;
	function postflight( $type, $parent ) {&lt;br /&gt;
		// always create or modify these parameters&lt;br /&gt;
		$params[&#039;my_param0&#039;] = &#039;Component version &#039; . $this-&amp;gt;release;&lt;br /&gt;
		$params[&#039;my_param1&#039;] = &#039;Another value&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// define the following parameters only if it is an original install&lt;br /&gt;
		if ( $type == &#039;install&#039; ) {&lt;br /&gt;
			$params[&#039;my_param2&#039;] = &#039;4&#039;;&lt;br /&gt;
			$params[&#039;my_param3&#039;] = &#039;Star&#039;;&lt;br /&gt;
		}&lt;br /&gt;
 &lt;br /&gt;
		$this-&amp;gt;setParams( $params );&lt;br /&gt;
 &lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_POSTFLIGHT &#039; . $type . &#039; to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method&lt;br /&gt;
	 * uninstall runs before any other action is taken (file removal or database processing).&lt;br /&gt;
	 */&lt;br /&gt;
	function uninstall( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UNINSTALL &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * get a variable from the manifest file (actually, from the manifest cache).&lt;br /&gt;
	 */&lt;br /&gt;
	function getParam( $name ) {&lt;br /&gt;
		$db = JFactory::getDbo();&lt;br /&gt;
		$db-&amp;gt;setQuery(&#039;SELECT manifest_cache FROM #__extensions WHERE name = &#039;.$db-&amp;gt;quote(&#039;com_democompupdate&#039;));&lt;br /&gt;
		$manifest = json_decode( $db-&amp;gt;loadResult(), true );&lt;br /&gt;
		return $manifest[ $name ];&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * sets parameter values in the component&#039;s row of the extension table&lt;br /&gt;
	 */&lt;br /&gt;
	function setParams($param_array) {&lt;br /&gt;
		if ( count($param_array) &amp;gt; 0 ) {&lt;br /&gt;
			// read the existing component value(s)&lt;br /&gt;
			$db = JFactory::getDbo();&lt;br /&gt;
			$db-&amp;gt;setQuery(&#039;SELECT params FROM #__extensions WHERE name = &#039;.$db-&amp;gt;quote(&#039;com_democompupdate&#039;));&lt;br /&gt;
			$params = json_decode( $db-&amp;gt;loadResult(), true );&lt;br /&gt;
			// add the new variable(s) to the existing one(s)&lt;br /&gt;
			foreach ( $param_array as $name =&amp;gt; $value ) {&lt;br /&gt;
				$params[ (string) $name ] = (string) $value;&lt;br /&gt;
			}&lt;br /&gt;
			// store the combined new and existing values back as a JSON string&lt;br /&gt;
			$paramsString = json_encode( $params );&lt;br /&gt;
			$db-&amp;gt;setQuery(&#039;UPDATE #__extensions SET params = &#039; .&lt;br /&gt;
				$db-&amp;gt;quote( $paramsString ) .&lt;br /&gt;
				&#039; WHERE name = &#039;.$db-&amp;gt;quote(&#039;com_democompupdate&#039;));&lt;br /&gt;
				$db-&amp;gt;query();&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
*[[User:tapaccos|Alex Tapaccos]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Joomla! 1.6]]&lt;br /&gt;
[[Category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Joomla! 2.5]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Script.php)&amp;diff=67563</id>
		<title>Archived:Managing Component Updates (Script.php)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Script.php)&amp;diff=67563"/>
		<updated>2012-06-10T20:58:08Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* preflight */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}} {{JVer|2.5}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Script.php ==&lt;br /&gt;
This file contains the component-specific methods preflight, install, update, postflight and uninstall.  This file is where the component developer implements all of the unique code for these actions.&lt;br /&gt;
For this example, in addition to various checks, HTML is inserted into the back-end output to show which code has been executed.  You may choose to display different HTML, or to display none for your component.&lt;br /&gt;
&lt;br /&gt;
=== preflight ===&lt;br /&gt;
This is where most of the checking should be done before install, update or discover_install.  Preflight is executed prior to any Joomla install, update or discover_install actions.  Preflight is not executed on uninstall.  A string denoting the type of action (install, update or discover_install) is passed to preflight in the $type operand.  Your code can use this string to execute different checks and responses for the three cases.&lt;br /&gt;
&lt;br /&gt;
It is appropriate to check the Joomla version and the existing component version in the preflight module.  A failure of either of these two should cause an abort of the action.  An abort is triggered by returning a false value from this preflight method.  On receiving a false return value, Joomla will reverse any actions already completed.&lt;br /&gt;
&lt;br /&gt;
The PHP function &#039;&#039;version_compare&#039;&#039; is useful to compare version strings.  Joomla also uses &#039;&#039;version_compare&#039;&#039; to define the sequence of SQL file execution, when an update is being executed that spans multiple versions.&lt;br /&gt;
&lt;br /&gt;
In this example, the preflight method checks that Joomla version 1.6 or greater is in use.  If an earlier Joomla version is in use, the install or update will abort.  Since this script.php file only works in Joomla version 1.6 or greater, this check is currently not very useful.  As subsequent Joomla versions become available, this check will be useful.  Try changing the version string in the script.php file to a value greater than the Joomla version that you are using.  Installs and updates should fail. This is what the version &#039;&#039;democompupdate_10j3.zip&#039;&#039; demonstrates.&lt;br /&gt;
&lt;br /&gt;
In addition to failing, it is important to give the web site administrator useful information as to why the component installation failed. See the example below.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function preflight( $type, $parent ) {&lt;br /&gt;
	$jversion = new JVersion();&lt;br /&gt;
&lt;br /&gt;
	// Installing component manifest file version&lt;br /&gt;
	$this-&amp;gt;release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;version;&lt;br /&gt;
		&lt;br /&gt;
	// Manifest file minimum Joomla version&lt;br /&gt;
	$this-&amp;gt;minimum_joomla_release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;attributes()-&amp;gt;version;   &lt;br /&gt;
&lt;br /&gt;
	// Show the essential information at the install/update back-end&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;Installing component manifest file version = &#039; . $this-&amp;gt;release;&lt;br /&gt;
	echo &#039;&amp;lt;br /&amp;gt;Current manifest cache commponent version = &#039; . $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
	echo &#039;&amp;lt;br /&amp;gt;Installing component manifest file minimum Joomla version = &#039; . $this-&amp;gt;minimum_joomla_release;&lt;br /&gt;
	echo &#039;&amp;lt;br /&amp;gt;Current Joomla version = &#039; . $jversion-&amp;gt;getShortVersion();&lt;br /&gt;
&lt;br /&gt;
	// abort if the current Joomla release is older&lt;br /&gt;
	if( version_compare( $jversion-&amp;gt;getShortVersion(), $this-&amp;gt;minimum_joomla_release, &#039;lt&#039; ) ) {&lt;br /&gt;
		Jerror::raiseWarning(null, &#039;Cannot install com_democompupdate in a Joomla release prior to &#039;.$this-&amp;gt;minimum_joomla_release);&lt;br /&gt;
		return false;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// abort if the component being installed is not newer than the currently installed version&lt;br /&gt;
	if ( $type == &#039;update&#039; ) {&lt;br /&gt;
		$oldRelease = $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
		$rel = $oldRelease . &#039; to &#039; . $this-&amp;gt;release;&lt;br /&gt;
		if ( version_compare( $this-&amp;gt;release, $oldRelease, &#039;le&#039; ) ) {&lt;br /&gt;
			Jerror::raiseWarning(null, &#039;Incorrect version sequence. Cannot upgrade &#039; . $rel);&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	else { $rel = $this-&amp;gt;release; }&lt;br /&gt;
 &lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_PREFLIGHT_&#039; . $type . &#039; &#039; . $rel) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== install ===&lt;br /&gt;
Install is executed after the Joomla install database scripts have completed. Returning &#039;false&#039; will abort the install and undo any changes already made.&lt;br /&gt;
It is cleaner to abort the install during preflight, if possible.  Since fewer install actions have occurred at preflight, there is less risk that that their reversal may be done incorrectly.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function install( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_INSTALL to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	// Following an install, the backend can jump directly to the newly installed component configuration page&lt;br /&gt;
	$parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== update ===&lt;br /&gt;
Update is executed after the Joomla update database scripts have completed.  Returning &#039;false&#039; will abort the update and undo any changes already made.&lt;br /&gt;
It is cleaner to abort the update during preflight, if possible.  Since fewer update actions have occurred at preflight, there is less risk that that their reversal may be done incorrectly.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function update( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UPDATE_ to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	// Following an update, the backend can jump directly to the newly installed component configuration page&lt;br /&gt;
	$parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== postflight ===&lt;br /&gt;
Postflight is executed after the Joomla install, update or discover_update actions have completed.  It is not executed after uninstall.  Postflight is executed after the extension is registered in the database.  The type of action (install, update or discover_install) is passed to postflight in the $type operand. Postflight cannot cause an abort of the Joomla install, update or discover_install action.&lt;br /&gt;
&lt;br /&gt;
The postflight method is a good place to set the default values of component parameters during installs, and to set the values of hidden component parameters during installs and updates.  Postflight can be used for any other action that must follow the install, update or discover_install actions.&lt;br /&gt;
&lt;br /&gt;
This example defines component parameters in postflight.  The value of &#039;&#039;my_param0&#039;&#039; is displayed in the component front-end.  Both &#039;&#039;my_param0&#039;&#039; and &#039;&#039;my_param1&#039;&#039; are overwritten in updates. This is how you would change revision-specific identification values during an update. The examples &#039;&#039;myparam2&#039;&#039; and &#039;&#039;myparam3&#039;&#039; represent component configuration parameters that you expect users to set, and you do not want to overwrite during an update. Parameters that control component operation would be treated this way.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function postflight( $type, $parent ) {&lt;br /&gt;
	// always create or modify these parameters&lt;br /&gt;
	$params[&#039;my_param0&#039;] = &#039;Component version &#039; . $this-&amp;gt;release;&lt;br /&gt;
	$params[&#039;my_param1&#039;] = &#039;Another value&#039;;&lt;br /&gt;
&lt;br /&gt;
	// define the following parameters only if it is an original install&lt;br /&gt;
	if ( $type == &#039;install&#039; ) {&lt;br /&gt;
		$params[&#039;my_param2&#039;] = &#039;4&#039;;&lt;br /&gt;
		$params[&#039;my_param3&#039;] = &#039;Star&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	$this-&amp;gt;setParams( $params );&lt;br /&gt;
&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_POSTFLIGHT &#039; . $type . &#039; to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== uninstall ===&lt;br /&gt;
The uninstall method is executed before any Joomla uninstall action, such as file removal or database changes.  Uninstall cannot cause an abort of the Joomla uninstall action, so returning false would be a waste of time.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function uninstall( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UNINSTALL &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The entire script.php file ==&lt;br /&gt;
This is the entire script.php file for version 1.0.&lt;br /&gt;
Note the definition of the variable &#039;&#039;$release&#039;&#039;.&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(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
//the name of the class must be the name of your component + InstallerScript&lt;br /&gt;
//for example: com_contentInstallerScript for com_content.&lt;br /&gt;
class com_democompupdateInstallerScript&lt;br /&gt;
{&lt;br /&gt;
	/*&lt;br /&gt;
	 * The release value to be displayed and checked against throughout this file.&lt;br /&gt;
	 */&lt;br /&gt;
	private $release = &#039;1.0&#039;;&lt;br /&gt;
&lt;br /&gt;
        /*&lt;br /&gt;
         * Find mimimum required joomla version for this extension. It will be read from the version attribute (install tag) in the manifest file&lt;br /&gt;
         */&lt;br /&gt;
        private $minimum_joomla_release = &#039;1.6.0&#039;;    &lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * $type is the type of change (install, update or discover_install, not uninstall).&lt;br /&gt;
	 * preflight runs before anything else and while the extracted files are in the uploaded temp folder.&lt;br /&gt;
	 * If preflight returns false, Joomla will abort the update and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function preflight( $type, $parent ) {&lt;br /&gt;
		// this component does not work with Joomla releases prior to 1.6&lt;br /&gt;
		// abort if the current Joomla release is older&lt;br /&gt;
		$jversion = new JVersion();&lt;br /&gt;
&lt;br /&gt;
                // Extract the version number from the manifest. This will overwrite the 1.0 value set above &lt;br /&gt;
                $this-&amp;gt;release=$parent-&amp;gt;get(&amp;quot;manifest&amp;quot;)-&amp;gt;version;&lt;br /&gt;
                &lt;br /&gt;
                // Find mimimum required joomla version&lt;br /&gt;
                $this-&amp;gt;minimum_joomla_release=$parent-&amp;gt;get(&amp;quot;manifest&amp;quot;)-&amp;gt;attributes()-&amp;gt;version;    &lt;br /&gt;
&lt;br /&gt;
		if( version_compare( $jversion-&amp;gt;getShortVersion(), $this-&amp;gt;minimum_joomla_release, &#039;lt&#039; ) ) {&lt;br /&gt;
			Jerror::raiseWarning(null, &#039;Cannot install com_democompupdate in a Joomla release prior to &#039;.$this-&amp;gt;minimum_joomla_release);&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// abort if the component being installed is not newer than the currently installed version&lt;br /&gt;
		if ( $type == &#039;update&#039; ) {&lt;br /&gt;
			$oldRelease = $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
			$rel = $oldRelease . &#039; to &#039; . $this-&amp;gt;release;&lt;br /&gt;
			if ( version_compare( $this-&amp;gt;release, $oldRelease, &#039;le&#039; ) ) {&lt;br /&gt;
				Jerror::raiseWarning(null, &#039;Incorrect version sequence. Cannot upgrade &#039; . $rel);&lt;br /&gt;
				return false;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
		else { $rel = $this-&amp;gt;release; }&lt;br /&gt;
		&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_PREFLIGHT_&#039; . $type . &#039; &#039; . $rel) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * install runs after the database scripts are executed.&lt;br /&gt;
	 * If the extension is new, the install method is run.&lt;br /&gt;
	 * If install returns false, Joomla will abort the install and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function install( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_INSTALL to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
		// You can have the backend jump directly to the newly installed component configuration page&lt;br /&gt;
		// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * update runs after the database scripts are executed.&lt;br /&gt;
	 * If the extension exists, then the update method is run.&lt;br /&gt;
	 * If this returns false, Joomla will abort the update and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function update( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UPDATE_ to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * $type is the type of change (install, update or discover_install, not uninstall).&lt;br /&gt;
	 * postflight is run after the extension is registered in the database.&lt;br /&gt;
	 */&lt;br /&gt;
	function postflight( $type, $parent ) {&lt;br /&gt;
		// always create or modify these parameters&lt;br /&gt;
		$params[&#039;my_param0&#039;] = &#039;Component version &#039; . $this-&amp;gt;release;&lt;br /&gt;
		$params[&#039;my_param1&#039;] = &#039;Another value&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// define the following parameters only if it is an original install&lt;br /&gt;
		if ( $type == &#039;install&#039; ) {&lt;br /&gt;
			$params[&#039;my_param2&#039;] = &#039;4&#039;;&lt;br /&gt;
			$params[&#039;my_param3&#039;] = &#039;Star&#039;;&lt;br /&gt;
		}&lt;br /&gt;
 &lt;br /&gt;
		$this-&amp;gt;setParams( $params );&lt;br /&gt;
 &lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_POSTFLIGHT &#039; . $type . &#039; to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method&lt;br /&gt;
	 * uninstall runs before any other action is taken (file removal or database processing).&lt;br /&gt;
	 */&lt;br /&gt;
	function uninstall( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UNINSTALL &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * get a variable from the manifest file (actually, from the manifest cache).&lt;br /&gt;
	 */&lt;br /&gt;
	function getParam( $name ) {&lt;br /&gt;
		$db = JFactory::getDbo();&lt;br /&gt;
		$db-&amp;gt;setQuery(&#039;SELECT manifest_cache FROM #__extensions WHERE name = &#039;.$db-&amp;gt;quote(&#039;com_democompupdate&#039;));&lt;br /&gt;
		$manifest = json_decode( $db-&amp;gt;loadResult(), true );&lt;br /&gt;
		return $manifest[ $name ];&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * sets parameter values in the component&#039;s row of the extension table&lt;br /&gt;
	 */&lt;br /&gt;
	function setParams($param_array) {&lt;br /&gt;
		if ( count($param_array) &amp;gt; 0 ) {&lt;br /&gt;
			// read the existing component value(s)&lt;br /&gt;
			$db = JFactory::getDbo();&lt;br /&gt;
			$db-&amp;gt;setQuery(&#039;SELECT params FROM #__extensions WHERE name = &#039;.$db-&amp;gt;quote(&#039;com_democompupdate&#039;));&lt;br /&gt;
			$params = json_decode( $db-&amp;gt;loadResult(), true );&lt;br /&gt;
			// add the new variable(s) to the existing one(s)&lt;br /&gt;
			foreach ( $param_array as $name =&amp;gt; $value ) {&lt;br /&gt;
				$params[ (string) $name ] = (string) $value;&lt;br /&gt;
			}&lt;br /&gt;
			// store the combined new and existing values back as a JSON string&lt;br /&gt;
			$paramsString = json_encode( $params );&lt;br /&gt;
			$db-&amp;gt;setQuery(&#039;UPDATE #__extensions SET params = &#039; .&lt;br /&gt;
				$db-&amp;gt;quote( $paramsString ) .&lt;br /&gt;
				&#039; WHERE name = &#039;.$db-&amp;gt;quote(&#039;com_democompupdate&#039;));&lt;br /&gt;
				$db-&amp;gt;query();&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
*[[User:tapaccos|Alex Tapaccos]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Joomla! 1.6]]&lt;br /&gt;
[[Category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Joomla! 2.5]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=67562</id>
		<title>Archived:Managing Component Updates (Manifest file)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=67562"/>
		<updated>2012-06-10T20:49:30Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* Joomla version */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}} {{JVer|2.5}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Manifest File (democompupdate.xml) ==&lt;br /&gt;
The manifest file in this example is very similar to that of normal components.  Important contents for this example include:&lt;br /&gt;
&lt;br /&gt;
=== sql folder ===&lt;br /&gt;
Note the inclusion of the SQL folder in the administration files section.  This tells Joomla to copy the contents of this folder to the web site during install or update.  The &#039;&#039;schemapath&#039;&#039; declaration below depends on Joomla copying these files during the install or update process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;administration&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt; &lt;br /&gt;
		&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt; &lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== name ===&lt;br /&gt;
This is the name of the component.  The &#039;getParam($key)&#039; method in the &#039;&#039;script.php&#039;&#039; file uses this value to identify the correct row in the extensions table.  The &#039;&#039;manifest_cache&#039;&#039; field in the &#039;&#039;extensions&#039;&#039; table has the version string for the currently installed component.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== version ===&lt;br /&gt;
Joomla stores this value in the &#039;&#039;manifest_cache&#039;&#039; field of the &#039;&#039;extensions&#039;&#039; table.  The &#039;&#039;extensions&#039;&#039; table is where the custom code in the &#039;&#039;script.php&#039;&#039; file reads the version string of the currently installed component, and compares it to the version string of the update.&lt;br /&gt;
&lt;br /&gt;
The custom component code uses this comparison to abort an update if the version sequence is not allowed.  Joomla also compares this string to the SQL update file names, to determine which SQL commands to execute.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Joomla version ===&lt;br /&gt;
The component developer records in the manifest file the version of Joomla that is required to run the component. &lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your component installation script.php file can use this value to control whether a component installation or update should be allowed or not allowed.&lt;br /&gt;
&lt;br /&gt;
=== schemapath ===&lt;br /&gt;
This defines the directory that contains SQL files for component incremental database updates.&lt;br /&gt;
You may choose to put the SQL files somewhere else in your component release, but make sure their location is documented here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;update&amp;gt; &lt;br /&gt;
	&amp;lt;schemas&amp;gt; &lt;br /&gt;
		&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt; &lt;br /&gt;
	&amp;lt;/schemas&amp;gt; &lt;br /&gt;
&amp;lt;/update&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== #__schemas table ===&lt;br /&gt;
The SQL files have a second function.&lt;br /&gt;
In addition to potentially modifying the MySQL database, Joomla uses the names of these SQL files to enable updates to the &#039;&#039;version_id&#039;&#039; field in the &#039;&#039;#__schemas&#039;&#039; table for your component.&lt;br /&gt;
It is important to have an SQL file for EVERY version of your component.&lt;br /&gt;
The file should be empty if you have no SQL code to execute when updating to that version.&lt;br /&gt;
You must have a file or the &#039;&#039;version_id&#039;&#039; will not get updated correctly.&lt;br /&gt;
Joomla uses the &#039;&#039;version_id&#039;&#039; in the &#039;&#039;#__schemas&#039;&#039; table as the &#039;&#039;from&#039;&#039; version when calculating updates &#039;&#039;from&#039;&#039; an older version &#039;&#039;to&#039;&#039; a new version.&lt;br /&gt;
&lt;br /&gt;
It is important to include these &#039;&#039;schemapath&#039;&#039; lines in your manifest file, even if you have no SQL commands to execute.&lt;br /&gt;
By including these lines and including empty SQL files, the &#039;&#039;version_id&#039;&#039; value will be correctly maintained in the &#039;&#039;#__schemas&#039;&#039; table.&lt;br /&gt;
&lt;br /&gt;
If your new component version is not executing the SQL file as expected, check the &#039;&#039;#__schemas&#039;&#039; table to see if the previous version was correctly recorded.&lt;br /&gt;
If it is not, then your update will not execute the SQL file when updating from that version.&lt;br /&gt;
&lt;br /&gt;
== The entire manifest file ==&lt;br /&gt;
Here is the entire manifest file for version 1.0.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;2011 05 11&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;Your Name Here&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Free to copy&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;none&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Test the Install and Update Process&amp;lt;/description&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Runs on install/uninstall/update; New in 1.6 --&amp;gt;&lt;br /&gt;
	&amp;lt;scriptfile&amp;gt;script.php&amp;lt;/scriptfile&amp;gt;&lt;br /&gt;
	&amp;lt;install&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install_data.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;democompupdate.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=67560</id>
		<title>Archived:Managing Component Updates (Manifest file)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=67560"/>
		<updated>2012-06-10T20:46:11Z</updated>

		<summary type="html">&lt;p&gt;Sm990: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}} {{JVer|2.5}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Manifest File (democompupdate.xml) ==&lt;br /&gt;
The manifest file in this example is very similar to that of normal components.  Important contents for this example include:&lt;br /&gt;
&lt;br /&gt;
=== sql folder ===&lt;br /&gt;
Note the inclusion of the SQL folder in the administration files section.  This tells Joomla to copy the contents of this folder to the web site during install or update.  The &#039;&#039;schemapath&#039;&#039; declaration below depends on Joomla copying these files during the install or update process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;administration&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt; &lt;br /&gt;
		&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt; &lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== name ===&lt;br /&gt;
This is the name of the component.  The &#039;getParam($key)&#039; method in the &#039;&#039;script.php&#039;&#039; file uses this value to identify the correct row in the extensions table.  The &#039;&#039;manifest_cache&#039;&#039; field in the &#039;&#039;extensions&#039;&#039; table has the version string for the currently installed component.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== version ===&lt;br /&gt;
Joomla stores this value in the &#039;&#039;manifest_cache&#039;&#039; field of the &#039;&#039;extensions&#039;&#039; table.  The &#039;&#039;extensions&#039;&#039; table is where the custom code in the &#039;&#039;script.php&#039;&#039; file reads the version string of the currently installed component, and compares it to the version string of the update.&lt;br /&gt;
&lt;br /&gt;
The custom component code uses this comparison to abort an update if the version sequence is not allowed.  Joomla also compares this string to the SQL update file names, to determine which SQL commands to execute.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Joomla version ===&lt;br /&gt;
The component developer records in the manifest file the version of Joomla that is required to run the component. &lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your component installation script.php file can use this value to control whether a component installation should be allowe or not allowed.&lt;br /&gt;
&lt;br /&gt;
=== schemapath ===&lt;br /&gt;
This defines the directory that contains SQL files for component incremental database updates.&lt;br /&gt;
You may choose to put the SQL files somewhere else in your component release, but make sure their location is documented here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;update&amp;gt; &lt;br /&gt;
	&amp;lt;schemas&amp;gt; &lt;br /&gt;
		&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt; &lt;br /&gt;
	&amp;lt;/schemas&amp;gt; &lt;br /&gt;
&amp;lt;/update&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== #__schemas table ===&lt;br /&gt;
The SQL files have a second function.&lt;br /&gt;
In addition to potentially modifying the MySQL database, Joomla uses the names of these SQL files to enable updates to the &#039;&#039;version_id&#039;&#039; field in the &#039;&#039;#__schemas&#039;&#039; table for your component.&lt;br /&gt;
It is important to have an SQL file for EVERY version of your component.&lt;br /&gt;
The file should be empty if you have no SQL code to execute when updating to that version.&lt;br /&gt;
You must have a file or the &#039;&#039;version_id&#039;&#039; will not get updated correctly.&lt;br /&gt;
Joomla uses the &#039;&#039;version_id&#039;&#039; in the &#039;&#039;#__schemas&#039;&#039; table as the &#039;&#039;from&#039;&#039; version when calculating updates &#039;&#039;from&#039;&#039; an older version &#039;&#039;to&#039;&#039; a new version.&lt;br /&gt;
&lt;br /&gt;
It is important to include these &#039;&#039;schemapath&#039;&#039; lines in your manifest file, even if you have no SQL commands to execute.&lt;br /&gt;
By including these lines and including empty SQL files, the &#039;&#039;version_id&#039;&#039; value will be correctly maintained in the &#039;&#039;#__schemas&#039;&#039; table.&lt;br /&gt;
&lt;br /&gt;
If your new component version is not executing the SQL file as expected, check the &#039;&#039;#__schemas&#039;&#039; table to see if the previous version was correctly recorded.&lt;br /&gt;
If it is not, then your update will not execute the SQL file when updating from that version.&lt;br /&gt;
&lt;br /&gt;
== The entire manifest file ==&lt;br /&gt;
Here is the entire manifest file for version 1.0.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;2011 05 11&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;Your Name Here&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Free to copy&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;none&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Test the Install and Update Process&amp;lt;/description&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Runs on install/uninstall/update; New in 1.6 --&amp;gt;&lt;br /&gt;
	&amp;lt;scriptfile&amp;gt;script.php&amp;lt;/scriptfile&amp;gt;&lt;br /&gt;
	&amp;lt;install&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install_data.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;democompupdate.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Update_SQL_files)&amp;diff=67558</id>
		<title>Archived:Managing Component Updates (Update SQL files)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Update_SQL_files)&amp;diff=67558"/>
		<updated>2012-06-10T17:16:53Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* Update SQL files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}} {{JVer|2.5}}&lt;br /&gt;
&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Update SQL files ==&lt;br /&gt;
The update SQL file(s) are located in a directory that is listed in the manifest file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;update&amp;gt; &lt;br /&gt;
	&amp;lt;schemas&amp;gt; &lt;br /&gt;
		&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt; &lt;br /&gt;
	&amp;lt;/schemas&amp;gt; &lt;br /&gt;
&amp;lt;/update&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a file for each component version.  Each file name must match the version string in the manifest file for that version.  Joomla uses this string to determine which SQL files(s) to execute, and in what order they will be executed.  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Important Note:&#039;&#039; These files are also used to set the version number in the &amp;lt;code&amp;gt;#__schemas&amp;lt;/code&amp;gt; table. This version number must be present in the current version of the component in order for the new SQL files to be run during the update. For example, if you have version 1.0 and are updating to version 1.1, the &amp;lt;code&amp;gt;1.1.sql&amp;lt;/code&amp;gt; file will not be executed if there was no &amp;lt;code&amp;gt;1.0.sql&amp;lt;/code&amp;gt; file in the 1.0 release. For this reason, it is good practice to have a SQL update file for each version, even if there is no SQL change in that version. You can just use an empty file or a file with a comment line.&lt;br /&gt;
&lt;br /&gt;
Joomla uses the PHP &#039;&#039;version_compare&#039;&#039; function to execute the correct SQL files..  Familiarize yourself with this function.  Your version strings need to adhere to the conventions of this function.&lt;br /&gt;
For example, the SQL files for version 1.3 of this example include:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
1.0.sql&lt;br /&gt;
  (empty) OR&lt;br /&gt;
  # Dummy SQL file to set schema version to 1.0 so next update will work&lt;br /&gt;
&lt;br /&gt;
1.1.sql&lt;br /&gt;
  UPDATE `#__democompupdate_mytable` SET myvalue=&#039;Version 1.1 text&#039; WHERE id=1;&lt;br /&gt;
&lt;br /&gt;
1.1.1.sql&lt;br /&gt;
  UPDATE `#__democompupdate_mytable` SET myvalue=&#039;Version 1.1.1 text&#039; WHERE id=1;&lt;br /&gt;
&lt;br /&gt;
1.2.sql&lt;br /&gt;
  INSERT INTO `#__democompupdate_mytable` (id,myvalue) VALUES (2,&#039;Version 1.2 text&#039;);&lt;br /&gt;
&lt;br /&gt;
1.2.1.sql&lt;br /&gt;
  UPDATE `#__democompupdate_mytable` SET myvalue=&#039;Version 1.2.1 text&#039; WHERE id=2;&lt;br /&gt;
&lt;br /&gt;
1.3.sql&lt;br /&gt;
  INSERT INTO `#__democompupdate_mytable` (id,myvalue) VALUES (3,&#039;Version 1.3 text&#039;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example has complete install files for component versions 1.0 (initial), 1.1.1 and 1.3.  Update SQL files are included for additional incremental component versions (1.1, 1.2 and 1.2.1) between these three versions.  These extra versions illustrate the process for updates that span more than one incremental version.&lt;br /&gt;
&lt;br /&gt;
* When updating from version 1.0 to version 1.1.1, both files 1.1.sql and 1.1.1.sql are executed.  The SQL commands update the value of the first, and only, row in the database table.  The command in 1.1.1.sql over-writes the value that was written by 1.1.sql.&lt;br /&gt;
* When updating from version 1.1.1 to version 1.3, files 1.2.sql, 1.2.1.sql and 1.3.sql are executed.  The commands in 1.2.sql and 1.3.sql each create a new row in the database table.&lt;br /&gt;
* When updating from version 1.0 directly to 1.3, files 1.1.sql, 1.1.1.sql, 1.2.sql, 1.2.1.sql and 1.3.sql are all executed.  You can see the cumulative effect of the table changes in the component front-end.&lt;br /&gt;
&lt;br /&gt;
Joomla executes the database updates in the sequence that would occur, as if the user had updated each version separately.  This would be necessary if an incremental database update depended on the correct update from the previous version.  An example would be: if a modification of a table value during one update depended on the addition of a new table field during a previous update.&lt;br /&gt;
&lt;br /&gt;
Joomla uses the PHP function &#039;&#039;version_compare&#039;&#039; to define the execution order of the SQL files.  The sequencing of your component version string must adhere to that defined by the &#039;&#039;version_compare&#039;&#039; function.&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Script.php)&amp;diff=67557</id>
		<title>Archived:Managing Component Updates (Script.php)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Script.php)&amp;diff=67557"/>
		<updated>2012-06-10T17:13:58Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* postflight */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}} {{JVer|2.5}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Script.php ==&lt;br /&gt;
This file contains the component-specific methods preflight, install, update, postflight and uninstall.  This file is where the component developer implements all of the unique code for these actions.&lt;br /&gt;
For this example, in addition to various checks, HTML is inserted into the back-end output to show which code has been executed.  You may choose to display different HTML, or to display none for your component.&lt;br /&gt;
&lt;br /&gt;
=== preflight ===&lt;br /&gt;
This is where most of the checking should be done before install, update or discover_install.  Preflight is executed prior to any Joomla install, update or discover_install actions.  Preflight is not executed on uninstall.  A string denoting the type of action (install, update or discover_install) is passed to preflight in the $type operand.  Your code can use this string to execute different checks and responses for the three cases.&lt;br /&gt;
&lt;br /&gt;
It is appropriate to check the Joomla version and the existing component version in the preflight module.  A failure of either of these two should cause an abort of the action.  An abort is triggered by returning a false value from this preflight method.  On receiving a false return value, Joomla will reverse any actions already completed.&lt;br /&gt;
&lt;br /&gt;
The PHP function &#039;&#039;version_compare&#039;&#039; is useful to compare version strings.  Joomla also uses &#039;&#039;version_compare&#039;&#039; to define the sequence of SQL file execution, when an update is being executed that spans multiple versions.&lt;br /&gt;
&lt;br /&gt;
In this example, the preflight method checks that Joomla version 1.6 or greater is in use.  If an earlier Joomla version is in use, the install or update will abort.  Since this script.php file only works in Joomla version 1.6 or greater, this check is currently not very useful.  As subsequent Joomla versions become available, this check will be useful.  Try changing the version string in the script.php file to a value greater than the Joomla version that you are using.  Installs and updates should fail. This is what the version &#039;&#039;democompupdate_10j3.zip&#039;&#039; demonstrates.&lt;br /&gt;
&lt;br /&gt;
In addition to failing, it is important to give the web site administrator useful information as to why the component installation failed. See the example below.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function preflight( $type, $parent ) {&lt;br /&gt;
	$jversion = new JVersion();&lt;br /&gt;
&lt;br /&gt;
        // Extract the version number from the manifest file&lt;br /&gt;
        $this-&amp;gt;release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;version;&lt;br /&gt;
&lt;br /&gt;
        // Find mimimum required joomla version from the manifest file&lt;br /&gt;
        $this-&amp;gt;minimum_joomla_release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;attributes()-&amp;gt;version;        &lt;br /&gt;
&lt;br /&gt;
	if( version_compare( $jversion-&amp;gt;getShortVersion(), $this-&amp;gt;minimum_joomla_release, &#039;lt&#039; ) ) {&lt;br /&gt;
		Jerror::raiseWarning(null, &#039;Cannot install com_democompupdate in a Joomla release prior to &#039;. $this-&amp;gt;minimum_joomla_release);&lt;br /&gt;
		return false;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// abort if the component being installed is not newer than the currently installed version&lt;br /&gt;
	if ( $type == &#039;update&#039; ) {&lt;br /&gt;
		$oldRelease = $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
		$rel = $oldRelease . &#039; to &#039; . $this-&amp;gt;release;&lt;br /&gt;
		if ( version_compare( $this-&amp;gt;release, $oldRelease, &#039;le&#039; ) ) {&lt;br /&gt;
			Jerror::raiseWarning(null, &#039;Incorrect version sequence. Cannot upgrade &#039; . $rel);&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	else { $rel = $this-&amp;gt;release; }&lt;br /&gt;
		&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_PREFLIGHT_&#039; . $type . &#039; &#039; . $rel) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== install ===&lt;br /&gt;
Install is executed after the Joomla install database scripts have completed. Returning &#039;false&#039; will abort the install and undo any changes already made.&lt;br /&gt;
It is cleaner to abort the install during preflight, if possible.  Since fewer install actions have occurred at preflight, there is less risk that that their reversal may be done incorrectly.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function install( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_INSTALL to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	// Following an install, the backend can jump directly to the newly installed component configuration page&lt;br /&gt;
	$parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== update ===&lt;br /&gt;
Update is executed after the Joomla update database scripts have completed.  Returning &#039;false&#039; will abort the update and undo any changes already made.&lt;br /&gt;
It is cleaner to abort the update during preflight, if possible.  Since fewer update actions have occurred at preflight, there is less risk that that their reversal may be done incorrectly.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function update( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UPDATE_ to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	// Following an update, the backend can jump directly to the newly installed component configuration page&lt;br /&gt;
	$parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== postflight ===&lt;br /&gt;
Postflight is executed after the Joomla install, update or discover_update actions have completed.  It is not executed after uninstall.  Postflight is executed after the extension is registered in the database.  The type of action (install, update or discover_install) is passed to postflight in the $type operand. Postflight cannot cause an abort of the Joomla install, update or discover_install action.&lt;br /&gt;
&lt;br /&gt;
The postflight method is a good place to set the default values of component parameters during installs, and to set the values of hidden component parameters during installs and updates.  Postflight can be used for any other action that must follow the install, update or discover_install actions.&lt;br /&gt;
&lt;br /&gt;
This example defines component parameters in postflight.  The value of &#039;&#039;my_param0&#039;&#039; is displayed in the component front-end.  Both &#039;&#039;my_param0&#039;&#039; and &#039;&#039;my_param1&#039;&#039; are overwritten in updates. This is how you would change revision-specific identification values during an update. The examples &#039;&#039;myparam2&#039;&#039; and &#039;&#039;myparam3&#039;&#039; represent component configuration parameters that you expect users to set, and you do not want to overwrite during an update. Parameters that control component operation would be treated this way.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function postflight( $type, $parent ) {&lt;br /&gt;
	// always create or modify these parameters&lt;br /&gt;
	$params[&#039;my_param0&#039;] = &#039;Component version &#039; . $this-&amp;gt;release;&lt;br /&gt;
	$params[&#039;my_param1&#039;] = &#039;Another value&#039;;&lt;br /&gt;
&lt;br /&gt;
	// define the following parameters only if it is an original install&lt;br /&gt;
	if ( $type == &#039;install&#039; ) {&lt;br /&gt;
		$params[&#039;my_param2&#039;] = &#039;4&#039;;&lt;br /&gt;
		$params[&#039;my_param3&#039;] = &#039;Star&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	$this-&amp;gt;setParams( $params );&lt;br /&gt;
&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_POSTFLIGHT &#039; . $type . &#039; to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== uninstall ===&lt;br /&gt;
The uninstall method is executed before any Joomla uninstall action, such as file removal or database changes.  Uninstall cannot cause an abort of the Joomla uninstall action, so returning false would be a waste of time.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function uninstall( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UNINSTALL &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The entire script.php file ==&lt;br /&gt;
This is the entire script.php file for version 1.0.&lt;br /&gt;
Note the definition of the variable &#039;&#039;$release&#039;&#039;.&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(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
//the name of the class must be the name of your component + InstallerScript&lt;br /&gt;
//for example: com_contentInstallerScript for com_content.&lt;br /&gt;
class com_democompupdateInstallerScript&lt;br /&gt;
{&lt;br /&gt;
	/*&lt;br /&gt;
	 * The release value to be displayed and checked against throughout this file.&lt;br /&gt;
	 */&lt;br /&gt;
	private $release = &#039;1.0&#039;;&lt;br /&gt;
&lt;br /&gt;
        /*&lt;br /&gt;
         * Find mimimum required joomla version for this extension. It will be read from the version attribute (install tag) in the manifest file&lt;br /&gt;
         */&lt;br /&gt;
        private $minimum_joomla_release = &#039;1.6.0&#039;;    &lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * $type is the type of change (install, update or discover_install, not uninstall).&lt;br /&gt;
	 * preflight runs before anything else and while the extracted files are in the uploaded temp folder.&lt;br /&gt;
	 * If preflight returns false, Joomla will abort the update and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function preflight( $type, $parent ) {&lt;br /&gt;
		// this component does not work with Joomla releases prior to 1.6&lt;br /&gt;
		// abort if the current Joomla release is older&lt;br /&gt;
		$jversion = new JVersion();&lt;br /&gt;
&lt;br /&gt;
                // Extract the version number from the manifest. This will overwrite the 1.0 value set above &lt;br /&gt;
                $this-&amp;gt;release=$parent-&amp;gt;get(&amp;quot;manifest&amp;quot;)-&amp;gt;version;&lt;br /&gt;
                &lt;br /&gt;
                // Find mimimum required joomla version&lt;br /&gt;
                $this-&amp;gt;minimum_joomla_release=$parent-&amp;gt;get(&amp;quot;manifest&amp;quot;)-&amp;gt;attributes()-&amp;gt;version;    &lt;br /&gt;
&lt;br /&gt;
		if( version_compare( $jversion-&amp;gt;getShortVersion(), $this-&amp;gt;minimum_joomla_release, &#039;lt&#039; ) ) {&lt;br /&gt;
			Jerror::raiseWarning(null, &#039;Cannot install com_democompupdate in a Joomla release prior to &#039;.$this-&amp;gt;minimum_joomla_release);&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// abort if the component being installed is not newer than the currently installed version&lt;br /&gt;
		if ( $type == &#039;update&#039; ) {&lt;br /&gt;
			$oldRelease = $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
			$rel = $oldRelease . &#039; to &#039; . $this-&amp;gt;release;&lt;br /&gt;
			if ( version_compare( $this-&amp;gt;release, $oldRelease, &#039;le&#039; ) ) {&lt;br /&gt;
				Jerror::raiseWarning(null, &#039;Incorrect version sequence. Cannot upgrade &#039; . $rel);&lt;br /&gt;
				return false;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
		else { $rel = $this-&amp;gt;release; }&lt;br /&gt;
		&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_PREFLIGHT_&#039; . $type . &#039; &#039; . $rel) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * install runs after the database scripts are executed.&lt;br /&gt;
	 * If the extension is new, the install method is run.&lt;br /&gt;
	 * If install returns false, Joomla will abort the install and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function install( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_INSTALL to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
		// You can have the backend jump directly to the newly installed component configuration page&lt;br /&gt;
		// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * update runs after the database scripts are executed.&lt;br /&gt;
	 * If the extension exists, then the update method is run.&lt;br /&gt;
	 * If this returns false, Joomla will abort the update and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function update( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UPDATE_ to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * $type is the type of change (install, update or discover_install, not uninstall).&lt;br /&gt;
	 * postflight is run after the extension is registered in the database.&lt;br /&gt;
	 */&lt;br /&gt;
	function postflight( $type, $parent ) {&lt;br /&gt;
		// always create or modify these parameters&lt;br /&gt;
		$params[&#039;my_param0&#039;] = &#039;Component version &#039; . $this-&amp;gt;release;&lt;br /&gt;
		$params[&#039;my_param1&#039;] = &#039;Another value&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// define the following parameters only if it is an original install&lt;br /&gt;
		if ( $type == &#039;install&#039; ) {&lt;br /&gt;
			$params[&#039;my_param2&#039;] = &#039;4&#039;;&lt;br /&gt;
			$params[&#039;my_param3&#039;] = &#039;Star&#039;;&lt;br /&gt;
		}&lt;br /&gt;
 &lt;br /&gt;
		$this-&amp;gt;setParams( $params );&lt;br /&gt;
 &lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_POSTFLIGHT &#039; . $type . &#039; to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method&lt;br /&gt;
	 * uninstall runs before any other action is taken (file removal or database processing).&lt;br /&gt;
	 */&lt;br /&gt;
	function uninstall( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UNINSTALL &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * get a variable from the manifest file (actually, from the manifest cache).&lt;br /&gt;
	 */&lt;br /&gt;
	function getParam( $name ) {&lt;br /&gt;
		$db = JFactory::getDbo();&lt;br /&gt;
		$db-&amp;gt;setQuery(&#039;SELECT manifest_cache FROM #__extensions WHERE name = &#039;.$db-&amp;gt;quote(&#039;com_democompupdate&#039;));&lt;br /&gt;
		$manifest = json_decode( $db-&amp;gt;loadResult(), true );&lt;br /&gt;
		return $manifest[ $name ];&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * sets parameter values in the component&#039;s row of the extension table&lt;br /&gt;
	 */&lt;br /&gt;
	function setParams($param_array) {&lt;br /&gt;
		if ( count($param_array) &amp;gt; 0 ) {&lt;br /&gt;
			// read the existing component value(s)&lt;br /&gt;
			$db = JFactory::getDbo();&lt;br /&gt;
			$db-&amp;gt;setQuery(&#039;SELECT params FROM #__extensions WHERE name = &#039;.$db-&amp;gt;quote(&#039;com_democompupdate&#039;));&lt;br /&gt;
			$params = json_decode( $db-&amp;gt;loadResult(), true );&lt;br /&gt;
			// add the new variable(s) to the existing one(s)&lt;br /&gt;
			foreach ( $param_array as $name =&amp;gt; $value ) {&lt;br /&gt;
				$params[ (string) $name ] = (string) $value;&lt;br /&gt;
			}&lt;br /&gt;
			// store the combined new and existing values back as a JSON string&lt;br /&gt;
			$paramsString = json_encode( $params );&lt;br /&gt;
			$db-&amp;gt;setQuery(&#039;UPDATE #__extensions SET params = &#039; .&lt;br /&gt;
				$db-&amp;gt;quote( $paramsString ) .&lt;br /&gt;
				&#039; WHERE name = &#039;.$db-&amp;gt;quote(&#039;com_democompupdate&#039;));&lt;br /&gt;
				$db-&amp;gt;query();&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
*[[User:tapaccos|Alex Tapaccos]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Joomla! 1.6]]&lt;br /&gt;
[[Category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Joomla! 2.5]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=67556</id>
		<title>Archived:Managing Component Updates (Manifest file)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=67556"/>
		<updated>2012-06-10T17:03:30Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* version */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}} {{JVer|2.5}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Manifest File (democompupdate.xml) ==&lt;br /&gt;
The manifest file in this example is very similar to that of normal components.  Important contents for this example include:&lt;br /&gt;
&lt;br /&gt;
=== sql folder ===&lt;br /&gt;
Note the inclusion of the SQL folder in the administration files section.  This tells Joomla to copy the contents of this folder to the web site during install or update.  The &#039;&#039;schemapath&#039;&#039; declaration below depends on Joomla copying these files during the install or update process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;administration&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt; &lt;br /&gt;
		&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt; &lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== name ===&lt;br /&gt;
This is the name of the component.  The &#039;getParam($key)&#039; method in the &#039;&#039;script.php&#039;&#039; file uses this value to identify the correct row in the extensions table.  The &#039;&#039;manifest_cache&#039;&#039; field in the &#039;&#039;extensions&#039;&#039; table has the version string for the currently installed component.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== version ===&lt;br /&gt;
Joomla stores this value in the &#039;&#039;manifest_cache&#039;&#039; field of the &#039;&#039;extensions&#039;&#039; table.  The &#039;&#039;extensions&#039;&#039; table is where the custom code in the &#039;&#039;script.php&#039;&#039; file reads the version string of the currently installed component, and compares it to the version string of the update.&lt;br /&gt;
&lt;br /&gt;
The custom component code uses this comparison to abort an update if the version sequence is not allowed.  Joomla also compares this string to the SQL update file names, to determine which SQL commands to execute.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== schemapath ===&lt;br /&gt;
This defines the directory that contains SQL files for component incremental database updates.&lt;br /&gt;
You may choose to put the SQL files somewhere else in your component release, but make sure their location is documented here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;update&amp;gt; &lt;br /&gt;
	&amp;lt;schemas&amp;gt; &lt;br /&gt;
		&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt; &lt;br /&gt;
	&amp;lt;/schemas&amp;gt; &lt;br /&gt;
&amp;lt;/update&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== #__schemas table ===&lt;br /&gt;
The SQL files have a second function.&lt;br /&gt;
In addition to potentially modifying the MySQL database, Joomla uses the names of these SQL files to enable updates to the &#039;&#039;version_id&#039;&#039; field in the &#039;&#039;#__schemas&#039;&#039; table for your component.&lt;br /&gt;
It is important to have an SQL file for EVERY version of your component.&lt;br /&gt;
The file should be empty if you have no SQL code to execute when updating to that version.&lt;br /&gt;
You must have a file or the &#039;&#039;version_id&#039;&#039; will not get updated correctly.&lt;br /&gt;
Joomla uses the &#039;&#039;version_id&#039;&#039; in the &#039;&#039;#__schemas&#039;&#039; table as the &#039;&#039;from&#039;&#039; version when calculating updates &#039;&#039;from&#039;&#039; an older version &#039;&#039;to&#039;&#039; a new version.&lt;br /&gt;
&lt;br /&gt;
It is important to include these &#039;&#039;schemapath&#039;&#039; lines in your manifest file, even if you have no SQL commands to execute.&lt;br /&gt;
By including these lines and including empty SQL files, the &#039;&#039;version_id&#039;&#039; value will be correctly maintained in the &#039;&#039;#__schemas&#039;&#039; table.&lt;br /&gt;
&lt;br /&gt;
If your new component version is not executing the SQL file as expected, check the &#039;&#039;#__schemas&#039;&#039; table to see if the previous version was correctly recorded.&lt;br /&gt;
If it is not, then your update will not execute the SQL file when updating from that version.&lt;br /&gt;
&lt;br /&gt;
== The entire manifest file ==&lt;br /&gt;
Here is the entire manifest file for version 1.0.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;2011 05 11&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;Your Name Here&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Free to copy&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;none&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Test the Install and Update Process&amp;lt;/description&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Runs on install/uninstall/update; New in 1.6 --&amp;gt;&lt;br /&gt;
	&amp;lt;scriptfile&amp;gt;script.php&amp;lt;/scriptfile&amp;gt;&lt;br /&gt;
	&amp;lt;install&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install_data.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;democompupdate.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(How_to_use_this_example)&amp;diff=65721</id>
		<title>Archived:Managing Component Updates (How to use this example)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(How_to_use_this_example)&amp;diff=65721"/>
		<updated>2012-03-19T00:28:26Z</updated>

		<summary type="html">&lt;p&gt;Sm990: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}} {{JVer|2.5}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
You will need to download all four versions of this example to exercise all of the features.&lt;br /&gt;
&lt;br /&gt;
== Normal update sequence ==&lt;br /&gt;
&lt;br /&gt;
You can use the following sequence of installs, updates and uninstalls to show the effects of this example.  You may also try installs, updates and uninstalls in any sequence that you desire.&lt;br /&gt;
&lt;br /&gt;
* Previous state: no com_democompupdate component installed.&lt;br /&gt;
* Install democompupdate_10.zip.&lt;br /&gt;
** Verify the install is good by the text echoed in back-end.&lt;br /&gt;
** Front-end: verify database, files and parameter setting.&lt;br /&gt;
** optional: phpMyAdmin: verify:&lt;br /&gt;
*** jos_democompupdate_mytable exists and has one row, myvalue = &#039;1.0&#039;.&lt;br /&gt;
*** jos_extensions table has entry for com_democompupdate.&lt;br /&gt;
**** params field (JSON), has three values.&lt;br /&gt;
**** manifest_cache field (JSON) shows version &#039;1.0&#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Previous state: version 1.0 installed.&lt;br /&gt;
* Install democompupdate_111.zip.&lt;br /&gt;
** Verify the update is good by the text echoed in back-end.&lt;br /&gt;
** Front-end: verify database, files and parameter setting.&lt;br /&gt;
** optional: phpMyAdmin: verify:&lt;br /&gt;
*** jos_democompupdate_mytable exists and has one row, value &#039;1.1.1&#039;.&lt;br /&gt;
*** jos_extensions table has entry for com_democompupdate.&lt;br /&gt;
**** params field (JSON), has three values.&lt;br /&gt;
**** manifest_cache field (JSON) shows version &#039;1.1.1&#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Previous state: version 1.1.1 installed.&lt;br /&gt;
* Install democompupdate_13.zip.&lt;br /&gt;
** Verify the update is good by the text echoed in back-end.&lt;br /&gt;
** Front-end: verify database, files and parameter setting.&lt;br /&gt;
*** There should be three rows in the table.&lt;br /&gt;
** optional: phpMyAdmin: verify:&lt;br /&gt;
*** jos_democompupdate_mytable exists and has three rows, values &#039;1.1.1&#039;, &#039;1.2.1&#039; and &#039;1.3&#039;.&lt;br /&gt;
*** jos_extensions table has entry for com_democompupdate.&lt;br /&gt;
**** params field (JSON), has three values.&lt;br /&gt;
**** manifest_cache field (JSON) shows version &#039;1.3&#039;.&lt;br /&gt;
&lt;br /&gt;
== Try a reverse-sequence update ==&lt;br /&gt;
&lt;br /&gt;
* Previous state: version 1.3 installed.&lt;br /&gt;
* Install democompupdate_10.zip.&lt;br /&gt;
** Update should fail, give useful information in the back-end.&lt;br /&gt;
** No change should be seen in the front-end, back-end or MySqlAdmin.&lt;br /&gt;
&lt;br /&gt;
== Make sure that uninstall works ==&lt;br /&gt;
&lt;br /&gt;
* Previous state: version 1.3 installed.&lt;br /&gt;
* Uninstall com_democompupdate&lt;br /&gt;
** Verify the component does not exist in Joomla extension manager or front-end.&lt;br /&gt;
** optional: phpMyAdmin: verify that democompupdate elements are gone.&lt;br /&gt;
&lt;br /&gt;
== Verify full installs of each revision work correctly ==&lt;br /&gt;
&lt;br /&gt;
* Previous state: no democompupdate component installed.&lt;br /&gt;
* Install democompupdate_111.zip.&lt;br /&gt;
** Verify that the full install created the same database and file state as the update to 1.1.1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Previous state: version 1.1.1 installed.&lt;br /&gt;
* Uninstall com_democompupdate&lt;br /&gt;
** Verify the component does not exist in Joomla extension manager or front-end.&lt;br /&gt;
** optional: phpMyAdmin: verify that democompupdate elements are gone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Previous state: no democompupdate component installed.&lt;br /&gt;
* Install democompupdate_13.zip.&lt;br /&gt;
** Verify that the full install created the same database and file state as the update to 1.3.&lt;br /&gt;
&lt;br /&gt;
== Verify that Joomla version check works ==&lt;br /&gt;
&lt;br /&gt;
* Previous state: version 1.3 installed.&lt;br /&gt;
* Uninstall com_democompupdate&lt;br /&gt;
* Install democompupdate_10j3.zip.&lt;br /&gt;
** The update should fail, give useful information in the back-end.&lt;br /&gt;
** No evidence of the installed component should exist in front-end, back-end or MySqlAdmin.&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
You can use the update features in Joomla 1.6 (and greater) to ensure that the web site administrator installs your component properly.&lt;br /&gt;
* Your component version string sequence must follow the requirements shown in the PHP &#039;&#039;version_compare&#039;&#039; function.&lt;br /&gt;
* Create update SQL files for component revisions.  The file names must match your version strings.&lt;br /&gt;
* Update the version string in the manifest file for each version.&lt;br /&gt;
* Update the version string in the script.php file for each version.  Modify the custom code in this file, if needed, for each version.&lt;br /&gt;
&lt;br /&gt;
If your component requires non-standard update handling, you can implement it in the script.php file.  You can disable the normal update SQL file execution and implement your own code.  You can implement custom checks and custom install and update actions.  You can, and should, create confirmation messages and error messages to help the web site administrator understand what your code is doing.&lt;br /&gt;
&lt;br /&gt;
I intentionally made this example simple, to make debugging easier. You can implement your custom code in this example, verify that it works correctly, then implement it in your component.  Share your successes with the Joomla community.&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Component_release_files)&amp;diff=65720</id>
		<title>Archived:Managing Component Updates (Component release files)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Component_release_files)&amp;diff=65720"/>
		<updated>2012-03-19T00:28:11Z</updated>

		<summary type="html">&lt;p&gt;Sm990: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}} {{JVer|2.5}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Component Release Files ==&lt;br /&gt;
Included in this example are zip files for four releases. You will need to download all four to exercise the features of this example.&lt;br /&gt;
&lt;br /&gt;
=== Version 1.0 ===&lt;br /&gt;
The zip file can be downloaded from &lt;br /&gt;
[http://joomlacode.org/gf/download/frsrelease/16495/72056/democompupdate_10.zip democompupdate_10.zip].&lt;br /&gt;
It contains files:&lt;br /&gt;
* democompupdate_10/democompupdate.xml&lt;br /&gt;
* democompupdate_10/script.php&lt;br /&gt;
* democompupdate_10/admin/sql/install_data.sql&lt;br /&gt;
* democompupdate_10/admin/sql/uninstall.sql&lt;br /&gt;
* democompupdate_10/admin/sql/updates/1.0.sql&lt;br /&gt;
* democompupdate_10/site/controller.php&lt;br /&gt;
* democompupdate_10/site/democompupdate.php&lt;br /&gt;
* democompupdate_10/site/models/democompupdate.php&lt;br /&gt;
* democompupdate_10/site/views/democompupdate/view.html.php&lt;br /&gt;
* democompupdate_10/site/views/democompupdate/tmpl/default.php&lt;br /&gt;
&lt;br /&gt;
=== Version 1.0.j3 ===&lt;br /&gt;
The zip file can be downloaded from &lt;br /&gt;
[http://joomlacode.org/gf/download/frsrelease/16495/72057/democompupdate_10j3.zip democompupdate_10j3.zip].  It is identical to version 1.0, except that is requires Joomla 30.0.  The intent is that this will cause an abort of the install or update.&lt;br /&gt;
Diff&#039;s of &#039;&#039;democompupdate_10&#039;&#039; and &#039;&#039;democompupdate_10j3&#039;&#039; show how files have changed.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff -r democompupdate_10/ democompupdate_10j3/&lt;br /&gt;
diff -r democompupdate_10/democompupdate.xml democompupdate_10j3/democompupdate.xml&lt;br /&gt;
2c2&lt;br /&gt;
&amp;lt; &amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; &amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;30.0&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
diff -r democompupdate_10/script.php democompupdate_10j3/script.php&lt;br /&gt;
17c17&lt;br /&gt;
&amp;lt;         private $minimum_joomla_release = &#039;1.6.0&#039;;    &lt;br /&gt;
---&lt;br /&gt;
&amp;gt;         private $minimum_joomla_release = &#039;30.0&#039;;    &lt;br /&gt;
26c26&lt;br /&gt;
&amp;lt; 		// this component does not work with Joomla releases prior to 1.6&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 		// this component does not work with Joomla releases prior to 30.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Version 1.1.1 ===&lt;br /&gt;
&lt;br /&gt;
The zip file can be downloaded from &lt;br /&gt;
[http://joomlacode.org/gf/download/frsrelease/16495/72058/democompupdate_111.zip democompupdate_111.zip].&lt;br /&gt;
Diff&#039;s of &#039;&#039;democompupdate_10&#039;&#039; and &#039;&#039;democompupdate_111&#039;&#039; show how files have changed.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff -r democompupdate_10/ democompupdate_111/&lt;br /&gt;
diff -r democompupdate_10/admin/sql/install_data.sql democompupdate_111/admin/sql/install_data.sql&lt;br /&gt;
10c10&lt;br /&gt;
&amp;lt; (1,&#039;1.0&#039;);&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; (1,&#039;1.1.1&#039;);&lt;br /&gt;
Only in democompupdate_111/admin/sql/updates: 1.1.1.sql&lt;br /&gt;
Only in democompupdate_111/admin/sql/updates: 1.1.sql&lt;br /&gt;
diff -r democompupdate_10/democompupdate.xml democompupdate_111/democompupdate.xml&lt;br /&gt;
2c2&lt;br /&gt;
&amp;lt; &amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; &amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
8c8&lt;br /&gt;
&amp;lt; 	&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 	&amp;lt;version&amp;gt;1.1.1&amp;lt;/version&amp;gt;&lt;br /&gt;
diff -r democompupdate_10/script.php democompupdate_111/script.php&lt;br /&gt;
12c12&lt;br /&gt;
&amp;lt; 	private $release = &#039;1.0&#039;;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 	private $release = &#039;1.1.1&#039;;&lt;br /&gt;
diff -r democompupdate_10/site/views/democompupdate/view.html.php democompupdate_111/site/views/democompupdate/view.html.php&lt;br /&gt;
25c25&lt;br /&gt;
&amp;lt; 		$myRev = &#039;1.0&#039;;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 		$myRev = &#039;1.1.1&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Version 1.3 ===&lt;br /&gt;
The zip file can be downloaded from &lt;br /&gt;
[http://joomlacode.org/gf/download/frsrelease/16495/72059/democompupdate_13.zip democompupdate_13.zip].&lt;br /&gt;
Diff&#039;s of &#039;&#039;democompupdate_111&#039;&#039; and &#039;&#039;democompupdate_13&#039;&#039; show how files have changed.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff -r democompupdate_111/ democompupdate_13/&lt;br /&gt;
diff -r democompupdate_111/admin/sql/install_data.sql democompupdate_13/admin/sql/install_data.sql&lt;br /&gt;
10c10,12&lt;br /&gt;
&amp;lt; (1,&#039;1.1.1&#039;);&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; (1,&#039;1.1.1&#039;),&lt;br /&gt;
&amp;gt; (2,&#039;1.2.1&#039;),&lt;br /&gt;
&amp;gt; (3,&#039;1.3&#039;);&lt;br /&gt;
Only in democompupdate_13/admin/sql/updates: 1.2.1.sql&lt;br /&gt;
Only in democompupdate_13/admin/sql/updates: 1.2.sql&lt;br /&gt;
Only in democompupdate_13/admin/sql/updates: 1.3.sql&lt;br /&gt;
diff -r democompupdate_111/democompupdate.xml democompupdate_13/democompupdate.xml&lt;br /&gt;
8c8&lt;br /&gt;
&amp;lt; 	&amp;lt;version&amp;gt;1.1.1&amp;lt;/version&amp;gt;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 	&amp;lt;version&amp;gt;1.3&amp;lt;/version&amp;gt;&lt;br /&gt;
diff -r democompupdate_111/script.php democompupdate_13/script.php&lt;br /&gt;
12c12&lt;br /&gt;
&amp;lt; 	private $release = &#039;1.1.1&#039;;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 	private $release = &#039;1.3&#039;;&lt;br /&gt;
diff -r democompupdate_111/site/views/democompupdate/view.html.php democompupdate_13/site/views/democompupdate/view.html.php&lt;br /&gt;
25c25&lt;br /&gt;
&amp;lt; 		$myRev = &#039;1.1.1&#039;;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 		$myRev = &#039;1.3&#039;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Update_SQL_files)&amp;diff=65719</id>
		<title>Archived:Managing Component Updates (Update SQL files)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Update_SQL_files)&amp;diff=65719"/>
		<updated>2012-03-19T00:27:55Z</updated>

		<summary type="html">&lt;p&gt;Sm990: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}} {{JVer|2.5}}&lt;br /&gt;
&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Update SQL files ==&lt;br /&gt;
The update SQL file(s) are located in a directory that is listed in the manifest file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;update&amp;gt; &lt;br /&gt;
	&amp;lt;schemas&amp;gt; &lt;br /&gt;
		&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt; &lt;br /&gt;
	&amp;lt;/schemas&amp;gt; &lt;br /&gt;
&amp;lt;/update&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a file for each component version.  Each file name must match the version string in the manifest file for that version.  Joomla uses this string to determine which SQL files(s) to execute, and in what order they will be executed.  Joomla uses the PHP &#039;&#039;version_compare&#039;&#039; function for this.  Familiarize yourself with this function.  Your version strings need to adhere to the conventions of this function.&lt;br /&gt;
For example, the SQL files for version 1.3 of this example include:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
1.0.sql&lt;br /&gt;
  (empty)&lt;br /&gt;
&lt;br /&gt;
1.1.sql&lt;br /&gt;
  UPDATE `#__democompupdate_mytable` SET myvalue=&#039;Version 1.1 text&#039; WHERE id=1;&lt;br /&gt;
&lt;br /&gt;
1.1.1.sql&lt;br /&gt;
  UPDATE `#__democompupdate_mytable` SET myvalue=&#039;Version 1.1.1 text&#039; WHERE id=1;&lt;br /&gt;
&lt;br /&gt;
1.2.sql&lt;br /&gt;
  INSERT INTO `#__democompupdate_mytable` (id,myvalue) VALUES (2,&#039;Version 1.2 text&#039;);&lt;br /&gt;
&lt;br /&gt;
1.2.1.sql&lt;br /&gt;
  UPDATE `#__democompupdate_mytable` SET myvalue=&#039;Version 1.2.1 text&#039; WHERE id=2;&lt;br /&gt;
&lt;br /&gt;
1.3.sql&lt;br /&gt;
  INSERT INTO `#__democompupdate_mytable` (id,myvalue) VALUES (3,&#039;Version 1.3 text&#039;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example has complete install files for component versions 1.0 (initial), 1.1.1 and 1.3.  Update SQL files are included for additional incremental component versions (1.1, 1.2 and 1.2.1) between these three versions.  These extra versions illustrate the process for updates that span more than one incremental version.&lt;br /&gt;
&lt;br /&gt;
* When updating from version 1.0 to version 1.1.1, both files 1.1.sql and 1.1.1.sql are executed.  The SQL commands update the value of the first, and only, row in the database table.  The command in 1.1.1.sql over-writes the value that was written by 1.1.sql.&lt;br /&gt;
* When updating from version 1.1.1 to version 1.3, files 1.2.sql, 1.2.1.sql and 1.3.sql are executed.  The commands in 1.2.sql and 1.3.sql each create a new row in the database table.&lt;br /&gt;
* When updating from version 1.0 directly to 1.3, files 1.1.sql, 1.1.1.sql, 1.2.sql, 1.2.1.sql and 1.3.sql are all executed.  You can see the cumulative effect of the table changes in the component front-end.&lt;br /&gt;
&lt;br /&gt;
Joomla executes the database updates in the sequence that would occur, as if the user had updated each version separately.  This would be necessary if an incremental database update depended on the correct update from the previous version.  An example would be: if a modification of a table value during one update depended on the addition of a new table field during a previous update.&lt;br /&gt;
&lt;br /&gt;
Joomla uses the PHP function &#039;&#039;version_compare&#039;&#039; to define the execution order of the SQL files.  The sequencing of your component version string must adhere to that defined by the &#039;&#039;version_compare&#039;&#039; function.&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=65718</id>
		<title>Archived:Managing Component Updates (Manifest file)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=65718"/>
		<updated>2012-03-19T00:26:54Z</updated>

		<summary type="html">&lt;p&gt;Sm990: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}} {{JVer|2.5}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Manifest File (democompupdate.xml) ==&lt;br /&gt;
The manifest file in this example is very similar to that of normal components.  Important contents for this example include:&lt;br /&gt;
&lt;br /&gt;
=== sql folder ===&lt;br /&gt;
Note the inclusion of the SQL folder in the administration files section.  This tells Joomla to copy the contents of this folder to the web site during install or update.  The &#039;&#039;schemapath&#039;&#039; declaration below depends on Joomla copying these files during the install or update process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;administration&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt; &lt;br /&gt;
		&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt; &lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== name ===&lt;br /&gt;
This is the name of the component.  The &#039;getParam($key)&#039; method in the &#039;&#039;script.php&#039;&#039; file uses this value to identify the correct row in the extensions table.  The &#039;&#039;manifest_cache&#039;&#039; field in the &#039;&#039;extensions&#039;&#039; table has the version string for the currently installed component.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== version ===&lt;br /&gt;
Joomla stores this value in the &#039;&#039;manifest_cache&#039;&#039; field of the &#039;&#039;extensions&#039;&#039; table.  The &#039;&#039;extensions&#039;&#039; table is where the custom code in the &#039;&#039;script.php&#039;&#039; file reads the version string of the currently installed component, and compares it to the version string of the update.&lt;br /&gt;
&lt;br /&gt;
The custom component code uses this comparison to abort an update, if the version sequence is not allowed.  Joomla also compares this string to the SQL update file names, to determine which SQL commands to execute.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== schemapath ===&lt;br /&gt;
This defines the directory that contains SQL files for component incremental database updates.&lt;br /&gt;
You may choose to put the SQL files somewhere else in your component release, but make sure their location is documented here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;update&amp;gt; &lt;br /&gt;
	&amp;lt;schemas&amp;gt; &lt;br /&gt;
		&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt; &lt;br /&gt;
	&amp;lt;/schemas&amp;gt; &lt;br /&gt;
&amp;lt;/update&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== #__schemas table ===&lt;br /&gt;
The SQL files have a second function.&lt;br /&gt;
In addition to potentially modifying the MySQL database, Joomla uses the names of these SQL files to enable updates to the &#039;&#039;version_id&#039;&#039; field in the &#039;&#039;#__schemas&#039;&#039; table for your component.&lt;br /&gt;
It is important to have an SQL file for EVERY version of your component.&lt;br /&gt;
The file should be empty if you have no SQL code to execute when updating to that version.&lt;br /&gt;
You must have a file or the &#039;&#039;version_id&#039;&#039; will not get updated correctly.&lt;br /&gt;
Joomla uses the &#039;&#039;version_id&#039;&#039; in the &#039;&#039;#__schemas&#039;&#039; table as the &#039;&#039;from&#039;&#039; version when calculating updates &#039;&#039;from&#039;&#039; an older version &#039;&#039;to&#039;&#039; a new version.&lt;br /&gt;
&lt;br /&gt;
It is important to include these &#039;&#039;schemapath&#039;&#039; lines in your manifest file, even if you have no SQL commands to execute.&lt;br /&gt;
By including these lines and including empty SQL files, the &#039;&#039;version_id&#039;&#039; value will be correctly maintained in the &#039;&#039;#__schemas&#039;&#039; table.&lt;br /&gt;
&lt;br /&gt;
If your new component version is not executing the SQL file as expected, check the &#039;&#039;#__schemas&#039;&#039; table to see if the previous version was correctly recorded.&lt;br /&gt;
If it is not, then your update will not execute the SQL file when updating from that version.&lt;br /&gt;
&lt;br /&gt;
== The entire manifest file ==&lt;br /&gt;
Here is the entire manifest file for version 1.0.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;2011 05 11&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;Your Name Here&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Free to copy&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;none&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Test the Install and Update Process&amp;lt;/description&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Runs on install/uninstall/update; New in 1.6 --&amp;gt;&lt;br /&gt;
	&amp;lt;scriptfile&amp;gt;script.php&amp;lt;/scriptfile&amp;gt;&lt;br /&gt;
	&amp;lt;install&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install_data.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;democompupdate.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=65407</id>
		<title>Archived:Managing Component Updates (Manifest file)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=65407"/>
		<updated>2012-03-04T21:28:07Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* #__schemas table */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Manifest File (democompupdate.xml) ==&lt;br /&gt;
The manifest file in this example is very similar to that of normal components.  Important contents for this example include:&lt;br /&gt;
&lt;br /&gt;
=== sql folder ===&lt;br /&gt;
Note the inclusion of the SQL folder in the administration files section.  This tells Joomla to copy the contents of this folder to the web site during install or update.  The &#039;&#039;schemapath&#039;&#039; declaration below depends on Joomla copying these files during the install or update process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;administration&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt; &lt;br /&gt;
		&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt; &lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== name ===&lt;br /&gt;
This is the name of the component.  The &#039;getParam($key)&#039; method in the &#039;&#039;script.php&#039;&#039; file uses this value to identify the correct row in the extensions table.  The &#039;&#039;manifest_cache&#039;&#039; field in the &#039;&#039;extensions&#039;&#039; table has the version string for the currently installed component.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== version ===&lt;br /&gt;
Joomla stores this value in the &#039;&#039;manifest_cache&#039;&#039; field of the &#039;&#039;extensions&#039;&#039; table.  The &#039;&#039;extensions&#039;&#039; table is where the custom code in the &#039;&#039;script.php&#039;&#039; file reads the version string of the currently installed component, and compares it to the version string of the update.&lt;br /&gt;
&lt;br /&gt;
The custom component code uses this comparison to abort an update, if the version sequence is not allowed.  Joomla also compares this string to the SQL update file names, to determine which SQL commands to execute.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== schemapath ===&lt;br /&gt;
This defines the directory that contains SQL files for component incremental database updates.&lt;br /&gt;
You may choose to put the SQL files somewhere else in your component release, but make sure their location is documented here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;update&amp;gt; &lt;br /&gt;
	&amp;lt;schemas&amp;gt; &lt;br /&gt;
		&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt; &lt;br /&gt;
	&amp;lt;/schemas&amp;gt; &lt;br /&gt;
&amp;lt;/update&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== #__schemas table ===&lt;br /&gt;
The SQL files have a second function.&lt;br /&gt;
In addition to potentially modifying the MySQL database, Joomla uses the names of these SQL files to enable updates to the &#039;&#039;version_id&#039;&#039; field in the &#039;&#039;#__schemas&#039;&#039; table for your component.&lt;br /&gt;
It is important to have an SQL file for EVERY version of your component.&lt;br /&gt;
The file should be empty if you have no SQL code to execute when updating to that version.&lt;br /&gt;
You must have a file or the &#039;&#039;version_id&#039;&#039; will not get updated correctly.&lt;br /&gt;
Joomla uses the &#039;&#039;version_id&#039;&#039; in the &#039;&#039;#__schemas&#039;&#039; table as the &#039;&#039;from&#039;&#039; version when calculating updates &#039;&#039;from&#039;&#039; an older version &#039;&#039;to&#039;&#039; a new version.&lt;br /&gt;
&lt;br /&gt;
It is important to include these &#039;&#039;schemapath&#039;&#039; lines in your manifest file, even if you have no SQL commands to execute.&lt;br /&gt;
By including these lines and including empty SQL files, the &#039;&#039;version_id&#039;&#039; value will be correctly maintained in the &#039;&#039;#__schemas&#039;&#039; table.&lt;br /&gt;
&lt;br /&gt;
If your new component version is not executing the SQL file as expected, check the &#039;&#039;#__schemas&#039;&#039; table to see if the previous version was correctly recorded.&lt;br /&gt;
If it is not, then your update will not execute the SQL file when updating from that version.&lt;br /&gt;
&lt;br /&gt;
== The entire manifest file ==&lt;br /&gt;
Here is the entire manifest file for version 1.0.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;2011 05 11&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;Your Name Here&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Free to copy&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;none&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Test the Install and Update Process&amp;lt;/description&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Runs on install/uninstall/update; New in 1.6 --&amp;gt;&lt;br /&gt;
	&amp;lt;scriptfile&amp;gt;script.php&amp;lt;/scriptfile&amp;gt;&lt;br /&gt;
	&amp;lt;install&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install_data.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;democompupdate.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=65406</id>
		<title>Archived:Managing Component Updates (Manifest file)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=65406"/>
		<updated>2012-03-04T21:09:50Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* #__schemas table */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Manifest File (democompupdate.xml) ==&lt;br /&gt;
The manifest file in this example is very similar to that of normal components.  Important contents for this example include:&lt;br /&gt;
&lt;br /&gt;
=== sql folder ===&lt;br /&gt;
Note the inclusion of the SQL folder in the administration files section.  This tells Joomla to copy the contents of this folder to the web site during install or update.  The &#039;&#039;schemapath&#039;&#039; declaration below depends on Joomla copying these files during the install or update process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;administration&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt; &lt;br /&gt;
		&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt; &lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== name ===&lt;br /&gt;
This is the name of the component.  The &#039;getParam($key)&#039; method in the &#039;&#039;script.php&#039;&#039; file uses this value to identify the correct row in the extensions table.  The &#039;&#039;manifest_cache&#039;&#039; field in the &#039;&#039;extensions&#039;&#039; table has the version string for the currently installed component.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== version ===&lt;br /&gt;
Joomla stores this value in the &#039;&#039;manifest_cache&#039;&#039; field of the &#039;&#039;extensions&#039;&#039; table.  The &#039;&#039;extensions&#039;&#039; table is where the custom code in the &#039;&#039;script.php&#039;&#039; file reads the version string of the currently installed component, and compares it to the version string of the update.&lt;br /&gt;
&lt;br /&gt;
The custom component code uses this comparison to abort an update, if the version sequence is not allowed.  Joomla also compares this string to the SQL update file names, to determine which SQL commands to execute.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== schemapath ===&lt;br /&gt;
This defines the directory that contains SQL files for component incremental database updates.&lt;br /&gt;
You may choose to put the SQL files somewhere else in your component release, but make sure their location is documented here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;update&amp;gt; &lt;br /&gt;
	&amp;lt;schemas&amp;gt; &lt;br /&gt;
		&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt; &lt;br /&gt;
	&amp;lt;/schemas&amp;gt; &lt;br /&gt;
&amp;lt;/update&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== #__schemas table ===&lt;br /&gt;
The SQL files have a second function.&lt;br /&gt;
In addition to potentially modifying the MySQL database, Joomla uses the names of these SQL files to enable updates to the &#039;&#039;version_id&#039;&#039; field in the &#039;&#039;#__schemas&#039;&#039; table for your component.&lt;br /&gt;
It is important to have an SQL file for EVERY version of your component.&lt;br /&gt;
The file should be empty if you have no SQL code to execute when updating to that version.&lt;br /&gt;
You must have a file or the &#039;&#039;version_id&#039;&#039; will not get updated correctly.&lt;br /&gt;
Joomla uses the &#039;&#039;version_id&#039;&#039; in the &#039;&#039;#__schemas&#039;&#039; table as the &#039;&#039;from&#039;&#039; version when calculating updates &#039;&#039;from&#039;&#039; an older version &#039;&#039;to&#039;&#039; a new version.&lt;br /&gt;
&lt;br /&gt;
It is important to include these &#039;&#039;schemapath&#039;&#039; lines in your manifest file, even if you have no SQL commands to execute.&lt;br /&gt;
By including these lines and including empty SQL files, the &#039;&#039;version_id&#039;&#039; value will be correctly maintained in the &#039;&#039;#__schemas&#039;&#039; table.&lt;br /&gt;
&lt;br /&gt;
If your new component version is not executing the SQL file as expected, check the &#039;&#039;#__schemas&#039;&#039; table to see if the previous version was correctly recorded.&lt;br /&gt;
If it is not, then your update will not execute the SQL file.&lt;br /&gt;
&lt;br /&gt;
== The entire manifest file ==&lt;br /&gt;
Here is the entire manifest file for version 1.0.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;2011 05 11&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;Your Name Here&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Free to copy&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;none&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Test the Install and Update Process&amp;lt;/description&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Runs on install/uninstall/update; New in 1.6 --&amp;gt;&lt;br /&gt;
	&amp;lt;scriptfile&amp;gt;script.php&amp;lt;/scriptfile&amp;gt;&lt;br /&gt;
	&amp;lt;install&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install_data.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;democompupdate.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=65405</id>
		<title>Archived:Managing Component Updates (Manifest file)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=65405"/>
		<updated>2012-03-04T21:09:29Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* #__schemas table */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Manifest File (democompupdate.xml) ==&lt;br /&gt;
The manifest file in this example is very similar to that of normal components.  Important contents for this example include:&lt;br /&gt;
&lt;br /&gt;
=== sql folder ===&lt;br /&gt;
Note the inclusion of the SQL folder in the administration files section.  This tells Joomla to copy the contents of this folder to the web site during install or update.  The &#039;&#039;schemapath&#039;&#039; declaration below depends on Joomla copying these files during the install or update process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;administration&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt; &lt;br /&gt;
		&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt; &lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== name ===&lt;br /&gt;
This is the name of the component.  The &#039;getParam($key)&#039; method in the &#039;&#039;script.php&#039;&#039; file uses this value to identify the correct row in the extensions table.  The &#039;&#039;manifest_cache&#039;&#039; field in the &#039;&#039;extensions&#039;&#039; table has the version string for the currently installed component.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== version ===&lt;br /&gt;
Joomla stores this value in the &#039;&#039;manifest_cache&#039;&#039; field of the &#039;&#039;extensions&#039;&#039; table.  The &#039;&#039;extensions&#039;&#039; table is where the custom code in the &#039;&#039;script.php&#039;&#039; file reads the version string of the currently installed component, and compares it to the version string of the update.&lt;br /&gt;
&lt;br /&gt;
The custom component code uses this comparison to abort an update, if the version sequence is not allowed.  Joomla also compares this string to the SQL update file names, to determine which SQL commands to execute.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== schemapath ===&lt;br /&gt;
This defines the directory that contains SQL files for component incremental database updates.&lt;br /&gt;
You may choose to put the SQL files somewhere else in your component release, but make sure their location is documented here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;update&amp;gt; &lt;br /&gt;
	&amp;lt;schemas&amp;gt; &lt;br /&gt;
		&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt; &lt;br /&gt;
	&amp;lt;/schemas&amp;gt; &lt;br /&gt;
&amp;lt;/update&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== #__schemas table ===&lt;br /&gt;
The SQL files have a second function.&lt;br /&gt;
In addition to potentially modifying the MySQL database, Joomla uses the names of these SQL files to key updates to the &#039;&#039;version_id&#039;&#039; field in the &#039;&#039;#__schemas&#039;&#039; table for your component.&lt;br /&gt;
It is important to have an SQL file for EVERY version of your component.&lt;br /&gt;
The file should be empty if you have no SQL code to execute when updating to that version.&lt;br /&gt;
You must have a file or the &#039;&#039;version_id&#039;&#039; will not get updated correctly.&lt;br /&gt;
Joomla uses the &#039;&#039;version_id&#039;&#039; in the &#039;&#039;#__schemas&#039;&#039; table as the &#039;&#039;from&#039;&#039; version when calculating updates &#039;&#039;from&#039;&#039; an older version &#039;&#039;to&#039;&#039; a new version.&lt;br /&gt;
&lt;br /&gt;
It is important to include these &#039;&#039;schemapath&#039;&#039; lines in your manifest file, even if you have no SQL commands to execute.&lt;br /&gt;
By including these lines and including empty SQL files, the &#039;&#039;version_id&#039;&#039; value will be correctly maintained in the &#039;&#039;#__schemas&#039;&#039; table.&lt;br /&gt;
&lt;br /&gt;
If your new component version is not executing the SQL file as expected, check the &#039;&#039;#__schemas&#039;&#039; table to see if the previous version was correctly recorded.&lt;br /&gt;
If it is not, then your update will not execute the SQL file.&lt;br /&gt;
&lt;br /&gt;
== The entire manifest file ==&lt;br /&gt;
Here is the entire manifest file for version 1.0.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;2011 05 11&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;Your Name Here&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Free to copy&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;none&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Test the Install and Update Process&amp;lt;/description&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Runs on install/uninstall/update; New in 1.6 --&amp;gt;&lt;br /&gt;
	&amp;lt;scriptfile&amp;gt;script.php&amp;lt;/scriptfile&amp;gt;&lt;br /&gt;
	&amp;lt;install&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install_data.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;democompupdate.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=65404</id>
		<title>Archived:Managing Component Updates (Manifest file)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=65404"/>
		<updated>2012-03-04T21:07:12Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* #__schemas table */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Manifest File (democompupdate.xml) ==&lt;br /&gt;
The manifest file in this example is very similar to that of normal components.  Important contents for this example include:&lt;br /&gt;
&lt;br /&gt;
=== sql folder ===&lt;br /&gt;
Note the inclusion of the SQL folder in the administration files section.  This tells Joomla to copy the contents of this folder to the web site during install or update.  The &#039;&#039;schemapath&#039;&#039; declaration below depends on Joomla copying these files during the install or update process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;administration&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt; &lt;br /&gt;
		&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt; &lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== name ===&lt;br /&gt;
This is the name of the component.  The &#039;getParam($key)&#039; method in the &#039;&#039;script.php&#039;&#039; file uses this value to identify the correct row in the extensions table.  The &#039;&#039;manifest_cache&#039;&#039; field in the &#039;&#039;extensions&#039;&#039; table has the version string for the currently installed component.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== version ===&lt;br /&gt;
Joomla stores this value in the &#039;&#039;manifest_cache&#039;&#039; field of the &#039;&#039;extensions&#039;&#039; table.  The &#039;&#039;extensions&#039;&#039; table is where the custom code in the &#039;&#039;script.php&#039;&#039; file reads the version string of the currently installed component, and compares it to the version string of the update.&lt;br /&gt;
&lt;br /&gt;
The custom component code uses this comparison to abort an update, if the version sequence is not allowed.  Joomla also compares this string to the SQL update file names, to determine which SQL commands to execute.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== schemapath ===&lt;br /&gt;
This defines the directory that contains SQL files for component incremental database updates.&lt;br /&gt;
You may choose to put the SQL files somewhere else in your component release, but make sure their location is documented here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;update&amp;gt; &lt;br /&gt;
	&amp;lt;schemas&amp;gt; &lt;br /&gt;
		&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt; &lt;br /&gt;
	&amp;lt;/schemas&amp;gt; &lt;br /&gt;
&amp;lt;/update&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== #__schemas table ===&lt;br /&gt;
The SQL files have a second function.&lt;br /&gt;
In addition to potentially modifying the MySQL database, Joomla uses the names of these SQL files to update the &#039;&#039;version_id&#039;&#039; field in the &#039;&#039;#__schemas&#039;&#039; table for your component.&lt;br /&gt;
It is important to have an SQL file for EVERY version of your component.&lt;br /&gt;
The file should be empty if you have no SQL code to execute when updating to that version.&lt;br /&gt;
You must have a file or the &#039;&#039;version_id&#039;&#039; will not get updated correctly.&lt;br /&gt;
Joomla uses the &#039;&#039;version_id&#039;&#039; in the &#039;&#039;#__schemas&#039;&#039; table as the &#039;&#039;from&#039;&#039; version when calculating updates &#039;&#039;from&#039;&#039; an older version &#039;&#039;to&#039;&#039; a new version.&lt;br /&gt;
&lt;br /&gt;
It is important to include these &#039;&#039;schemapath&#039;&#039; lines in your manifest file, even if you have no SQL commands to execute.&lt;br /&gt;
By including these lines and including empty SQL files, the &#039;&#039;version_id&#039;&#039; value will be correctly maintained in the &#039;&#039;#__schemas&#039;&#039; table.&lt;br /&gt;
&lt;br /&gt;
If your new component version is not executing the SQL file as expected, check the &#039;&#039;#__schemas&#039;&#039; table to see if the previous version was correctly recorded.&lt;br /&gt;
If it is not, then your update will not execute the SQL file.&lt;br /&gt;
&lt;br /&gt;
== The entire manifest file ==&lt;br /&gt;
Here is the entire manifest file for version 1.0.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;2011 05 11&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;Your Name Here&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Free to copy&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;none&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Test the Install and Update Process&amp;lt;/description&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Runs on install/uninstall/update; New in 1.6 --&amp;gt;&lt;br /&gt;
	&amp;lt;scriptfile&amp;gt;script.php&amp;lt;/scriptfile&amp;gt;&lt;br /&gt;
	&amp;lt;install&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install_data.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;democompupdate.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=65403</id>
		<title>Archived:Managing Component Updates (Manifest file)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=65403"/>
		<updated>2012-03-04T20:59:49Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* #__schemas table */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Manifest File (democompupdate.xml) ==&lt;br /&gt;
The manifest file in this example is very similar to that of normal components.  Important contents for this example include:&lt;br /&gt;
&lt;br /&gt;
=== sql folder ===&lt;br /&gt;
Note the inclusion of the SQL folder in the administration files section.  This tells Joomla to copy the contents of this folder to the web site during install or update.  The &#039;&#039;schemapath&#039;&#039; declaration below depends on Joomla copying these files during the install or update process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;administration&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt; &lt;br /&gt;
		&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt; &lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== name ===&lt;br /&gt;
This is the name of the component.  The &#039;getParam($key)&#039; method in the &#039;&#039;script.php&#039;&#039; file uses this value to identify the correct row in the extensions table.  The &#039;&#039;manifest_cache&#039;&#039; field in the &#039;&#039;extensions&#039;&#039; table has the version string for the currently installed component.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== version ===&lt;br /&gt;
Joomla stores this value in the &#039;&#039;manifest_cache&#039;&#039; field of the &#039;&#039;extensions&#039;&#039; table.  The &#039;&#039;extensions&#039;&#039; table is where the custom code in the &#039;&#039;script.php&#039;&#039; file reads the version string of the currently installed component, and compares it to the version string of the update.&lt;br /&gt;
&lt;br /&gt;
The custom component code uses this comparison to abort an update, if the version sequence is not allowed.  Joomla also compares this string to the SQL update file names, to determine which SQL commands to execute.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== schemapath ===&lt;br /&gt;
This defines the directory that contains SQL files for component incremental database updates.&lt;br /&gt;
You may choose to put the SQL files somewhere else in your component release, but make sure their location is documented here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;update&amp;gt; &lt;br /&gt;
	&amp;lt;schemas&amp;gt; &lt;br /&gt;
		&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt; &lt;br /&gt;
	&amp;lt;/schemas&amp;gt; &lt;br /&gt;
&amp;lt;/update&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== #__schemas table ===&lt;br /&gt;
The SQL files have a second function.&lt;br /&gt;
In addition to potentially modifying the MySQL database, Joomla uses the names of these SQL files to update the &#039;&#039;version_id&#039;&#039; field in the &#039;&#039;#__schemas&#039;&#039; table for your component.&lt;br /&gt;
It is important to have an SQL file for EVERY version of your component.&lt;br /&gt;
The file should be empty if you have no SQL code to execute when updating to that version.&lt;br /&gt;
You must have a file or the &#039;&#039;version_id&#039;&#039; will not get updated correctly.&lt;br /&gt;
Joomla uses the &#039;&#039;version_id&#039;&#039; in the &#039;&#039;#__schemas&#039;&#039; table as the &#039;&#039;from&#039;&#039; version when calculating updates &#039;&#039;from&#039;&#039; an older version &#039;&#039;to&#039;&#039; a new version.&lt;br /&gt;
&lt;br /&gt;
It is important to include these &#039;&#039;schemapath&#039;&#039; lines in your manifest file, even if you have no SQL commands to execute.&lt;br /&gt;
By including these lines and including empty SQL files, the &#039;&#039;version_id&#039;&#039; value will be correctly maintained in the &#039;&#039;#__schemas&#039;&#039; table.&lt;br /&gt;
&lt;br /&gt;
== The entire manifest file ==&lt;br /&gt;
Here is the entire manifest file for version 1.0.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;2011 05 11&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;Your Name Here&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Free to copy&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;none&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Test the Install and Update Process&amp;lt;/description&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Runs on install/uninstall/update; New in 1.6 --&amp;gt;&lt;br /&gt;
	&amp;lt;scriptfile&amp;gt;script.php&amp;lt;/scriptfile&amp;gt;&lt;br /&gt;
	&amp;lt;install&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install_data.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;democompupdate.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=65402</id>
		<title>Archived:Managing Component Updates (Manifest file)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=65402"/>
		<updated>2012-03-04T20:58:54Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* #__schemas table */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Manifest File (democompupdate.xml) ==&lt;br /&gt;
The manifest file in this example is very similar to that of normal components.  Important contents for this example include:&lt;br /&gt;
&lt;br /&gt;
=== sql folder ===&lt;br /&gt;
Note the inclusion of the SQL folder in the administration files section.  This tells Joomla to copy the contents of this folder to the web site during install or update.  The &#039;&#039;schemapath&#039;&#039; declaration below depends on Joomla copying these files during the install or update process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;administration&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt; &lt;br /&gt;
		&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt; &lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== name ===&lt;br /&gt;
This is the name of the component.  The &#039;getParam($key)&#039; method in the &#039;&#039;script.php&#039;&#039; file uses this value to identify the correct row in the extensions table.  The &#039;&#039;manifest_cache&#039;&#039; field in the &#039;&#039;extensions&#039;&#039; table has the version string for the currently installed component.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== version ===&lt;br /&gt;
Joomla stores this value in the &#039;&#039;manifest_cache&#039;&#039; field of the &#039;&#039;extensions&#039;&#039; table.  The &#039;&#039;extensions&#039;&#039; table is where the custom code in the &#039;&#039;script.php&#039;&#039; file reads the version string of the currently installed component, and compares it to the version string of the update.&lt;br /&gt;
&lt;br /&gt;
The custom component code uses this comparison to abort an update, if the version sequence is not allowed.  Joomla also compares this string to the SQL update file names, to determine which SQL commands to execute.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== schemapath ===&lt;br /&gt;
This defines the directory that contains SQL files for component incremental database updates.&lt;br /&gt;
You may choose to put the SQL files somewhere else in your component release, but make sure their location is documented here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;update&amp;gt; &lt;br /&gt;
	&amp;lt;schemas&amp;gt; &lt;br /&gt;
		&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt; &lt;br /&gt;
	&amp;lt;/schemas&amp;gt; &lt;br /&gt;
&amp;lt;/update&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== #__schemas table ===&lt;br /&gt;
The SQL files have a second function.&lt;br /&gt;
In addition to potentially modifying the MySQL database, Joomla uses the names of these SQL files to update the &#039;&#039;version_id&#039;&#039; in the &#039;&#039;#__schemas&#039;&#039; table for your component.&lt;br /&gt;
It is important to have an SQL file for EVERY version of your component.&lt;br /&gt;
The file should be empty if you have no SQL code to execute when updating to that version.&lt;br /&gt;
You must have a file or the &#039;&#039;version_id&#039;&#039; will not get updated correctly.&lt;br /&gt;
Joomla uses the &#039;&#039;version_id&#039;&#039; in the &#039;&#039;#__schemas&#039;&#039; table as the &#039;&#039;from&#039;&#039; version when calculating updates &#039;&#039;from&#039;&#039; an older version &#039;&#039;to&#039;&#039; a new version.&lt;br /&gt;
&lt;br /&gt;
It is important to include these &#039;&#039;schemapath&#039;&#039; lines in your manifest file, even if you have no SQL commands to execute.&lt;br /&gt;
By including these lines and including empty SQL files, the &#039;&#039;version_id&#039;&#039; value will be correctly maintained in the &#039;&#039;#__schemas&#039;&#039; table.&lt;br /&gt;
&lt;br /&gt;
== The entire manifest file ==&lt;br /&gt;
Here is the entire manifest file for version 1.0.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;2011 05 11&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;Your Name Here&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Free to copy&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;none&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Test the Install and Update Process&amp;lt;/description&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Runs on install/uninstall/update; New in 1.6 --&amp;gt;&lt;br /&gt;
	&amp;lt;scriptfile&amp;gt;script.php&amp;lt;/scriptfile&amp;gt;&lt;br /&gt;
	&amp;lt;install&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install_data.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;democompupdate.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=65401</id>
		<title>Archived:Managing Component Updates (Manifest file)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=65401"/>
		<updated>2012-03-04T20:57:18Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* #__schemas table */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Manifest File (democompupdate.xml) ==&lt;br /&gt;
The manifest file in this example is very similar to that of normal components.  Important contents for this example include:&lt;br /&gt;
&lt;br /&gt;
=== sql folder ===&lt;br /&gt;
Note the inclusion of the SQL folder in the administration files section.  This tells Joomla to copy the contents of this folder to the web site during install or update.  The &#039;&#039;schemapath&#039;&#039; declaration below depends on Joomla copying these files during the install or update process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;administration&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt; &lt;br /&gt;
		&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt; &lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== name ===&lt;br /&gt;
This is the name of the component.  The &#039;getParam($key)&#039; method in the &#039;&#039;script.php&#039;&#039; file uses this value to identify the correct row in the extensions table.  The &#039;&#039;manifest_cache&#039;&#039; field in the &#039;&#039;extensions&#039;&#039; table has the version string for the currently installed component.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== version ===&lt;br /&gt;
Joomla stores this value in the &#039;&#039;manifest_cache&#039;&#039; field of the &#039;&#039;extensions&#039;&#039; table.  The &#039;&#039;extensions&#039;&#039; table is where the custom code in the &#039;&#039;script.php&#039;&#039; file reads the version string of the currently installed component, and compares it to the version string of the update.&lt;br /&gt;
&lt;br /&gt;
The custom component code uses this comparison to abort an update, if the version sequence is not allowed.  Joomla also compares this string to the SQL update file names, to determine which SQL commands to execute.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== schemapath ===&lt;br /&gt;
This defines the directory that contains SQL files for component incremental database updates.&lt;br /&gt;
You may choose to put the SQL files somewhere else in your component release, but make sure their location is documented here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;update&amp;gt; &lt;br /&gt;
	&amp;lt;schemas&amp;gt; &lt;br /&gt;
		&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt; &lt;br /&gt;
	&amp;lt;/schemas&amp;gt; &lt;br /&gt;
&amp;lt;/update&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== #__schemas table ===&lt;br /&gt;
The SQL files have a second function.&lt;br /&gt;
In addition to potentially modifying the MySQL database, Joomla uses the names of these SQL files to update the &#039;&#039;version_id&#039;&#039; in the &#039;&#039;#__schemas&#039;&#039; table for your component.&lt;br /&gt;
It is important to have an SQL file for EVERY version of your component.  The file should be empty if you have no SQL code to execute when updating to that version.  You must have a file or the &#039;&#039;version_id&#039;&#039; will not get updated correctly.  The &#039;&#039;version_id&#039;&#039; in the #__schemas table is used as the &#039;&#039;from&#039;&#039; version when calculating updates &#039;&#039;from&#039;&#039; an older version &#039;&#039;to&#039;&#039; a new version.&lt;br /&gt;
&lt;br /&gt;
It is important to include these &#039;&#039;schemapath&#039;&#039; lines in your manifest file, even if you have no SQL commands to execute.  By including these lines and including empty SQL files, the &#039;&#039;version_id&#039;&#039; value will be correctly maintained in the &#039;&#039;#__schemas&#039;&#039; table.&lt;br /&gt;
&lt;br /&gt;
== The entire manifest file ==&lt;br /&gt;
Here is the entire manifest file for version 1.0.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;2011 05 11&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;Your Name Here&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Free to copy&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;none&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Test the Install and Update Process&amp;lt;/description&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Runs on install/uninstall/update; New in 1.6 --&amp;gt;&lt;br /&gt;
	&amp;lt;scriptfile&amp;gt;script.php&amp;lt;/scriptfile&amp;gt;&lt;br /&gt;
	&amp;lt;install&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install_data.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;democompupdate.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=65400</id>
		<title>Archived:Managing Component Updates (Manifest file)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=65400"/>
		<updated>2012-03-04T20:55:54Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* #__schemas table */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Manifest File (democompupdate.xml) ==&lt;br /&gt;
The manifest file in this example is very similar to that of normal components.  Important contents for this example include:&lt;br /&gt;
&lt;br /&gt;
=== sql folder ===&lt;br /&gt;
Note the inclusion of the SQL folder in the administration files section.  This tells Joomla to copy the contents of this folder to the web site during install or update.  The &#039;&#039;schemapath&#039;&#039; declaration below depends on Joomla copying these files during the install or update process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;administration&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt; &lt;br /&gt;
		&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt; &lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== name ===&lt;br /&gt;
This is the name of the component.  The &#039;getParam($key)&#039; method in the &#039;&#039;script.php&#039;&#039; file uses this value to identify the correct row in the extensions table.  The &#039;&#039;manifest_cache&#039;&#039; field in the &#039;&#039;extensions&#039;&#039; table has the version string for the currently installed component.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== version ===&lt;br /&gt;
Joomla stores this value in the &#039;&#039;manifest_cache&#039;&#039; field of the &#039;&#039;extensions&#039;&#039; table.  The &#039;&#039;extensions&#039;&#039; table is where the custom code in the &#039;&#039;script.php&#039;&#039; file reads the version string of the currently installed component, and compares it to the version string of the update.&lt;br /&gt;
&lt;br /&gt;
The custom component code uses this comparison to abort an update, if the version sequence is not allowed.  Joomla also compares this string to the SQL update file names, to determine which SQL commands to execute.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== schemapath ===&lt;br /&gt;
This defines the directory that contains SQL files for component incremental database updates.&lt;br /&gt;
You may choose to put the SQL files somewhere else in your component release, but make sure their location is documented here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;update&amp;gt; &lt;br /&gt;
	&amp;lt;schemas&amp;gt; &lt;br /&gt;
		&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt; &lt;br /&gt;
	&amp;lt;/schemas&amp;gt; &lt;br /&gt;
&amp;lt;/update&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== #__schemas table ===&lt;br /&gt;
The SQL files have a second function.&lt;br /&gt;
In addition to potentially modifying the MySQL database, Joomla uses the names of these SQL files to update the version_id in the &#039;&#039;#__schemas&#039;&#039; table for your component.  It is important to have an SQL file for EVERY version of your component.  The file should be empty if you have no SQL code to execute when updating to that version.  You must have a file or the version_id will not get updated correctly.  The version_id in the #__schemas table is used as the &#039;&#039;from&#039;&#039; version when calculating updates &#039;&#039;from&#039;&#039; an older version &#039;&#039;to&#039;&#039; a new version.&lt;br /&gt;
&lt;br /&gt;
It is important to include these &#039;&#039;schemapath&#039;&#039; lines in your manifest file, even if you have no SQL commands to execute.  By including these lines and including empty SQL files, the version_id value will be correctly maintained in the &#039;&#039;#__schemas&#039;&#039; table.&lt;br /&gt;
&lt;br /&gt;
== The entire manifest file ==&lt;br /&gt;
Here is the entire manifest file for version 1.0.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;2011 05 11&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;Your Name Here&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Free to copy&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;none&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Test the Install and Update Process&amp;lt;/description&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Runs on install/uninstall/update; New in 1.6 --&amp;gt;&lt;br /&gt;
	&amp;lt;scriptfile&amp;gt;script.php&amp;lt;/scriptfile&amp;gt;&lt;br /&gt;
	&amp;lt;install&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install_data.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;democompupdate.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=65399</id>
		<title>Archived:Managing Component Updates (Manifest file)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=65399"/>
		<updated>2012-03-04T20:54:38Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* schemapath */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Manifest File (democompupdate.xml) ==&lt;br /&gt;
The manifest file in this example is very similar to that of normal components.  Important contents for this example include:&lt;br /&gt;
&lt;br /&gt;
=== sql folder ===&lt;br /&gt;
Note the inclusion of the SQL folder in the administration files section.  This tells Joomla to copy the contents of this folder to the web site during install or update.  The &#039;&#039;schemapath&#039;&#039; declaration below depends on Joomla copying these files during the install or update process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;administration&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt; &lt;br /&gt;
		&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt; &lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== name ===&lt;br /&gt;
This is the name of the component.  The &#039;getParam($key)&#039; method in the &#039;&#039;script.php&#039;&#039; file uses this value to identify the correct row in the extensions table.  The &#039;&#039;manifest_cache&#039;&#039; field in the &#039;&#039;extensions&#039;&#039; table has the version string for the currently installed component.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== version ===&lt;br /&gt;
Joomla stores this value in the &#039;&#039;manifest_cache&#039;&#039; field of the &#039;&#039;extensions&#039;&#039; table.  The &#039;&#039;extensions&#039;&#039; table is where the custom code in the &#039;&#039;script.php&#039;&#039; file reads the version string of the currently installed component, and compares it to the version string of the update.&lt;br /&gt;
&lt;br /&gt;
The custom component code uses this comparison to abort an update, if the version sequence is not allowed.  Joomla also compares this string to the SQL update file names, to determine which SQL commands to execute.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== schemapath ===&lt;br /&gt;
This defines the directory that contains SQL files for component incremental database updates.&lt;br /&gt;
You may choose to put the SQL files somewhere else in your component release, but make sure their location is documented here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;update&amp;gt; &lt;br /&gt;
	&amp;lt;schemas&amp;gt; &lt;br /&gt;
		&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt; &lt;br /&gt;
	&amp;lt;/schemas&amp;gt; &lt;br /&gt;
&amp;lt;/update&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== #__schemas table ===&lt;br /&gt;
In addition to potentially modifying the MySQL database, Joomla uses the names of these SQL files to update the version_id in the &#039;&#039;#__schemas&#039;&#039; table for your component.  It is important to have an SQL file for EVERY version of your component.  The file should be empty if you have no SQL code to execute when updating to that version.  You must have a file or the version_id will not get updated correctly.  The version_id in the #__schemas table is used as the &#039;&#039;from&#039;&#039; version when calculating updates &#039;&#039;from&#039;&#039; an older version &#039;&#039;to&#039;&#039; a new version.&lt;br /&gt;
&lt;br /&gt;
It is important to include these &#039;&#039;schemapath&#039;&#039; lines in your manifest file, even if you have no SQL commands to execute.  By including these lines and including empty SQL files, the version_id value will be correctly maintained in the &#039;&#039;#__schemas&#039;&#039; table.&lt;br /&gt;
&lt;br /&gt;
== The entire manifest file ==&lt;br /&gt;
Here is the entire manifest file for version 1.0.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;2011 05 11&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;Your Name Here&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Free to copy&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;none&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Test the Install and Update Process&amp;lt;/description&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Runs on install/uninstall/update; New in 1.6 --&amp;gt;&lt;br /&gt;
	&amp;lt;scriptfile&amp;gt;script.php&amp;lt;/scriptfile&amp;gt;&lt;br /&gt;
	&amp;lt;install&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install_data.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;democompupdate.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=65398</id>
		<title>Archived:Managing Component Updates (Manifest file)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=65398"/>
		<updated>2012-03-04T20:53:49Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* schemapath */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Manifest File (democompupdate.xml) ==&lt;br /&gt;
The manifest file in this example is very similar to that of normal components.  Important contents for this example include:&lt;br /&gt;
&lt;br /&gt;
=== sql folder ===&lt;br /&gt;
Note the inclusion of the SQL folder in the administration files section.  This tells Joomla to copy the contents of this folder to the web site during install or update.  The &#039;&#039;schemapath&#039;&#039; declaration below depends on Joomla copying these files during the install or update process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;administration&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt; &lt;br /&gt;
		&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt; &lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== name ===&lt;br /&gt;
This is the name of the component.  The &#039;getParam($key)&#039; method in the &#039;&#039;script.php&#039;&#039; file uses this value to identify the correct row in the extensions table.  The &#039;&#039;manifest_cache&#039;&#039; field in the &#039;&#039;extensions&#039;&#039; table has the version string for the currently installed component.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== version ===&lt;br /&gt;
Joomla stores this value in the &#039;&#039;manifest_cache&#039;&#039; field of the &#039;&#039;extensions&#039;&#039; table.  The &#039;&#039;extensions&#039;&#039; table is where the custom code in the &#039;&#039;script.php&#039;&#039; file reads the version string of the currently installed component, and compares it to the version string of the update.&lt;br /&gt;
&lt;br /&gt;
The custom component code uses this comparison to abort an update, if the version sequence is not allowed.  Joomla also compares this string to the SQL update file names, to determine which SQL commands to execute.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== schemapath ===&lt;br /&gt;
This defines the directory that contains SQL files for component incremental database updates.&lt;br /&gt;
You may choose to put the SQL files somewhere else in your component release, but make sure their location is documented here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;update&amp;gt; &lt;br /&gt;
	&amp;lt;schemas&amp;gt; &lt;br /&gt;
		&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt; &lt;br /&gt;
	&amp;lt;/schemas&amp;gt; &lt;br /&gt;
&amp;lt;/update&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition to potentially modifying the MySQL database, Joomla uses the names of these SQL files to update the version_id in the &#039;&#039;#__schemas&#039;&#039; table for your component.  It is important to have an SQL file for EVERY version of your component.  The file should be empty if you have no SQL code to execute when updating to that version.  You must have a file or the version_id will not get updated correctly.  The version_id in the #__schemas table is used as the &#039;&#039;from&#039;&#039; version when calculating updates &#039;&#039;from&#039;&#039; an older version &#039;&#039;to&#039;&#039; a new version.&lt;br /&gt;
&lt;br /&gt;
It is important to include these &#039;&#039;schemapath&#039;&#039; lines in your manifest file, even if you have no SQL commands to execute.  By including these lines and including empty SQL files, the version_id value will be correctly maintained in the &#039;&#039;#__schemas&#039;&#039; table.&lt;br /&gt;
&lt;br /&gt;
== The entire manifest file ==&lt;br /&gt;
Here is the entire manifest file for version 1.0.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;2011 05 11&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;Your Name Here&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Free to copy&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;none&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Test the Install and Update Process&amp;lt;/description&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Runs on install/uninstall/update; New in 1.6 --&amp;gt;&lt;br /&gt;
	&amp;lt;scriptfile&amp;gt;script.php&amp;lt;/scriptfile&amp;gt;&lt;br /&gt;
	&amp;lt;install&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install_data.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;democompupdate.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=65397</id>
		<title>Archived:Managing Component Updates (Manifest file)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=65397"/>
		<updated>2012-03-04T20:51:20Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* schemapath */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Manifest File (democompupdate.xml) ==&lt;br /&gt;
The manifest file in this example is very similar to that of normal components.  Important contents for this example include:&lt;br /&gt;
&lt;br /&gt;
=== sql folder ===&lt;br /&gt;
Note the inclusion of the SQL folder in the administration files section.  This tells Joomla to copy the contents of this folder to the web site during install or update.  The &#039;&#039;schemapath&#039;&#039; declaration below depends on Joomla copying these files during the install or update process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;administration&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt; &lt;br /&gt;
		&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt; &lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== name ===&lt;br /&gt;
This is the name of the component.  The &#039;getParam($key)&#039; method in the &#039;&#039;script.php&#039;&#039; file uses this value to identify the correct row in the extensions table.  The &#039;&#039;manifest_cache&#039;&#039; field in the &#039;&#039;extensions&#039;&#039; table has the version string for the currently installed component.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== version ===&lt;br /&gt;
Joomla stores this value in the &#039;&#039;manifest_cache&#039;&#039; field of the &#039;&#039;extensions&#039;&#039; table.  The &#039;&#039;extensions&#039;&#039; table is where the custom code in the &#039;&#039;script.php&#039;&#039; file reads the version string of the currently installed component, and compares it to the version string of the update.&lt;br /&gt;
&lt;br /&gt;
The custom component code uses this comparison to abort an update, if the version sequence is not allowed.  Joomla also compares this string to the SQL update file names, to determine which SQL commands to execute.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== schemapath ===&lt;br /&gt;
This defines the directory that contains SQL files for component incremental database updates.&lt;br /&gt;
You may choose to put the SQL files somewhere else in your component release, but make sure their location is documented here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;update&amp;gt; &lt;br /&gt;
	&amp;lt;schemas&amp;gt; &lt;br /&gt;
		&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt; &lt;br /&gt;
	&amp;lt;/schemas&amp;gt; &lt;br /&gt;
&amp;lt;/update&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition to potentially modifying the MySQL database, Joomla uses the names of these SQL files to update the version_id in the &#039;&#039;#__schemas&#039;&#039; table for your component.  It is important to have an SQL file for EVERY version of your component.  The file should be empty if you have no SQL code to execute when updating to that version.  You must have a file or the version_id will not get updated correctly.  The version_id in the #__schemas table is used as the &#039;&#039;from&#039;&#039; version when calculating updates &#039;&#039;from&#039;&#039; an older version &#039;&#039;to&#039;&#039; a new version.&lt;br /&gt;
&lt;br /&gt;
== The entire manifest file ==&lt;br /&gt;
Here is the entire manifest file for version 1.0.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;2011 05 11&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;Your Name Here&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Free to copy&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;none&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Test the Install and Update Process&amp;lt;/description&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Runs on install/uninstall/update; New in 1.6 --&amp;gt;&lt;br /&gt;
	&amp;lt;scriptfile&amp;gt;script.php&amp;lt;/scriptfile&amp;gt;&lt;br /&gt;
	&amp;lt;install&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install_data.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;democompupdate.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=65396</id>
		<title>Archived:Managing Component Updates (Manifest file)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=65396"/>
		<updated>2012-03-04T20:49:14Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* schemapath */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Manifest File (democompupdate.xml) ==&lt;br /&gt;
The manifest file in this example is very similar to that of normal components.  Important contents for this example include:&lt;br /&gt;
&lt;br /&gt;
=== sql folder ===&lt;br /&gt;
Note the inclusion of the SQL folder in the administration files section.  This tells Joomla to copy the contents of this folder to the web site during install or update.  The &#039;&#039;schemapath&#039;&#039; declaration below depends on Joomla copying these files during the install or update process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;administration&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt; &lt;br /&gt;
		&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt; &lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== name ===&lt;br /&gt;
This is the name of the component.  The &#039;getParam($key)&#039; method in the &#039;&#039;script.php&#039;&#039; file uses this value to identify the correct row in the extensions table.  The &#039;&#039;manifest_cache&#039;&#039; field in the &#039;&#039;extensions&#039;&#039; table has the version string for the currently installed component.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== version ===&lt;br /&gt;
Joomla stores this value in the &#039;&#039;manifest_cache&#039;&#039; field of the &#039;&#039;extensions&#039;&#039; table.  The &#039;&#039;extensions&#039;&#039; table is where the custom code in the &#039;&#039;script.php&#039;&#039; file reads the version string of the currently installed component, and compares it to the version string of the update.&lt;br /&gt;
&lt;br /&gt;
The custom component code uses this comparison to abort an update, if the version sequence is not allowed.  Joomla also compares this string to the SQL update file names, to determine which SQL commands to execute.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== schemapath ===&lt;br /&gt;
This defines the directory that contains SQL files for component incremental database updates.&lt;br /&gt;
You may choose to put the SQL files somewhere else in your component release, but make sure their location is documented here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;update&amp;gt; &lt;br /&gt;
	&amp;lt;schemas&amp;gt; &lt;br /&gt;
		&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt; &lt;br /&gt;
	&amp;lt;/schemas&amp;gt; &lt;br /&gt;
&amp;lt;/update&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition to potentially modifying the MySQL database, Joomla uses the names of these SQL files to update the version_id in the #__schemas table for your component.  It is important to have an SQL file for EVERY version of your component.  The file should be empty if you have no SQL code to execute when updating to that version.  You must have a file or the version_id will not get updated correctly.  The version_id in the #__schemas table is used as the from version when calculating updates from one version to a different version.&lt;br /&gt;
&lt;br /&gt;
== The entire manifest file ==&lt;br /&gt;
Here is the entire manifest file for version 1.0.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;2011 05 11&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;Your Name Here&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Free to copy&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;none&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Test the Install and Update Process&amp;lt;/description&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Runs on install/uninstall/update; New in 1.6 --&amp;gt;&lt;br /&gt;
	&amp;lt;scriptfile&amp;gt;script.php&amp;lt;/scriptfile&amp;gt;&lt;br /&gt;
	&amp;lt;install&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install_data.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;democompupdate.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=65395</id>
		<title>Archived:Managing Component Updates (Manifest file)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=65395"/>
		<updated>2012-03-04T20:45:59Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* schemapath */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Manifest File (democompupdate.xml) ==&lt;br /&gt;
The manifest file in this example is very similar to that of normal components.  Important contents for this example include:&lt;br /&gt;
&lt;br /&gt;
=== sql folder ===&lt;br /&gt;
Note the inclusion of the SQL folder in the administration files section.  This tells Joomla to copy the contents of this folder to the web site during install or update.  The &#039;&#039;schemapath&#039;&#039; declaration below depends on Joomla copying these files during the install or update process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;administration&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt; &lt;br /&gt;
		&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt; &lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== name ===&lt;br /&gt;
This is the name of the component.  The &#039;getParam($key)&#039; method in the &#039;&#039;script.php&#039;&#039; file uses this value to identify the correct row in the extensions table.  The &#039;&#039;manifest_cache&#039;&#039; field in the &#039;&#039;extensions&#039;&#039; table has the version string for the currently installed component.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== version ===&lt;br /&gt;
Joomla stores this value in the &#039;&#039;manifest_cache&#039;&#039; field of the &#039;&#039;extensions&#039;&#039; table.  The &#039;&#039;extensions&#039;&#039; table is where the custom code in the &#039;&#039;script.php&#039;&#039; file reads the version string of the currently installed component, and compares it to the version string of the update.&lt;br /&gt;
&lt;br /&gt;
The custom component code uses this comparison to abort an update, if the version sequence is not allowed.  Joomla also compares this string to the SQL update file names, to determine which SQL commands to execute.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== schemapath ===&lt;br /&gt;
This defines the directory that contains SQL files for component incremental database updates.&lt;br /&gt;
You may choose to put the SQL files somewhere else in your component release, but make sure their location is documented here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;update&amp;gt; &lt;br /&gt;
	&amp;lt;schemas&amp;gt; &lt;br /&gt;
		&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt; &lt;br /&gt;
	&amp;lt;/schemas&amp;gt; &lt;br /&gt;
&amp;lt;/update&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition to potentially modifying the MySQL database, Joomla uses the names of these SQL files to update the version_id in the #__schemas table for your component.  It is important to have an SQL file for EVERY version of your component.  The file should be empty if you have no SQL code to execute.  You must have a file or the version_id will not get updated correctly.  The version_id in the #__schemas table is used as the from version when calculating updates from one version to a different version.&lt;br /&gt;
&lt;br /&gt;
== The entire manifest file ==&lt;br /&gt;
Here is the entire manifest file for version 1.0.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;2011 05 11&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;Your Name Here&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Free to copy&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;none&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Test the Install and Update Process&amp;lt;/description&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Runs on install/uninstall/update; New in 1.6 --&amp;gt;&lt;br /&gt;
	&amp;lt;scriptfile&amp;gt;script.php&amp;lt;/scriptfile&amp;gt;&lt;br /&gt;
	&amp;lt;install&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install_data.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;democompupdate.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=65394</id>
		<title>Archived:Managing Component Updates (Manifest file)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=65394"/>
		<updated>2012-03-04T20:44:12Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* schemapath */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Manifest File (democompupdate.xml) ==&lt;br /&gt;
The manifest file in this example is very similar to that of normal components.  Important contents for this example include:&lt;br /&gt;
&lt;br /&gt;
=== sql folder ===&lt;br /&gt;
Note the inclusion of the SQL folder in the administration files section.  This tells Joomla to copy the contents of this folder to the web site during install or update.  The &#039;&#039;schemapath&#039;&#039; declaration below depends on Joomla copying these files during the install or update process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;administration&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt; &lt;br /&gt;
		&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt; &lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== name ===&lt;br /&gt;
This is the name of the component.  The &#039;getParam($key)&#039; method in the &#039;&#039;script.php&#039;&#039; file uses this value to identify the correct row in the extensions table.  The &#039;&#039;manifest_cache&#039;&#039; field in the &#039;&#039;extensions&#039;&#039; table has the version string for the currently installed component.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== version ===&lt;br /&gt;
Joomla stores this value in the &#039;&#039;manifest_cache&#039;&#039; field of the &#039;&#039;extensions&#039;&#039; table.  The &#039;&#039;extensions&#039;&#039; table is where the custom code in the &#039;&#039;script.php&#039;&#039; file reads the version string of the currently installed component, and compares it to the version string of the update.&lt;br /&gt;
&lt;br /&gt;
The custom component code uses this comparison to abort an update, if the version sequence is not allowed.  Joomla also compares this string to the SQL update file names, to determine which SQL commands to execute.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== schemapath ===&lt;br /&gt;
This defines the directory that contains SQL files for component incremental database updates.&lt;br /&gt;
You may choose to put the SQL files somewhere else in your component release, but make sure their location is documented here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;update&amp;gt; &lt;br /&gt;
	&amp;lt;schemas&amp;gt; &lt;br /&gt;
		&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt; &lt;br /&gt;
	&amp;lt;/schemas&amp;gt; &lt;br /&gt;
&amp;lt;/update&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition to potentially modifying the MySQL database, Joomla uses the names of these files to update the version_id in the #__schemas table for your component.  It is important to have an SQL file for EVERY version of your component.  The file should be empty if you have not SQL code to execute.  You must have a file or the version_id will not get updated correctly.&lt;br /&gt;
&lt;br /&gt;
== The entire manifest file ==&lt;br /&gt;
Here is the entire manifest file for version 1.0.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;2011 05 11&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;Your Name Here&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Free to copy&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;none&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Test the Install and Update Process&amp;lt;/description&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Runs on install/uninstall/update; New in 1.6 --&amp;gt;&lt;br /&gt;
	&amp;lt;scriptfile&amp;gt;script.php&amp;lt;/scriptfile&amp;gt;&lt;br /&gt;
	&amp;lt;install&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install_data.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;democompupdate.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Script.php)&amp;diff=64654</id>
		<title>Archived:Managing Component Updates (Script.php)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Script.php)&amp;diff=64654"/>
		<updated>2012-02-02T02:25:49Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* postflight */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Script.php ==&lt;br /&gt;
This file contains the component-specific methods preflight, install, update, postflight and uninstall.  This file is where the component developer implements all of the unique code for these actions.&lt;br /&gt;
For this example, in addition to various checks, HTML is inserted into the back-end output to show which code has been executed.  You may choose to display different HTML, or to display none for your component.&lt;br /&gt;
&lt;br /&gt;
=== preflight ===&lt;br /&gt;
This is where most of the checking should be done before install, update or discover_install.  Preflight is executed prior to any Joomla install, update or discover_install actions.  Preflight is not executed on uninstall.  A string denoting the type of action (install, update or discover_install) is passed to preflight in the $type operand.  Your code can use this string to execute different checks and responses for the three cases.&lt;br /&gt;
&lt;br /&gt;
It is appropriate to check the Joomla version and the existing component version in the preflight module.  A failure of either of these two should cause an abort of the action.  An abort is triggered by returning a false value from this preflight method.  On receiving a false return value, Joomla will reverse any actions already completed.&lt;br /&gt;
&lt;br /&gt;
The PHP function &#039;&#039;version_compare&#039;&#039; is useful to compare version strings.  Joomla also uses &#039;&#039;version_compare&#039;&#039; to define the sequence of SQL file execution, when an update is being executed that spans multiple versions.&lt;br /&gt;
&lt;br /&gt;
In this example, the preflight method checks that Joomla version 1.6 or greater is in use.  If an earlier Joomla version is in use, the install or update will abort.  Since this script.php file only works in Joomla version 1.6 or greater, this check is currently not very useful.  As subsequent Joomla versions become available, this check will be useful.  Try changing the version string in the script.php file to a value greater than the Joomla version that you are using.  Installs and updates should fail. This is what the version &#039;&#039;democompupdate_10j3.zip&#039;&#039; demonstrates.&lt;br /&gt;
&lt;br /&gt;
In addition to failing, it is important to give the web site administrator useful information as to why the component installation failed. See the example below.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function preflight( $type, $parent ) {&lt;br /&gt;
	$jversion = new JVersion();&lt;br /&gt;
&lt;br /&gt;
        // Extract the version number from the manifest file&lt;br /&gt;
        $this-&amp;gt;release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;version;&lt;br /&gt;
&lt;br /&gt;
        // Find mimimum required joomla version from the manifest file&lt;br /&gt;
        $this-&amp;gt;minimum_joomla_release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;attributes()-&amp;gt;version;        &lt;br /&gt;
&lt;br /&gt;
	if( version_compare( $jversion-&amp;gt;getShortVersion(), $this-&amp;gt;minimum_joomla_release, &#039;lt&#039; ) ) {&lt;br /&gt;
		Jerror::raiseWarning(null, &#039;Cannot install com_democompupdate in a Joomla release prior to &#039;. $this-&amp;gt;minimum_joomla_release);&lt;br /&gt;
		return false;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// abort if the component being installed is not newer than the currently installed version&lt;br /&gt;
	if ( $type == &#039;update&#039; ) {&lt;br /&gt;
		$oldRelease = $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
		$rel = $oldRelease . &#039; to &#039; . $this-&amp;gt;release;&lt;br /&gt;
		if ( version_compare( $this-&amp;gt;release, $oldRelease, &#039;le&#039; ) ) {&lt;br /&gt;
			Jerror::raiseWarning(null, &#039;Incorrect version sequence. Cannot upgrade &#039; . $rel);&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	else { $rel = $this-&amp;gt;release; }&lt;br /&gt;
		&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_PREFLIGHT_&#039; . $type . &#039; &#039; . $rel) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== install ===&lt;br /&gt;
Install is executed after the Joomla install database scripts have completed. Returning &#039;false&#039; will abort the install and undo any changes already made.&lt;br /&gt;
It is cleaner to abort the install during preflight, if possible.  Since fewer install actions have occurred at preflight, there is less risk that that their reversal may be done incorrectly.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function install( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_INSTALL to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	// Following an install, the backend can jump directly to the newly installed component configuration page&lt;br /&gt;
	$parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== update ===&lt;br /&gt;
Update is executed after the Joomla update database scripts have completed.  Returning &#039;false&#039; will abort the update and undo any changes already made.&lt;br /&gt;
It is cleaner to abort the update during preflight, if possible.  Since fewer update actions have occurred at preflight, there is less risk that that their reversal may be done incorrectly.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function update( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UPDATE_ to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	// Following an update, the backend can jump directly to the newly installed component configuration page&lt;br /&gt;
	$parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== postflight ===&lt;br /&gt;
Postflight is executed after the Joomla install, update or discover_update actions have completed.  It is not executed after uninstall.  Postflight is executed after the extension is registered in the database.  The type of action (install, update or discover_install) is passed to postflight in the $type operand. Postflight cannot cause an abort of the Joomla install, update or discover_install action.&lt;br /&gt;
&lt;br /&gt;
The postflight method is a good place to set the default values of component parameters during installs, and to set the values of hidden component parameters during installs and updates.  Postflight can be used for any other action that must follow the install, update or discover_install actions.&lt;br /&gt;
&lt;br /&gt;
This example defines component parameters in postflight.  The value of &#039;&#039;my_param0&#039;&#039; is displayed in the component front-end.  Both &#039;&#039;my_param0&#039;&#039; and &#039;&#039;my_param1&#039;&#039; are overwritten in updates. This is how you would change the component revision number during an update. The examples &#039;&#039;myparam2&#039;&#039; and &#039;&#039;myparam3&#039;&#039; show how you would treat parameters that you expect users to set, and you do not want to overwrite during an update. Parameters that control component operation would be treated this way.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function postflight( $type, $parent ) {&lt;br /&gt;
	// always create or modify these parameters&lt;br /&gt;
	$params[&#039;my_param0&#039;] = &#039;Component version &#039; . $this-&amp;gt;release;&lt;br /&gt;
	$params[&#039;my_param1&#039;] = &#039;Another value&#039;;&lt;br /&gt;
&lt;br /&gt;
	// define the following parameters only if it is an original install&lt;br /&gt;
	if ( $type == &#039;install&#039; ) {&lt;br /&gt;
		$params[&#039;my_param2&#039;] = &#039;4&#039;;&lt;br /&gt;
		$params[&#039;my_param3&#039;] = &#039;Star&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	$this-&amp;gt;setParams( $params );&lt;br /&gt;
&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_POSTFLIGHT &#039; . $type . &#039; to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== uninstall ===&lt;br /&gt;
The uninstall method is executed before any Joomla uninstall action, such as file removal or database changes.  Uninstall cannot cause an abort of the Joomla uninstall action, so returning false would be a waste of time.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function uninstall( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UNINSTALL &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The entire script.php file ==&lt;br /&gt;
This is the entire script.php file for version 1.0.&lt;br /&gt;
Note the definition of the variable &#039;&#039;$release&#039;&#039;.&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(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
//the name of the class must be the name of your component + InstallerScript&lt;br /&gt;
//for example: com_contentInstallerScript for com_content.&lt;br /&gt;
class com_democompupdateInstallerScript&lt;br /&gt;
{&lt;br /&gt;
	/*&lt;br /&gt;
	 * The release value to be displayed and checked against throughout this file.&lt;br /&gt;
	 */&lt;br /&gt;
	private $release = &#039;1.0&#039;;&lt;br /&gt;
&lt;br /&gt;
        /*&lt;br /&gt;
         * Find mimimum required joomla version for this extension. It will be read from the version attribute (install tag) in the manifest file&lt;br /&gt;
         */&lt;br /&gt;
        private $minimum_joomla_release = &#039;1.6.0&#039;;    &lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * $type is the type of change (install, update or discover_install, not uninstall).&lt;br /&gt;
	 * preflight runs before anything else and while the extracted files are in the uploaded temp folder.&lt;br /&gt;
	 * If preflight returns false, Joomla will abort the update and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function preflight( $type, $parent ) {&lt;br /&gt;
		// this component does not work with Joomla releases prior to 1.6&lt;br /&gt;
		// abort if the current Joomla release is older&lt;br /&gt;
		$jversion = new JVersion();&lt;br /&gt;
&lt;br /&gt;
                // Extract the version number from the manifest. This will overwrite the 1.0 value set above &lt;br /&gt;
                $this-&amp;gt;release=$parent-&amp;gt;get(&amp;quot;manifest&amp;quot;)-&amp;gt;version;&lt;br /&gt;
                &lt;br /&gt;
                // Find mimimum required joomla version&lt;br /&gt;
                $this-&amp;gt;minimum_joomla_release=$parent-&amp;gt;get(&amp;quot;manifest&amp;quot;)-&amp;gt;attributes()-&amp;gt;version;    &lt;br /&gt;
&lt;br /&gt;
		if( version_compare( $jversion-&amp;gt;getShortVersion(), $this-&amp;gt;minimum_joomla_release, &#039;lt&#039; ) ) {&lt;br /&gt;
			Jerror::raiseWarning(null, &#039;Cannot install com_democompupdate in a Joomla release prior to &#039;.$this-&amp;gt;minimum_joomla_release);&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// abort if the component being installed is not newer than the currently installed version&lt;br /&gt;
		if ( $type == &#039;update&#039; ) {&lt;br /&gt;
			$oldRelease = $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
			$rel = $oldRelease . &#039; to &#039; . $this-&amp;gt;release;&lt;br /&gt;
			if ( version_compare( $this-&amp;gt;release, $oldRelease, &#039;le&#039; ) ) {&lt;br /&gt;
				Jerror::raiseWarning(null, &#039;Incorrect version sequence. Cannot upgrade &#039; . $rel);&lt;br /&gt;
				return false;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
		else { $rel = $this-&amp;gt;release; }&lt;br /&gt;
		&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_PREFLIGHT_&#039; . $type . &#039; &#039; . $rel) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * install runs after the database scripts are executed.&lt;br /&gt;
	 * If the extension is new, the install method is run.&lt;br /&gt;
	 * If install returns false, Joomla will abort the install and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function install( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_INSTALL to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
		// You can have the backend jump directly to the newly installed component configuration page&lt;br /&gt;
		// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * update runs after the database scripts are executed.&lt;br /&gt;
	 * If the extension exists, then the update method is run.&lt;br /&gt;
	 * If this returns false, Joomla will abort the update and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function update( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UPDATE_ to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * $type is the type of change (install, update or discover_install, not uninstall).&lt;br /&gt;
	 * postflight is run after the extension is registered in the database.&lt;br /&gt;
	 */&lt;br /&gt;
	function postflight( $type, $parent ) {&lt;br /&gt;
		// always create or modify these parameters&lt;br /&gt;
		$params[&#039;my_param0&#039;] = &#039;Component version &#039; . $this-&amp;gt;release;&lt;br /&gt;
		$params[&#039;my_param1&#039;] = &#039;Another value&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// define the following parameters only if it is an original install&lt;br /&gt;
		if ( $type == &#039;install&#039; ) {&lt;br /&gt;
			$params[&#039;my_param2&#039;] = &#039;4&#039;;&lt;br /&gt;
			$params[&#039;my_param3&#039;] = &#039;Star&#039;;&lt;br /&gt;
		}&lt;br /&gt;
 &lt;br /&gt;
		$this-&amp;gt;setParams( $params );&lt;br /&gt;
 &lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_POSTFLIGHT &#039; . $type . &#039; to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method&lt;br /&gt;
	 * uninstall runs before any other action is taken (file removal or database processing).&lt;br /&gt;
	 */&lt;br /&gt;
	function uninstall( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UNINSTALL &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * get a variable from the manifest file (actually, from the manifest cache).&lt;br /&gt;
	 */&lt;br /&gt;
	function getParam( $name ) {&lt;br /&gt;
		$db = JFactory::getDbo();&lt;br /&gt;
		$db-&amp;gt;setQuery(&#039;SELECT manifest_cache FROM #__extensions WHERE name = &amp;quot;com_democompupdate&amp;quot;&#039;);&lt;br /&gt;
		$manifest = json_decode( $db-&amp;gt;loadResult(), true );&lt;br /&gt;
		return $manifest[ $name ];&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * sets parameter values in the component&#039;s row of the extension table&lt;br /&gt;
	 */&lt;br /&gt;
	function setParams($param_array) {&lt;br /&gt;
		if ( count($param_array) &amp;gt; 0 ) {&lt;br /&gt;
			// read the existing component value(s)&lt;br /&gt;
			$db = JFactory::getDbo();&lt;br /&gt;
			$db-&amp;gt;setQuery(&#039;SELECT params FROM #__extensions WHERE name = &amp;quot;com_democompupdate&amp;quot;&#039;);&lt;br /&gt;
			$params = json_decode( $db-&amp;gt;loadResult(), true );&lt;br /&gt;
			// add the new variable(s) to the existing one(s)&lt;br /&gt;
			foreach ( $param_array as $name =&amp;gt; $value ) {&lt;br /&gt;
				$params[ (string) $name ] = (string) $value;&lt;br /&gt;
			}&lt;br /&gt;
			// store the combined new and existing values back as a JSON string&lt;br /&gt;
			$paramsString = json_encode( $params );&lt;br /&gt;
			$db-&amp;gt;setQuery(&#039;UPDATE #__extensions SET params = &#039; .&lt;br /&gt;
				$db-&amp;gt;quote( $paramsString ) .&lt;br /&gt;
				&#039; WHERE name = &amp;quot;com_democompupdate&amp;quot;&#039; );&lt;br /&gt;
				$db-&amp;gt;query();&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
*[[User:tapaccos|Alex Tapaccos]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Script.php)&amp;diff=64653</id>
		<title>Archived:Managing Component Updates (Script.php)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Script.php)&amp;diff=64653"/>
		<updated>2012-02-02T02:24:15Z</updated>

		<summary type="html">&lt;p&gt;Sm990: /* postflight */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Script.php ==&lt;br /&gt;
This file contains the component-specific methods preflight, install, update, postflight and uninstall.  This file is where the component developer implements all of the unique code for these actions.&lt;br /&gt;
For this example, in addition to various checks, HTML is inserted into the back-end output to show which code has been executed.  You may choose to display different HTML, or to display none for your component.&lt;br /&gt;
&lt;br /&gt;
=== preflight ===&lt;br /&gt;
This is where most of the checking should be done before install, update or discover_install.  Preflight is executed prior to any Joomla install, update or discover_install actions.  Preflight is not executed on uninstall.  A string denoting the type of action (install, update or discover_install) is passed to preflight in the $type operand.  Your code can use this string to execute different checks and responses for the three cases.&lt;br /&gt;
&lt;br /&gt;
It is appropriate to check the Joomla version and the existing component version in the preflight module.  A failure of either of these two should cause an abort of the action.  An abort is triggered by returning a false value from this preflight method.  On receiving a false return value, Joomla will reverse any actions already completed.&lt;br /&gt;
&lt;br /&gt;
The PHP function &#039;&#039;version_compare&#039;&#039; is useful to compare version strings.  Joomla also uses &#039;&#039;version_compare&#039;&#039; to define the sequence of SQL file execution, when an update is being executed that spans multiple versions.&lt;br /&gt;
&lt;br /&gt;
In this example, the preflight method checks that Joomla version 1.6 or greater is in use.  If an earlier Joomla version is in use, the install or update will abort.  Since this script.php file only works in Joomla version 1.6 or greater, this check is currently not very useful.  As subsequent Joomla versions become available, this check will be useful.  Try changing the version string in the script.php file to a value greater than the Joomla version that you are using.  Installs and updates should fail. This is what the version &#039;&#039;democompupdate_10j3.zip&#039;&#039; demonstrates.&lt;br /&gt;
&lt;br /&gt;
In addition to failing, it is important to give the web site administrator useful information as to why the component installation failed. See the example below.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function preflight( $type, $parent ) {&lt;br /&gt;
	$jversion = new JVersion();&lt;br /&gt;
&lt;br /&gt;
        // Extract the version number from the manifest file&lt;br /&gt;
        $this-&amp;gt;release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;version;&lt;br /&gt;
&lt;br /&gt;
        // Find mimimum required joomla version from the manifest file&lt;br /&gt;
        $this-&amp;gt;minimum_joomla_release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;attributes()-&amp;gt;version;        &lt;br /&gt;
&lt;br /&gt;
	if( version_compare( $jversion-&amp;gt;getShortVersion(), $this-&amp;gt;minimum_joomla_release, &#039;lt&#039; ) ) {&lt;br /&gt;
		Jerror::raiseWarning(null, &#039;Cannot install com_democompupdate in a Joomla release prior to &#039;. $this-&amp;gt;minimum_joomla_release);&lt;br /&gt;
		return false;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// abort if the component being installed is not newer than the currently installed version&lt;br /&gt;
	if ( $type == &#039;update&#039; ) {&lt;br /&gt;
		$oldRelease = $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
		$rel = $oldRelease . &#039; to &#039; . $this-&amp;gt;release;&lt;br /&gt;
		if ( version_compare( $this-&amp;gt;release, $oldRelease, &#039;le&#039; ) ) {&lt;br /&gt;
			Jerror::raiseWarning(null, &#039;Incorrect version sequence. Cannot upgrade &#039; . $rel);&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	else { $rel = $this-&amp;gt;release; }&lt;br /&gt;
		&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_PREFLIGHT_&#039; . $type . &#039; &#039; . $rel) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== install ===&lt;br /&gt;
Install is executed after the Joomla install database scripts have completed. Returning &#039;false&#039; will abort the install and undo any changes already made.&lt;br /&gt;
It is cleaner to abort the install during preflight, if possible.  Since fewer install actions have occurred at preflight, there is less risk that that their reversal may be done incorrectly.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function install( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_INSTALL to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	// Following an install, the backend can jump directly to the newly installed component configuration page&lt;br /&gt;
	$parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== update ===&lt;br /&gt;
Update is executed after the Joomla update database scripts have completed.  Returning &#039;false&#039; will abort the update and undo any changes already made.&lt;br /&gt;
It is cleaner to abort the update during preflight, if possible.  Since fewer update actions have occurred at preflight, there is less risk that that their reversal may be done incorrectly.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function update( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UPDATE_ to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	// Following an update, the backend can jump directly to the newly installed component configuration page&lt;br /&gt;
	$parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== postflight ===&lt;br /&gt;
Postflight is executed after the Joomla install, update or discover_update actions have completed.  It is not executed after uninstall.  Postflight is executed after the extension is registered in the database.  The type of action (install, update or discover_install) is passed to postflight in the $type operand. Postflight cannot cause an abort of the Joomla install, update or discover_install action.&lt;br /&gt;
&lt;br /&gt;
The postflight method is a good place to set the default values of component parameters during installs, and to set the values of hidden component parameters during installs and updates.  Postflight can be used for any other action that must follow the install, update or discover_install actions.&lt;br /&gt;
&lt;br /&gt;
This example defines component parameters in postflight.  The value of &#039;&#039;my_param0&#039;&#039; is displayed in the component front-end.  Both &#039;&#039;my_param0&#039;&#039; and &#039;&#039;my_param1&#039;&#039; are overwritten in updates. This is how you would change the component revision number during an update. The examples &#039;&#039;myparam2&#039;&#039; and &#039;&#039;myparam3&#039;&#039; show how you would treat parameters that you expect users to set, and you do not want to overwrite during an update. Parameters that define component operation would be treated this way.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function postflight( $type, $parent ) {&lt;br /&gt;
	// always create or modify these parameters&lt;br /&gt;
	$params[&#039;my_param0&#039;] = &#039;Component version &#039; . $this-&amp;gt;release;&lt;br /&gt;
	$params[&#039;my_param1&#039;] = &#039;Another value&#039;;&lt;br /&gt;
&lt;br /&gt;
	// define the following parameters only if it is an original install&lt;br /&gt;
	if ( $type == &#039;install&#039; ) {&lt;br /&gt;
		$params[&#039;my_param2&#039;] = &#039;4&#039;;&lt;br /&gt;
		$params[&#039;my_param3&#039;] = &#039;Star&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	$this-&amp;gt;setParams( $params );&lt;br /&gt;
&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_POSTFLIGHT &#039; . $type . &#039; to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== uninstall ===&lt;br /&gt;
The uninstall method is executed before any Joomla uninstall action, such as file removal or database changes.  Uninstall cannot cause an abort of the Joomla uninstall action, so returning false would be a waste of time.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function uninstall( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UNINSTALL &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The entire script.php file ==&lt;br /&gt;
This is the entire script.php file for version 1.0.&lt;br /&gt;
Note the definition of the variable &#039;&#039;$release&#039;&#039;.&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(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
//the name of the class must be the name of your component + InstallerScript&lt;br /&gt;
//for example: com_contentInstallerScript for com_content.&lt;br /&gt;
class com_democompupdateInstallerScript&lt;br /&gt;
{&lt;br /&gt;
	/*&lt;br /&gt;
	 * The release value to be displayed and checked against throughout this file.&lt;br /&gt;
	 */&lt;br /&gt;
	private $release = &#039;1.0&#039;;&lt;br /&gt;
&lt;br /&gt;
        /*&lt;br /&gt;
         * Find mimimum required joomla version for this extension. It will be read from the version attribute (install tag) in the manifest file&lt;br /&gt;
         */&lt;br /&gt;
        private $minimum_joomla_release = &#039;1.6.0&#039;;    &lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * $type is the type of change (install, update or discover_install, not uninstall).&lt;br /&gt;
	 * preflight runs before anything else and while the extracted files are in the uploaded temp folder.&lt;br /&gt;
	 * If preflight returns false, Joomla will abort the update and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function preflight( $type, $parent ) {&lt;br /&gt;
		// this component does not work with Joomla releases prior to 1.6&lt;br /&gt;
		// abort if the current Joomla release is older&lt;br /&gt;
		$jversion = new JVersion();&lt;br /&gt;
&lt;br /&gt;
                // Extract the version number from the manifest. This will overwrite the 1.0 value set above &lt;br /&gt;
                $this-&amp;gt;release=$parent-&amp;gt;get(&amp;quot;manifest&amp;quot;)-&amp;gt;version;&lt;br /&gt;
                &lt;br /&gt;
                // Find mimimum required joomla version&lt;br /&gt;
                $this-&amp;gt;minimum_joomla_release=$parent-&amp;gt;get(&amp;quot;manifest&amp;quot;)-&amp;gt;attributes()-&amp;gt;version;    &lt;br /&gt;
&lt;br /&gt;
		if( version_compare( $jversion-&amp;gt;getShortVersion(), $this-&amp;gt;minimum_joomla_release, &#039;lt&#039; ) ) {&lt;br /&gt;
			Jerror::raiseWarning(null, &#039;Cannot install com_democompupdate in a Joomla release prior to &#039;.$this-&amp;gt;minimum_joomla_release);&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// abort if the component being installed is not newer than the currently installed version&lt;br /&gt;
		if ( $type == &#039;update&#039; ) {&lt;br /&gt;
			$oldRelease = $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
			$rel = $oldRelease . &#039; to &#039; . $this-&amp;gt;release;&lt;br /&gt;
			if ( version_compare( $this-&amp;gt;release, $oldRelease, &#039;le&#039; ) ) {&lt;br /&gt;
				Jerror::raiseWarning(null, &#039;Incorrect version sequence. Cannot upgrade &#039; . $rel);&lt;br /&gt;
				return false;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
		else { $rel = $this-&amp;gt;release; }&lt;br /&gt;
		&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_PREFLIGHT_&#039; . $type . &#039; &#039; . $rel) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * install runs after the database scripts are executed.&lt;br /&gt;
	 * If the extension is new, the install method is run.&lt;br /&gt;
	 * If install returns false, Joomla will abort the install and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function install( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_INSTALL to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
		// You can have the backend jump directly to the newly installed component configuration page&lt;br /&gt;
		// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * update runs after the database scripts are executed.&lt;br /&gt;
	 * If the extension exists, then the update method is run.&lt;br /&gt;
	 * If this returns false, Joomla will abort the update and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function update( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UPDATE_ to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * $type is the type of change (install, update or discover_install, not uninstall).&lt;br /&gt;
	 * postflight is run after the extension is registered in the database.&lt;br /&gt;
	 */&lt;br /&gt;
	function postflight( $type, $parent ) {&lt;br /&gt;
		// always create or modify these parameters&lt;br /&gt;
		$params[&#039;my_param0&#039;] = &#039;Component version &#039; . $this-&amp;gt;release;&lt;br /&gt;
		$params[&#039;my_param1&#039;] = &#039;Another value&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// define the following parameters only if it is an original install&lt;br /&gt;
		if ( $type == &#039;install&#039; ) {&lt;br /&gt;
			$params[&#039;my_param2&#039;] = &#039;4&#039;;&lt;br /&gt;
			$params[&#039;my_param3&#039;] = &#039;Star&#039;;&lt;br /&gt;
		}&lt;br /&gt;
 &lt;br /&gt;
		$this-&amp;gt;setParams( $params );&lt;br /&gt;
 &lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_POSTFLIGHT &#039; . $type . &#039; to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method&lt;br /&gt;
	 * uninstall runs before any other action is taken (file removal or database processing).&lt;br /&gt;
	 */&lt;br /&gt;
	function uninstall( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UNINSTALL &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * get a variable from the manifest file (actually, from the manifest cache).&lt;br /&gt;
	 */&lt;br /&gt;
	function getParam( $name ) {&lt;br /&gt;
		$db = JFactory::getDbo();&lt;br /&gt;
		$db-&amp;gt;setQuery(&#039;SELECT manifest_cache FROM #__extensions WHERE name = &amp;quot;com_democompupdate&amp;quot;&#039;);&lt;br /&gt;
		$manifest = json_decode( $db-&amp;gt;loadResult(), true );&lt;br /&gt;
		return $manifest[ $name ];&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * sets parameter values in the component&#039;s row of the extension table&lt;br /&gt;
	 */&lt;br /&gt;
	function setParams($param_array) {&lt;br /&gt;
		if ( count($param_array) &amp;gt; 0 ) {&lt;br /&gt;
			// read the existing component value(s)&lt;br /&gt;
			$db = JFactory::getDbo();&lt;br /&gt;
			$db-&amp;gt;setQuery(&#039;SELECT params FROM #__extensions WHERE name = &amp;quot;com_democompupdate&amp;quot;&#039;);&lt;br /&gt;
			$params = json_decode( $db-&amp;gt;loadResult(), true );&lt;br /&gt;
			// add the new variable(s) to the existing one(s)&lt;br /&gt;
			foreach ( $param_array as $name =&amp;gt; $value ) {&lt;br /&gt;
				$params[ (string) $name ] = (string) $value;&lt;br /&gt;
			}&lt;br /&gt;
			// store the combined new and existing values back as a JSON string&lt;br /&gt;
			$paramsString = json_encode( $params );&lt;br /&gt;
			$db-&amp;gt;setQuery(&#039;UPDATE #__extensions SET params = &#039; .&lt;br /&gt;
				$db-&amp;gt;quote( $paramsString ) .&lt;br /&gt;
				&#039; WHERE name = &amp;quot;com_democompupdate&amp;quot;&#039; );&lt;br /&gt;
				$db-&amp;gt;query();&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
*[[User:tapaccos|Alex Tapaccos]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(How_to_use_this_example)&amp;diff=64652</id>
		<title>Archived:Managing Component Updates (How to use this example)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(How_to_use_this_example)&amp;diff=64652"/>
		<updated>2012-02-02T02:18:33Z</updated>

		<summary type="html">&lt;p&gt;Sm990: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
You will need to download all four versions of this example to exercise all of the features.&lt;br /&gt;
&lt;br /&gt;
== Normal update sequence ==&lt;br /&gt;
&lt;br /&gt;
You can use the following sequence of installs, updates and uninstalls to show the effects of this example.  You may also try installs, updates and uninstalls in any sequence that you desire.&lt;br /&gt;
&lt;br /&gt;
* Previous state: no com_democompupdate component installed.&lt;br /&gt;
* Install democompupdate_10.zip.&lt;br /&gt;
** Verify the install is good by the text echoed in back-end.&lt;br /&gt;
** Front-end: verify database, files and parameter setting.&lt;br /&gt;
** optional: phpMyAdmin: verify:&lt;br /&gt;
*** jos_democompupdate_mytable exists and has one row, myvalue = &#039;1.0&#039;.&lt;br /&gt;
*** jos_extensions table has entry for com_democompupdate.&lt;br /&gt;
**** params field (JSON), has three values.&lt;br /&gt;
**** manifest_cache field (JSON) shows version &#039;1.0&#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Previous state: version 1.0 installed.&lt;br /&gt;
* Install democompupdate_111.zip.&lt;br /&gt;
** Verify the update is good by the text echoed in back-end.&lt;br /&gt;
** Front-end: verify database, files and parameter setting.&lt;br /&gt;
** optional: phpMyAdmin: verify:&lt;br /&gt;
*** jos_democompupdate_mytable exists and has one row, value &#039;1.1.1&#039;.&lt;br /&gt;
*** jos_extensions table has entry for com_democompupdate.&lt;br /&gt;
**** params field (JSON), has three values.&lt;br /&gt;
**** manifest_cache field (JSON) shows version &#039;1.1.1&#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Previous state: version 1.1.1 installed.&lt;br /&gt;
* Install democompupdate_13.zip.&lt;br /&gt;
** Verify the update is good by the text echoed in back-end.&lt;br /&gt;
** Front-end: verify database, files and parameter setting.&lt;br /&gt;
*** There should be three rows in the table.&lt;br /&gt;
** optional: phpMyAdmin: verify:&lt;br /&gt;
*** jos_democompupdate_mytable exists and has three rows, values &#039;1.1.1&#039;, &#039;1.2.1&#039; and &#039;1.3&#039;.&lt;br /&gt;
*** jos_extensions table has entry for com_democompupdate.&lt;br /&gt;
**** params field (JSON), has three values.&lt;br /&gt;
**** manifest_cache field (JSON) shows version &#039;1.3&#039;.&lt;br /&gt;
&lt;br /&gt;
== Try a reverse-sequence update ==&lt;br /&gt;
&lt;br /&gt;
* Previous state: version 1.3 installed.&lt;br /&gt;
* Install democompupdate_10.zip.&lt;br /&gt;
** Update should fail, give useful information in the back-end.&lt;br /&gt;
** No change should be seen in the front-end, back-end or MySqlAdmin.&lt;br /&gt;
&lt;br /&gt;
== Make sure that uninstall works ==&lt;br /&gt;
&lt;br /&gt;
* Previous state: version 1.3 installed.&lt;br /&gt;
* Uninstall com_democompupdate&lt;br /&gt;
** Verify the component does not exist in Joomla extension manager or front-end.&lt;br /&gt;
** optional: phpMyAdmin: verify that democompupdate elements are gone.&lt;br /&gt;
&lt;br /&gt;
== Verify full installs of each revision work correctly ==&lt;br /&gt;
&lt;br /&gt;
* Previous state: no democompupdate component installed.&lt;br /&gt;
* Install democompupdate_111.zip.&lt;br /&gt;
** Verify that the full install created the same database and file state as the update to 1.1.1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Previous state: version 1.1.1 installed.&lt;br /&gt;
* Uninstall com_democompupdate&lt;br /&gt;
** Verify the component does not exist in Joomla extension manager or front-end.&lt;br /&gt;
** optional: phpMyAdmin: verify that democompupdate elements are gone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Previous state: no democompupdate component installed.&lt;br /&gt;
* Install democompupdate_13.zip.&lt;br /&gt;
** Verify that the full install created the same database and file state as the update to 1.3.&lt;br /&gt;
&lt;br /&gt;
== Verify that Joomla version check works ==&lt;br /&gt;
&lt;br /&gt;
* Previous state: version 1.3 installed.&lt;br /&gt;
* Uninstall com_democompupdate&lt;br /&gt;
* Install democompupdate_10j3.zip.&lt;br /&gt;
** The update should fail, give useful information in the back-end.&lt;br /&gt;
** No evidence of the installed component should exist in front-end, back-end or MySqlAdmin.&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
You can use the update features in Joomla 1.6 (and greater) to ensure that the web site administrator installs your component properly.&lt;br /&gt;
* Your component version string sequence must follow the requirements shown in the PHP &#039;&#039;version_compare&#039;&#039; function.&lt;br /&gt;
* Create update SQL files for component revisions.  The file names must match your version strings.&lt;br /&gt;
* Update the version string in the manifest file for each version.&lt;br /&gt;
* Update the version string in the script.php file for each version.  Modify the custom code in this file, if needed, for each version.&lt;br /&gt;
&lt;br /&gt;
If your component requires non-standard update handling, you can implement it in the script.php file.  You can disable the normal update SQL file execution and implement your own code.  You can implement custom checks and custom install and update actions.  You can, and should, create confirmation messages and error messages to help the web site administrator understand what your code is doing.&lt;br /&gt;
&lt;br /&gt;
I intentionally made this example simple, to make debugging easier. You can implement your custom code in this example, verify that it works correctly, then implement it in your component.  Share your successes with the Joomla community.&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Component_release_files)&amp;diff=64651</id>
		<title>Archived:Managing Component Updates (Component release files)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Component_release_files)&amp;diff=64651"/>
		<updated>2012-02-02T02:18:05Z</updated>

		<summary type="html">&lt;p&gt;Sm990: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Component Release Files ==&lt;br /&gt;
Included in this example are zip files for four releases. You will need to download all four to exercise the features of this example.&lt;br /&gt;
&lt;br /&gt;
=== Version 1.0 ===&lt;br /&gt;
The zip file can be downloaded from &lt;br /&gt;
[http://joomlacode.org/gf/download/frsrelease/16495/72056/democompupdate_10.zip democompupdate_10.zip].&lt;br /&gt;
It contains files:&lt;br /&gt;
* democompupdate_10/democompupdate.xml&lt;br /&gt;
* democompupdate_10/script.php&lt;br /&gt;
* democompupdate_10/admin/sql/install_data.sql&lt;br /&gt;
* democompupdate_10/admin/sql/uninstall.sql&lt;br /&gt;
* democompupdate_10/admin/sql/updates/1.0.sql&lt;br /&gt;
* democompupdate_10/site/controller.php&lt;br /&gt;
* democompupdate_10/site/democompupdate.php&lt;br /&gt;
* democompupdate_10/site/models/democompupdate.php&lt;br /&gt;
* democompupdate_10/site/views/democompupdate/view.html.php&lt;br /&gt;
* democompupdate_10/site/views/democompupdate/tmpl/default.php&lt;br /&gt;
&lt;br /&gt;
=== Version 1.0.j3 ===&lt;br /&gt;
The zip file can be downloaded from &lt;br /&gt;
[http://joomlacode.org/gf/download/frsrelease/16495/72057/democompupdate_10j3.zip democompupdate_10j3.zip].  It is identical to version 1.0, except that is requires Joomla 30.0.  The intent is that this will cause an abort of the install or update.&lt;br /&gt;
Diff&#039;s of &#039;&#039;democompupdate_10&#039;&#039; and &#039;&#039;democompupdate_10j3&#039;&#039; show how files have changed.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff -r democompupdate_10/ democompupdate_10j3/&lt;br /&gt;
diff -r democompupdate_10/democompupdate.xml democompupdate_10j3/democompupdate.xml&lt;br /&gt;
2c2&lt;br /&gt;
&amp;lt; &amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; &amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;30.0&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
diff -r democompupdate_10/script.php democompupdate_10j3/script.php&lt;br /&gt;
17c17&lt;br /&gt;
&amp;lt;         private $minimum_joomla_release = &#039;1.6.0&#039;;    &lt;br /&gt;
---&lt;br /&gt;
&amp;gt;         private $minimum_joomla_release = &#039;30.0&#039;;    &lt;br /&gt;
26c26&lt;br /&gt;
&amp;lt; 		// this component does not work with Joomla releases prior to 1.6&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 		// this component does not work with Joomla releases prior to 30.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Version 1.1.1 ===&lt;br /&gt;
&lt;br /&gt;
The zip file can be downloaded from &lt;br /&gt;
[http://joomlacode.org/gf/download/frsrelease/16495/72058/democompupdate_111.zip democompupdate_111.zip].&lt;br /&gt;
Diff&#039;s of &#039;&#039;democompupdate_10&#039;&#039; and &#039;&#039;democompupdate_111&#039;&#039; show how files have changed.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff -r democompupdate_10/ democompupdate_111/&lt;br /&gt;
diff -r democompupdate_10/admin/sql/install_data.sql democompupdate_111/admin/sql/install_data.sql&lt;br /&gt;
10c10&lt;br /&gt;
&amp;lt; (1,&#039;1.0&#039;);&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; (1,&#039;1.1.1&#039;);&lt;br /&gt;
Only in democompupdate_111/admin/sql/updates: 1.1.1.sql&lt;br /&gt;
Only in democompupdate_111/admin/sql/updates: 1.1.sql&lt;br /&gt;
diff -r democompupdate_10/democompupdate.xml democompupdate_111/democompupdate.xml&lt;br /&gt;
2c2&lt;br /&gt;
&amp;lt; &amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; &amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;upgrade&amp;quot;&amp;gt;&lt;br /&gt;
8c8&lt;br /&gt;
&amp;lt; 	&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 	&amp;lt;version&amp;gt;1.1.1&amp;lt;/version&amp;gt;&lt;br /&gt;
diff -r democompupdate_10/script.php democompupdate_111/script.php&lt;br /&gt;
12c12&lt;br /&gt;
&amp;lt; 	private $release = &#039;1.0&#039;;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 	private $release = &#039;1.1.1&#039;;&lt;br /&gt;
diff -r democompupdate_10/site/views/democompupdate/view.html.php democompupdate_111/site/views/democompupdate/view.html.php&lt;br /&gt;
25c25&lt;br /&gt;
&amp;lt; 		$myRev = &#039;1.0&#039;;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 		$myRev = &#039;1.1.1&#039;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Version 1.3 ===&lt;br /&gt;
The zip file can be downloaded from &lt;br /&gt;
[http://joomlacode.org/gf/download/frsrelease/16495/72059/democompupdate_13.zip democompupdate_13.zip].&lt;br /&gt;
Diff&#039;s of &#039;&#039;democompupdate_111&#039;&#039; and &#039;&#039;democompupdate_13&#039;&#039; show how files have changed.&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
diff -r democompupdate_111/ democompupdate_13/&lt;br /&gt;
diff -r democompupdate_111/admin/sql/install_data.sql democompupdate_13/admin/sql/install_data.sql&lt;br /&gt;
10c10,12&lt;br /&gt;
&amp;lt; (1,&#039;1.1.1&#039;);&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; (1,&#039;1.1.1&#039;),&lt;br /&gt;
&amp;gt; (2,&#039;1.2.1&#039;),&lt;br /&gt;
&amp;gt; (3,&#039;1.3&#039;);&lt;br /&gt;
Only in democompupdate_13/admin/sql/updates: 1.2.1.sql&lt;br /&gt;
Only in democompupdate_13/admin/sql/updates: 1.2.sql&lt;br /&gt;
Only in democompupdate_13/admin/sql/updates: 1.3.sql&lt;br /&gt;
diff -r democompupdate_111/democompupdate.xml democompupdate_13/democompupdate.xml&lt;br /&gt;
8c8&lt;br /&gt;
&amp;lt; 	&amp;lt;version&amp;gt;1.1.1&amp;lt;/version&amp;gt;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 	&amp;lt;version&amp;gt;1.3&amp;lt;/version&amp;gt;&lt;br /&gt;
diff -r democompupdate_111/script.php democompupdate_13/script.php&lt;br /&gt;
12c12&lt;br /&gt;
&amp;lt; 	private $release = &#039;1.1.1&#039;;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 	private $release = &#039;1.3&#039;;&lt;br /&gt;
diff -r democompupdate_111/site/views/democompupdate/view.html.php democompupdate_13/site/views/democompupdate/view.html.php&lt;br /&gt;
25c25&lt;br /&gt;
&amp;lt; 		$myRev = &#039;1.1.1&#039;;&lt;br /&gt;
---&lt;br /&gt;
&amp;gt; 		$myRev = &#039;1.3&#039;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Update_SQL_files)&amp;diff=64650</id>
		<title>Archived:Managing Component Updates (Update SQL files)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Update_SQL_files)&amp;diff=64650"/>
		<updated>2012-02-02T02:17:37Z</updated>

		<summary type="html">&lt;p&gt;Sm990: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}}&lt;br /&gt;
&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Update SQL files ==&lt;br /&gt;
The update SQL file(s) are located in a directory that is listed in the manifest file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;update&amp;gt; &lt;br /&gt;
	&amp;lt;schemas&amp;gt; &lt;br /&gt;
		&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt; &lt;br /&gt;
	&amp;lt;/schemas&amp;gt; &lt;br /&gt;
&amp;lt;/update&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a file for each component version.  Each file name must match the version string in the manifest file for that version.  Joomla uses this string to determine which SQL files(s) to execute, and in what order they will be executed.  Joomla uses the PHP &#039;&#039;version_compare&#039;&#039; function for this.  Familiarize yourself with this function.  Your version strings need to adhere to the conventions of this function.&lt;br /&gt;
For example, the SQL files for version 1.3 of this example include:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
1.0.sql&lt;br /&gt;
  (empty)&lt;br /&gt;
&lt;br /&gt;
1.1.sql&lt;br /&gt;
  UPDATE `#__democompupdate_mytable` SET myvalue=&#039;Version 1.1 text&#039; WHERE id=1;&lt;br /&gt;
&lt;br /&gt;
1.1.1.sql&lt;br /&gt;
  UPDATE `#__democompupdate_mytable` SET myvalue=&#039;Version 1.1.1 text&#039; WHERE id=1;&lt;br /&gt;
&lt;br /&gt;
1.2.sql&lt;br /&gt;
  INSERT INTO `#__democompupdate_mytable` (id,myvalue) VALUES (2,&#039;Version 1.2 text&#039;);&lt;br /&gt;
&lt;br /&gt;
1.2.1.sql&lt;br /&gt;
  UPDATE `#__democompupdate_mytable` SET myvalue=&#039;Version 1.2.1 text&#039; WHERE id=2;&lt;br /&gt;
&lt;br /&gt;
1.3.sql&lt;br /&gt;
  INSERT INTO `#__democompupdate_mytable` (id,myvalue) VALUES (3,&#039;Version 1.3 text&#039;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example has complete install files for component versions 1.0 (initial), 1.1.1 and 1.3.  Update SQL files are included for additional incremental component versions (1.1, 1.2 and 1.2.1) between these three versions.  These extra versions illustrate the process for updates that span more than one incremental version.&lt;br /&gt;
&lt;br /&gt;
* When updating from version 1.0 to version 1.1.1, both files 1.1.sql and 1.1.1.sql are executed.  The SQL commands update the value of the first, and only, row in the database table.  The command in 1.1.1.sql over-writes the value that was written by 1.1.sql.&lt;br /&gt;
* When updating from version 1.1.1 to version 1.3, files 1.2.sql, 1.2.1.sql and 1.3.sql are executed.  The commands in 1.2.sql and 1.3.sql each create a new row in the database table.&lt;br /&gt;
* When updating from version 1.0 directly to 1.3, files 1.1.sql, 1.1.1.sql, 1.2.sql, 1.2.1.sql and 1.3.sql are all executed.  You can see the cumulative effect of the table changes in the component front-end.&lt;br /&gt;
&lt;br /&gt;
Joomla executes the database updates in the sequence that would occur, as if the user had updated each version separately.  This would be necessary if an incremental database update depended on the correct update from the previous version.  An example would be: if a modification of a table value during one update depended on the addition of a new table field during a previous update.&lt;br /&gt;
&lt;br /&gt;
Joomla uses the PHP function &#039;&#039;version_compare&#039;&#039; to define the execution order of the SQL files.  The sequencing of your component version string must adhere to that defined by the &#039;&#039;version_compare&#039;&#039; function.&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Script.php)&amp;diff=64649</id>
		<title>Archived:Managing Component Updates (Script.php)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Script.php)&amp;diff=64649"/>
		<updated>2012-02-02T02:17:09Z</updated>

		<summary type="html">&lt;p&gt;Sm990: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Script.php ==&lt;br /&gt;
This file contains the component-specific methods preflight, install, update, postflight and uninstall.  This file is where the component developer implements all of the unique code for these actions.&lt;br /&gt;
For this example, in addition to various checks, HTML is inserted into the back-end output to show which code has been executed.  You may choose to display different HTML, or to display none for your component.&lt;br /&gt;
&lt;br /&gt;
=== preflight ===&lt;br /&gt;
This is where most of the checking should be done before install, update or discover_install.  Preflight is executed prior to any Joomla install, update or discover_install actions.  Preflight is not executed on uninstall.  A string denoting the type of action (install, update or discover_install) is passed to preflight in the $type operand.  Your code can use this string to execute different checks and responses for the three cases.&lt;br /&gt;
&lt;br /&gt;
It is appropriate to check the Joomla version and the existing component version in the preflight module.  A failure of either of these two should cause an abort of the action.  An abort is triggered by returning a false value from this preflight method.  On receiving a false return value, Joomla will reverse any actions already completed.&lt;br /&gt;
&lt;br /&gt;
The PHP function &#039;&#039;version_compare&#039;&#039; is useful to compare version strings.  Joomla also uses &#039;&#039;version_compare&#039;&#039; to define the sequence of SQL file execution, when an update is being executed that spans multiple versions.&lt;br /&gt;
&lt;br /&gt;
In this example, the preflight method checks that Joomla version 1.6 or greater is in use.  If an earlier Joomla version is in use, the install or update will abort.  Since this script.php file only works in Joomla version 1.6 or greater, this check is currently not very useful.  As subsequent Joomla versions become available, this check will be useful.  Try changing the version string in the script.php file to a value greater than the Joomla version that you are using.  Installs and updates should fail. This is what the version &#039;&#039;democompupdate_10j3.zip&#039;&#039; demonstrates.&lt;br /&gt;
&lt;br /&gt;
In addition to failing, it is important to give the web site administrator useful information as to why the component installation failed. See the example below.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function preflight( $type, $parent ) {&lt;br /&gt;
	$jversion = new JVersion();&lt;br /&gt;
&lt;br /&gt;
        // Extract the version number from the manifest file&lt;br /&gt;
        $this-&amp;gt;release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;version;&lt;br /&gt;
&lt;br /&gt;
        // Find mimimum required joomla version from the manifest file&lt;br /&gt;
        $this-&amp;gt;minimum_joomla_release = $parent-&amp;gt;get( &amp;quot;manifest&amp;quot; )-&amp;gt;attributes()-&amp;gt;version;        &lt;br /&gt;
&lt;br /&gt;
	if( version_compare( $jversion-&amp;gt;getShortVersion(), $this-&amp;gt;minimum_joomla_release, &#039;lt&#039; ) ) {&lt;br /&gt;
		Jerror::raiseWarning(null, &#039;Cannot install com_democompupdate in a Joomla release prior to &#039;. $this-&amp;gt;minimum_joomla_release);&lt;br /&gt;
		return false;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// abort if the component being installed is not newer than the currently installed version&lt;br /&gt;
	if ( $type == &#039;update&#039; ) {&lt;br /&gt;
		$oldRelease = $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
		$rel = $oldRelease . &#039; to &#039; . $this-&amp;gt;release;&lt;br /&gt;
		if ( version_compare( $this-&amp;gt;release, $oldRelease, &#039;le&#039; ) ) {&lt;br /&gt;
			Jerror::raiseWarning(null, &#039;Incorrect version sequence. Cannot upgrade &#039; . $rel);&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	else { $rel = $this-&amp;gt;release; }&lt;br /&gt;
		&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_PREFLIGHT_&#039; . $type . &#039; &#039; . $rel) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== install ===&lt;br /&gt;
Install is executed after the Joomla install database scripts have completed. Returning &#039;false&#039; will abort the install and undo any changes already made.&lt;br /&gt;
It is cleaner to abort the install during preflight, if possible.  Since fewer install actions have occurred at preflight, there is less risk that that their reversal may be done incorrectly.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function install( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_INSTALL to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	// Following an install, the backend can jump directly to the newly installed component configuration page&lt;br /&gt;
	$parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== update ===&lt;br /&gt;
Update is executed after the Joomla update database scripts have completed.  Returning &#039;false&#039; will abort the update and undo any changes already made.&lt;br /&gt;
It is cleaner to abort the update during preflight, if possible.  Since fewer update actions have occurred at preflight, there is less risk that that their reversal may be done incorrectly.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function update( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UPDATE_ to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	// Following an update, the backend can jump directly to the newly installed component configuration page&lt;br /&gt;
	$parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== postflight ===&lt;br /&gt;
Postflight is executed after the Joomla install, update or discover_update actions have completed.  It is not executed after uninstall.  Postflight is executed after the extension is registered in the database.  The type of action (install, update or discover_install) is passed to postflight in the $type operand. Postflight cannot cause an abort of the Joomla install, update or discover_install action.&lt;br /&gt;
&lt;br /&gt;
The postflight method is a good place to set the default values of component parameters during installs, and to set the values of hidden component parameters during installs and updates.  Postflight can be used for any other action that must follow the install, update or discover_install actions.&lt;br /&gt;
&lt;br /&gt;
This example defines component parameters in postflight.  The value of &#039;&#039;my_param0&#039;&#039; is displayed in the component front-end.  Both &#039;&#039;my_param0&#039;&#039; and &#039;&#039;my_param1&#039;&#039; are overwritten in updates. This is how you would change the component revision number during an update. The example &#039;&#039;myparam2&#039;&#039; is how you would treat parameters that you expect users to define, and you do not want to overwrite during an update. Parameters that define component operation would be treated this way.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function postflight( $type, $parent ) {&lt;br /&gt;
	// always create or modify these parameters&lt;br /&gt;
	$params[&#039;my_param0&#039;] = &#039;Component version &#039; . $this-&amp;gt;release;&lt;br /&gt;
	$params[&#039;my_param1&#039;] = &#039;Another value&#039;;&lt;br /&gt;
&lt;br /&gt;
	// define the following parameters only if it is an original install&lt;br /&gt;
	if ( $type == &#039;install&#039; ) {&lt;br /&gt;
		$params[&#039;my_param2&#039;] = &#039;4&#039;;&lt;br /&gt;
		$params[&#039;my_param3&#039;] = &#039;Star&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	$this-&amp;gt;setParams( $params );&lt;br /&gt;
&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_POSTFLIGHT &#039; . $type . &#039; to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== uninstall ===&lt;br /&gt;
The uninstall method is executed before any Joomla uninstall action, such as file removal or database changes.  Uninstall cannot cause an abort of the Joomla uninstall action, so returning false would be a waste of time.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function uninstall( $parent ) {&lt;br /&gt;
	echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UNINSTALL &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The entire script.php file ==&lt;br /&gt;
This is the entire script.php file for version 1.0.&lt;br /&gt;
Note the definition of the variable &#039;&#039;$release&#039;&#039;.&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(&#039;Restricted access&#039;);&lt;br /&gt;
&lt;br /&gt;
//the name of the class must be the name of your component + InstallerScript&lt;br /&gt;
//for example: com_contentInstallerScript for com_content.&lt;br /&gt;
class com_democompupdateInstallerScript&lt;br /&gt;
{&lt;br /&gt;
	/*&lt;br /&gt;
	 * The release value to be displayed and checked against throughout this file.&lt;br /&gt;
	 */&lt;br /&gt;
	private $release = &#039;1.0&#039;;&lt;br /&gt;
&lt;br /&gt;
        /*&lt;br /&gt;
         * Find mimimum required joomla version for this extension. It will be read from the version attribute (install tag) in the manifest file&lt;br /&gt;
         */&lt;br /&gt;
        private $minimum_joomla_release = &#039;1.6.0&#039;;    &lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * $type is the type of change (install, update or discover_install, not uninstall).&lt;br /&gt;
	 * preflight runs before anything else and while the extracted files are in the uploaded temp folder.&lt;br /&gt;
	 * If preflight returns false, Joomla will abort the update and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function preflight( $type, $parent ) {&lt;br /&gt;
		// this component does not work with Joomla releases prior to 1.6&lt;br /&gt;
		// abort if the current Joomla release is older&lt;br /&gt;
		$jversion = new JVersion();&lt;br /&gt;
&lt;br /&gt;
                // Extract the version number from the manifest. This will overwrite the 1.0 value set above &lt;br /&gt;
                $this-&amp;gt;release=$parent-&amp;gt;get(&amp;quot;manifest&amp;quot;)-&amp;gt;version;&lt;br /&gt;
                &lt;br /&gt;
                // Find mimimum required joomla version&lt;br /&gt;
                $this-&amp;gt;minimum_joomla_release=$parent-&amp;gt;get(&amp;quot;manifest&amp;quot;)-&amp;gt;attributes()-&amp;gt;version;    &lt;br /&gt;
&lt;br /&gt;
		if( version_compare( $jversion-&amp;gt;getShortVersion(), $this-&amp;gt;minimum_joomla_release, &#039;lt&#039; ) ) {&lt;br /&gt;
			Jerror::raiseWarning(null, &#039;Cannot install com_democompupdate in a Joomla release prior to &#039;.$this-&amp;gt;minimum_joomla_release);&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// abort if the component being installed is not newer than the currently installed version&lt;br /&gt;
		if ( $type == &#039;update&#039; ) {&lt;br /&gt;
			$oldRelease = $this-&amp;gt;getParam(&#039;version&#039;);&lt;br /&gt;
			$rel = $oldRelease . &#039; to &#039; . $this-&amp;gt;release;&lt;br /&gt;
			if ( version_compare( $this-&amp;gt;release, $oldRelease, &#039;le&#039; ) ) {&lt;br /&gt;
				Jerror::raiseWarning(null, &#039;Incorrect version sequence. Cannot upgrade &#039; . $rel);&lt;br /&gt;
				return false;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
		else { $rel = $this-&amp;gt;release; }&lt;br /&gt;
		&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_PREFLIGHT_&#039; . $type . &#039; &#039; . $rel) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * install runs after the database scripts are executed.&lt;br /&gt;
	 * If the extension is new, the install method is run.&lt;br /&gt;
	 * If install returns false, Joomla will abort the install and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function install( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_INSTALL to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
		// You can have the backend jump directly to the newly installed component configuration page&lt;br /&gt;
		// $parent-&amp;gt;getParent()-&amp;gt;setRedirectURL(&#039;index.php?option=com_democompupdate&#039;);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * update runs after the database scripts are executed.&lt;br /&gt;
	 * If the extension exists, then the update method is run.&lt;br /&gt;
	 * If this returns false, Joomla will abort the update and undo everything already done.&lt;br /&gt;
	 */&lt;br /&gt;
	function update( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UPDATE_ to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method.&lt;br /&gt;
	 * $type is the type of change (install, update or discover_install, not uninstall).&lt;br /&gt;
	 * postflight is run after the extension is registered in the database.&lt;br /&gt;
	 */&lt;br /&gt;
	function postflight( $type, $parent ) {&lt;br /&gt;
		// always create or modify these parameters&lt;br /&gt;
		$params[&#039;my_param0&#039;] = &#039;Component version &#039; . $this-&amp;gt;release;&lt;br /&gt;
		$params[&#039;my_param1&#039;] = &#039;Another value&#039;;&lt;br /&gt;
 &lt;br /&gt;
		// define the following parameters only if it is an original install&lt;br /&gt;
		if ( $type == &#039;install&#039; ) {&lt;br /&gt;
			$params[&#039;my_param2&#039;] = &#039;4&#039;;&lt;br /&gt;
			$params[&#039;my_param3&#039;] = &#039;Star&#039;;&lt;br /&gt;
		}&lt;br /&gt;
 &lt;br /&gt;
		$this-&amp;gt;setParams( $params );&lt;br /&gt;
 &lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_POSTFLIGHT &#039; . $type . &#039; to &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * $parent is the class calling this method&lt;br /&gt;
	 * uninstall runs before any other action is taken (file removal or database processing).&lt;br /&gt;
	 */&lt;br /&gt;
	function uninstall( $parent ) {&lt;br /&gt;
		echo &#039;&amp;lt;p&amp;gt;&#039; . JText::_(&#039;COM_DEMOCOMPUPDATE_UNINSTALL &#039; . $this-&amp;gt;release) . &#039;&amp;lt;/p&amp;gt;&#039;;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * get a variable from the manifest file (actually, from the manifest cache).&lt;br /&gt;
	 */&lt;br /&gt;
	function getParam( $name ) {&lt;br /&gt;
		$db = JFactory::getDbo();&lt;br /&gt;
		$db-&amp;gt;setQuery(&#039;SELECT manifest_cache FROM #__extensions WHERE name = &amp;quot;com_democompupdate&amp;quot;&#039;);&lt;br /&gt;
		$manifest = json_decode( $db-&amp;gt;loadResult(), true );&lt;br /&gt;
		return $manifest[ $name ];&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * sets parameter values in the component&#039;s row of the extension table&lt;br /&gt;
	 */&lt;br /&gt;
	function setParams($param_array) {&lt;br /&gt;
		if ( count($param_array) &amp;gt; 0 ) {&lt;br /&gt;
			// read the existing component value(s)&lt;br /&gt;
			$db = JFactory::getDbo();&lt;br /&gt;
			$db-&amp;gt;setQuery(&#039;SELECT params FROM #__extensions WHERE name = &amp;quot;com_democompupdate&amp;quot;&#039;);&lt;br /&gt;
			$params = json_decode( $db-&amp;gt;loadResult(), true );&lt;br /&gt;
			// add the new variable(s) to the existing one(s)&lt;br /&gt;
			foreach ( $param_array as $name =&amp;gt; $value ) {&lt;br /&gt;
				$params[ (string) $name ] = (string) $value;&lt;br /&gt;
			}&lt;br /&gt;
			// store the combined new and existing values back as a JSON string&lt;br /&gt;
			$paramsString = json_encode( $params );&lt;br /&gt;
			$db-&amp;gt;setQuery(&#039;UPDATE #__extensions SET params = &#039; .&lt;br /&gt;
				$db-&amp;gt;quote( $paramsString ) .&lt;br /&gt;
				&#039; WHERE name = &amp;quot;com_democompupdate&amp;quot;&#039; );&lt;br /&gt;
				$db-&amp;gt;query();&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
*[[User:tapaccos|Alex Tapaccos]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=64648</id>
		<title>Archived:Managing Component Updates (Manifest file)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Managing_Component_Updates_(Manifest_file)&amp;diff=64648"/>
		<updated>2012-02-02T02:16:30Z</updated>

		<summary type="html">&lt;p&gt;Sm990: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{review}}&lt;br /&gt;
{{RightTOC}}&lt;br /&gt;
This tutorial is for Joomla {{JVer|1.6}} {{JVer|1.7}}&lt;br /&gt;
== Articles in this series ==&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_1|Overview]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_2|Manifest file]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_3|Script.php]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_4|Update SQL files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_5|Component release files]]&lt;br /&gt;
* [[Managing_Component_Updates_with_Joomla!1.6_-_Part_6|How to use this example]]&lt;br /&gt;
&lt;br /&gt;
== Manifest File (democompupdate.xml) ==&lt;br /&gt;
The manifest file in this example is very similar to that of normal components.  Important contents for this example include:&lt;br /&gt;
&lt;br /&gt;
=== sql folder ===&lt;br /&gt;
Note the inclusion of the SQL folder in the administration files section.  This tells Joomla to copy the contents of this folder to the web site during install or update.  The &#039;&#039;schemapath&#039;&#039; declaration below depends on Joomla copying these files during the install or update process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;administration&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt; &lt;br /&gt;
		&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt; &lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== name ===&lt;br /&gt;
This is the name of the component.  The &#039;getParam($key)&#039; method in the &#039;&#039;script.php&#039;&#039; file uses this value to identify the correct row in the extensions table.  The &#039;&#039;manifest_cache&#039;&#039; field in the &#039;&#039;extensions&#039;&#039; table has the version string for the currently installed component.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== version ===&lt;br /&gt;
Joomla stores this value in the &#039;&#039;manifest_cache&#039;&#039; field of the &#039;&#039;extensions&#039;&#039; table.  The &#039;&#039;extensions&#039;&#039; table is where the custom code in the &#039;&#039;script.php&#039;&#039; file reads the version string of the currently installed component, and compares it to the version string of the update.&lt;br /&gt;
&lt;br /&gt;
The custom component code uses this comparison to abort an update, if the version sequence is not allowed.  Joomla also compares this string to the SQL update file names, to determine which SQL commands to execute.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== schemapath ===&lt;br /&gt;
This defines the directory that contains SQL files for component incremental database updates.&lt;br /&gt;
You may choose to put the SQL files somewhere else in your component release, but make sure their location is documented here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;update&amp;gt; &lt;br /&gt;
	&amp;lt;schemas&amp;gt; &lt;br /&gt;
		&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt; &lt;br /&gt;
	&amp;lt;/schemas&amp;gt; &lt;br /&gt;
&amp;lt;/update&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The entire manifest file ==&lt;br /&gt;
Here is the entire manifest file for version 1.0.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension type=&amp;quot;component&amp;quot; version=&amp;quot;1.6&amp;quot; method=&amp;quot;new&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;name&amp;gt;COM_DEMOCOMPUPDATE&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;2011 05 11&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;Your Name Here&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;Free to copy&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;none&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;Test the Install and Update Process&amp;lt;/description&amp;gt;&lt;br /&gt;
	&amp;lt;!-- Runs on install/uninstall/update; New in 1.6 --&amp;gt;&lt;br /&gt;
	&amp;lt;scriptfile&amp;gt;script.php&amp;lt;/scriptfile&amp;gt;&lt;br /&gt;
	&amp;lt;install&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/install_data.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/install&amp;gt;&lt;br /&gt;
	&amp;lt;uninstall&amp;gt;&lt;br /&gt;
		&amp;lt;sql&amp;gt;&lt;br /&gt;
			&amp;lt;file driver=&amp;quot;mysql&amp;quot; charset=&amp;quot;utf8&amp;quot;&amp;gt;sql/uninstall.sql&amp;lt;/file&amp;gt;&lt;br /&gt;
		&amp;lt;/sql&amp;gt;&lt;br /&gt;
	&amp;lt;/uninstall&amp;gt;&lt;br /&gt;
	&amp;lt;update&amp;gt;&lt;br /&gt;
		&amp;lt;schemas&amp;gt;&lt;br /&gt;
			&amp;lt;schemapath type=&amp;quot;mysql&amp;quot;&amp;gt;sql/updates&amp;lt;/schemapath&amp;gt;&lt;br /&gt;
		&amp;lt;/schemas&amp;gt;&lt;br /&gt;
	&amp;lt;/update&amp;gt;&lt;br /&gt;
	&amp;lt;files folder=&amp;quot;site&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;democompupdate.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;controller.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;models&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;views&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;administration&amp;gt;&lt;br /&gt;
		&amp;lt;files folder=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;folder&amp;gt;sql&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;/administration&amp;gt;&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
*[[User:sm990|Kim Eckert]]&lt;br /&gt;
&lt;br /&gt;
[[category:Joomla! 1.6]]&lt;br /&gt;
[[category:Joomla! 1.7]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Component Development]]&lt;/div&gt;</summary>
		<author><name>Sm990</name></author>
	</entry>
</feed>