1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-12-22 13:45:02 +00:00

Resave the pagedata if it has been changed by the preprocessors

This commit is contained in:
Starbeamrainbowlabs 2015-10-04 08:59:35 +01:00
parent 6c5c11562a
commit 8788b89ce5

View file

@ -139,6 +139,10 @@ register_module([
else
$pageindex->$page->lasteditor = utf8_encode("anonymous");
// A hack to resave the pagedata if the preprocessors have
// changed it. We need this because the preprocessors *must*
// run _after_ the pageindex has been updated.
$pagedata_orig = $pagedata;
// Execute all the preprocessors
foreach($save_preprocessors as $func)
@ -146,6 +150,9 @@ register_module([
$func($pageindex->$page, $pagedata);
}
if($pagedata !== $pagedata_orig)
file_put_contents("$env->page.md", $pagedata);
file_put_contents("./pageindex.json", json_encode($pageindex, JSON_PRETTY_PRINT));