protected function processDeleteDir(int $targetID, array $post = [], string $oldCabin = '', array $cabins = []) : bool
{
if (empty($post['move_contents'])) {
// Delete everything
return $this->pg->recursiveDelete($targetID);
}
// We're moving the contents
if (\is_numeric($post['move_destination'])) {
// To a different directory...
$destination = (int) $post['move_destination'];
$newCabin = $this->pg->getCabinForDirectory($destination);
$this->pg->movePagesToDir($targetID, $destination, !empty($post['create_redirect']), $oldCabin, $newCabin, $this->pg->getDirectoryPieces($destination));
} else {
if (!\in_array($post['move_destination'], $cabins)) {
// Cabin doesn't exist!
return false;
}
// To the root directory of a different cabin...
// To a different directory...
$this->pg->movePagesToDir($targetID, 0, !empty($post['create_redirect']), $oldCabin, $post['move_destination']);
}
return $this->pg->deleteDir($targetID);
}