From c20c4066311341e332dc425023f856b6414de9ae Mon Sep 17 00:00:00 2001 From: joey Date: Sat, 27 May 2006 19:04:46 +0000 Subject: [PATCH] * Add -refresh option to ikiwiki-mass-rebuild and use that on upgrades that do not need a full rebuild, in order to update any basewiki pages. --- IkiWiki/CGI.pm | 20 ++++++++++---------- Makefile.PL | 2 +- basewiki/style.css | 2 +- debian/changelog | 4 +++- debian/postinst | 2 ++ doc/ikiwiki-mass-rebuild.mdwn | 7 +++++++ ikiwiki-mass-rebuild | 9 +++++++-- templates/editpage.tmpl | 5 +++-- 8 files changed, 34 insertions(+), 17 deletions(-) diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm index 6ead8fc56..cf6000314 100644 --- a/IkiWiki/CGI.pm +++ b/IkiWiki/CGI.pm @@ -291,13 +291,13 @@ sub cgi_editpage ($$) { #{{{ eval q{use CGI::FormBuilder}; my $form = CGI::FormBuilder->new( - fields => [qw(do rcsinfo subpage from page content comments)], + fields => [qw(do rcsinfo subpage from page editcontent comments)], header => 1, method => 'POST', validate => { - content => '/.+/', + editcontent => '/.+/', }, - required => [qw{content}], + required => [qw{editcontent}], javascript => 0, params => $q, action => $config{cgiurl}, @@ -330,7 +330,7 @@ sub cgi_editpage ($$) { #{{{ $form->field(name => "subpage", type => 'hidden'); $form->field(name => "page", value => "$page", force => 1); $form->field(name => "comments", type => "text", size => 80); - $form->field(name => "content", type => "textarea", rows => 20, + $form->field(name => "editcontent", type => "textarea", rows => 20, cols => 80); $form->tmpl_param("can_commit", $config{rcs}); $form->tmpl_param("indexlink", indexlink()); @@ -351,7 +351,7 @@ sub cgi_editpage ($$) { #{{{ require IkiWiki::Render; $form->tmpl_param("page_preview", htmlize($config{default_pageext}, - linkify($page, $page, $form->field('content')))); + linkify($page, $page, $form->field('editcontent')))); } else { $form->tmpl_param("page_preview", ""); @@ -410,14 +410,14 @@ sub cgi_editpage ($$) { #{{{ } elsif ($form->field("do") eq "edit") { page_locked($page, $session); - if (! defined $form->field('content') || - ! length $form->field('content')) { + if (! defined $form->field('editcontent') || + ! length $form->field('editcontent')) { my $content=""; if (exists $pagesources{lc($page)}) { $content=readfile(srcfile($pagesources{lc($page)})); $content=~s/\n/\r\n/g; } - $form->field(name => "content", value => $content, + $form->field(name => "editcontent", value => $content, force => 1); } $form->tmpl_param("page_select", 0); @@ -431,7 +431,7 @@ sub cgi_editpage ($$) { #{{{ # save page page_locked($page, $session); - my $content=$form->field('content'); + my $content=$form->field('editcontent'); $content=~s/\r\n/\n/g; $content=~s/\r/\n/g; writefile($file, $config{srcdir}, $content); @@ -463,7 +463,7 @@ sub cgi_editpage ($$) { #{{{ $form->field(name => "rcsinfo", value => rcs_prepedit($file), force => 1); $form->tmpl_param("page_conflict", 1); - $form->field("content", value => $conflict, force => 1); + $form->field("editcontent", value => $conflict, force => 1); $form->field("do", "edit)"); $form->tmpl_param("page_select", 0); $form->field(name => "page", type => 'hidden'); diff --git a/Makefile.PL b/Makefile.PL index aac6946ba..b20070869 100755 --- a/Makefile.PL +++ b/Makefile.PL @@ -22,7 +22,7 @@ extra_build: extra_clean: rm -rf html doc/.ikiwiki - rm -f ikiwiki.man + rm -f ikiwiki.man ikiwiki-mass-rebuild.man extra_install: install -d $(PREFIX)/share/ikiwiki/templates diff --git a/basewiki/style.css b/basewiki/style.css index 0d64240e6..8d51685fb 100644 --- a/basewiki/style.css +++ b/basewiki/style.css @@ -26,7 +26,7 @@ border-bottom: 1px solid #000; } -#content textarea { +#editcontent { width: 100%; } diff --git a/debian/changelog b/debian/changelog index 667a49c30..44d324dd8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -35,8 +35,10 @@ ikiwiki (1.4) UNRELEASED; urgency=low (This was slightly complex to do as the link still has to be constructed relative to the inlining page.) * Make page edit textarea resize to fit browser window. + * Add -refresh option to ikiwiki-mass-rebuild and use that on upgrades that + do not need a full rebuild, in order to update any basewiki pages. - -- Joey Hess Sat, 27 May 2006 14:28:19 -0400 + -- Joey Hess Sat, 27 May 2006 15:01:52 -0400 ikiwiki (1.3) unstable; urgency=low diff --git a/debian/postinst b/debian/postinst index 9135af754..72b457716 100755 --- a/debian/postinst +++ b/debian/postinst @@ -9,4 +9,6 @@ firstcompat=1.4 if [ "$1" = configure ] && \ dpkg --compare-versions "$2" lt "$firstcompat"; then ikiwiki-mass-rebuild +else + ikiwiki-mass-rebuild -refresh fi diff --git a/doc/ikiwiki-mass-rebuild.mdwn b/doc/ikiwiki-mass-rebuild.mdwn index 5c2cf40e5..a9a7f4adb 100644 --- a/doc/ikiwiki-mass-rebuild.mdwn +++ b/doc/ikiwiki-mass-rebuild.mdwn @@ -14,6 +14,13 @@ on a system. You will need to list the wikis it shuld build in the file user /path/to/wiki +# OPTIONS + +* -refresh + + Rather than rebuilding all the wikis, just build any changed pages + (including pages inherited from the basewiki). + # AUTHOR Joey Hess diff --git a/ikiwiki-mass-rebuild b/ikiwiki-mass-rebuild index daba2ca43..dac54cb8e 100755 --- a/ikiwiki-mass-rebuild +++ b/ikiwiki-mass-rebuild @@ -1,6 +1,11 @@ #!/bin/sh set -e +action="" +if [ -n "$1" ]; then + action="$1" +fi + wikilist=/etc/ikiwiki/wikilist processline () { @@ -15,8 +20,8 @@ processline () { if [ ! -f "$setup" ]; then echo "warning: $setup specified in /etc/ikiwiki/wikilist does not exist, skipping" >&2 else - echo "Rebuilding $setup as user $user ..." - su "$user" -c "ikiwiki -setup $setup" + echo "Processing $setup as user $user ..." + su "$user" -c "ikiwiki -setup $setup $action" fi } diff --git a/templates/editpage.tmpl b/templates/editpage.tmpl index 89f01e664..ec48df4c2 100644 --- a/templates/editpage.tmpl +++ b/templates/editpage.tmpl @@ -27,11 +27,12 @@ confict and commit again to save your changes. -Page location:
+Page location: +
-
+
Optional comment about this change: