1 | <?php |
||
10 | class HackedProjectWebDownloader { |
||
11 | /** |
||
12 | * @var Project |
||
13 | */ |
||
14 | protected $project; |
||
15 | |||
16 | /** |
||
17 | * Constructor, pass in the project this downloaded is expected to download. |
||
18 | * @param Project $project |
||
19 | */ |
||
20 | public function __construct(Project $project) { |
||
23 | |||
24 | /** |
||
25 | * Returns a temp directory to work in. |
||
26 | * |
||
27 | * @param string $namespace |
||
28 | * The optional namespace of the temp directory, defaults to the classname. |
||
29 | * @return string |
||
30 | */ |
||
31 | protected function getTempDirectory($namespace = NULL) { |
||
46 | |||
47 | /** |
||
48 | * Returns a directory to save the downloaded project into. |
||
49 | * @return string |
||
50 | */ |
||
51 | protected function getDestination() { |
||
63 | |||
64 | /** |
||
65 | * Returns the final destination of the unpacked project. |
||
66 | * @return string |
||
67 | */ |
||
68 | public function getFinalDestination() { |
||
73 | |||
74 | /** |
||
75 | * Download the remote files to the local filesystem. |
||
76 | * @return bool |
||
77 | */ |
||
78 | public function downloadFile() { |
||
81 | |||
82 | /** |
||
83 | * Recursively delete all files and folders in the specified filepath, then |
||
84 | * delete the containing folder. |
||
85 | * |
||
86 | * Note that this only deletes visible files with write permission. |
||
87 | * |
||
88 | * @param string $path |
||
89 | * A filepath relative to file_directory_path. |
||
90 | */ |
||
91 | protected function removeDir($path) { |
||
110 | } |
||
111 |
If you suppress an error, we recommend checking for the error condition explicitly: