diff --git a/.github/workflows/check-same-code-base.yml b/.github/workflows/check-same-code-base.yml index 30c302d3..8928a6c8 100644 --- a/.github/workflows/check-same-code-base.yml +++ b/.github/workflows/check-same-code-base.yml @@ -16,27 +16,32 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-versions: ["8.0"] + php-versions: ["8.1"] name: check-same-code-base steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - name: Set up php ${{ matrix.php-versions }} - uses: shivammathur/setup-php@v2 + uses: shivammathur/setup-php@c5fc0d8281aba02c7fda07d3a70cc5371548067d # v2 with: php-version: ${{ matrix.php-versions }} coverage: none + ini-file: development + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Install dependencies + run: composer i - name: check-same-code-base run: make check-same-code-base - name: check-updater-phar run: | - make box - ./box info -l updater.phar | grep -v "^Signature Hash" | grep -v "^ Version.php " | grep -v "^Contents: " >updater.old.txt + ./vendor/bin/box info -l updater.phar | grep -v "^Signature Hash" | grep -v "^ Version.php " | grep -v "^Contents: " | grep -v "^ installed.php " > updater.old.txt make updater.phar - ./box info -l updater.phar | grep -v "^Signature Hash" | grep -v "^ Version.php " | grep -v "^Contents: " >updater.txt + ./vendor/bin/box info -l updater.phar | grep -v "^Signature Hash" | grep -v "^ Version.php " | grep -v "^Contents: " | grep -v "^ installed.php " > updater.txt diff updater.txt updater.old.txt diff --git a/.github/workflows/lint-php-cs.yml b/.github/workflows/lint-php-cs.yml index eb236b73..f8d33751 100644 --- a/.github/workflows/lint-php-cs.yml +++ b/.github/workflows/lint-php-cs.yml @@ -3,19 +3,17 @@ # https://github.com/nextcloud/.github # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization -name: Lint +name: Lint php-cs -on: - pull_request: - push: - branches: - - main - - master - - stable* +on: pull_request permissions: contents: read +concurrency: + group: lint-php-cs-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + jobs: lint: runs-on: ubuntu-latest @@ -24,13 +22,16 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - - name: Set up php ${{ matrix.php-versions }} - uses: shivammathur/setup-php@v2 + - name: Set up php + uses: shivammathur/setup-php@c5fc0d8281aba02c7fda07d3a70cc5371548067d # v2 with: - php-version: "7.4" + php-version: 8.1 coverage: none + ini-file: development + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install dependencies run: composer i diff --git a/.github/workflows/lint-php.yml b/.github/workflows/lint-php.yml index d089d1ba..110ae2ad 100644 --- a/.github/workflows/lint-php.yml +++ b/.github/workflows/lint-php.yml @@ -3,7 +3,7 @@ # https://github.com/nextcloud/.github # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization -name: Lint +name: Lint php on: pull_request: @@ -16,24 +16,31 @@ on: permissions: contents: read +concurrency: + group: lint-php-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + jobs: php-lint: runs-on: ubuntu-latest strategy: matrix: - php-versions: ["7.4", "8.0", "8.1"] + php-versions: [ "7.4", "8.0", "8.1" ] name: php-lint steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - name: Set up php ${{ matrix.php-versions }} - uses: shivammathur/setup-php@v2 + uses: shivammathur/setup-php@c5fc0d8281aba02c7fda07d3a70cc5371548067d # v2 with: php-version: ${{ matrix.php-versions }} coverage: none + ini-file: development + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Lint run: composer run lint diff --git a/.github/workflows/psalm.yml b/.github/workflows/psalm.yml index dd8ca72c..7be48f26 100644 --- a/.github/workflows/psalm.yml +++ b/.github/workflows/psalm.yml @@ -1,30 +1,39 @@ +# This workflow is provided via the organization template repository +# +# https://github.com/nextcloud/.github +# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization + name: Static analysis on: pull_request: push: branches: + - master - main - stable* +concurrency: + group: psalm-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + jobs: - static-psalm-analysis: + static-analysis: runs-on: ubuntu-latest - strategy: - matrix: - ocp-version: [ 'dev-master' ] - - name: Nextcloud ${{ matrix.ocp-version }} + name: Nextcloud steps: - name: Checkout - uses: actions/checkout@master + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - name: Set up php - uses: shivammathur/setup-php@v2 + uses: shivammathur/setup-php@c5fc0d8281aba02c7fda07d3a70cc5371548067d # v2 with: - php-version: 7.4 + php-version: 8.1 coverage: none + ini-file: development + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install dependencies run: composer i diff --git a/.github/workflows/test-cli.yml b/.github/workflows/test-cli.yml index f3b2657c..61537451 100644 --- a/.github/workflows/test-cli.yml +++ b/.github/workflows/test-cli.yml @@ -12,11 +12,11 @@ permissions: contents: read jobs: - php-lint: + test-cli: runs-on: ubuntu-latest strategy: matrix: - php-versions: ["7.4"] + php-versions: ["8.1"] name: test-cli @@ -28,7 +28,12 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-versions }} + extensions: apcu,ctype,curl,dom,fileinfo,ftp,gd,intl,json,ldap,mbstring,openssl,pdo_sqlite,posix,sqlite,xml,zip coverage: none + ini-file: development + + - name: Install dependencies + run: composer i - name: test-cli run: make test-cli diff --git a/.github/workflows/test-master.yml b/.github/workflows/test-master.yml index 30b88140..24deeb59 100644 --- a/.github/workflows/test-master.yml +++ b/.github/workflows/test-master.yml @@ -16,19 +16,24 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-versions: ["7.4", "8.0", "8.1"] + php-versions: ["8.0", "8.1", "8.2"] name: test-master steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - name: Set up php ${{ matrix.php-versions }} - uses: shivammathur/setup-php@v2 + uses: shivammathur/setup-php@c5fc0d8281aba02c7fda07d3a70cc5371548067d # v2 with: php-version: ${{ matrix.php-versions }} + extensions: apcu,ctype,curl,dom,fileinfo,ftp,gd,intl,json,ldap,mbstring,openssl,pdo_sqlite,posix,sqlite,xml,zip coverage: none + ini-file: development + + - name: Install dependencies + run: composer i - name: test-master run: make test-master diff --git a/.github/workflows/test-stable.yml b/.github/workflows/test-stable.yml index f77d183e..fa51c584 100644 --- a/.github/workflows/test-stable.yml +++ b/.github/workflows/test-stable.yml @@ -16,25 +16,25 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-versions: ["7.4", "8.0"] - nextcloud-versions: ["19", "20", "21"] - exclude: - - php-versions: "8.0" - nextcloud-versions: "19" - - php-versions: "8.0" - nextcloud-versions: "20" + php-versions: ["7.4", "8.0", "8.1"] + nextcloud-versions: ["25"] name: test-stable steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - name: Set up php ${{ matrix.php-versions }} - uses: shivammathur/setup-php@v2 + uses: shivammathur/setup-php@c5fc0d8281aba02c7fda07d3a70cc5371548067d # v2 with: php-version: ${{ matrix.php-versions }} + extensions: apcu,ctype,curl,dom,fileinfo,ftp,gd,intl,json,ldap,mbstring,openssl,pdo_sqlite,posix,sqlite,xml,zip coverage: none + ini-file: development + + - name: Install dependencies + run: composer i - name: test-stable${{ matrix.nextcloud-versions }} run: make test-stable${{ matrix.nextcloud-versions }} diff --git a/.gitignore b/.gitignore index c7c60320..975e27d6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,10 @@ -box -lib/Version.php -tests/data -tests/vendor -vendor/symfony/console/Tests -vendor/symfony/debug/Tests +/box +/lib/Version.php +/tests/data +/tests/vendor +/vendor/bamarni/composer-bin-plugin/e2e +/vendor/bin +/vendor/symfony/console/Tests +/vendor/symfony/debug/Tests /vendor-bin/**/vendor .php-cs-fixer.cache diff --git a/Makefile b/Makefile index 6ac8f940..4bb6b495 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,9 @@ .PHONY: updater.phar -box: - curl -L https://github.com/box-project/box/releases/download/3.11.1/box.phar -o box - chmod +x box - -updater.phar: box updater.php lib/*.php buildVersionFile.php +updater.phar: updater.php lib/*.php buildVersionFile.php php buildVersionFile.php composer dump-autoload - ./box compile -c box.json + composer run box chmod +x updater.phar rm lib/Version.php @@ -29,14 +25,11 @@ test: updater.phar test/vendor test-cli: updater.phar test/vendor cd tests && vendor/behat/behat/bin/behat features/cli.feature -test-stable19: updater.phar test/vendor - cd tests && vendor/behat/behat/bin/behat features/stable19.feature - -test-stable20: updater.phar test/vendor - cd tests && vendor/behat/behat/bin/behat features/stable20.feature +test-stable24: updater.phar test/vendor + cd tests && vendor/behat/behat/bin/behat features/stable24.feature -test-stable21: updater.phar test/vendor - cd tests && vendor/behat/behat/bin/behat features/stable21.feature +test-stable25: updater.phar test/vendor + cd tests && vendor/behat/behat/bin/behat features/stable25.feature test-master: updater.phar test/vendor cd tests && vendor/behat/behat/bin/behat features/master.feature diff --git a/composer.json b/composer.json index a948e924..2a795da1 100644 --- a/composer.json +++ b/composer.json @@ -19,16 +19,23 @@ "symfony/console": "^4.4" }, "scripts": { + "box": "box compile -c box.json", "cs:check": "php-cs-fixer fix --dry-run --diff", "cs:fix": "php-cs-fixer fix", "lint": "find . -name \\*.php -not -path './vendor*' -not -path './build/*' -not -path './node_modules/*' -print0 | xargs -0 -n1 php -l", - "post-install-cmd": ["@composer bin all install --ansi"], - "post-update-cmd": ["@composer bin all update --ansi"], - "psalm": "psalm", - "psalm:fix": "psalm --alter --issues=InvalidReturnType,InvalidNullableReturnType,MissingParamType,InvalidFalsableReturnType", - "psalm:update-baseline": "psalm --threads=1 --update-baseline" + "psalm": "psalm --threads=$(nproc)", + "psalm:ci": "psalm --threads=1", + "psalm:fix": "- --issues=InvalidReturnType,InvalidNullableReturnType,MissingParamType,InvalidFalsableReturnType" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.5" + "bamarni/composer-bin-plugin": "^1.8", + "nextcloud/coding-standard": "^1.1" + }, + "extra": { + "bamarni-bin": { + "bin-links": true, + "target-directory": "vendor-bin", + "forward-command": true + } } } diff --git a/composer.lock b/composer.lock index 1a0b1334..f252fe3c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "41e003a0aea3705ba595ca045d13224e", + "content-hash": "64735a3802f11a7dfce0eea6c7285653", "packages": [ { "name": "psr/container", @@ -56,16 +56,16 @@ }, { "name": "symfony/console", - "version": "v4.4.43", + "version": "v4.4.49", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "8a2628d2d5639f35113dc1b833ecd91e1ed1cf46" + "reference": "33fa45ffc81fdcc1ca368d4946da859c8cdb58d9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/8a2628d2d5639f35113dc1b833ecd91e1ed1cf46", - "reference": "8a2628d2d5639f35113dc1b833ecd91e1ed1cf46", + "url": "https://api.github.com/repos/symfony/console/zipball/33fa45ffc81fdcc1ca368d4946da859c8cdb58d9", + "reference": "33fa45ffc81fdcc1ca368d4946da859c8cdb58d9", "shasum": "" }, "require": { @@ -126,7 +126,7 @@ "description": "Eases the creation of beautiful and testable command line interfaces", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/console/tree/v4.4.43" + "source": "https://github.com/symfony/console/tree/v4.4.49" }, "funding": [ { @@ -142,7 +142,7 @@ "type": "tidelift" } ], - "time": "2022-06-23T12:22:25+00:00" + "time": "2022-11-05T17:10:16+00:00" }, { "name": "symfony/deprecation-contracts", @@ -213,16 +213,16 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.26.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e" + "reference": "42292d99c55abe617799667f454222c54c60e229" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", - "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", + "reference": "42292d99c55abe617799667f454222c54c60e229", "shasum": "" }, "require": { @@ -237,7 +237,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -276,7 +276,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" }, "funding": [ { @@ -292,20 +292,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2023-07-28T09:04:16+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.26.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85" + "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/e440d35fa0286f77fb45b79a03fedbeda9307e85", - "reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fe2f306d1d9d346a7fee353d0d5012e401e984b5", + "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5", "shasum": "" }, "require": { @@ -314,7 +314,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -355,7 +355,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.28.0" }, "funding": [ { @@ -371,20 +371,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.26.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace" + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/cfa0ae98841b9e461207c13ab093d76b0fa7bace", - "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", "shasum": "" }, "require": { @@ -393,7 +393,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -438,7 +438,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" }, "funding": [ { @@ -454,7 +454,7 @@ "type": "tidelift" } ], - "time": "2022-05-10T07:21:04+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/service-contracts", @@ -543,29 +543,36 @@ "packages-dev": [ { "name": "bamarni/composer-bin-plugin", - "version": "v1.5.0", + "version": "1.8.2", "source": { "type": "git", "url": "https://github.com/bamarni/composer-bin-plugin.git", - "reference": "49934ffea764864788334c1485fbb08a4b852031" + "reference": "92fd7b1e6e9cdae19b0d57369d8ad31a37b6a880" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bamarni/composer-bin-plugin/zipball/49934ffea764864788334c1485fbb08a4b852031", - "reference": "49934ffea764864788334c1485fbb08a4b852031", + "url": "https://api.github.com/repos/bamarni/composer-bin-plugin/zipball/92fd7b1e6e9cdae19b0d57369d8ad31a37b6a880", + "reference": "92fd7b1e6e9cdae19b0d57369d8ad31a37b6a880", "shasum": "" }, "require": { - "composer-plugin-api": "^1.0 || ^2.0", - "php": "^5.5.9 || ^7.0 || ^8.0" + "composer-plugin-api": "^2.0", + "php": "^7.2.5 || ^8.0" }, "require-dev": { - "composer/composer": "^1.0 || ^2.0", - "symfony/console": "^2.5 || ^3.0 || ^4.0" + "composer/composer": "^2.0", + "ext-json": "*", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-phpunit": "^1.1", + "phpunit/phpunit": "^8.5 || ^9.5", + "symfony/console": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0", + "symfony/finder": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0", + "symfony/process": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0" }, "type": "composer-plugin", "extra": { - "class": "Bamarni\\Composer\\Bin\\Plugin" + "class": "Bamarni\\Composer\\Bin\\BamarniBinPlugin" }, "autoload": { "psr-4": { @@ -585,7 +592,104 @@ "isolation", "tool" ], - "time": "2022-02-22T21:01:25+00:00" + "support": { + "issues": "https://github.com/bamarni/composer-bin-plugin/issues", + "source": "https://github.com/bamarni/composer-bin-plugin/tree/1.8.2" + }, + "time": "2022-10-31T08:38:03+00:00" + }, + { + "name": "nextcloud/coding-standard", + "version": "v1.1.1", + "source": { + "type": "git", + "url": "https://github.com/nextcloud/coding-standard.git", + "reference": "55def702fb9a37a219511e1d8c6fe8e37164c1fb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/55def702fb9a37a219511e1d8c6fe8e37164c1fb", + "reference": "55def702fb9a37a219511e1d8c6fe8e37164c1fb", + "shasum": "" + }, + "require": { + "php": "^7.3|^8.0", + "php-cs-fixer/shim": "^3.17" + }, + "type": "library", + "autoload": { + "psr-4": { + "Nextcloud\\CodingStandard\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christoph Wurst", + "email": "christoph@winzerhof-wurst.at" + } + ], + "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" + }, + "time": "2023-06-01T12:05:01+00:00" + }, + { + "name": "php-cs-fixer/shim", + "version": "v3.27.0", + "source": { + "type": "git", + "url": "https://github.com/PHP-CS-Fixer/shim.git", + "reference": "fc5c89dc53f46e533cca327d699802017022c3a7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/fc5c89dc53f46e533cca327d699802017022c3a7", + "reference": "fc5c89dc53f46e533cca327d699802017022c3a7", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-tokenizer": "*", + "php": "^7.4 || ^8.0" + }, + "replace": { + "friendsofphp/php-cs-fixer": "self.version" + }, + "suggest": { + "ext-dom": "For handling output formats in XML", + "ext-mbstring": "For handling non-UTF8 characters." + }, + "bin": [ + "php-cs-fixer", + "php-cs-fixer.phar" + ], + "type": "application", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Dariusz Rumiński", + "email": "dariusz.ruminski@gmail.com" + } + ], + "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.27.0" + }, + "time": "2023-09-17T14:38:32+00:00" } ], "aliases": [], @@ -598,5 +702,5 @@ "platform-overrides": { "php": "7.4" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/index.php b/index.php index 0251c003..31142c90 100644 --- a/index.php +++ b/index.php @@ -21,6 +21,7 @@ * */ + class UpdateException extends \Exception { protected $data; @@ -47,7 +48,13 @@ public function accept(): bool { 'data', '..', ]; - return !(in_array($this->current()->getFilename(), $excludes, true) || $this->current()->isDir()); + + $current = $this->current(); + if (!$current) { + return false; + } + + return !(in_array($current->getFilename(), $excludes, true) || $current->isDir()); } } @@ -248,9 +255,13 @@ private function getExpectedElementsList() { 'index.html', 'indie.json', '.user.ini', + 'composer.json', + 'composer.lock', 'console.php', 'cron.php', 'index.php', + 'package.json', + 'package-lock.json', 'public.php', 'remote.php', 'status.php', @@ -465,7 +476,7 @@ public function createBackup() { $this->silentLog('[info] end of createBackup()'); } - private function getChangelogURL($versionString) { + private function getChangelogURL(string $versionString) { $this->silentLog('[info] getChangelogURL()'); $changelogWebsite = 'https://nextcloud.com/changelog/'; $changelogURL = $changelogWebsite . '#' . str_replace('.', '-', $versionString); @@ -643,7 +654,7 @@ public function verifyIntegrity() { } $response = $this->getUpdateServerResponse(); - if (!isset($response['signature'])) { + if (empty($response['signature'])) { throw new \Exception('No signature specified for defined update'); } @@ -1829,13 +1840,13 @@ public function isAuthenticated() { - +

Authentication

To login you need to provide the unhashed value of "updater.secret" in your config file.

If you don't know that value, you can access this updater directly via the Nextcloud admin screen or generate your own secret:

- php -r '$password = trim(shell_exec("openssl rand -base64 48")); if (strlen($password) === 64) {$hash = password_hash($password, PASSWORD_DEFAULT) . "\n"; echo "Insert as \"updater.secret\": ".$hash; echo "The plaintext value is: ".$password."\n";} else {echo "Could not execute OpenSSL.\n";};' + php -r '$password = trim(shell_exec("openssl rand -base64 48"));if(strlen($password) === 64) {$hash = password_hash($password, PASSWORD_DEFAULT) . "\n"; echo "Insert as \"updater.secret\": ".$hash; echo "The plaintext value is: ".$password."\n";}else{echo "Could not execute OpenSSL.\n";};'
- -isAuthenticated()) : ?> +isAuthenticated()): ?>