diff --git a/.github/workflows/check-same-code-base.yml b/.github/workflows/check-same-code-base.yml index f22151d1..ecbd0859 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.1"] + php-versions: ["8.2"] 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..8d7f63f8 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: [ "8.0", "8.1", "8.2" ] 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 b33b767f..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: ["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..ce32e9ec 100644 --- a/.github/workflows/test-stable.yml +++ b/.github/workflows/test-stable.yml @@ -16,25 +16,31 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-versions: ["7.4", "8.0"] - nextcloud-versions: ["19", "20", "21"] + php-versions: ["8.0", "8.1", "8.2"] + nextcloud-versions: ["24", "25", "26"] exclude: - - php-versions: "8.0" - nextcloud-versions: "19" - - php-versions: "8.0" - nextcloud-versions: "20" + - php-versions: "8.2" + nextcloud-versions: "25" + - php-versions: "8.2" + nextcloud-versions: "24" + 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..7a7b2073 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,14 @@ 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-stable24: updater.phar test/vendor + cd tests && vendor/behat/behat/bin/behat features/stable24.feature -test-stable20: updater.phar test/vendor - cd tests && vendor/behat/behat/bin/behat features/stable20.feature +test-stable25: updater.phar test/vendor + cd tests && vendor/behat/behat/bin/behat features/stable25.feature -test-stable21: updater.phar test/vendor - cd tests && vendor/behat/behat/bin/behat features/stable21.feature +test-stable26: updater.phar test/vendor + cd tests && vendor/behat/behat/bin/behat features/stable26.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..b520a6f9 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "classmap-authoritative": true, "optimize-autoloader": true, "platform": { - "php": "7.4" + "php": "8.0" }, "sort-packages": true }, @@ -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..8ab62602 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": "23c652df1417ae8b124cb8d6ef292f1c", "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://github.com/gitapi/repos/symfony/console/zipball/8a2628d2d5639f35113dc1b833ecd91e1ed1cf46", - "reference": "8a2628d2d5639f35113dc1b833ecd91e1ed1cf46", + "url": "https://github.com/gitapi/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.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e" + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/symfony/polyfill-mbstring/zipball/9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", - "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", + "url": "https://github.com/gitapi/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", "shasum": "" }, "require": { @@ -237,7 +237,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-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.27.0" }, "funding": [ { @@ -292,20 +292,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85" + "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/symfony/polyfill-php73/zipball/e440d35fa0286f77fb45b79a03fedbeda9307e85", - "reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85", + "url": "https://github.com/gitapi/repos/symfony/polyfill-php73/zipball/9e8ecb5f92152187c4799efd3c96b78ccab18ff9", + "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9", "shasum": "" }, "require": { @@ -314,7 +314,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-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.27.0" }, "funding": [ { @@ -371,20 +371,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace" + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/symfony/polyfill-php80/zipball/cfa0ae98841b9e461207c13ab093d76b0fa7bace", - "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace", + "url": "https://github.com/gitapi/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", "shasum": "" }, "require": { @@ -393,7 +393,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-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.27.0" }, "funding": [ { @@ -454,7 +454,7 @@ "type": "tidelift" } ], - "time": "2022-05-10T07:21:04+00:00" + "time": "2022-11-03T14:55:06+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://github.com/gitapi/repos/bamarni/composer-bin-plugin/zipball/49934ffea764864788334c1485fbb08a4b852031", - "reference": "49934ffea764864788334c1485fbb08a4b852031", + "url": "https://github.com/gitapi/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://github.com/gitapi/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.17.0", + "source": { + "type": "git", + "url": "https://github.com/PHP-CS-Fixer/shim.git", + "reference": "f51b4aed90565c447136f1d015798f6f7c82490f" + }, + "dist": { + "type": "zip", + "url": "https://github.com/gitapi/repos/PHP-CS-Fixer/shim/zipball/f51b4aed90565c447136f1d015798f6f7c82490f", + "reference": "f51b4aed90565c447136f1d015798f6f7c82490f", + "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.17.0" + }, + "time": "2023-05-22T20:00:38+00:00" } ], "aliases": [], @@ -596,7 +700,7 @@ "platform": [], "platform-dev": [], "platform-overrides": { - "php": "7.4" + "php": "8.0" }, "plugin-api-version": "2.3.0" } diff --git a/index.php b/index.php index 5fcdcc09..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()); } } @@ -469,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); @@ -647,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'); } @@ -1833,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()): ?>