ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ForcedCopy.php
Go to the documentation of this file.
1<?php
2
4
6
8{
12 public function getMethod()
13 {
14 return 'forceCopy';
15 }
16
27 public function handle($path, $newpath)
28 {
29 try {
30 $deleted = $this->filesystem->delete($newpath);
31 } catch (FileNotFoundException $e) {
32 // The destination path does not exist. That's ok.
33 $deleted = true;
34 }
35
36 if ($deleted) {
37 return $this->filesystem->copy($path, $newpath);
38 }
39
40 return false;
41 }
42}
An exception for terminatinating execution or to throw for unit testing.
getMethod()
Get the method name.string
Definition: ForcedCopy.php:12
handle($path, $newpath)
Copies a file, overwriting any existing files.
Definition: ForcedCopy.php:27