Update site
Goal
This packaging task goal is to update site.
It’s support partial update (you don’t need to update all your website).
Update rules
- If page / folder / template / bloc is found, then it is updated
- If page / folder / template / bloc is not found, then it is created
- We never delete pages by update
Packaging task configuration
The packaging task need some configuration :
<extension name="com.axemble.vdoc.update.easysite.UpdateSiteExtension" critical="true">
<param name="file" value="update.zip"/>
<param name="name" value="workplace"/>
</extension>
Parameter | Mandatory | Description |
---|---|---|
name | true | System name of the site to update |
file | true | the update file name (located in custom/resources directory) |
Building a partial update ZIP file
Export site with new page / folder / template / bloc as new ZIP file (we name it original.zip).
Extract orignal.zip you got tree tree /F
like it :
ROOT
│ site.xml
│ template.xml
│
├───storage
│ │ storage.xml
│ │
│ ├───documents
│ └───files
└───structure
│ structure.xml
│
├───contents
│ xx.xml
│ xx.xml
│ ...
│
├───folders
│ xx.xml
│ xx.xml
│ ...
│
└───forms
ROOT directory
The root directory contains 2 files :
site.xml
The site.xml contain site configuration.
If your import don’t need update site configuration the easiest way is to omit this file in your update. This will print warn message.
If the target site have configuration take care and don’t overwrite it.
template.xml
The template.xml describes the export versions. You may not change it.
storage directory
This directory contains document space files.
This is not supported by update. You can cleanup this directory to reduce final zip size.
structure directory
This directory contains all page, folder, template and bloc now we will see how to keep essential.
structure.xml
structure.xml describes elements to be updated.
<?xml version="1.0" encoding="UTF-8"?>
<structure>
<rootFolder>
<folder active="true" def="1.xml" name=".templates" newWindow="false" noStats="false" unindexed="false" visibility="visible">
<content active="true" def="1.xml" name="sys-default-template" newWindow="false" noStats="false" status="approved" type="template" unindexed="false" visibility="visible"/>
...
</folder>
<folder active="true" def="2.xml" name=".common" newWindow="false" noStats="false" unindexed="false" visibility="visible">
<folder active="true" def="3.xml" name="commun" newWindow="false" noStats="false" unindexed="false" visibility="visible">
<content active="true" def="8.xml" name="pied-de-page" newWindow="false" noStats="false" status="approved" type="block" unindexed="false" visibility="visible"/>
...
</folder>
</folder>
<folder active="true" def="4.xml" name=".plugins" newWindow="false" noStats="false" unindexed="false" visibility="visible">
<folder active="true" def="5.xml" name="sys.filecenter" newWindow="false" noStats="false" type="plugin" unindexed="false" visibility="visible"/>
...
</folder>
<folder active="true" def="14.xml" name="custom" newWindow="false" noStats="false" unindexed="false" visibility="visible">
<folder active="true" def="15.xml" name="techcenter" newWindow="false" noStats="false" unindexed="false" visibility="visible">
<folder active="true" def="16.xml" name="explorer" newWindow="false" noStats="false" unindexed="false" visibility="visible">
<content active="true" def="24.xml" name="index" newWindow="false" noStats="false" status="approved" type="page" unindexed="false" visibility="visible"/>
</folder>
<folder active="true" def="17.xml" name="my-search" newWindow="false" noStats="false" unindexed="false" visibility="visible">
<content active="true" def="25.xml" name="index" newWindow="false" noStats="false" status="approved" type="page" unindexed="false" visibility="visible"/>
</folder>
</folder>
</folder>
</rootFolder>
</structure>
Oh my god. How does it work?
It’s pretty easy. We have :
- folder:
- system folder: is a folder node whose have a dot prefixed name.
- folder: is a folder node
- plugin: is a folder with type=“plugin”
- content:
- template: is a content in the .templates folder
- bloc: is a content in the .commons folder
- page: any other content
In this sample we need to update 2 pages : custom/techcenter/explorer/index and custom/techcenter/my-search/index.
We just need to keep content and content’s parents folders.
<?xml version="1.0" encoding="UTF-8"?>
<structure>
<rootFolder>
<folder active="true" def="14.xml" name="custom" newWindow="false" noStats="false" unindexed="false" visibility="visible">
<folder active="true" def="15.xml" name="techcenter" newWindow="false" noStats="false" unindexed="false" visibility="visible">
<folder active="true" def="16.xml" name="explorer" newWindow="false" noStats="false" unindexed="false" visibility="visible">
<content active="true" def="24.xml" name="index" newWindow="false" noStats="false" status="approved" type="page" unindexed="false" visibility="visible"/>
</folder>
<folder active="true" def="17.xml" name="my-search" newWindow="false" noStats="false" unindexed="false" visibility="visible">
<content active="true" def="25.xml" name="index" newWindow="false" noStats="false" status="approved" type="page" unindexed="false" visibility="visible"/>
</folder>
</folder>
</folder>
</rootFolder>
</structure>
Now you can cleanup folders and contents directories to keep only needed def=“xx.xml” (but it’s not mandatory)
Create update ZIP
Now you can zip the updated directory to get the same zip archive as original.xml it’s the update.zip