Skip to content

Commit

Permalink
API Remove deprecated API
Browse files Browse the repository at this point in the history
Note that we will also need to update any composer references to
vendor-plugin to use the new version, since until this we were just
going to keep using 2.x
  • Loading branch information
GuySartorelli committed Jan 6, 2025
1 parent 4149c1f commit c53af4c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 31 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ is blocked from web-access by default.

For example, given the below module composer.json:

(note there is no need to explicitly add `silverstripe/vendor-plugin` as a dependency when `silverstripe/framework` is included)

```json
{
"name": "tractorcow/anothermodule",
Expand All @@ -22,7 +24,6 @@ For example, given the below module composer.json:
]
},
"require": {
"silverstripe/vendor-plugin": "^1.0",
"silverstripe/framework": "^4.0"
}
}
Expand Down
30 changes: 0 additions & 30 deletions src/Methods/CopyMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,34 +34,4 @@ public function exposeDirectory($source, $target)
throw new RuntimeException("Could not write to directory $target");
}
}

/**
* Copies a file or directory from $source to $target.
*
*
* @param string $source
* @param string $target
* @deprecated 5.2 Use Filesystem::copy instead
* @return bool
*/
public function copy($source, $target)
{
if (!is_dir($source ?? '')) {
return copy($source ?? '', $target ?? '');
}
$it = new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS);
/** @var RecursiveDirectoryIterator $ri */
$ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::SELF_FIRST);
$this->filesystem->ensureDirectoryExists($target);
$result = true;
foreach ($ri as $file) {
$targetPath = $target . DIRECTORY_SEPARATOR . $ri->getSubPathName();
if ($file->isDir()) {
$this->filesystem->ensureDirectoryExists($targetPath);
} else {
$result = $result && copy($file->getPathname() ?? '', $targetPath ?? '');
}
}
return $result;
}
}

0 comments on commit c53af4c

Please sign in to comment.