Forum OpenACS Q&A: My experience upgrading from OpenACS 4.6.3 to 5.2.3

Request notifications

I thought I might document a few of the upgrade gotchas I encountered when upgrading from OpenACS 4.6.3 to 5.2.3. People may want to use some of the information here (maybe it is documented elsewhere?), and perhaps criticise some of the hacks I put in place to fix things. Some of the items I fix may be fixed in OpenACS 5.3.x (I stopped upgrading at OpenACS 5.2.3 as I am using Postgresql 7.4).

When upgrading, make backups of the db and filesystem as you reach significant points in the upgrade.

Take note of what software is required as you upgrade (AOLServer 4.0 and Postgres 7.2 will allow you to upgrade from OpenACS 4.6.3 to 5.2.3):

The upgrade from OpenACS 4.6.3 to 5.0.3 is reasonably well documented:
A couple of threads also help:

#I had to delete some duplicate files:
rm packages/acs-templating/tcl/0-procs.tcl
rm packages/acs-lang/tcl/lang-init.tcl
rm packages/acs-lang/tcl/lang-procs*
rm packages/acs-templating/resources/forms/standard-lars.adp

#I dropped no longer used file-related data :
psql -c "drop table apm_package_file_types"

#And update some kernel parameters to allow url posting:
Site-Wide Administration -> Kernel Parameters -> Antispam -> AllowedAttribute
Add href (to src and target)

After upgrading to OpenACS 5.0.3, templating upgrades had broke the appearance of some of the pages (comment/forum posting). In most cases this was fixed by my later upgrade to 5.2.3 (except for the Directory).

I then updated my OpenACS 5.0.3 sites to 5.2.3.

I installed the 5.2.3 updates from the OpenACS Repository. This was done by altering the install URL to allow me to install the kernel files: "acs-admin/install/install?repository".
Is there a standard way of upgrading OpenACS 5.n to 5.n+1 via the repository?

When upgrading the ACS Messaging to 5.2.3 I had problems with old acs_message_revisions that had parent_id=0, I manually altered that to parent_id=-4:
#The specific scripts reporting errors were packages/acs-messaging/sql/postgresql/upgrade/upgrade-5.1.0d1-5.1.0d2.sql and
update cr_items set parent_id=-4 where parent_id=0 and content_type='acs_message_revision' and storage_area_key ='CR_FILES';

When upgrading the Content Repository to 5.2.3 I had problems with pre-existing functions.

#Try to upgrade content repository packages from remote files (it will fail)
#fix the problems in the files you have downloaded locally:
perl -pi -e "s/create function/create or replace function/g" packages/acs-content-repository/sql/postgresql/upgrade/upgrade-5.1.0d2*.sql
#Comment out includes from line 88 onwards:
vi packages/acs-content-repository/sql/postgresql/upgrade/upgrade-5.1.0d2-5.1.0d3.sql
#Upgrade content repository packages from locally downloaded files

After upgrading to OpenACS 5.2.3, I discovered that the upgraded general-comments module allowed anonymous posting (I saw 1600 automated spam posts). To fix this I altered the comment-add.tcl files to require login:
#add "set user_id [auth::require_login]" to the top of the contract function:
vi packages/general-comments/www/comment-add.tcl
vi packages/general-comments/www/comment-add-2.tcl
vi packages/general-comments/www/comment-add-3.tcl

In the upgraded forum module I also found that older forum posts weren't listing authors. I fixed this with some SQL:
update forums_messages set last_poster=user_id where last_poster is null and parent_id is null and posting_date =last_child_post;

The upgraded directory had problems with templating on the index page. I added ";noquote" after search_vars, alpha_nav_bar, row_range_html, name_header
vi packages/directory/www/index.adp

Hopefully this will help someone, or inform me as to how I _should_ have performed the upgrade.

Posted by Dave Bauer on
I think you did fine.

You should be able to upgrade directly frm 4.6.3 to 5.2.3, but you might have ended up with some of the same problems.

In some cases, a problem with an upgrade script might have been fixed in a newer version.

Regarding upgrade from repository, you are correct. You can only upgrade minor versions from the repository without changing the repository URL. It looks like it pretty much worked.

Thanks for persevering. I think the upgrades are generally more reliable in newer versions, but it is not a well tested feature. It's very difficult to test it reliably without using real data.

Posted by Brian Fenton on
Thanks for this Michael. I'm considering doing an upgrade on an OpenACS 4.5 system, which I believe is a much tougher jump, and it's encouraging to see that upgrades from 4.6.3 are possible.

Can I ask why you stopped at 5.2.3 and didn't take the current version?


Posted by Michael Bluett on
As I wrote above, I didn't upgrade further because of the Postgresql version my new server is running:
"I stopped upgrading at OpenACS 5.2.3 as I am using Postgresql 7.4"
I used Postgresql 7.3 on the old server to move from OpenACS 4.6.3 to 5.2.3 and then moved the code and database to the new server running Postgresql 7.4. Is there a page summarising the improvements in the different versions?

According to the compatibility matrix ( ) to upgrade from OpenACS 4.5, you first need to run Postresql 7.2 to upgrade to OpenACS 4.6.3, and then
run Postgresql 7.3 to upgrade from OpenACS 4.6.3 to OpenACS 5.2.x. And then Postgresql 8.x to upgrade beyond that.

Posted by Brian Fenton on
Oops, I missed that comment in the original mail. Thanks for pointing it out. I'm actually running on Oracle 10g so there are very little compatibility issues there for me.

I actually couldn't find the release notes describing the changes between each OpenACS release, but I'm sure they're here on the website somewhere. :-)

Posted by Mark Aufflick on
I recently upgraded my personal site ( ) from OpenACS 4.something (circa 2002) to 5.4, postgres changing from 7.2 to 8.2.5.

I agree with Don that the later you go the easier it gets. I had to tweak a few sql upgrade files (some I checked in, some were local tweaks).

But after a few hours effort, thanks to some forum threads (same ones posted above). It worked perfectly.

I was (and still am to a lesser extent) using some old non-standard lars-* packages and some personal hacks which were easy to re-implement on the latest oacs.

I think that's pretty amazing - upgrading 6 years of core changes in a few hours - and shows the discpline in the oacs core team given to upgradability.

Posted by Mark Aufflick on