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;