diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index d3e3adbc9..653970065 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -1,5 +1,6 @@ 7.7.16 - Fix template not found diagnostics. + - fixed #10665: Navigations with old templates still in 7.7.16 7.7.15 - fixed #10629: WebGUI::ProfileField create new field bug diff --git a/docs/upgrades/packages-7.7.15/root_import_navigation.wgpkg b/docs/upgrades/packages-7.7.15/root_import_navigation.wgpkg index 4d2cedf06..6f6c33504 100644 Binary files a/docs/upgrades/packages-7.7.15/root_import_navigation.wgpkg and b/docs/upgrades/packages-7.7.15/root_import_navigation.wgpkg differ diff --git a/docs/upgrades/upgrade_7.7.15-7.7.16.pl b/docs/upgrades/upgrade_7.7.15-7.7.16.pl index 83e4317b7..d69c46a6c 100644 --- a/docs/upgrades/upgrade_7.7.15-7.7.16.pl +++ b/docs/upgrades/upgrade_7.7.15-7.7.16.pl @@ -22,13 +22,14 @@ use Getopt::Long; use WebGUI::Session; use WebGUI::Storage; use WebGUI::Asset; - +use List::MoreUtils qw/uniq/; my $toVersion = '7.7.16'; my $quiet; # this line required my $session = start(); # this line required +replaceUsageOfOldTemplatesAgain($session); # upgrade functions go here @@ -44,6 +45,33 @@ finish($session); # this line required # print "DONE!\n" unless $quiet; #} +#---------------------------------------------------------------------------- +sub replaceUsageOfOldTemplatesAgain { + my $session = shift; + print "\tRemoving usage of outdated templates with new ones... " unless $quiet; + # and here's our code + print "\n\t\tUpgrading Navigation templates... " unless $quiet; + my @navigationPairs = ( + ## New Old + [ qw/PBnav00000000000bullet PBtmpl0000000000000048/ ] ##Bulleted List <- Vertical Menu + ); + foreach my $pairs (@navigationPairs) { + my ($new, $old) = @{ $pairs }; + $session->db->write('UPDATE Navigation SET templateId=? where templateId=?', [$new, $old]) + } + print "\n\t\tPurging old templates... " unless $quiet; + my @oldTemplates = uniq(map { $_->[1] } (@navigationPairs)); + TEMPLATE: foreach my $templateId (@oldTemplates) { + my $template = eval { WebGUI::Asset->newPending($session, $templateId); }; + if ($@) { + print "\n\t\t\tUnable to instanciate templateId: $templateId. Skipping..."; + next TEMPLATE; + } + print "\n\t\t\tPurging ". $template->getTitle . " ..." unless $quiet; + $template->purge; + } + print "DONE!\n" unless $quiet; +} # -------------- DO NOT EDIT BELOW THIS LINE --------------------------------