]> sipb.mit.edu Git - ikiwiki.git/commitdiff
Fix a bug that prevented matching deleted comments, and so did not update pages that...
authorJoey Hess <joey@kitenet.net>
Tue, 18 May 2010 17:28:35 +0000 (13:28 -0400)
committerJoey Hess <joey@kitenet.net>
Tue, 18 May 2010 17:32:28 +0000 (13:32 -0400)
Problem is that by the time rendering calls render_dependent, %pagesources
has had deleted files removed from it. So match_comment's lookup of
files in there to see if they had the _comment extension failed.

I had to introduce a hash that temporarily holds filenames of deleted pages
to fix this.

Note that unlike comment(), internal() had avoided this pitfall by being
defined to match both internal and non-internal pages.

IkiWiki.pm
IkiWiki/Plugin/comments.pm
IkiWiki/Render.pm
debian/changelog

index 699ad13dac4183e5d3135e62d6956e6f40c8a731..0f28801a60a354cf38b1b8f271133fb22acc60a0 100644 (file)
@@ -12,9 +12,9 @@ use open qw{:utf8 :std};
 
 use vars qw{%config %links %oldlinks %pagemtime %pagectime %pagecase
        %pagestate %wikistate %renderedfiles %oldrenderedfiles
-       %pagesources %destsources %depends %depends_simple @mass_depends 
-       %hooks %forcerebuild %loaded_plugins %typedlinks %oldtypedlinks
-       %autofiles};
+       %pagesources %delpagesources %destsources %depends %depends_simple
+       @mass_depends %hooks %forcerebuild %loaded_plugins %typedlinks
+       %oldtypedlinks %autofiles};
 
 use Exporter q{import};
 our @EXPORT = qw(hook debug error htmlpage template template_depends
index eb861d74fbd1206476c74387ba1bd2fba694775f..de193bd12b358d2850a823c3e492af1844b4a292 100644 (file)
@@ -908,10 +908,12 @@ sub match_comment ($$;@) {
        my $page = shift;
        my $glob = shift;
 
-       if (! IkiWiki::isinternal($page)) {
-               return IkiWiki::FailReason->new("$page is not a comment");
-       }
-       my $type=IkiWiki::pagetype($IkiWiki::pagesources{$page});
+       # To see if it's a comment, check the source file type.
+       # Deal with comments that were just deleted.
+       my $source=exists $IkiWiki::pagesources{$page} ?
+               $IkiWiki::pagesources{$page} :
+               $IkiWiki::delpagesources{$page};
+       my $type=IkiWiki::pagetype($source);
        if (defined $type && $type ne "_comment") {
                return IkiWiki::FailReason->new("$page is not a comment");
        }
@@ -923,10 +925,10 @@ sub match_comment_pending ($$;@) {
        my $page = shift;
        my $glob = shift;
        
-       if (! IkiWiki::isinternal($page)) {
-               return IkiWiki::FailReason->new("$page is not a pending comment");
-       }
-       my $type=IkiWiki::pagetype($IkiWiki::pagesources{$page});
+       my $source=exists $IkiWiki::pagesources{$page} ?
+               $IkiWiki::pagesources{$page} :
+               $IkiWiki::delpagesources{$page};
+       my $type=IkiWiki::pagetype($source);
        if (defined $type && $type ne "_comment_pending") {
                return IkiWiki::FailReason->new("$page is not a pending comment");
        }
index 833fcaaff0d0412ce97faca6405a406c26fd4807..f9fbc801f750419c76ca301dbcaac1ec62d32aa6 100644 (file)
@@ -442,6 +442,7 @@ sub remove_del (@) {
                }
        
                delete $pagecase{lc $page};
+               $delpagesources{$page}=$pagesources{$page};
                delete $pagesources{$page};
        }
 }
index b8939f455593861ca8f939affb09c899c7785692..8b5389e88dcdcf0817612c535e776cf97d6851e8 100644 (file)
@@ -2,6 +2,8 @@ ikiwiki (3.20100516) UNRELEASED; urgency=low
 
   * page.tmpl: Accidentially broke po plugin's otherlanguages list styling
     when modifying for html5; now fixed.
+  * Fix a bug that prevented matching deleted comments, and so did not update
+    pages that had contained them.
 
  -- Joey Hess <joeyh@debian.org>  Sun, 16 May 2010 00:03:06 -0400