This example compares the cms root item with code FS_MIRROR to the folder indexedcontent (relative path to the www) on disc.
If the cms folder doesn't completely mirror the files and (sub)folder(s) on disc, the syncfilelinks macro will generate an Import xml file and will return true.
After importing this file (using e.g. webservice call to the Asynchronous Import module), the cms folder will exactly mirror the folder on disc.
This example uses the syncfilelinks macro to generate an Import xml file with changes to be made to exactly mirror the specified folder on disc.
By (built-in) default, the syncfilelinks macro uses contenttype FileLink (FLK) for generating page nodes within this import xml (see example below).
XML |
Copy Code
|
<?xml version="1.0"?>
<page update="false">
<contenttype code="CWP" storage="SixCT.SimpleLookupStorage" />
<nr>1476</nr>
<code><![CDATA[FS_INDEXEDCONTENT]]></code>
<children>
<page update="false">
<title><![CDATA[Images]]></title>
<contenttype code="WP" storage="SixCT.SimpleLookupStorage" />
<folder type="xsd:boolean">1</folder>
<defaultcontenttype code="FLK" storage="SixCT.DefaultContentTypeStorage" />
<nr>2736</nr>
<code><![CDATA[GUID-242FB159559745488F0F4498B371A359]]></code>
<children>
<page update="false">
<title><![CDATA[IIS 7.0 config]]></title>
<contenttype code="WP" storage="SixCT.SimpleLookupStorage" />
<folder type="xsd:boolean">1</folder>
<defaultcontenttype code="FLK" storage="SixCT.DefaultContentTypeStorage" />
<nr>2737</nr>
<code><![CDATA[GUID-7A173C241FA34299B94A0F40D4D1C5B0]]></code>
<children>
<page>
<title><![CDATA[Application Pool - Idle timeout]]></title>
<contenttype code="FLK" storage="SixCT.SimpleLookupStorage" />
<filetype code="PNG" storage="SixCT.SimpleLookupStorage" />
<url><![CDATA[/indexcontent/Images/IIS 7.0 config/Application Pool - Idle timeout.png]]></url>
<file_lastwritetime type="xsd:dateTime">2010-10-08T13:42:20.000</file_lastwritetime>
<file_creationtime type="xsd:dateTime">2011-02-10T16:06:17.742</file_creationtime>
<file_size>38313</file_size>
<file_extension>.png</file_extension>
</page>
</children>
</page>
</children>
</page>
</children>
</page>
|
This Import xml contains one page node (the page node with title Application Pool - Idle timeout) which will be added when the xml is imported. The page nodes higher in the hierarchy just reflect the cms hierarchy, so the Importer knows where to insert/update the item (the update=false attribute instructs the Importer not to update the corresponding items).
If you want to use a different contenttype for items referencing files on disc, you need to adjust the generated Import xml. Notice however, the contenttype used must belong to the Reference contenttype group.
The example below shows you how this can be achieved.
It uses the writefileproperties (introduced in 1.4 build 2) parameter, to have the syncfilelinks macro also output generic file properties for each file (the four nodes in the example above starting with "file_"). Then the xml file is transformed using the transform macro, changing the contenttype used and mapping the file_lastwritetime node to the adddate field.