Actions

J2.5

Difference between revisions of "Managing Component Updates (Manifest file)"

From Joomla! Documentation

m (sql folder)
m (name)
Line 24: Line 24:
  
 
=== name ===
 
=== name ===
This is the name of the component.  The 'getParam($key)' method in the script.php file uses this value to identify the correct row in the extensions table.  The manifest_cache field in the extensions table has the version string for the currently installed component.
+
This is the name of the component.  The 'getParam($key)' method in the ''script.php'' file uses this value to identify the correct row in the extensions table.  The ''manifest_cache'' field in the ''extensions'' table has the version string for the currently installed component.
  
 
<source lang="xml">
 
<source lang="xml">

Revision as of 12:44, 4 June 2011

Copyedit.png
This Page Needs Your Help

This page is tagged because it NEEDS REVIEW. You can help the Joomla! Documentation Wiki by contributing to it.
More pages that need help similar to this one are here. NOTE-If you feel the need is satistified, please remove this notice.


This tutorial is for Joomla Joomla 1.6

Contents

Articles in this series

Manifest File (democompupdate.xml)

The manifest file in this example is very similar to that of normal components. Important contents for this example include:

sql folder

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 SQL folder contains one SQL file for each incremental update.

<administration>
        <files folder="admin"> 
                <folder>sql</folder> 
        </files>
</administration>

name

This is the name of the component. The 'getParam($key)' method in the script.php file uses this value to identify the correct row in the extensions table. The manifest_cache field in the extensions table has the version string for the currently installed component.

<name>COM_DEMOCOMPUPDATE</name>

version

Joomla stores this value in the manifest_cache field of the extensions table. The extensions table is where the custom code in the script.php file reads the version string of the currently installed component, and compares it to the version string of the update.

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.

<version>1.0</version>

update

This defines the directory that contains SQL files for component incremental database updates. You may choose to put the SQL files somewhere else in your component release, but make sure their location is documented here.

<update> 
        <schemas> 
                <schemapath type="mysql">sql/updates</schemapath> 
        </schemas> 
</update>

The entire manifest file

Here is the entire manifest file for version 1.0.

<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="1.6" method="new">
        <name>COM_DEMOCOMPUPDATE</name>
        <creationDate>2011 05 11</creationDate>
        <author>Your Name Here</author>
        <copyright>Free to copy</copyright>
        <license>none</license>
        <version>1.0</version>
        <description>Test the Install and Update Process</description>
        <!-- Runs on install/uninstall/update; New in 1.6 -->
        <scriptfile>script.php</scriptfile>
        <install>
                <sql>
                        <file driver="mysql" charset="utf8">sql/install_data.sql</file>
                </sql>
        </install>
        <uninstall>
                <sql>
                        <file driver="mysql" charset="utf8">sql/uninstall.sql</file>
                </sql>
        </uninstall>
        <update>
                <schemas>
                        <schemapath type="mysql">sql/updates</schemapath>
                </schemas>
        </update>
        <files folder="site">
                <filename>democompupdate.php</filename>
                <filename>controller.php</filename>
                <folder>models</folder>
                <folder>views</folder>
        </files>
        <administration>
                <files folder="admin">
                        <folder>sql</folder>
                </files>
        </administration>
</extension>

Contributors