Because Windows... shitty OS is shitty. Added a Windows-only fix to the extension symlink and deltree.

Windows will nag about file info not found on relative paths with symlink (php bug?).
Also, when deleting a symlink on Windows, it needs to be rmdir'd, no unlink'd (kept throwing permission denied for unlink).
This commit is contained in:
Diftraku 2011-03-03 11:40:34 +02:00
parent 9a1e8dc4b1
commit 93e2110056
2 changed files with 15 additions and 2 deletions

View file

@ -612,7 +612,13 @@ function ip_in_range($IP, $CIDR) {
*/
function deltree($f) {
if (is_link($f)) {
unlink($f);
//Because Windows (I know, bad excuse)
if (PHP_OS === 'WINNT') {
rmdir($f);
}
else {
unlink($f);
}
}
else if(is_dir($f)) {
foreach(glob($f.'/*') as $sf) {

View file

@ -177,7 +177,14 @@ class ExtManager extends SimpleExtension {
// yes, even though we are in /, and thus the path to contrib is
// ./contrib, the link needs to be ../ because it is literal data
// which will be interpreted relative to ./ext/ by the OS
symlink("../contrib/$fname", "ext/$fname");
//Because Windows (I know, bad excuse)
if (PHP_OS === 'WINNT') {
symlink(realpath("./contrib/$fname"), realpath("./ext/").'/'.$fname);
}
else {
symlink("../contrib/$fname", "ext/$fname");
}
}
else {
full_copy("contrib/$fname", "ext/$fname");