Project

General

Profile

Version infrastructure » History » Version 2

Max Milbers, 04/19/2010 12:02 PM

1 1 Max Milbers
h1. Version infrastructure
2 1 Max Milbers
3 1 Max Milbers
h2. Virtuemart 1.5
4 1 Max Milbers
5 2 Max Milbers
h3. For developers
6 2 Max Milbers
You can easily update your tables in the updateMigration view in the backend ("yourhost.com/administrator/index.php?option=com_virtuemart&view=updatesMigration). Just use the "restore system defaults"
7 2 Max Milbers
8 1 Max Milbers
h2. Virtuemart 1.1.x
9 1 Max Milbers
10 1 Max Milbers
h3. General
11 1 Max Milbers
12 1 Max Milbers
The VirtueMart Version Updater is handled by a prepared Infrastructure of the following components:
13 1 Max Milbers
 
14 1 Max Milbers
    * class vmUpdate in the VirtueMart Installation
15 1 Max Milbers
    * Versions Component on virtuemart.net
16 1 Max Milbers
    * Document Repository on dev.virtuemart.net 
17 1 Max Milbers
18 1 Max Milbers
Basically the update process is the following:
19 1 Max Milbers
20 1 Max Milbers
Update Check + Patch Retrieval
21 1 Max Milbers
22 1 Max Milbers
The VirtueMart Installation asks for the latest available (stable) version of VirtueMart.
23 1 Max Milbers
24 1 Max Milbers
http://virtuemart.net/index2.php?option=com_versions&catid=1&myVersion={$VMVERSION->RELEASE}&task=latestversionastext 
25 1 Max Milbers
26 1 Max Milbers
A number like "1.1.3" is returned - just the number as string, nothing else.
27 1 Max Milbers
28 1 Max Milbers
If the returned Version is higher than the installed Version, the user is allowed to download the Patch Package when available.
29 1 Max Milbers
30 1 Max Milbers
The VirtueMart Installation will ask for the location of the Patch Package:
31 1 Max Milbers
32 1 Max Milbers
http://virtuemart.net/index2.php?option=com_versions&catid=1&myVersion={$VMVERSION->RELEASE}&task=listpatchpackages 
33 1 Max Milbers
34 1 Max Milbers
The Version Component on virtuemart.net must have a new-line separated list of all available Patch Packages in the field "Extra Information:".
35 1 Max Milbers
36 1 Max Milbers
Example:
37 1 Max Milbers
38 1 Max Milbers
http://dev.virtuemart.net/cb/displayDocument/Patch_VirtueMart-1.1.0_TO_VirtueMart-1.1.3.tar.gz?doc_id=xx
39 1 Max Milbers
http://dev.virtuemart.net/cb/displayDocument/Patch_VirtueMart-1.1.1_TO_VirtueMart-1.1.3.tar.gz?doc_id=xxx
40 1 Max Milbers
http://dev.virtuemart.net/cb/displayDocument/Patch_VirtueMart-1.1.2_TO_VirtueMart-1.1.3.tar.gz?doc_id=xxxx
41 1 Max Milbers
42 1 Max Milbers
If the Patch Package exists, the URL is returned as pure Text. Example:
43 1 Max Milbers
44 1 Max Milbers
http://dev.virtuemart.net/cb/displayDocument/Patch_VirtueMart-1.1.2_TO_VirtueMart-1.1.3.tar.gz?doc_id=XXX
45 1 Max Milbers
46 1 Max Milbers
If no Patch Package exists for the requested Version Update, an empty String is returned.
47 1 Max Milbers
48 1 Max Milbers
In the last Step the Document is retrieved from the VirtueMart Document Repository and stored and extracted on the Server the VirtueMart Installation is located on.
49 1 Max Milbers
Patch Package Manifest
50 1 Max Milbers
51 1 Max Milbers
After that the Package is checked for a file called "update.xml". this file must be located in the root of the Patch Package.
52 1 Max Milbers
53 1 Max Milbers
@
54 1 Max Milbers
Here's an example update.xml:
55 1 Max Milbers
56 1 Max Milbers
 <?xml version="1.0"?>
57 1 Max Milbers
 <vmupdate>
58 1 Max Milbers
    <forversion>1.1.0</forversion>
59 1 Max Milbers
    <toversion>1.1.3</toversion>
60 1 Max Milbers
    <releasedate>May 25th 2008</releasedate>
61 1 Max Milbers
    <description>VirtueMart 1.1.3 Update Package for VirtueMart 1.1.0</description>
62 1 Max Milbers
    <files>
63 1 Max Milbers
        <file>administrator/components/com_virtuemart/classes/htmlTools.class.php</file>
64 1 Max Milbers
        <file>administrator/components/com_virtuemart/global.php</file>
65 1 Max Milbers
        <file>administrator/components/com_virtuemart/version.php</file>
66 1 Max Milbers
        <file>components/com_virtuemart/virtuemart.php</file>
67 1 Max Milbers
        <file>components/com_virtuemart/virtuemart_parser.php</file>
68 1 Max Milbers
    </files>
69 1 Max Milbers
    <queries>
70 1 Max Milbers
        <!-- Trailing Semicolons are not necessary -->
71 1 Max Milbers
        <!-- Prefix placeholders must be used (#__ or  #__{vm}, not "jos_") -->
72 1 Max Milbers
        <query>SELECT `id` FROM `jos_components`</query>
73 1 Max Milbers
    </queries>
74 1 Max Milbers
 </vmupdate>
75 1 Max Milbers
@
76 1 Max Milbers
77 1 Max Milbers
The Files in the Package are checked:
78 1 Max Milbers
79 1 Max Milbers
    * do all exist in the local extraction copy of the Patch Package Archive?
80 1 Max Milbers
    * are all target files writable?
81 1 Max Milbers
    * is the target directory writable if the target file doesn't exist? 
82 1 Max Milbers
83 1 Max Milbers
The Patch Packages should always contain an updated version.php file, so the Version Update is visible afterwards.