mirror of
https://github.com/getformwork/formwork.git
synced 2025-01-17 13:38:22 +01:00
Remove const DS
This commit is contained in:
parent
db46c7c3ae
commit
f944c313e0
@ -898,7 +898,7 @@ class Page extends Model implements Stringable
|
|||||||
throw new UnexpectedValueException('Unexpected missing site path');
|
throw new UnexpectedValueException('Unexpected missing site path');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->relativePath = Str::prepend(Path::makeRelative($this->path, $this->site()->contentPath(), DS), DS);
|
$this->relativePath = Str::prepend(Path::makeRelative($this->path, $this->site()->contentPath(), DIRECTORY_SEPARATOR), DIRECTORY_SEPARATOR);
|
||||||
|
|
||||||
$routePath = preg_replace('~[/\\\](\d+-)~', '/', $this->relativePath)
|
$routePath = preg_replace('~[/\\\](\d+-)~', '/', $this->relativePath)
|
||||||
?? throw new RuntimeException(sprintf('Replacement failed with error: %s', preg_last_error_msg()));
|
?? throw new RuntimeException(sprintf('Replacement failed with error: %s', preg_last_error_msg()));
|
||||||
|
@ -127,7 +127,7 @@ class ToolsController extends AbstractController
|
|||||||
'jaybizzle/crawler-detect' => $dependencies['jaybizzle/crawler-detect']['version'],
|
'jaybizzle/crawler-detect' => $dependencies['jaybizzle/crawler-detect']['version'],
|
||||||
],
|
],
|
||||||
'System' => [
|
'System' => [
|
||||||
'Directory Separator' => DS,
|
'Directory Separator' => DIRECTORY_SEPARATOR,
|
||||||
'EOL Symbol' => addcslashes(PHP_EOL, "\r\n"),
|
'EOL Symbol' => addcslashes(PHP_EOL, "\r\n"),
|
||||||
'Max Path Length' => FileSystem::MAX_PATH_LENGTH,
|
'Max Path Length' => FileSystem::MAX_PATH_LENGTH,
|
||||||
'File Creation Mask' => sprintf('0%03o', umask()),
|
'File Creation Mask' => sprintf('0%03o', umask()),
|
||||||
|
@ -43,7 +43,7 @@ class Schemes
|
|||||||
public function loadFromPath(string $path): void
|
public function loadFromPath(string $path): void
|
||||||
{
|
{
|
||||||
foreach (FileSystem::listRecursive($path) as $item) {
|
foreach (FileSystem::listRecursive($path) as $item) {
|
||||||
$id = str_replace(DS, '.', Str::beforeLast($item, '.'));
|
$id = str_replace(DIRECTORY_SEPARATOR, '.', Str::beforeLast($item, '.'));
|
||||||
$this->load($id, FileSystem::joinPaths($path, $item));
|
$this->load($id, FileSystem::joinPaths($path, $item));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@ class Updater
|
|||||||
if (!FileSystem::exists($destinationDirectory)) {
|
if (!FileSystem::exists($destinationDirectory)) {
|
||||||
FileSystem::createDirectory($destinationDirectory);
|
FileSystem::createDirectory($destinationDirectory);
|
||||||
}
|
}
|
||||||
if (!Str::endsWith($destination, DS)) {
|
if (!Str::endsWith($destination, DIRECTORY_SEPARATOR)) {
|
||||||
$contents = $zipArchive->getFromIndex($i);
|
$contents = $zipArchive->getFromIndex($i);
|
||||||
if ($contents === false) {
|
if ($contents === false) {
|
||||||
throw new RuntimeException(sprintf('Cannot read "%s" from zip archive', $filename));
|
throw new RuntimeException(sprintf('Cannot read "%s" from zip archive', $filename));
|
||||||
|
@ -72,7 +72,7 @@ class FileSystem
|
|||||||
*/
|
*/
|
||||||
public static function normalizePath(string $path): string
|
public static function normalizePath(string $path): string
|
||||||
{
|
{
|
||||||
return Path::normalize($path, DS);
|
return Path::normalize($path, DIRECTORY_SEPARATOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -80,7 +80,7 @@ class FileSystem
|
|||||||
*/
|
*/
|
||||||
public static function joinPaths(string ...$paths): string
|
public static function joinPaths(string ...$paths): string
|
||||||
{
|
{
|
||||||
return Path::join($paths, DS);
|
return Path::join($paths, DIRECTORY_SEPARATOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -88,7 +88,7 @@ class FileSystem
|
|||||||
*/
|
*/
|
||||||
public static function resolvePath(string $path): string
|
public static function resolvePath(string $path): string
|
||||||
{
|
{
|
||||||
return Path::resolve($path, static::cwd(), DS);
|
return Path::resolve($path, static::cwd(), DIRECTORY_SEPARATOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -432,7 +432,7 @@ class FileSystem
|
|||||||
}
|
}
|
||||||
// On Windows symbolic links pointing to a directory have to be removed with `rmdir()`
|
// On Windows symbolic links pointing to a directory have to be removed with `rmdir()`
|
||||||
// see https://bugs.php.net/bug.php?id=52176
|
// see https://bugs.php.net/bug.php?id=52176
|
||||||
if (@unlink($link) || (DS === '\\' && @rmdir($link))) {
|
if (@unlink($link) || (DIRECTORY_SEPARATOR === '\\' && @rmdir($link))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
throw new FileSystemException(sprintf('Cannot delete symbolic link "%s": %s', $link, static::getLastErrorMessage()));
|
throw new FileSystemException(sprintf('Cannot delete symbolic link "%s": %s', $link, static::getLastErrorMessage()));
|
||||||
@ -707,7 +707,7 @@ class FileSystem
|
|||||||
throw new InvalidArgumentException(sprintf('%s() accepts only links as $link argument', __METHOD__));
|
throw new InvalidArgumentException(sprintf('%s() accepts only links as $link argument', __METHOD__));
|
||||||
}
|
}
|
||||||
// Use `realpath()` on Windows because `readlink()` returns the canonicalized path
|
// Use `realpath()` on Windows because `readlink()` returns the canonicalized path
|
||||||
if (($target = DS === '\\' ? @realpath($link) : @readlink($link)) !== false) {
|
if (($target = DIRECTORY_SEPARATOR === '\\' ? @realpath($link) : @readlink($link)) !== false) {
|
||||||
return $target;
|
return $target;
|
||||||
}
|
}
|
||||||
throw new FileSystemException(sprintf('Cannot resolve symbolic link "%s": %s', $link, static::getLastErrorMessage()));
|
throw new FileSystemException(sprintf('Cannot resolve symbolic link "%s": %s', $link, static::getLastErrorMessage()));
|
||||||
@ -790,7 +790,7 @@ class FileSystem
|
|||||||
static::assertExists($target);
|
static::assertExists($target);
|
||||||
}
|
}
|
||||||
// On Windows `symlink()` may require an absolute path
|
// On Windows `symlink()` may require an absolute path
|
||||||
if (@symlink($target, $link) || (DS === '\\' && @symlink(static::resolvePath($target), $link))) {
|
if (@symlink($target, $link) || (DIRECTORY_SEPARATOR === '\\' && @symlink(static::resolvePath($target), $link))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
throw new FileSystemException(sprintf('Cannot create symbolic link "%s": %s', $link, static::getLastErrorMessage()));
|
throw new FileSystemException(sprintf('Cannot create symbolic link "%s": %s', $link, static::getLastErrorMessage()));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user