+ }, '.');
+
+ chdir($origdir) || die "chdir $origdir: $!";
+ }
+
+ # Compatibility code.
+ #
+ # {deleted} contains pages that have been deleted at some point.
+ # This plugin used to delete from the hash sometimes, but no longer
+ # does; in [[todo/autoindex_should_use_add__95__autofile]] Joey
+ # thought the old behaviour was probably a bug.
+ #
+ # The effect of listing a page in {deleted} was to avoid re-creating
+ # it; we migrate these pages to {autofile} which has the same effect.
+ # However, {autofile} contains source filenames whereas {deleted}
+ # contains page names.
+ my %deleted;
+ if (ref $wikistate{autoindex}{deleted}) {
+ %deleted=%{$wikistate{autoindex}{deleted}};
+ delete $wikistate{autoindex}{deleted};
+ }
+ elsif (ref $pagestate{index}{autoindex}{deleted}) {
+ # an even older version
+ %deleted=%{$pagestate{index}{autoindex}{deleted}};
+ delete $pagestate{index}{autoindex};
+ }
+
+ if (keys %deleted) {
+ foreach my $dir (keys %deleted) {
+ my $file=newpagefile($dir, $config{default_pageext});
+ $wikistate{autoindex}{autofile}{$file} = 1;