Skip to content

Commit cb7d525

Browse files
committed
fix removeInstall folder after cli-install
1 parent d9f2a0d commit cb7d525

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

install/cli-install.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,9 +1526,41 @@ function parse_docblock($element_dir, $filename) {
15261526
}
15271527
//remove installFolder
15281528
if ($removeInstall == 'y') {
1529+
removeFolder($path);
1530+
removeFolder($base_path.'.tx');
1531+
unlink($base_path.'README.md');
15291532
echo 'Install folder deleted!'. PHP_EOL . PHP_EOL;
15301533
}
15311534

1535+
/**
1536+
* RemoveFolder
1537+
*
1538+
* @param string $path
1539+
* @return string
1540+
*/
1541+
function removeFolder($path)
1542+
{
1543+
$dir = realpath($path);
1544+
if (!is_dir($dir)) {
1545+
return;
1546+
}
1547+
1548+
$it = new RecursiveDirectoryIterator($dir);
1549+
$files = new RecursiveIteratorIterator($it,
1550+
RecursiveIteratorIterator::CHILD_FIRST);
1551+
foreach ($files as $file) {
1552+
if ($file->getFilename() === "." || $file->getFilename() === "..") {
1553+
continue;
1554+
}
1555+
if ($file->isDir()) {
1556+
rmdir($file->getRealPath());
1557+
} else {
1558+
unlink($file->getRealPath());
1559+
}
1560+
}
1561+
rmdir($dir);
1562+
}
1563+
15321564
/**
15331565
* Property Update function
15341566
*

0 commit comments

Comments
 (0)