diff --git a/index.php b/index.php index 1b804488..b060f952 100644 --- a/index.php +++ b/index.php @@ -536,6 +536,8 @@ private function getUpdateServerResponse(): array { CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => $updateURL, CURLOPT_USERAGENT => 'Nextcloud Updater', + CURLOPT_FOLLOWLOCATION => 1, + CURLOPT_MAXREDIRS => 2, ]); if ($this->getConfigOption('proxy') !== null) { diff --git a/lib/Updater.php b/lib/Updater.php index df188d7c..d2bce8bf 100644 --- a/lib/Updater.php +++ b/lib/Updater.php @@ -498,6 +498,8 @@ private function getUpdateServerResponse(): array { CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => $updateURL, CURLOPT_USERAGENT => 'Nextcloud Updater', + CURLOPT_FOLLOWLOCATION => 1, + CURLOPT_MAXREDIRS => 2, ]); if ($this->getConfigOption('proxy') !== null) { diff --git a/tests/features/master.feature b/tests/features/master.feature index 49cfdd10..678858b5 100644 --- a/tests/features/master.feature +++ b/tests/features/master.feature @@ -7,6 +7,6 @@ Feature: CLI updater - master base And the version number is decreased in the config.php to enforce upgrade When the CLI updater is run successfully And the output should contain "Update successful" - Then the installed version should be 30.0 + Then the installed version should be 32.0 And maintenance mode should be off And upgrade is not required diff --git a/updater.phar b/updater.phar index ee0db8d1..d7dc7d18 100755 Binary files a/updater.phar and b/updater.phar differ diff --git a/vendor/autoload.php b/vendor/autoload.php index c4a5cf9d..2c8feb0b 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -14,10 +14,7 @@ echo $err; } } - trigger_error( - $err, - E_USER_ERROR - ); + throw new RuntimeException($err); } require_once __DIR__ . '/composer/autoload_real.php'; diff --git a/vendor/composer/InstalledVersions.php b/vendor/composer/InstalledVersions.php index 51e734a7..2052022f 100644 --- a/vendor/composer/InstalledVersions.php +++ b/vendor/composer/InstalledVersions.php @@ -26,12 +26,23 @@ */ class InstalledVersions { + /** + * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to + * @internal + */ + private static $selfDir = null; + /** * @var mixed[]|null * @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}|array{}|null */ private static $installed; + /** + * @var bool + */ + private static $installedIsLocalDir; + /** * @var bool|null */ @@ -309,6 +320,24 @@ public static function reload($data) { self::$installed = $data; self::$installedByVendor = array(); + + // when using reload, we disable the duplicate protection to ensure that self::$installed data is + // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not, + // so we have to assume it does not, and that may result in duplicate data being returned when listing + // all installed packages for example + self::$installedIsLocalDir = false; + } + + /** + * @return string + */ + private static function getSelfDir() + { + if (self::$selfDir === null) { + self::$selfDir = strtr(__DIR__, '\\', '/'); + } + + return self::$selfDir; } /** @@ -322,19 +351,27 @@ private static function getInstalled() } $installed = array(); + $copiedLocalDir = false; if (self::$canGetVendors) { + $selfDir = self::getSelfDir(); foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { + $vendorDir = strtr($vendorDir, '\\', '/'); if (isset(self::$installedByVendor[$vendorDir])) { $installed[] = self::$installedByVendor[$vendorDir]; } elseif (is_file($vendorDir.'/composer/installed.php')) { /** @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} $required */ $required = require $vendorDir.'/composer/installed.php'; - $installed[] = self::$installedByVendor[$vendorDir] = $required; - if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { - self::$installed = $installed[count($installed) - 1]; + self::$installedByVendor[$vendorDir] = $required; + $installed[] = $required; + if (self::$installed === null && $vendorDir.'/composer' === $selfDir) { + self::$installed = $required; + self::$installedIsLocalDir = true; } } + if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) { + $copiedLocalDir = true; + } } } @@ -350,7 +387,7 @@ private static function getInstalled() } } - if (self::$installed !== array()) { + if (self::$installed !== array() && !$copiedLocalDir) { $installed[] = self::$installed; } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index a2bab66c..12dbac5a 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -62,24 +62,24 @@ }, { "name": "nextcloud/coding-standard", - "version": "v1.1.1", - "version_normalized": "1.1.1.0", + "version": "v1.2.1", + "version_normalized": "1.2.1.0", "source": { "type": "git", "url": "https://github.com/nextcloud/coding-standard.git", - "reference": "55def702fb9a37a219511e1d8c6fe8e37164c1fb" + "reference": "cf5f18d989ec62fb4cdc7fc92a36baf34b3d829e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/55def702fb9a37a219511e1d8c6fe8e37164c1fb", - "reference": "55def702fb9a37a219511e1d8c6fe8e37164c1fb", + "url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/cf5f18d989ec62fb4cdc7fc92a36baf34b3d829e", + "reference": "cf5f18d989ec62fb4cdc7fc92a36baf34b3d829e", "shasum": "" }, "require": { "php": "^7.3|^8.0", "php-cs-fixer/shim": "^3.17" }, - "time": "2023-06-01T12:05:01+00:00", + "time": "2024-02-01T14:54:37+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -100,23 +100,23 @@ "description": "Nextcloud coding standards for the php cs fixer", "support": { "issues": "https://github.com/nextcloud/coding-standard/issues", - "source": "https://github.com/nextcloud/coding-standard/tree/v1.1.1" + "source": "https://github.com/nextcloud/coding-standard/tree/v1.2.1" }, "install-path": "../nextcloud/coding-standard" }, { "name": "php-cs-fixer/shim", - "version": "v3.17.0", - "version_normalized": "3.17.0.0", + "version": "v3.51.0", + "version_normalized": "3.51.0.0", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/shim.git", - "reference": "f51b4aed90565c447136f1d015798f6f7c82490f" + "reference": "a792394f7f3934f75a4df9dca544796c6f503027" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/f51b4aed90565c447136f1d015798f6f7c82490f", - "reference": "f51b4aed90565c447136f1d015798f6f7c82490f", + "url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/a792394f7f3934f75a4df9dca544796c6f503027", + "reference": "a792394f7f3934f75a4df9dca544796c6f503027", "shasum": "" }, "require": { @@ -131,7 +131,7 @@ "ext-dom": "For handling output formats in XML", "ext-mbstring": "For handling non-UTF8 characters." }, - "time": "2023-05-22T20:00:38+00:00", + "time": "2024-02-28T19:51:07+00:00", "bin": [ "php-cs-fixer", "php-cs-fixer.phar" @@ -155,7 +155,7 @@ "description": "A tool to automatically fix PHP code style", "support": { "issues": "https://github.com/PHP-CS-Fixer/shim/issues", - "source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.17.0" + "source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.51.0" }, "install-path": "../php-cs-fixer/shim" }, diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 6aecd5e3..adbd1efa 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => '__root__', 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => 'de0582d00a183fca1d5645d354e88b94b9b75a90', + 'reference' => '0d7ecb7201963d7adb575991f83f392b8a425a61', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -13,7 +13,7 @@ '__root__' => array( 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => 'de0582d00a183fca1d5645d354e88b94b9b75a90', + 'reference' => '0d7ecb7201963d7adb575991f83f392b8a425a61', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -31,22 +31,22 @@ 'friendsofphp/php-cs-fixer' => array( 'dev_requirement' => true, 'replaced' => array( - 0 => 'v3.17.0', + 0 => 'v3.51.0', ), ), 'nextcloud/coding-standard' => array( - 'pretty_version' => 'v1.1.1', - 'version' => '1.1.1.0', - 'reference' => '55def702fb9a37a219511e1d8c6fe8e37164c1fb', + 'pretty_version' => 'v1.2.1', + 'version' => '1.2.1.0', + 'reference' => 'cf5f18d989ec62fb4cdc7fc92a36baf34b3d829e', 'type' => 'library', 'install_path' => __DIR__ . '/../nextcloud/coding-standard', 'aliases' => array(), 'dev_requirement' => true, ), 'php-cs-fixer/shim' => array( - 'pretty_version' => 'v3.17.0', - 'version' => '3.17.0.0', - 'reference' => 'f51b4aed90565c447136f1d015798f6f7c82490f', + 'pretty_version' => 'v3.51.0', + 'version' => '3.51.0.0', + 'reference' => 'a792394f7f3934f75a4df9dca544796c6f503027', 'type' => 'application', 'install_path' => __DIR__ . '/../php-cs-fixer/shim', 'aliases' => array(), diff --git a/vendor/nextcloud/coding-standard/CHANGELOG.md b/vendor/nextcloud/coding-standard/CHANGELOG.md index 88758a3b..a71c8bc6 100644 --- a/vendor/nextcloud/coding-standard/CHANGELOG.md +++ b/vendor/nextcloud/coding-standard/CHANGELOG.md @@ -1,6 +1,33 @@ # Changelog All notable changes to this project will be documented in this file. +## 1.2.1 - 2024-02-01 +### Fix +* fix: Remove `fully_qualified_strict_types` again by @nickvergessen in https://github.com/nextcloud/coding-standard/pull/16 + +## 1.2.0 - 2024-02-01 +### Added +- `array_syntax`: Force short syntax for array +- `list_syntax`: Same for list +- ~~`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 +- `no_leading_import_slash`: Remove leading slash from `use` statement +- `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. +- `yoda_style`: forbid yoda style comparision. This replaces `null === $a` by `$a === null`. + +## 1.1.1 - 2023-06-23 +### Changed +* feat: use php-cs-fixer/shim by @kesselb in https://github.com/nextcloud/coding-standard/pull/13 + +## 1.1.0 - 2023-04-13 +### Changed +* Order imports alphabetically by @come-nc in https://github.com/nextcloud/coding-standard/pull/10 +* fix(rules): Replace deprecated braces rules by @nickvergessen in https://github.com/nextcloud/coding-standard/pull/12 + +## 1.0.0 – 2021-11-10 +### Breaking change +* Update php-cs-fixer to 3.x +* See https://github.com/nextcloud/coding-standard#upgrade-from-v0x-to-v10 for instructions. + ## 0.5.0 – 2021-01-11 ### Added - New rule: short list syntax diff --git a/vendor/nextcloud/coding-standard/README.md b/vendor/nextcloud/coding-standard/README.md index 62729e3d..646b6a9f 100644 --- a/vendor/nextcloud/coding-standard/README.md +++ b/vendor/nextcloud/coding-standard/README.md @@ -46,7 +46,7 @@ For convenience you may add it to the `scripts` section of your `composer.json`: } ``` -*Note: Don't forget to exclude .php_cs.dist in your build scripts.* +*Note: Don't forget to exclude `.php-cs-fixer.dist.php` and `.php-cs-fixer.cache` in your build scripts.* ## Upgrade from v0.x to v1.0 diff --git a/vendor/nextcloud/coding-standard/src/Config.php b/vendor/nextcloud/coding-standard/src/Config.php index c6b229a0..c888eaff 100644 --- a/vendor/nextcloud/coding-standard/src/Config.php +++ b/vendor/nextcloud/coding-standard/src/Config.php @@ -18,6 +18,7 @@ public function getRules() : array { '@PSR2' => true, 'align_multiline_comment' => true, 'array_indentation' => true, + 'array_syntax' => true, 'binary_operator_spaces' => [ 'default' => 'single_space', ], @@ -35,16 +36,19 @@ public function getRules() : array { ], 'indentation_type' => true, 'line_ending' => true, + 'list_syntax' => true, 'lowercase_keywords' => true, 'method_argument_space' => [ 'on_multiline' => 'ignore', ], 'no_closing_tag' => true, + 'no_leading_import_slash' => true, 'no_spaces_after_function_name' => true, 'no_spaces_inside_parenthesis' => true, 'no_trailing_whitespace' => true, 'no_trailing_whitespace_in_comment' => true, 'no_unused_imports' => true, + 'nullable_type_declaration_for_default_null_value' => true, 'ordered_imports' => [ 'imports_order' => ['class', 'function', 'const'], 'sort_algorithm' => 'alpha' @@ -57,6 +61,7 @@ public function getRules() : array { 'visibility_required' => [ 'elements' => ['property', 'method', 'const'] ], + 'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false], ]; } } diff --git a/vendor/php-cs-fixer/shim/logo.md b/vendor/php-cs-fixer/shim/logo.md index c5f7b399..c2877f71 100644 --- a/vendor/php-cs-fixer/shim/logo.md +++ b/vendor/php-cs-fixer/shim/logo.md @@ -1,3 +1,3 @@ -The logo is © 2010-2022 Sensio Labs. +The logo is © 2010+ Sensio Labs. Original resolution can be found at https://github.com/PHP-CS-Fixer/logo . diff --git a/vendor/php-cs-fixer/shim/php-cs-fixer.phar b/vendor/php-cs-fixer/shim/php-cs-fixer.phar index 8dc906a1..8182b0f7 100755 Binary files a/vendor/php-cs-fixer/shim/php-cs-fixer.phar and b/vendor/php-cs-fixer/shim/php-cs-fixer.phar differ diff --git a/vendor/php-cs-fixer/shim/php-cs-fixer.phar.asc b/vendor/php-cs-fixer/shim/php-cs-fixer.phar.asc index 65fbde63..aa833e9a 100644 Binary files a/vendor/php-cs-fixer/shim/php-cs-fixer.phar.asc and b/vendor/php-cs-fixer/shim/php-cs-fixer.phar.asc differ