Skip to content

Commit 8ea351f

Browse files
committed
Remove alias when removing php version
1 parent f7c56d1 commit 8ea351f

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ vendor/
88
box.phar
99

1010
index.phar
11+
12+
LMPA.zip

LMPA.zip

-221 KB
Binary file not shown.

controllers/PHPVersionsController.php

+13-1
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,22 @@ private function remove() {
5656

5757
//TODO: Check in vhosts for current usage
5858
$directory = realpath("../../../bin/php/".substr($choice, 2)."-nts/");
59-
exec(sprintf("rd /s /q %s", escapeshellarg($directory)));
59+
removeDirectory($directory);
6060
if(file_exists($directory)) {
6161
$this->climate->error("Cannot delete the php versions");
6262
exit;
63+
} else {
64+
$this->climate->lightGreen("Base binary removed");
65+
}
66+
67+
//Remove alias
68+
$_aliases = '..\..\..\bin\php\_aliases';
69+
$file = $_aliases.'\php'.implode('', array_slice(explode('.', substr($choice, 2)), 0, 2)).'.bat';
70+
if(!unlink($file)) {
71+
$this->climate->error("Can't remove alias, $file");
72+
exit;
73+
} else {
74+
$this->climate->lightGreen("Alias removed!");
6375
}
6476

6577
$this->climate->info("PHP " . $choice . " has been deleted");

index.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
const LMPA_VERSION = '0.3.0';
2+
const LMPA_VERSION = '0.3.1';
33
define("APP_DIRECTORY", dirname(__FILE__));
44

55
if(PHP_OS !== "WINNT") exit("Only work on windows");

0 commit comments

Comments
 (0)