Skip to content

Commit 0906fb8

Browse files
authored
Merge pull request #625 from nextcloud/backport/624/stable30
2 parents b1a6143 + cc4d463 commit 0906fb8

File tree

14 files changed

+104
-34
lines changed

14 files changed

+104
-34
lines changed

index.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,8 @@ private function getUpdateServerResponse(): array {
536536
CURLOPT_RETURNTRANSFER => 1,
537537
CURLOPT_URL => $updateURL,
538538
CURLOPT_USERAGENT => 'Nextcloud Updater',
539+
CURLOPT_FOLLOWLOCATION => 1,
540+
CURLOPT_MAXREDIRS => 2,
539541
]);
540542

541543
if ($this->getConfigOption('proxy') !== null) {

lib/Updater.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,8 @@ private function getUpdateServerResponse(): array {
498498
CURLOPT_RETURNTRANSFER => 1,
499499
CURLOPT_URL => $updateURL,
500500
CURLOPT_USERAGENT => 'Nextcloud Updater',
501+
CURLOPT_FOLLOWLOCATION => 1,
502+
CURLOPT_MAXREDIRS => 2,
501503
]);
502504

503505
if ($this->getConfigOption('proxy') !== null) {

tests/features/master.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ Feature: CLI updater - master base
77
And the version number is decreased in the config.php to enforce upgrade
88
When the CLI updater is run successfully
99
And the output should contain "Update successful"
10-
Then the installed version should be 30.0
10+
Then the installed version should be 32.0
1111
And maintenance mode should be off
1212
And upgrade is not required

updater.phar

1.27 KB
Binary file not shown.

vendor/autoload.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@
1414
echo $err;
1515
}
1616
}
17-
trigger_error(
18-
$err,
19-
E_USER_ERROR
20-
);
17+
throw new RuntimeException($err);
2118
}
2219

2320
require_once __DIR__ . '/composer/autoload_real.php';

vendor/composer/InstalledVersions.php

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,23 @@
2626
*/
2727
class InstalledVersions
2828
{
29+
/**
30+
* @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to
31+
* @internal
32+
*/
33+
private static $selfDir = null;
34+
2935
/**
3036
* @var mixed[]|null
3137
* @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
3238
*/
3339
private static $installed;
3440

41+
/**
42+
* @var bool
43+
*/
44+
private static $installedIsLocalDir;
45+
3546
/**
3647
* @var bool|null
3748
*/
@@ -309,6 +320,24 @@ public static function reload($data)
309320
{
310321
self::$installed = $data;
311322
self::$installedByVendor = array();
323+
324+
// when using reload, we disable the duplicate protection to ensure that self::$installed data is
325+
// always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
326+
// so we have to assume it does not, and that may result in duplicate data being returned when listing
327+
// all installed packages for example
328+
self::$installedIsLocalDir = false;
329+
}
330+
331+
/**
332+
* @return string
333+
*/
334+
private static function getSelfDir()
335+
{
336+
if (self::$selfDir === null) {
337+
self::$selfDir = strtr(__DIR__, '\\', '/');
338+
}
339+
340+
return self::$selfDir;
312341
}
313342

314343
/**
@@ -322,19 +351,27 @@ private static function getInstalled()
322351
}
323352

324353
$installed = array();
354+
$copiedLocalDir = false;
325355

326356
if (self::$canGetVendors) {
357+
$selfDir = self::getSelfDir();
327358
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
359+
$vendorDir = strtr($vendorDir, '\\', '/');
328360
if (isset(self::$installedByVendor[$vendorDir])) {
329361
$installed[] = self::$installedByVendor[$vendorDir];
330362
} elseif (is_file($vendorDir.'/composer/installed.php')) {
331363
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
332364
$required = require $vendorDir.'/composer/installed.php';
333-
$installed[] = self::$installedByVendor[$vendorDir] = $required;
334-
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
335-
self::$installed = $installed[count($installed) - 1];
365+
self::$installedByVendor[$vendorDir] = $required;
366+
$installed[] = $required;
367+
if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
368+
self::$installed = $required;
369+
self::$installedIsLocalDir = true;
336370
}
337371
}
372+
if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
373+
$copiedLocalDir = true;
374+
}
338375
}
339376
}
340377

@@ -350,7 +387,7 @@ private static function getInstalled()
350387
}
351388
}
352389

353-
if (self::$installed !== array()) {
390+
if (self::$installed !== array() && !$copiedLocalDir) {
354391
$installed[] = self::$installed;
355392
}
356393

vendor/composer/installed.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,24 +62,24 @@
6262
},
6363
{
6464
"name": "nextcloud/coding-standard",
65-
"version": "v1.1.1",
66-
"version_normalized": "1.1.1.0",
65+
"version": "v1.2.1",
66+
"version_normalized": "1.2.1.0",
6767
"source": {
6868
"type": "git",
6969
"url": "https://github.com/nextcloud/coding-standard.git",
70-
"reference": "55def702fb9a37a219511e1d8c6fe8e37164c1fb"
70+
"reference": "cf5f18d989ec62fb4cdc7fc92a36baf34b3d829e"
7171
},
7272
"dist": {
7373
"type": "zip",
74-
"url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/55def702fb9a37a219511e1d8c6fe8e37164c1fb",
75-
"reference": "55def702fb9a37a219511e1d8c6fe8e37164c1fb",
74+
"url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/cf5f18d989ec62fb4cdc7fc92a36baf34b3d829e",
75+
"reference": "cf5f18d989ec62fb4cdc7fc92a36baf34b3d829e",
7676
"shasum": ""
7777
},
7878
"require": {
7979
"php": "^7.3|^8.0",
8080
"php-cs-fixer/shim": "^3.17"
8181
},
82-
"time": "2023-06-01T12:05:01+00:00",
82+
"time": "2024-02-01T14:54:37+00:00",
8383
"type": "library",
8484
"installation-source": "dist",
8585
"autoload": {
@@ -100,23 +100,23 @@
100100
"description": "Nextcloud coding standards for the php cs fixer",
101101
"support": {
102102
"issues": "https://github.com/nextcloud/coding-standard/issues",
103-
"source": "https://github.com/nextcloud/coding-standard/tree/v1.1.1"
103+
"source": "https://github.com/nextcloud/coding-standard/tree/v1.2.1"
104104
},
105105
"install-path": "../nextcloud/coding-standard"
106106
},
107107
{
108108
"name": "php-cs-fixer/shim",
109-
"version": "v3.17.0",
110-
"version_normalized": "3.17.0.0",
109+
"version": "v3.51.0",
110+
"version_normalized": "3.51.0.0",
111111
"source": {
112112
"type": "git",
113113
"url": "https://github.com/PHP-CS-Fixer/shim.git",
114-
"reference": "f51b4aed90565c447136f1d015798f6f7c82490f"
114+
"reference": "a792394f7f3934f75a4df9dca544796c6f503027"
115115
},
116116
"dist": {
117117
"type": "zip",
118-
"url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/f51b4aed90565c447136f1d015798f6f7c82490f",
119-
"reference": "f51b4aed90565c447136f1d015798f6f7c82490f",
118+
"url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/a792394f7f3934f75a4df9dca544796c6f503027",
119+
"reference": "a792394f7f3934f75a4df9dca544796c6f503027",
120120
"shasum": ""
121121
},
122122
"require": {
@@ -131,7 +131,7 @@
131131
"ext-dom": "For handling output formats in XML",
132132
"ext-mbstring": "For handling non-UTF8 characters."
133133
},
134-
"time": "2023-05-22T20:00:38+00:00",
134+
"time": "2024-02-28T19:51:07+00:00",
135135
"bin": [
136136
"php-cs-fixer",
137137
"php-cs-fixer.phar"
@@ -155,7 +155,7 @@
155155
"description": "A tool to automatically fix PHP code style",
156156
"support": {
157157
"issues": "https://github.com/PHP-CS-Fixer/shim/issues",
158-
"source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.17.0"
158+
"source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.51.0"
159159
},
160160
"install-path": "../php-cs-fixer/shim"
161161
},

vendor/composer/installed.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
'name' => '__root__',
44
'pretty_version' => 'dev-master',
55
'version' => 'dev-master',
6-
'reference' => 'de0582d00a183fca1d5645d354e88b94b9b75a90',
6+
'reference' => '0d7ecb7201963d7adb575991f83f392b8a425a61',
77
'type' => 'library',
88
'install_path' => __DIR__ . '/../../',
99
'aliases' => array(),
@@ -13,7 +13,7 @@
1313
'__root__' => array(
1414
'pretty_version' => 'dev-master',
1515
'version' => 'dev-master',
16-
'reference' => 'de0582d00a183fca1d5645d354e88b94b9b75a90',
16+
'reference' => '0d7ecb7201963d7adb575991f83f392b8a425a61',
1717
'type' => 'library',
1818
'install_path' => __DIR__ . '/../../',
1919
'aliases' => array(),
@@ -31,22 +31,22 @@
3131
'friendsofphp/php-cs-fixer' => array(
3232
'dev_requirement' => true,
3333
'replaced' => array(
34-
0 => 'v3.17.0',
34+
0 => 'v3.51.0',
3535
),
3636
),
3737
'nextcloud/coding-standard' => array(
38-
'pretty_version' => 'v1.1.1',
39-
'version' => '1.1.1.0',
40-
'reference' => '55def702fb9a37a219511e1d8c6fe8e37164c1fb',
38+
'pretty_version' => 'v1.2.1',
39+
'version' => '1.2.1.0',
40+
'reference' => 'cf5f18d989ec62fb4cdc7fc92a36baf34b3d829e',
4141
'type' => 'library',
4242
'install_path' => __DIR__ . '/../nextcloud/coding-standard',
4343
'aliases' => array(),
4444
'dev_requirement' => true,
4545
),
4646
'php-cs-fixer/shim' => array(
47-
'pretty_version' => 'v3.17.0',
48-
'version' => '3.17.0.0',
49-
'reference' => 'f51b4aed90565c447136f1d015798f6f7c82490f',
47+
'pretty_version' => 'v3.51.0',
48+
'version' => '3.51.0.0',
49+
'reference' => 'a792394f7f3934f75a4df9dca544796c6f503027',
5050
'type' => 'application',
5151
'install_path' => __DIR__ . '/../php-cs-fixer/shim',
5252
'aliases' => array(),

vendor/nextcloud/coding-standard/CHANGELOG.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,33 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## 1.2.1 - 2024-02-01
5+
### Fix
6+
* fix: Remove `fully_qualified_strict_types` again by @nickvergessen in https://github.com/nextcloud/coding-standard/pull/16
7+
8+
## 1.2.0 - 2024-02-01
9+
### Added
10+
- `array_syntax`: Force short syntax for array
11+
- `list_syntax`: Same for list
12+
- ~~`fully_qualified_strict_types`: Remove namespace from classname when there is a `use` statement, and add missing backslash for global namespace~~ - Removed in 1.2.1 due to issues
13+
- `no_leading_import_slash`: Remove leading slash from `use` statement
14+
- `nullable_type_declaration_for_default_null_value`: Add missing `?` on type declaration for parameters defaulting to `null`. This will most likely be needed to avoid warnings in PHP 8.4.
15+
- `yoda_style`: forbid yoda style comparision. This replaces `null === $a` by `$a === null`.
16+
17+
## 1.1.1 - 2023-06-23
18+
### Changed
19+
* feat: use php-cs-fixer/shim by @kesselb in https://github.com/nextcloud/coding-standard/pull/13
20+
21+
## 1.1.0 - 2023-04-13
22+
### Changed
23+
* Order imports alphabetically by @come-nc in https://github.com/nextcloud/coding-standard/pull/10
24+
* fix(rules): Replace deprecated braces rules by @nickvergessen in https://github.com/nextcloud/coding-standard/pull/12
25+
26+
## 1.0.0 – 2021-11-10
27+
### Breaking change
28+
* Update php-cs-fixer to 3.x
29+
* See https://github.com/nextcloud/coding-standard#upgrade-from-v0x-to-v10 for instructions.
30+
431
## 0.5.0 – 2021-01-11
532
### Added
633
- New rule: short list syntax

vendor/nextcloud/coding-standard/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ For convenience you may add it to the `scripts` section of your `composer.json`:
4646
}
4747
```
4848

49-
*Note: Don't forget to exclude .php_cs.dist in your build scripts.*
49+
*Note: Don't forget to exclude `.php-cs-fixer.dist.php` and `.php-cs-fixer.cache` in your build scripts.*
5050

5151
## Upgrade from v0.x to v1.0
5252

0 commit comments

Comments
 (0)