Skip to content
kanduvisla edited this page Apr 26, 2012 · 2 revisions

The Diff Screen shows external pages to the Pages- en Section XML-files and offers the developer to accept or reject the changes. When the developer accepts the changes, the modified XML files are stored in the cache and required actions (like creating or dropping tbl_entries_data_-fields) are taken. When the changes are rejected, the XML-files in the pages- and sections-folder are deleted and rewritten by the cached data.

The diff process

The diff-process goes as follows:

  1. A cached index is created. This is the index from Symphonys' cache table in the database.
  2. A local index is created. This is a raw index created from the local XML-files in the pages- or sections-folder.
  3. The cached and the local index are compared against each other by using some complex iterating loops. These are discussed further on for Pages and for Sections.
  4. When no errors are found, the developer get the choice to accept or reject the changes.
  5. When errors are found, the developer only gets the choice to reject the changes.

For Pages

  1. Check if the XML files in the pages-directory are valid XML files.
  2. Iterate through each cached page.
  3. Get the local page corresponding to the unique hash.
  4. If more local pages are found, throw an error (since this would mean there are more pages using the same unique hash).
  5. If no local pages are found, delete the page.
  6. If one local page is found:
    1. Check the local page types: add types that don't occur in the cached page types.
    2. Check the cached page types: remove types that don't occur in the local page types.
    3. Check the cached page datasources: remove datasources that don't occur in the local page datasources.
    4. Check the local page datasources: add datasources that don't occur in the cached page datasources, or throw an error if a datasource doesn't exist in the workspace/data-sources-folder.
    5. Check the cached page events: remove events that don't occur in the local page events.
    6. Check the local page events: add events that don't occur in the cached page events, or throw an error if a event doesn't exist in the workspace/events-folder.
    7. For all other elements in the cached page XML: throw an error if the element doesn't exist in the local page XML, or change the element if it differs.
    8. Check if the parent page (if set) exists.
    9. Check if there is a page with a duplicate handle on the same level.
    10. Check if the page type index is only used once.
    11. Check if pages XML file and path matches it's handle and path.
    12. Check if the pages XML file name is correctly named.
    13. Check if there is a XSL-template for this XML-file.
  7. Iterate through the pages in the local index
  8. For each page that doesn't occur in the cached index (=new page)
    1. Check if the pages' hash doesn't already exists in the cached index (needs to be unique).
    2. Check if the pages' parent exists.
    3. Check if the pages' handle is unique for this level.
    4. Check that there is only 1 page of type index.
    5. Check if each datasource exists in the workspace/data-sources-folder.
    6. Check if each event exists in the workspace/events-folder.
    7. Check if pages XML file and path matches it's handle and path.
    8. Check if the pages XML file name is correctly named.
    9. Check if there is a XSL-template for this XML-file.

For more information, check the __viewDiff()-function in content.blueprintspages.php.

For Sections

  1. Check if the XML files in the sections-directory are valid XML files.
  2. Iterate through each cached section.
  3. Get the local section corresponding to the unique hash.
  4. If more local sections are found, throw an error (since this would mean there are more sections using the same unique hash).
  5. If no local sections are found, delete the section.
  6. If one local section is found:
    1. For all elements in the cached section XML (except the fields-node): throw an error if the element doesn't exist in the local section XML, or change the element if it differs.
    2. For the fields-node, iterate through each cached field and:
      1. Check if there are fields with duplicate hashes and if so throw an error.
      2. Delete fields that don't occur in the local section.
      3. If the field is changed:
        1. Iterate through each element and throw an error if the element doesn't occur in the local field.
        2. Check if the field type is an available type in the current Symphony installation and throw an error if not.
    3. For the fields-node, iterate through each local field and:
      1. Check if the field type is an available type in the current Symphony installation and throw an error if not.
      2. Check if the fields' element_name is unique.
  7. Iterate through the sections in the local index
  8. For each section that doesn't occur in the cached index (=new section)
    1. Check if the field types used by this sections are available in this Symphony installation.
    2. Check if the field hashes are unique:
    3. Check if there are no duplicate fields in this section.
    4. Check if the hash of the section is unique.
    5. Check if the section name is unique.
    6. Check if the sections' handle matches it's name.
    7. Check if the sections' XML file matches it's handle.
    8. Check if the sections' XML file name is correctly named.

For more information, check the __viewDiff()-function in content.blueprintssections.php.