Updating to Contribute 4.x breaks the cthub XML

When trying to sort my cthub XML file recently I found out that my code from the post on sorting the role listing had stopped working.

Turns out that there was an error introduced into the format of this file when upgrading from Contribute 3.11.

As you are no doubt aware, when at least one admin upgrades to Contribute 4 or Contribute CS3 (aka 4.1) all the admins have to since there are upgrades made to the XML files that control the site. Well it appears that this upgrade makes the cthub file non-valid XML.

Take a look at this file and look for the tag font_use_css inside the group_list_item child node of the group_list node. In a copy of the cthub file that was upgraded you will find that this standalone tag is missing the appropriate closing slash. If you compare this against a copy of the cthub file from before the upgrade, assuming you made a backup, you will find that the tag is properly closed.

Since this file is the master file with all of the role information for the site, I wonder if this XML error is causing unknown instability in the system somewhere.

While this is an easy fix, I will be posting some code that you can run to fix this, since editing a file like this by hand can be a real pain.

Changing Harddrive name breaks Contribute

While changing some things on my computer setup today I decided to change the name of my harddrive and computer to match my local DNS entry.

Having done this many times before I knew that there would be certain applications that would be looking for an absolute path that would have issues, such as Dreamweaver sites and the root folder locations for them.

Adobe Contribute (formerly Macromedia Contribute) has the same problem with the stored sites that you have setup prior to the name change.

Here is how to fix Contribute after changing the harddrive name:

  1. Open up the Contribute preferences file located in /Users/USERNAME/Library/Preferences/ (in my case the filename was Contribute 4.1 Preferences, this will be different for other versions) in your favorite text editor.
  2. Start searching at the top of the file for each instance of the old harddrive name.
  3. Replace each instance with the new harddrive name.
  4. Save and close the file.

Now the next time you start Contribute, you won’t get the any error messages related to having missing site files.

Oh, and don’t forget to backup the file first. You do back up your data right? :)

Hidden Password Policy in CPS

Recently I ran into a situation where I had to change the username and password that Contribute uses for the SFTP operations.

I don’t have my stuff setup to use individual SFTP logins, since I am doing away with direct shell access to the webroot and dislike manually updating permissions for people.

I found out that there is a hidden password policy in the Contribute Publishing System with regards to what it will pass as the SFTP password.

I tend to use mixed-case as well as punctuation and numbers in my passwords. When I put the new password in, the system seemed to take it. Unfortunately, this was only an appearance, since it borked when I closed Contribute and opened it back up.

Apparently it doesn’t like the use of an ampersand in the password. And since the password is stored in an unusual encryption scheme I was unable to recover from this without recreating my entire connection to the particular webserver I was managing.

Stay tuned for a post on the steps to recreate the connection without losing all you data, as well as a utility to help in case of problems.

Sort the Role Listing in the Contribute Client

One of the annoyances I have found with the Contribute Client is that in the Administration interface section, when adding a user, the menu of roles is not sorted for you. The list that appears when you reassign a user or when you create a new role, is sorted for you.

Each time that a new role is added, the client updates the hub file, adding the new role to the end of the list.

In investigating this I found that the hub file is just an XML file. This file is stored in the root _mm folder of the website that you are managing. Note that this file is connection specific, so if you are managing multiple websites, the location of this control file will vary. And if you are managing a large deployment by having multiple sites with a single directory structure, you will have a different _mm folder and hub file for each site, even though they are physically on the same server they are treated differently by the logic of the software.

The XML node list structure that controls this is as follows:

<group_list>
<group_list_item>
...
</group_list_item>
<group_list_item>
...
</group_list_item>
</group_list>

The name of the role shown in the Contribute client administration interface is controlled by the value assigned to the value attribute of the individual group_list_item nodes.

The last group_item_list node is the most recent role that has been added to the system.

What I ended up doing was using a pre-compiled perl program to sort the group_list_item nodes based on the content of the value attribute.

In order to use xmlsort, you will need the following Perl modules:

XML-Filter-BufferText-1.01
XML-Filter-Sort-1.01
XML-SAX-Writer-0.50
Text-Iconv-1.4

After installing those Perl modules you will be able to use the xmlsort command. This is essentially a precompiled Perl command that eliminates you from having to write a Perl script to do a simple sort. If you need to do more complex sorting or XML processing then you will need to roll your own code.

The necessary syntax for the command is:

xmlsort -i -r=group_list/group_list_item -k=@value cthubxxx.csi > out.xml

Replace the cthubxxx.csi is the command with the actually filename for your particular hub file. At this point you should backup your hub file then rename out.xml to the hub filename. This process doesn’t require a restart of CPS or the Contribute client, but it would be safer to do this at a time when there is low usage of Contribute just in case.