From 13a50c74c88f35b9511e2dab5406771ccb6a05e6 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Thu, 26 Jul 2007 01:15:14 +0000 Subject: [PATCH] re-adding the upgrade stuff for wiki attachments --- docs/upgrades/upgrade_7.3.22-7.4.0.pl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/upgrades/upgrade_7.3.22-7.4.0.pl b/docs/upgrades/upgrade_7.3.22-7.4.0.pl index 3e69036a5..6df34f852 100644 --- a/docs/upgrades/upgrade_7.3.22-7.4.0.pl +++ b/docs/upgrades/upgrade_7.3.22-7.4.0.pl @@ -13,6 +13,7 @@ use strict; use Getopt::Long; use WebGUI::Session; use WebGUI::Workflow; +use WebGUI::Storage; my $toVersion = "7.4.0"; # make this match what version you're going to my $quiet; # this line required @@ -34,11 +35,29 @@ addHttpProxyUrlPatternFilter($session); addCanStartThreadToCS($session); addPostCaptchaToCS($session); addFieldsToDatabaseLinks($session); +addWikiAttachments($session); finish($session); # this line required #------------------------------------------------- +sub addWikiAttachments { + my $session = shift; + print "\tAdding support for attachmetns to wikis.\n" unless ($quiet); + my $db = $session->db; + $db->write("alter table WikiMaster add column allowAttachments int not null default 0"); + my $sth = $db->read("select storageId from WikiPage"); + while (my ($id) = $sth->array) { + my $storage = WebGUI::Storage->get($session, $id); + if (defined $storage) { + $storage->delete; + } + } + $db->write("alter table WikiPage drop column storageId"); +} + +#------------------------------------------------- + sub addFieldsToDatabaseLinks { my $session = shift; print "\tAdding new fields to Database Links...\n" unless ($quiet);