diff options
author | Joey Hess <joey@kitenet.net> | 2010-07-26 16:24:17 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-07-26 16:33:42 -0400 |
commit | c401b6958af7e12c1c2c46f870691bfb0a998fd3 (patch) | |
tree | ea0d991a16d08022209bb71d9202f1e4127c849b /IkiWiki.pm | |
parent | b300bc9650a40885cd8c6e0a646436539aed95c1 (diff) | |
download | ikiwiki-c401b6958af7e12c1c2c46f870691bfb0a998fd3.tar ikiwiki-c401b6958af7e12c1c2c46f870691bfb0a998fd3.tar.gz |
Add new disable hook, allowing plugins to perform cleanup after they have been disabled.
Diffstat (limited to 'IkiWiki.pm')
-rw-r--r-- | IkiWiki.pm | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm index cfa4f5f03..e08d02922 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -1596,6 +1596,12 @@ sub loadindex () { if (exists $index->{version} && ! ref $index->{version}) { $pages=$index->{page}; %wikistate=%{$index->{state}}; + # Handle plugins that got disabled by loading a new setup. + if (exists $config{setupfile}) { + require IkiWiki::Setup; + IkiWiki::Setup::disabled_plugins( + grep { ! $loaded_plugins{$_} } keys %wikistate); + } } else { $pages=$index; @@ -1663,11 +1669,7 @@ sub loadindex () { sub saveindex () { run_hooks(savestate => sub { shift->() }); - my %hookids; - foreach my $type (keys %hooks) { - $hookids{$_}=1 foreach keys %{$hooks{$type}}; - } - my @hookids=keys %hookids; + my @plugins=keys %loaded_plugins; if (! -d $config{wikistatedir}) { mkdir($config{wikistatedir}); @@ -1701,7 +1703,7 @@ sub saveindex () { } if (exists $pagestate{$page}) { - foreach my $id (@hookids) { + foreach my $id (@plugins) { foreach my $key (keys %{$pagestate{$page}{$id}}) { $index{page}{$src}{state}{$id}{$key}=$pagestate{$page}{$id}{$key}; } @@ -1710,7 +1712,8 @@ sub saveindex () { } $index{state}={}; - foreach my $id (@hookids) { + foreach my $id (@plugins) { + $index{state}{$id}={}; # used to detect disabled plugins foreach my $key (keys %{$wikistate{$id}}) { $index{state}{$id}{$key}=$wikistate{$id}{$key}; } |