From d6e242f8b27442dd26cd9a19401d3d5709ddc9ad Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 7 Jul 2009 19:30:01 +0000 Subject: [PATCH] Duplicate the old RSS asset fix right before the upgrade sub that causes problems, to catch users who have upgraded past the original stopping point. --- docs/upgrades/upgrade_7.7.6-7.7.7.pl | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/upgrades/upgrade_7.7.6-7.7.7.pl b/docs/upgrades/upgrade_7.7.6-7.7.7.pl index 7f859ef40..65d97d270 100644 --- a/docs/upgrades/upgrade_7.7.6-7.7.7.pl +++ b/docs/upgrades/upgrade_7.7.6-7.7.7.pl @@ -30,6 +30,7 @@ my $quiet; # this line required my $session = start(); # this line required +removeDanglingOldRssAssets( $session ); addOgoneToConfig( $session ); addUseEmailAsUsernameToSettings( $session ); alterVATNumberTable( $session ); @@ -47,6 +48,23 @@ addUserControlWorkflows($session); finish($session); # this line required +#---------------------------------------------------------------------------- +sub removeDanglingOldRssAssets { + my $session = shift; + print "\tChecking for uses of RSSCapable...\n" unless $quiet; + my @rssCapableClasses = $session->db->buildArray('SELECT className FROM RSSCapable INNER JOIN asset ON RSSCapable.assetId=asset.assetId GROUP BY className'); + if (@rssCapableClasses) { + warn "\t\tThis site is using the assets\n\t\t\t" . join(', ', @rssCapableClasses) . "\n\t\twhich use the RSSCapable class! Support RSSCapable has been dropped and it will no longer be maintained.\n"; + } + else { + print "\t\tNot used, removing leftover assets, if any.\n" unless $quiet; + $session->db->write(q|DELETE FROM assetData WHERE assetId IN (SELECT assetId FROM ASSET WHERE className="WebGUI::Asset::RssFromParent")|); + $session->db->write(q|DELETE FROM asset WHERE className = "WebGUI::Asset::RssFromParent"|); + } + print "\tDone.\n" unless $quiet; +} + + #---------------------------------------------------------------------------- sub addMatrixMaxGroup { my $session = shift;