1 | <?php |
||
33 | class Fetcher { |
||
34 | |||
35 | const DEFAULT_BASE_URL = 'https://updates.owncloud.com/server/'; |
||
36 | |||
37 | /** |
||
38 | * @var Locator $locator |
||
39 | */ |
||
40 | protected $locator; |
||
41 | |||
42 | /** |
||
43 | * @var ConfigReader $configReader |
||
44 | */ |
||
45 | protected $configReader; |
||
46 | |||
47 | /** |
||
48 | * @var Client $httpClient |
||
49 | */ |
||
50 | protected $httpClient; |
||
51 | protected $requiredFeedEntries = [ |
||
52 | 'version', |
||
53 | 'versionstring', |
||
54 | 'url' |
||
55 | ]; |
||
56 | |||
57 | /** |
||
58 | * Constructor |
||
59 | * |
||
60 | * @param Client $httpClient |
||
61 | * @param Locator $locator |
||
62 | * @param ConfigReader $configReader |
||
63 | */ |
||
64 | 3 | public function __construct(Client $httpClient, Locator $locator, ConfigReader $configReader){ |
|
69 | |||
70 | /** |
||
71 | * Download new ownCloud package |
||
72 | * @param Feed $feed |
||
73 | * @param Callable $onProgress |
||
74 | * @throws \Exception |
||
75 | * @throws \UnexpectedValueException |
||
76 | */ |
||
77 | public function getOwncloud(Feed $feed, callable $onProgress){ |
||
96 | |||
97 | /** |
||
98 | * Produce a local path to save the package to |
||
99 | * @param Feed $feed |
||
100 | * @return string |
||
101 | */ |
||
102 | public function getBaseDownloadPath(Feed $feed){ |
||
106 | |||
107 | /** |
||
108 | * Get md5 sum for the package |
||
109 | * @param Feed $feed |
||
110 | * @return string |
||
111 | */ |
||
112 | public function getMd5(Feed $feed){ |
||
118 | |||
119 | /** |
||
120 | * Read update feed for new releases |
||
121 | * @return Feed |
||
122 | */ |
||
123 | 3 | public function getFeed(){ |
|
141 | |||
142 | /** |
||
143 | * @return mixed|string |
||
144 | */ |
||
145 | 3 | public function getUpdateChannel(){ |
|
153 | |||
154 | /** |
||
155 | * Produce complete feed URL |
||
156 | * @return string |
||
157 | */ |
||
158 | 3 | protected function getFeedUrl(){ |
|
176 | |||
177 | /** |
||
178 | * Get URL content |
||
179 | * @param string $url |
||
180 | * @return string |
||
181 | * @throws \UnexpectedValueException |
||
182 | */ |
||
183 | 3 | protected function download($url){ |
|
188 | |||
189 | /** |
||
190 | * Check if request was successful |
||
191 | * @param ResponseInterface $response |
||
192 | * @param string $url |
||
193 | * @throws \UnexpectedValueException |
||
194 | */ |
||
195 | 3 | protected function validateResponse(ResponseInterface $response, $url){ |
|
205 | |||
206 | } |
||
207 |