I created a button that links to finish.php. It is supposed to delete the installer directory. The problem is that it fails on the first try, but will work on subsequent reloads of the page:
function Delete($path){
if (is_dir($path) === true){
$files = array_diff(scandir($path), array('.', '..'));
foreach ($files as $file){
Delete(realpath($path) . '/' . $file);
}
return rmdir($path);
}else if (is_file($path) === true){
return unlink($path);
}
return false;
}
Delete('installer');
$filename = '../admin/installer/';
if (file_exists($filename)) { Delete('installer'); } else {header("Location: index.php");}