Skip to content

Commit cb70d53

Browse files
committed
Move isWindows check to Utils
1 parent 8e5bdf7 commit cb70d53

2 files changed

Lines changed: 11 additions & 10 deletions

File tree

system/src/Grav/Common/Filesystem/Folder.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
namespace Grav\Common\Filesystem;
1010

1111
use Grav\Common\Grav;
12+
use Grav\Common\Utils;
1213
use RocketTheme\Toolbox\ResourceLocator\UniformResourceLocator;
1314

1415
abstract class Folder
@@ -341,7 +342,7 @@ public static function move($source, $target)
341342
self::create(dirname($target));
342343

343344
// Just rename the directory.
344-
if (self::execIsDisabled() || self::isWindows()) {
345+
if (self::execIsDisabled() || Utils::isWindows()) {
345346
// exec disabled, or windows. Cannot use mv. Fallback to rename() although
346347
// not working cross volumes
347348
$success = @rename($source, $target);
@@ -362,15 +363,6 @@ public static function move($source, $target)
362363
@touch(dirname($target));
363364
}
364365

365-
/**
366-
* Utility method to determine if the current OS is Windows
367-
*
368-
* @return bool
369-
*/
370-
private static function isWindows() {
371-
return strncasecmp(PHP_OS, 'WIN', 3) == 0;
372-
}
373-
374366
/**
375367
* Utility method to check if `exec` is disabled in the PHP disabled functioons
376368
*

system/src/Grav/Common/Utils.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,4 +813,13 @@ public static function setDotNotation(&$array, $key, $value, $merge = false)
813813

814814
return $array;
815815
}
816+
817+
/**
818+
* Utility method to determine if the current OS is Windows
819+
*
820+
* @return bool
821+
*/
822+
public static function isWindows() {
823+
return strncasecmp(PHP_OS, 'WIN', 3) == 0;
824+
}
816825
}

0 commit comments

Comments
 (0)