From aa414401817ffd4c15e4be48437d85bdf158fab2 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Wed, 21 Apr 2010 18:41:08 -0700 Subject: [PATCH] Give each existing wiki page a synopsis. --- docs/upgrades/upgrade_7.9.3-7.9.4.pl | 35 ++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/docs/upgrades/upgrade_7.9.3-7.9.4.pl b/docs/upgrades/upgrade_7.9.3-7.9.4.pl index fc5081e62..d50cd002d 100644 --- a/docs/upgrades/upgrade_7.9.3-7.9.4.pl +++ b/docs/upgrades/upgrade_7.9.3-7.9.4.pl @@ -22,6 +22,8 @@ use Getopt::Long; use WebGUI::Session; use WebGUI::Storage; use WebGUI::Asset; +use WebGUI::Asset::WikiPage; +use WebGUI::Exception; my $toVersion = '7.9.4'; @@ -31,6 +33,8 @@ my $quiet; # this line required my $session = start(); # this line required # upgrade functions go here +addWikiSubKeywords($session); +addSynopsistoEachWikiPage($session); finish($session); # this line required @@ -44,6 +48,37 @@ finish($session); # this line required # print "DONE!\n" unless $quiet; #} +#---------------------------------------------------------------------------- +sub addWikiSubKeywords { + my $session = shift; + print "\tAdd the WikiMaster sub-keywords table... " unless $quiet; + # and here's our code + $session->db->write(<getIsa($session); + PAGE: while (1) { + my $page = eval {$pager->()}; + next PAGE if Exception::Class->caught(); + last PAGE unless $page; + my ($synopsis) = $page->getSynopsisAndContent(undef, $page->get('content')); + $page->update({synopsis => $synopsis}); + } + # and here's our code + print "DONE!\n" unless $quiet; +} + # -------------- DO NOT EDIT BELOW THIS LINE --------------------------------