-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathFeatureContext.php
More file actions
556 lines (496 loc) · 17.5 KB
/
Copy pathFeatureContext.php
File metadata and controls
556 lines (496 loc) · 17.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
<?php
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
use Behat\Behat\Context\SnippetAcceptingContext;
/**
* Defines application features from the specific context.
*/
class FeatureContext implements SnippetAcceptingContext {
protected $buildDir;
protected $serverDir;
protected $updateServerDir;
protected $tmpDownloadDir;
protected $downloadURL = 'https://download.nextcloud.com/server/releases/';
protected $dailyDownloadURL = 'https://download.nextcloud.com/server/daily/latest-';
protected $prereleasesDownloadURL = 'https://download.nextcloud.com/server/prereleases/';
/** @var resource */
protected $updaterServerProcess = null;
/** @var string[] */
protected $CLIOutput;
/** @var integer */
protected $CLIReturnCode;
/** @var string */
protected $autoupdater = '1';
/** @var bool */
protected $skipIt = false;
public function __construct() {
$baseDir = __DIR__ . '/../../data/';
$this->serverDir = $baseDir . 'server/';
$this->tmpDownloadDir = $baseDir . 'downloads/';
$this->updateServerDir = $baseDir . 'update-server/';
$this->buildDir = $baseDir . '../../';
if (!file_exists($baseDir) && !mkdir($baseDir)) {
throw new RuntimeException('Creating tmp download dir failed');
}
if (!file_exists($this->serverDir) && !mkdir($this->serverDir)) {
throw new RuntimeException('Creating server dir failed');
}
if (!file_exists($this->tmpDownloadDir) && !mkdir($this->tmpDownloadDir)) {
throw new RuntimeException('Creating tmp download dir failed');
}
if (!file_exists($this->updateServerDir) && !mkdir($this->updateServerDir)) {
throw new RuntimeException('Creating update server dir failed');
}
}
/**
* @AfterScenario
*/
public function stopUpdateServer() {
if (is_resource($this->updaterServerProcess)) {
proc_terminate($this->updaterServerProcess);
proc_close($this->updaterServerProcess);
}
}
/**
* @Given /the current (installed )?version is ([0-9.]+((beta|RC|rc)[0-9]?)?|stable[0-9]+|master)/
*/
public function theCurrentInstalledVersionIs($installed, $version) {
if ($this->skipIt) {
return;
}
// recursive deletion of server folder
if (file_exists($this->serverDir)) {
$iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($this->serverDir, RecursiveDirectoryIterator::SKIP_DOTS),
RecursiveIteratorIterator::CHILD_FIRST
);
foreach ($iterator as $fileInfo) {
$action = $fileInfo->isDir() ? 'rmdir' : 'unlink';
$action($fileInfo->getRealPath());
}
$state = rmdir($this->serverDir);
if ($state === false) {
throw new \Exception('Could not rmdir ' . $this->serverDir);
}
}
$filename = 'nextcloud-' . $version . '.zip';
if (!file_exists($this->tmpDownloadDir . $filename)) {
$fp = fopen($this->tmpDownloadDir . $filename, 'w+');
$url = $this->downloadURL . $filename;
if (str_contains($version, 'RC') || str_contains($version, 'rc') || str_contains($version, 'beta')) {
$url = $this->prereleasesDownloadURL . 'nextcloud-' . $version . '.zip';
} elseif (strpos($version, 'stable') !== false || strpos($version, 'master') !== false) {
$url = $this->dailyDownloadURL . $version . '.zip';
}
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_USERAGENT, 'Nextcloud Updater');
if (curl_exec($ch) === false) {
throw new \Exception('Curl error: ' . curl_error($ch));
}
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($httpCode !== 200) {
throw new \Exception('Download failed for ' . $url . ' - HTTP code: ' . $httpCode);
}
curl_close($ch);
fclose($fp);
}
$zip = new ZipArchive;
$zipState = $zip->open($this->tmpDownloadDir . $filename);
if ($zipState === true) {
$zip->extractTo($this->serverDir);
$zip->close();
} else {
throw new \Exception('Cant handle ZIP file. Error code is: ' . $zipState);
}
if ($installed === '') {
// the instance should not be installed
return;
}
chdir($this->serverDir . 'nextcloud');
shell_exec('chmod +x occ');
exec('./occ maintenance:install --admin-user=admin --admin-pass=admin 2>&1', $output, $returnCode);
if ($returnCode !== 0) {
throw new Exception('Install failed' . PHP_EOL . join(PHP_EOL, $output));
}
}
/**
* @Given there is no update available
*/
public function thereIsNoUpdateAvailable() {
if ($this->skipIt) {
return;
}
$this->runUpdateServer();
$content = '';
file_put_contents($this->updateServerDir . 'index.php', $content);
}
/**
* @Given the autoupdater is disabled
*/
public function theAutoupdaterIsDisabled() {
if ($this->skipIt) {
return;
}
$this->autoupdater = '0';
}
/**
* @When the CLI updater is run successfully
*/
public function theCliUpdaterIsRunSuccessfully() {
if ($this->skipIt) {
return;
}
$this->theCliUpdaterIsRun();
if ($this->CLIReturnCode !== 0) {
throw new Exception('updater failed' . PHP_EOL . join(PHP_EOL, $this->CLIOutput));
}
}
/**
* @When the CLI updater is run
*/
public function theCliUpdaterIsRun() {
if ($this->skipIt) {
return;
}
if (!file_exists($this->buildDir . 'updater.phar')) {
throw new Exception('updater.phar not available - please build it in advance via "box build -c box.json"');
}
copy($this->buildDir . 'updater.phar', $this->serverDir . 'nextcloud/updater/updater');
chdir($this->serverDir . 'nextcloud/updater');
chmod($this->serverDir . 'nextcloud/updater/updater', 0755);
exec('./updater -n', $output, $returnCode);
// sleep to let the opcache do it's work and invalidate the status.php
sleep(5);
$this->CLIOutput = $output;
$this->CLIReturnCode = $returnCode;
}
/**
* @param $version
* @return string
*/
public function getSignatureForVersion($version) {
$signatures = [
'24.0.1' => 'AGjMXl1X1hRSZv++TOhoS5GzQ5LovzG6uCESqEVgSR+Xd+l82lCUNvJ6saGYp8xk
wL3OnDOnNVcT11xV9Xybt9JLU9tmXf3hf4/HNeyufWKr6AgUENrG7p4dx+tzLk5v
fYtOdoqnhyNNLkrshWcEd7COiaK73O4IlivdOyEZkp/L16RlK5wcs4wAy+M/ot6G
vodwhgcFEbTxA4rRgPQgAk1jw/IKOBb5mMqR0DwZXZGDrnt32+++fTVhMBIVe1hA
XvRlbXYM64mwjbLN0jsrj4yXvaq081NRcHgDUnx7crmgZPVcP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ufLw
V9tAyTb/fjsj/oUM0wa2bePC3wk/ai8RjWXbZNX2g5YQAxgkCQjfdvb5RNVvmuCL
AJBwc9EthsEKMVkKj9R41g==',
'26.0.0' => 'C7bAPCDo+ZrmIKkxXeJmInOINo2RI0zqxBmNk5bcMjXviPjPeE8SrHbhDcPLHMsp
wUM//AMxbYUKtKBHPYqvw28O5kQhDe9gyCGo5zyTeFDjpgNgQvxa6TxSyl5O03aD
CehZjUf8mnOyaSkJcmkCqJokl2uCXoB9r7pTZwGEURvjv7UOHe6rmKgJAWBeCb1D
ddE/CLFhszZSGGdZRnhYIR5aRkFxUWXiBqtCVbpPf0VjzYIlBzRXDh4s/8JjsPeW
gsVtwgwxZ3CfzIoVeFeq7LQep+bCstdTvCZjs7GmvS6SgRlDvAOm82EBGY1rVQKD
t87PcaZyrupEfAIfD9uQRA==',
];
if (isset($signatures[$version])) {
return $signatures[$version];
}
return '';
}
/**
* @Given /there is an update to version ([0-9.]+) available/
*/
public function thereIsAnUpdateToVersionAvailable($version) {
if ($this->skipIt) {
return;
}
$this->runUpdateServer();
$content = '<?php
header("Content-Type: application/xml");
?>
<?xml version="1.0" encoding="UTF-8"?>
<nextcloud>
<version>' . str_replace(['9.1', '9.2'], ['10.0', '11.0'], $version) . '</version>
<versionstring>Nextcloud ' . $version . '</versionstring>
<url>https://download.nextcloud.com/server/releases/nextcloud-' . $version . '.zip</url>
<web>https://docs.nextcloud.org/server/10/admin_manual/maintenance/manual_upgrade.html</web>
<autoupdater>' . $this->autoupdater . '</autoupdater>
<signature>' . $this->getSignatureForVersion($version) . '</signature>
</nextcloud>
';
file_put_contents($this->updateServerDir . 'index.php', $content);
}
/**
* @Given there is an update to prerelease version :version available
*/
public function thereIsAnUpdateToPrereleaseVersionAvailable($version) {
if ($this->skipIt) {
return;
}
$this->runUpdateServer();
$content = '<?php
header("Content-Type: application/xml");
?>
<?xml version="1.0" encoding="UTF-8"?>
<nextcloud>
<version>' . str_replace(['9.1', '9.2'], ['10.0', '11.0'], $version) . '</version>
<versionstring>Nextcloud ' . $version . '</versionstring>
<url>https://download.nextcloud.com/server/prereleases/nextcloud-' . $version . '.zip</url>
<web>https://docs.nextcloud.org/server/10/admin_manual/maintenance/manual_upgrade.html</web>
<autoupdater>1</autoupdater>
<signature>' . $this->getSignatureForVersion($version) . '</signature>
</nextcloud>
';
file_put_contents($this->updateServerDir . 'index.php', $content);
}
/**
* @Given /there is an update to daily version of (.*) available/
*/
public function thereIsAnUpdateToDailyVersionAvailable($version) {
if ($this->skipIt) {
return;
}
$this->runUpdateServer();
$content = '<?php
header("Content-Type: application/xml");
?>
<?xml version="1.0" encoding="UTF-8"?>
<nextcloud>
<version>100.0.0.0</version>
<versionstring>Nextcloud ' . $version . '</versionstring>
<url>https://download.nextcloud.com/server/daily/latest-' . $version . '.zip</url>
<web>https://docs.nextcloud.org/server/10/admin_manual/maintenance/manual_upgrade.html</web>
<autoupdater>1</autoupdater>
</nextcloud>
';
file_put_contents($this->updateServerDir . 'index.php', $content);
}
/**
* runs the updater server
* @throws Exception
*/
protected function runUpdateServer() {
$configFile = $this->serverDir . 'nextcloud/config/config.php';
$content = file_get_contents($configFile);
$content = preg_replace('!\$CONFIG\s*=\s*array\s*\(!', "\$CONFIG = array(\n 'updater.server.url' => 'http://localhost:8870/',", $content);
file_put_contents($configFile, $content);
if (!is_null($this->updaterServerProcess)) {
throw new Exception('Update server already started');
}
$cmd = 'php -S localhost:8870 -t ' . $this->updateServerDir . ' 2>/dev/null 1>/dev/null';
$this->updaterServerProcess = proc_open($cmd, [], $pipes, $this->updateServerDir);
if (!is_resource($this->updaterServerProcess)) {
throw new Exception('Update server could not be started');
}
// to let the server start
sleep(1);
}
/**
* @Then /the installed version should be ([0-9.]+)/
*/
public function theInstalledVersionShouldBe2($version) {
if ($this->skipIt) {
return;
}
/** @var $OC_Version */
require $this->serverDir . 'nextcloud/version.php';
$installedVersion = join('.', $OC_Version);
if (strpos($installedVersion, $version) !== 0) {
throw new Exception('Version mismatch - Installed: ' . $installedVersion . ' Wanted: ' . $version);
}
}
/**
* @Then /maintenance mode should be (on|off)/
*/
public function maintenanceModeShouldBe($state) {
if ($this->skipIt) {
return;
}
chdir($this->serverDir . 'nextcloud');
shell_exec('chmod +x occ');
exec('./occ maintenance:mode', $output, $returnCode);
$expectedOutput = 'Maintenance mode is currently '
. ($state === 'on' ? 'enabled' : 'disabled');
if ($returnCode !== 0 || strpos(join(PHP_EOL, $output), $expectedOutput) === false) {
throw new Exception('Maintenance mode does not match ' . PHP_EOL . join(PHP_EOL, $output));
}
}
/**
* @Given the current channel is :channel
* @param string $channel
*/
public function theCurrentChannelIs($channel) {
if ($this->skipIt) {
return;
}
chdir($this->serverDir . 'nextcloud');
shell_exec('chmod +x occ');
exec('./occ config:system:set --value ' . $channel . ' updater.release.channel');
}
/**
* @Given the config key :key is set to :value of type :type
* @param string $key
* @param mixed $value
* @param string $type ('string', 'boolean', 'integer', 'double')
*/
public function theConfigKeyIsSetTo(string $key, $value, string $type = 'string') {
if ($this->skipIt) {
return;
}
if (!in_array($type, ['string', 'boolean', 'integer', 'double'])) {
throw new Exception('Invalid type given: ' . $type);
}
chdir($this->serverDir . 'nextcloud');
shell_exec('chmod +x occ');
exec("./occ config:system:set $key --value '$value' --type '$type'");
}
/**
* @Then the user ini file contains :content
* @param string $content
*/
public function theUserIniFileContains(string $content) {
if ($this->skipIt) {
return;
}
$userIniFile = $this->serverDir . 'nextcloud/.user.ini';
if (!file_exists($userIniFile)) {
throw new Exception('User ini file does not exist: ' . $userIniFile);
}
$contents = file_get_contents($userIniFile);
if (!str_contains($contents, $content)) {
throw new Exception('Content not found in user ini file: ' . $content);
}
}
/**
* @Then /upgrade is (not required|required)/
*/
public function upgradeIs($state) {
if ($this->skipIt) {
return;
}
chdir($this->serverDir . 'nextcloud');
shell_exec('chmod +x occ');
exec('./occ status', $output, $returnCode);
$upgradeOutput = 'Nextcloud or one of the apps require upgrade';
$outputString = join(PHP_EOL, $output);
if ($returnCode !== 0) {
throw new Exception('Return code of status output does not match ' . PHP_EOL . $outputString);
}
if ($state === 'not required') {
if (strpos($outputString, $upgradeOutput) !== false) {
throw new Exception('Upgrade is required ' . PHP_EOL . join(PHP_EOL, $output));
}
} else {
if (strpos($outputString, $upgradeOutput) === false) {
throw new Exception('Upgrade is not required ' . PHP_EOL . join(PHP_EOL, $output));
}
}
}
/**
* @Then /the return code should not be (\S*)/
*/
public function theReturnCodeShouldNotBe($expectedReturnCode) {
if ($this->skipIt) {
return;
}
if ($this->CLIReturnCode === (int)$expectedReturnCode) {
throw new Exception('Return code does match but should not match: ' . $this->CLIReturnCode . PHP_EOL . join(PHP_EOL, $this->CLIOutput));
}
}
/**
* @Then /the output should contain "(.*)"/
*/
public function theOutputShouldBe($expectedOutput) {
if ($this->skipIt) {
return;
}
if (strpos(join(PHP_EOL, $this->CLIOutput), $expectedOutput) === false) {
throw new Exception('Output does not match: ' . PHP_EOL . join(PHP_EOL, $this->CLIOutput));
}
}
/**
* @Given /the version number is decreased in the config.php to enforce upgrade/
*/
public function theVersionNumberIsDecreasedInTheConfigPHPToEnforceUpgrade() {
if ($this->skipIt) {
return;
}
$configFile = $this->serverDir . 'nextcloud/config/config.php';
$content = file_get_contents($configFile);
$content = preg_replace("!'version'\s*=>\s*'(\d+\.\d+\.\d+)\.\d+!", "'version' => '$1", $content);
file_put_contents($configFile, $content);
}
/**
* @Given there is a folder called :name
*/
public function thereIsAFolderCalled($name) {
if ($this->skipIt) {
return;
}
mkdir($this->serverDir . 'nextcloud/' . $name);
}
/**
* @Given there is a config for a secondary apps directory called :name
*/
public function thereIsAConfigForASecondaryAppsDirectoryCalled($name) {
if ($this->skipIt) {
return;
}
$configFile = $this->serverDir . 'nextcloud/config/config.php';
$content = file_get_contents($configFile);
$appsPaths = <<<EOF
'apps_paths' => [
[
'path'=> dirname(__DIR__) . '/apps',
'url' => '/apps',
'writable' => true,
],
[
'path'=> dirname(__DIR__) . '/%s',
'url' => '/%s',
'writable' => true,
],
],
EOF;
$appsPaths = sprintf($appsPaths, $name, $name);
$content = preg_replace("!\);!", $appsPaths . ');', $content);
file_put_contents($configFile, $content);
}
/**
* @Given /PHP is at least in version ([0-9.]+)/
*/
public function phpIsAtLeastInVersion($version) {
$this->skipIt = !version_compare($version, PHP_VERSION, '<');
}
}