]> sipb.mit.edu Git - ikiwiki.git/blob - doc/forum/how_to_have_a_plugin_delete_a_file.mdwn
Added a comment
[ikiwiki.git] / doc / forum / how_to_have_a_plugin_delete_a_file.mdwn
1 [[!meta title="How to have a plugin delete a file?"]]
2
3 When using the [[plugins/contrib/jscalendar]] plugin,  it creates in the
4 [[plugins/transient]] directory some files (a bit like the
5 [[plugins/recentchanges]] plugin does). When the calendar that triggered
6 creation of this file is removed, I would like to remove the corresponding
7 page as well, but I cannot, because I get the following error.
8
9     internal error: jscalendar/90cde8dfad6413813b324a15ae2d1d95041aedd69e7be36c02b0cd4a58c4af73.jscalendar cannot be found in <path of wiki> or underlay
10
11 My guess is that:
12
13 * the page is stored, internally, in some list of pages to render (as it depends on the page containing the calendar that was just deleted);
14 * my plugin delete this page (using `IkiWiki::prune()` or `unlink()`, in the `rendered()` or `needsbuild()` hook);
15 * IkiWiki tries to render the page, but cannot (since I just deleted it), and throws the error.
16
17 My question is: How can I tell IkiWiki that I *deleted* this page, and that it is no longer necessary to render it? Is there a hook in which I can safely do this?
18