From 93e2110056de5653a2a279101cb4fd02a4905ad2 Mon Sep 17 00:00:00 2001 From: Diftraku Date: Thu, 3 Mar 2011 11:40:34 +0200 Subject: [PATCH] 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). --- core/util.inc.php | 8 +++++++- ext/ext_manager/main.php | 9 ++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/core/util.inc.php b/core/util.inc.php index 03259b20..8803ecf9 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -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) { diff --git a/ext/ext_manager/main.php b/ext/ext_manager/main.php index e4f83ad0..b1763f2a 100644 --- a/ext/ext_manager/main.php +++ b/ext/ext_manager/main.php @@ -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");