Skip to content

Commit f5496ed

Browse files
committed
fix: Remove coding-standard from main composer.json and update the one in bin folder instead
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
1 parent 34cd7da commit f5496ed

59 files changed

Lines changed: 613 additions & 1087 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
"psalm:fix": "- --issues=InvalidReturnType,InvalidNullableReturnType,MissingParamType,InvalidFalsableReturnType"
2929
},
3030
"require-dev": {
31-
"bamarni/composer-bin-plugin": "^1.8",
32-
"nextcloud/coding-standard": "^1.1"
31+
"bamarni/composer-bin-plugin": "^1.8"
3332
},
3433
"extra": {
3534
"bamarni-bin": {

composer.lock

Lines changed: 5 additions & 145 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.php

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,8 @@ private function getAppDirectories(): array {
277277
throw new \Exception('Invalid configuration in apps_paths configuration key');
278278
}
279279
$appDir = basename($appsPath['path']);
280-
if (strpos($appsPath['path'], $this->nextcloudDir.'/') === 0) {
281-
$relativePath = substr($appsPath['path'], strlen($this->nextcloudDir.'/'));
280+
if (strpos($appsPath['path'], $this->nextcloudDir . '/') === 0) {
281+
$relativePath = substr($appsPath['path'], strlen($this->nextcloudDir . '/'));
282282
if ($relativePath !== 'apps') {
283283
$expected[] = $relativePath;
284284
}
@@ -305,7 +305,7 @@ private function getRecursiveDirectoryIterator(string $folder, array $excludedPa
305305
$handle = opendir($folder);
306306

307307
if ($handle === false) {
308-
throw new \Exception('Could not open '.$folder);
308+
throw new \Exception('Could not open ' . $folder);
309309
}
310310

311311
/* Store first level children in an array to avoid trouble if changes happen while iterating */
@@ -323,7 +323,7 @@ private function getRecursiveDirectoryIterator(string $folder, array $excludedPa
323323
closedir($handle);
324324

325325
foreach ($children as $name) {
326-
$path = $folder.'/'.$name;
326+
$path = $folder . '/' . $name;
327327
if (is_dir($path)) {
328328
yield from $this->getRecursiveDirectoryIterator($path, []);
329329
}
@@ -382,7 +382,7 @@ public function checkWritePermissions(): void {
382382
* @throws \Exception when config.php can't be written
383383
*/
384384
public function setMaintenanceMode(bool $state): void {
385-
$this->silentLog('[info] setMaintenanceMode("' . ($state ? 'true' : 'false') . '")');
385+
$this->silentLog('[info] setMaintenanceMode("' . ($state ? 'true' : 'false') . '")');
386386

387387
if ($dir = getenv('NEXTCLOUD_CONFIG_DIR')) {
388388
$configFileName = rtrim($dir, '/') . '/config.php';
@@ -424,7 +424,7 @@ public function createBackup(): void {
424424
];
425425

426426
// Create new folder for the backup
427-
$backupFolderLocation = $this->getUpdateDirectoryLocation() . '/updater-'.$this->getConfigOptionMandatoryString('instanceid').'/backups/nextcloud-'.$this->getConfigOptionMandatoryString('version') . '-' . time() . '/';
427+
$backupFolderLocation = $this->getUpdateDirectoryLocation() . '/updater-' . $this->getConfigOptionMandatoryString('instanceid') . '/backups/nextcloud-' . $this->getConfigOptionMandatoryString('version') . '-' . time() . '/';
428428
$this->silentLog('[info] backup folder location: ' . $backupFolderLocation);
429429

430430
$state = mkdir($backupFolderLocation, 0750, true);
@@ -440,7 +440,7 @@ public function createBackup(): void {
440440
if (!file_exists($backupFolderLocation . '/' . $relativeDirectory)) {
441441
$state = mkdir($backupFolderLocation . '/' . $relativeDirectory, 0750, true);
442442
if ($state === false) {
443-
throw new \Exception('Could not create folder: '.$backupFolderLocation.'/'.$relativeDirectory);
443+
throw new \Exception('Could not create folder: ' . $backupFolderLocation . '/' . $relativeDirectory);
444444
}
445445
}
446446

@@ -501,7 +501,7 @@ private function getUpdateServerResponse(): array {
501501
$this->silentLog('[info] releaseChannel: ' . $releaseChannel);
502502
$this->silentLog('[info] internal version: ' . $this->getConfigOptionMandatoryString('version'));
503503

504-
$updateURL = $updaterServer . '?version='. str_replace('.', 'x', $this->getConfigOptionMandatoryString('version')) .'xxx'.$releaseChannel.'xx'.urlencode($this->buildTime).'x'.PHP_MAJOR_VERSION.'x'.PHP_MINOR_VERSION.'x'.PHP_RELEASE_VERSION;
504+
$updateURL = $updaterServer . '?version=' . str_replace('.', 'x', $this->getConfigOptionMandatoryString('version')) . 'xxx' . $releaseChannel . 'xx' . urlencode($this->buildTime) . 'x' . PHP_MAJOR_VERSION . 'x' . PHP_MINOR_VERSION . 'x' . PHP_RELEASE_VERSION;
505505
$this->silentLog('[info] updateURL: ' . $updateURL);
506506

507507
// Download update response
@@ -523,7 +523,7 @@ private function getUpdateServerResponse(): array {
523523
/** @var false|string $response */
524524
$response = curl_exec($curl);
525525
if ($response === false) {
526-
throw new \Exception('Could not do request to updater server: '.curl_error($curl));
526+
throw new \Exception('Could not do request to updater server: ' . curl_error($curl));
527527
}
528528
curl_close($curl);
529529

@@ -551,7 +551,7 @@ public function downloadUpdate(): void {
551551

552552
$response = $this->getUpdateServerResponse();
553553

554-
$storageLocation = $this->getUpdateDirectoryLocation() . '/updater-'.$this->getConfigOptionMandatoryString('instanceid') . '/downloads/';
554+
$storageLocation = $this->getUpdateDirectoryLocation() . '/updater-' . $this->getConfigOptionMandatoryString('instanceid') . '/downloads/';
555555
if (file_exists($storageLocation)) {
556556
$this->silentLog('[info] storage location exists');
557557
$this->recursiveDelete($storageLocation);
@@ -622,7 +622,7 @@ public function downloadUpdate(): void {
622622
* @throws \Exception
623623
*/
624624
private function getDownloadedFilePath(): string {
625-
$storageLocation = $this->getUpdateDirectoryLocation() . '/updater-'.$this->getConfigOptionMandatoryString('instanceid') . '/downloads/';
625+
$storageLocation = $this->getUpdateDirectoryLocation() . '/updater-' . $this->getConfigOptionMandatoryString('instanceid') . '/downloads/';
626626
$this->silentLog('[info] storage location: ' . $storageLocation);
627627

628628
$filesInStorageLocation = scandir($storageLocation);
@@ -732,23 +732,23 @@ public function extractDownload(): void {
732732
throw new \Exception('Required PHP extension missing: zip');
733733
}
734734

735-
$libzip_version = defined("ZipArchive::LIBZIP_VERSION") ? \ZipArchive::LIBZIP_VERSION : "Unknown (but old)";
735+
$libzip_version = defined('ZipArchive::LIBZIP_VERSION') ? \ZipArchive::LIBZIP_VERSION : 'Unknown (but old)';
736736
$this->silentLog('[info] Libzip version detected: ' . $libzip_version);
737737

738738
$zip = new \ZipArchive;
739739
$zipState = $zip->open($downloadedFilePath);
740740
if ($zipState === true) {
741741
$extraction = $zip->extractTo(dirname($downloadedFilePath));
742742
if ($extraction === false) {
743-
throw new \Exception('Error during unpacking zipfile: '.($zip->getStatusString()));
743+
throw new \Exception('Error during unpacking zipfile: ' . ($zip->getStatusString()));
744744
}
745745
$zip->close();
746746
$state = unlink($downloadedFilePath);
747747
if ($state === false) {
748-
throw new \Exception("Can't unlink ". $downloadedFilePath);
748+
throw new \Exception("Can't unlink " . $downloadedFilePath);
749749
}
750750
} else {
751-
throw new \Exception("Can't handle ZIP file. Error code is: ".print_r($zipState, true));
751+
throw new \Exception("Can't handle ZIP file. Error code is: " . print_r($zipState, true));
752752
}
753753

754754
// Ensure that the downloaded version is not lower
@@ -790,7 +790,7 @@ public function replaceEntryPoints(): void {
790790
}
791791
$state = file_put_contents($this->nextcloudDir . '/' . $file, $content);
792792
if ($state === false) {
793-
throw new \Exception('Can\'t replace entry point: '.$file);
793+
throw new \Exception('Can\'t replace entry point: ' . $file);
794794
}
795795
}
796796

@@ -846,7 +846,7 @@ public function deleteOldFiles(): void {
846846
throw new \Exception('core/shipped.json content is invalid');
847847
}
848848

849-
$newShippedAppsFile = $this->getUpdateDirectoryLocation() . '/updater-'.$this->getConfigOptionMandatoryString('instanceid') . '/downloads/nextcloud/core/shipped.json';
849+
$newShippedAppsFile = $this->getUpdateDirectoryLocation() . '/updater-' . $this->getConfigOptionMandatoryString('instanceid') . '/downloads/nextcloud/core/shipped.json';
850850
$newShippedAppsFileContent = file_get_contents($newShippedAppsFile);
851851
if ($newShippedAppsFileContent === false) {
852852
throw new \Exception('core/shipped.json is not available in the new release');
@@ -906,12 +906,12 @@ public function deleteOldFiles(): void {
906906
if ($fileInfo->isFile() || $fileInfo->isLink()) {
907907
$state = unlink($path);
908908
if ($state === false) {
909-
throw new \Exception('Could not unlink: '.$path);
909+
throw new \Exception('Could not unlink: ' . $path);
910910
}
911911
} elseif ($fileInfo->isDir()) {
912912
$state = rmdir($path);
913913
if ($state === false) {
914-
throw new \Exception('Could not rmdir: '.$path);
914+
throw new \Exception('Could not rmdir: ' . $path);
915915
}
916916
}
917917
}
@@ -973,7 +973,7 @@ public function moveNewVersionInPlace(): void {
973973
'public.php',
974974
'ocs',
975975
];
976-
$storageLocation = $this->getUpdateDirectoryLocation() . '/updater-'.$this->getConfigOptionMandatoryString('instanceid') . '/downloads/nextcloud/';
976+
$storageLocation = $this->getUpdateDirectoryLocation() . '/updater-' . $this->getConfigOptionMandatoryString('instanceid') . '/downloads/nextcloud/';
977977
$this->silentLog('[info] storage location: ' . $storageLocation);
978978

979979
// Rename apps and other stuff
@@ -993,15 +993,15 @@ public function moveNewVersionInPlace(): void {
993993
public function finalize(): void {
994994
$this->silentLog('[info] finalize()');
995995

996-
$storageLocation = $this->getUpdateDirectoryLocation() . '/updater-'.$this->getConfigOptionMandatoryString('instanceid') . '/downloads/nextcloud/';
996+
$storageLocation = $this->getUpdateDirectoryLocation() . '/updater-' . $this->getConfigOptionMandatoryString('instanceid') . '/downloads/nextcloud/';
997997
$this->silentLog('[info] storage location: ' . $storageLocation);
998998
$this->moveWithExclusions($storageLocation, []);
999999
$state = rmdir($storageLocation);
10001000
if ($state === false) {
10011001
throw new \Exception('Could not rmdir $storagelocation');
10021002
}
10031003

1004-
$state = unlink($this->getUpdateDirectoryLocation() . '/updater-'.$this->getConfigOptionMandatoryString('instanceid') . '/.step');
1004+
$state = unlink($this->getUpdateDirectoryLocation() . '/updater-' . $this->getConfigOptionMandatoryString('instanceid') . '/.step');
10051005
if ($state === false) {
10061006
throw new \Exception('Could not rmdir .step');
10071007
}
@@ -1018,7 +1018,7 @@ public function finalize(): void {
10181018
* @throws \Exception
10191019
*/
10201020
private function writeStep(string $state, int $step): void {
1021-
$updaterDir = $this->getUpdateDirectoryLocation() . '/updater-'.$this->getConfigOptionMandatoryString('instanceid');
1021+
$updaterDir = $this->getUpdateDirectoryLocation() . '/updater-' . $this->getConfigOptionMandatoryString('instanceid');
10221022
if (!file_exists($updaterDir . '/.step')) {
10231023
if (!file_exists($updaterDir)) {
10241024
$result = mkdir($updaterDir);
@@ -1060,8 +1060,8 @@ public function endStep(int $step): void {
10601060
public function currentStep(): array {
10611061
$this->silentLog('[info] currentStep()');
10621062

1063-
$updaterDir = $this->getUpdateDirectoryLocation() . '/updater-'.$this->getConfigOptionMandatoryString('instanceid');
1064-
if (!file_exists($updaterDir. '/.step')) {
1063+
$updaterDir = $this->getUpdateDirectoryLocation() . '/updater-' . $this->getConfigOptionMandatoryString('instanceid');
1064+
if (!file_exists($updaterDir . '/.step')) {
10651065
return [];
10661066
}
10671067

@@ -1079,7 +1079,7 @@ public function currentStep(): array {
10791079
}
10801080

10811081
public function getUpdateStepFileLocation(): string {
1082-
$updaterDir = $this->getUpdateDirectoryLocation() . '/updater-'.$this->getConfigOption('instanceid');
1082+
$updaterDir = $this->getUpdateDirectoryLocation() . '/updater-' . $this->getConfigOption('instanceid');
10831083
return $updaterDir . '/.step';
10841084
}
10851085

@@ -1091,7 +1091,7 @@ public function getUpdateStepFileLocation(): string {
10911091
public function rollbackChanges(int $step): void {
10921092
$this->silentLog('[info] rollbackChanges("' . $step . '")');
10931093

1094-
$updaterDir = $this->getUpdateDirectoryLocation() . '/updater-'.$this->getConfigOptionMandatoryString('instanceid');
1094+
$updaterDir = $this->getUpdateDirectoryLocation() . '/updater-' . $this->getConfigOptionMandatoryString('instanceid');
10951095
if (file_exists($updaterDir . '/.step')) {
10961096
$this->silentLog('[info] unlink .step');
10971097
$state = unlink($updaterDir . '/.step');

0 commit comments

Comments
 (0)