misc(installer): Added cleanup step (for master builds) (#1838)

* misc(installer): Added cleanup step (for master builds)

* Update _cleanup.php

* Update install.php

* Update install.php

* Update install.php

* Update install.php
This commit is contained in:
Roman Kelesidis 2025-03-07 21:13:31 +07:00 committed by GitHub
commit dd721367c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 29 additions and 8 deletions

View file

@ -7,12 +7,15 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
if (!defined('BB_ROOT')) {
define('BB_ROOT', __DIR__ . DIRECTORY_SEPARATOR);
}
// Check CLI mode
if (php_sapi_name() !== 'cli') {
exit;
}
define('BB_ROOT', __DIR__ . DIRECTORY_SEPARATOR);
$items = [
'.github',
'.editorconfig',
@ -47,9 +50,9 @@ foreach ($items as $item) {
function removeFile(string $file): void
{
if (unlink($file)) {
echo "[INFO] File removed: $file" . PHP_EOL;
echo "- File removed: $file" . PHP_EOL;
} else {
echo "[ERROR] File cannot be removed: $file" . PHP_EOL;
echo "- File cannot be removed: $file" . PHP_EOL;
exit;
}
}
@ -73,9 +76,9 @@ function removeDir(string $dir): void
}
if (rmdir($dir)) {
echo "[INFO] Folder removed: $dir" . PHP_EOL;
echo "- Folder removed: $dir" . PHP_EOL;
} else {
echo "[ERROR] Folder cannot be removed: $dir" . PHP_EOL;
echo "- Folder cannot be removed: $dir" . PHP_EOL;
exit;
}
}