7.10 Metadata Upgrade Fix

If you have already undergone the upgrade from 7.9.34 to 7.10, you may have noticed that your metadata values appear to have disappeared. This is a bug in the upgrade process. (See http://www.webgui.org/use/bugs/tracker/12339) This utility script help resolve the problem if you are too far along since your upgrade to fall back, or if you simply don't want to wait for a new release that fixes the problem.

The problem exists as of this writing, when 7.10.24 is the latest stable version available.

This script is provided AS IS and with no guarantees. Use at your own risk. If you can wait, I'd personally recommend doing so until the upgrade script is officially fixed for this bug. If you feel use of this script is your best solution, be sure to back up first, and check your site thoroughly afterwards.

The problem this script attempts to fix is the result of a TRULY GREAT NEW feature in 7.10, which is that Metadata are now versioned. Unlike in 7.9 and before, each metadata value now has a revisionDate to associate that value with individual asset revisions. During the upgrade from 7.9.34 to 7.10.22 the new revisionDate field is added to the metaData_values table, but this field is not populated. As a result, when assets are instantiated (for view or editing) no metadata are found associated with it because there are no records in the table with matching revisionDates. This prevents the metadata from being used when the asset is viewed, and also when the asset editing form is loaded.

To resolve this problem, and to preserve the ability to properly view previous asset revisions or to roll back version tags, each original metadata value must be replicated for EVERY asset revision that it was previously associated with, and the proper revisionDate added to these records.

The challenge arises if you have already upgraded and started editing your site. Is it better to roll back all your asset metadata to the values prior to the upgrade? (If so, use the script's --overwrite flag.) If not, the script will only update those asset revisions for which no metadata is currently associated (presumably those created prior to your upgrade), allowing for you to properly view and roll back to these revisions.

The script is in testing mode by default, allowing you to assess your current situation before committing to making updates. It is fully documented with POD, so use --help or --man to learn its full capabilities.

To use the script, download and unzip it to /data/WebGUI/sbin; be sure that you have run /data/wre/sbin/setenvironment.sh and then run "perl metadataFixer.pl --man" to learn the configuration options. You'll have to run the script once for each site on your server.

Depending on the size of your site and how many revisions of assets you have lying around, this script may take a while to run. Each existing metadata value must be replicated for each version of the asset it is associated with. One test I ran on a site with nearly 70,000 records in the original metaData_values table expanded to nearly 300,000 values, and took nearly 2 minutes for the script to run. Invoking the --verbose flag will help confirm that the script is still working and not frozen.

Release Notes for Version 1 (3/9/2012)

This script was developed and tested on servers that had been upgraded to 7.10.24.