Thursday, June 23, 2011

Tips for upgrading to Gallery Server Pro 2.5

Since releasing 2.5.0 a couple weeks ago, I am pleased the upgrade is going smoothly for the vast majority of you. However, a few support issues seem to be repeating themselves, so I wanted to throw out some tips to help it go smoothly.

Back up before upgrading – Make a backup of your database and web files before the upgrade. That way, in case anything goes wrong, you have something to revert to.

.NET 4.0 required – Version 2.5 requires .NET 4.0, so be sure it is available. I recommend getting your 2.3 or 2.4 gallery running on .NET 4.0 before upgrading to 2.5. The Admin Guide has all the details – read it carefully.

SQLite to SQL CE migration errors – There have been two users who reported issues in the upgrade step that migrates data from the SQLite database to the SQL CE database. In one case, data in the Comment column of one of the aspnet_Users records had to be deleted before the upgrade would succeed (it was actually quite mysterious because the data didn’t *look* corrupt). In the other case, there were two records in the aspnet_Roles table that referred to an application that didn’t exist in the aspnet_Applications table. Since SQL CE enforces referential integrity – and SQLite does not – this caused the migration to fail. The fix was to delete the two records from SQLite and run the upgrade again.

In other words, you might have to clean up the SQLite data a bit to make it “fit” in SQL CE. If you have trouble, read the error message carefully for clues, then use a tool like SQLite Administrator to find and fix it. If you really, really get stuck, send it to me (roger*at*techinfosystems*dot*com) and I can take a look (make sure you provide details with as much info about the error as possible).

jQuery 1.6 or higher required – In early May, jQuery released 1.6, which broke backward compatibility with earlier versions. At the time, the workaround was to temporarily change your jQuery version to a pre-1.6 version. Gallery Server Pro 2.5 fixes the issues by using the new jQuery 1.6 prop() function (instead of attr()). Of course, this means 2.5 isn’t compatible with jQuery 1.5 and earlier. If you try to use jQuery 1.5 in GSP 2.5, the two main issues you’ll notice are broken next/previous media browsing and broken UI functionality in several of the site admin pages.

This means that after you upgrade your gallery, one of your first steps is to make sure you are referencing jQuery 1.6 or higher (on the site settings page). I recommend using the value “//”, which will use the most recent 1.* release available.

If for some reason you must use jQuery 1.5, you can revert to the old behavior by replacing all instances of “.prop(“ with “.attr(“. That needs to be done in these files: gs\pages\admin\gallerycontrolsettings.ascx, gs\pages\admin\metadata.ascx, gs\pages\admin\usersettings.ascx, gs\script\mediaobjectview.js, and gs\pages\admin\manageroles.ascx.cs. Note that the last file (manageroles.ascx.cs) is a code file and is only found in the source code version. Once you update it, you will need to compile it and deploy a new GalleryServerPro.Web.dll to your bin directory (the assembly is named TechInfoSystems.GalleryServerPro.dll in the DotNetNuke module).

DotNetNuke users – This jQuery gotcha is especially important for you, since most installations of DNN are using a pre-1.6 version of jQuery. Probably the easiest way to update your site to the latest version of jQuery is to select the “Use hosted jQuery version” checkbox in the Advanced Settings/jQuery section of the Host Settings page. This will automatically use the latest 1.* release of jQuery available, assuming the hosted jQuery URL settings is still at its default value of “//”.

SQL CE editor – With SQL CE 4 just being released, there really isn’t an excellent, simple, and free tool available to let you see and edit the data directly in the database. I expect that to change in the coming months as SQL CE picks up speed. For now, there are a few options, and I describe them in the Admin Guide. Look for the section Management Tools for SQLite, SQL CE and SQL Server.

Apply the patches – A patch is available that fixes a few bugs in the 2.5.0 release.

Be on the lookout for new errors when extracting metadata – Version 2.5 incorporates the WPF-based metadata extraction technique directly in the business layer, whereas earlier versions were invoked via reflection in a separate DLL (this provided enhanced metadata for users running .NET 3/3.5 while still working on servers running only .NET 2.0). The reflection-based technique had a side benefit in that all errors were wrapped in a special exception that GSP chose to ignore (after first logging it), preventing files with metadata corruption from causing any visible trouble.

Version 2.5 directly calls the metadata extraction code, so any errors that aren’t caught cause the file upload or synchronization to fail. Microsoft recommends against using global exception handlers to silently catch all errors, so what I need to do is add little catch blocks that catch each type of exception that may occur. However, I have no idea what those are until you tell me. That has happened twice a few times now, and I’ve updated the patch accordingly.

If you didn’t understand that techno-speak – what I am saying is this: If you get an error while syncing or uploading files, post a thread in the forum with all the details (look in GSP’s error log if necessary). I can’t fix what I don’t know about.

Deleted DLLs – One of the nice things about 2.5 is that it no longer needs several DLLs, so it deletes them during the upgrade:

  • AjaxControlToolkit.dll
  • System.Data.SQLite.DLL
  • Microsoft.Practices.EnterpriseLibrary.Caching.dll
  • Microsoft.Practices.EnterpriseLibrary.Common.dll
  • Microsoft.Practices.ObjectBuilder.dll
  • GalleryServerPro.Business.Wpf.dll
  • GalleryServerPro.Data.SQLite.dll
  • TechInfoSystems.TracingTools.dll

Obviously, if you are using GSP in a site that requires one or more of these assemblies, be sure to save a copy and then restore them when the upgrade is complete. I imagine the most likely DLL you need to preserve is AjaxControlToolkit.dll.

Note: The DNN upgrade won’t delete any DLL’s, so you don’t have to worry whether another module might need one of these assemblies.

Also, the ugprade wizard might find that it can’t delete one or more DLLs it wants to. In my experience, this is most likely System.Data.SQLite.DLL. If you discover this file still exists in your bin directory after the upgrade, you may delete it.

No comments: