<?php

return function($page) {  
  if ($page->template() == "project") {
    kirby()->impersonate('kirby');
    foreach ($page->childrenAndDrafts() as $child) {
      Dir::remove($child->root());
    }
  }
};