diff --git a/.github/workflows/dependabot-approve-merge.yml b/.github/workflows/dependabot-approve-merge.yml index 8f39811e..ed902d92 100644 --- a/.github/workflows/dependabot-approve-merge.yml +++ b/.github/workflows/dependabot-approve-merge.yml @@ -2,11 +2,14 @@ # # https://github.com/nextcloud/.github # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization +# +# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: MIT name: Dependabot on: - pull_request_target: + pull_request_target: # zizmor: ignore[dangerous-triggers] branches: - main - master @@ -21,8 +24,8 @@ concurrency: jobs: auto-approve-merge: - if: github.actor == 'dependabot[bot]' - runs-on: ubuntu-latest + if: github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'renovate[bot]' + runs-on: ubuntu-latest-low permissions: # for hmarr/auto-approve-action to approve PRs pull-requests: write @@ -34,7 +37,7 @@ jobs: echo 'Can not approve PRs from forks' exit 1 - # Github actions bot approve + # GitHub actions bot approve - uses: hmarr/auto-approve-action@b40d6c9ed2fa10c9a2749eca7eb004418a705501 # v2 with: github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/lint-eslint.yml b/.github/workflows/lint-eslint.yml index 99b624d1..1b1d5328 100644 --- a/.github/workflows/lint-eslint.yml +++ b/.github/workflows/lint-eslint.yml @@ -3,8 +3,8 @@ # https://github.com/nextcloud/.github # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization # -# Use lint-eslint together with lint-eslint-when-unrelated to make eslint a required check for GitHub actions -# https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks +# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: MIT name: Lint eslint @@ -19,13 +19,16 @@ concurrency: jobs: changes: - runs-on: ubuntu-latest + runs-on: ubuntu-latest-low + permissions: + contents: read + pull-requests: read outputs: src: ${{ steps.changes.outputs.src}} steps: - - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1 + - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 id: changes continue-on-error: true with: @@ -53,22 +56,24 @@ jobs: steps: - name: Checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false - name: Read package.json node and npm engines version - uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2 + uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3 id: versions with: fallbackNode: '^20' - fallbackNpm: '^9' + fallbackNpm: '^10' - name: Set up node ${{ steps.versions.outputs.nodeVersion }} - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v3 + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: node-version: ${{ steps.versions.outputs.nodeVersion }} - name: Set up npm ${{ steps.versions.outputs.npmVersion }} - run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}" + run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}' - name: Install dependencies env: @@ -82,7 +87,7 @@ jobs: summary: permissions: contents: none - runs-on: ubuntu-latest + runs-on: ubuntu-latest-low needs: [changes, lint] if: always() diff --git a/.github/workflows/lint-info-xml.yml b/.github/workflows/lint-info-xml.yml index bf6f1787..25b65504 100644 --- a/.github/workflows/lint-info-xml.yml +++ b/.github/workflows/lint-info-xml.yml @@ -2,6 +2,9 @@ # # https://github.com/nextcloud/.github # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization +# +# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: MIT name: Lint info.xml @@ -16,12 +19,14 @@ concurrency: jobs: xml-linters: - runs-on: ubuntu-latest + runs-on: ubuntu-latest-low name: info.xml lint steps: - name: Checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false - name: Download schema run: wget https://raw.githubusercontent.com/nextcloud/appstore/master/nextcloudappstore/api/v1/release/info.xsd diff --git a/.github/workflows/lint-php-cs.yml b/.github/workflows/lint-php-cs.yml index 62b02334..0a22b80b 100644 --- a/.github/workflows/lint-php-cs.yml +++ b/.github/workflows/lint-php-cs.yml @@ -2,6 +2,9 @@ # # https://github.com/nextcloud/.github # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization +# +# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: MIT name: Lint php-cs @@ -22,12 +25,18 @@ jobs: steps: - name: Checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + + - name: Get php version + id: versions + uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1 - - name: Set up php8.2 - uses: shivammathur/setup-php@e6f75134d35752277f093989e72e140eaa222f35 # v2 + - name: Set up php${{ steps.versions.outputs.php-min }} + uses: shivammathur/setup-php@0f7f1d08e3e32076e51cae65eb0b0c871405b16e # v2.34.1 with: - php-version: 8.2 + php-version: ${{ steps.versions.outputs.php-min }} extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite coverage: none ini-file: development @@ -35,7 +44,9 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install dependencies - run: composer i + run: | + composer remove nextcloud/ocp --dev --no-scripts + composer i - name: Lint run: composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 ) diff --git a/.github/workflows/lint-php.yml b/.github/workflows/lint-php.yml index 6da9da87..9e2de303 100644 --- a/.github/workflows/lint-php.yml +++ b/.github/workflows/lint-php.yml @@ -2,6 +2,9 @@ # # https://github.com/nextcloud/.github # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization +# +# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: MIT name: Lint php @@ -15,20 +18,37 @@ concurrency: cancel-in-progress: true jobs: + matrix: + runs-on: ubuntu-latest-low + outputs: + php-versions: ${{ steps.versions.outputs.php-versions }} + steps: + - name: Checkout app + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + + - name: Get version matrix + id: versions + uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.0.0 + php-lint: runs-on: ubuntu-latest + needs: matrix strategy: matrix: - php-versions: [ '8.0', '8.1', '8.2', '8.3' ] + php-versions: ${{fromJson(needs.matrix.outputs.php-versions)}} name: php-lint steps: - name: Checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false - name: Set up php ${{ matrix.php-versions }} - uses: shivammathur/setup-php@e6f75134d35752277f093989e72e140eaa222f35 # v2 + uses: shivammathur/setup-php@0f7f1d08e3e32076e51cae65eb0b0c871405b16e # v2.34.1 with: php-version: ${{ matrix.php-versions }} extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite @@ -43,7 +63,7 @@ jobs: summary: permissions: contents: none - runs-on: ubuntu-latest + runs-on: ubuntu-latest-low needs: php-lint if: always() diff --git a/.github/workflows/lint-stylelint.yml b/.github/workflows/lint-stylelint.yml index 684bb619..22c0f445 100644 --- a/.github/workflows/lint-stylelint.yml +++ b/.github/workflows/lint-stylelint.yml @@ -2,6 +2,9 @@ # # https://github.com/nextcloud/.github # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization +# +# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: MIT name: Lint stylelint @@ -22,22 +25,24 @@ jobs: steps: - name: Checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false - name: Read package.json node and npm engines version - uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2 + uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3 id: versions with: fallbackNode: '^20' - fallbackNpm: '^9' + fallbackNpm: '^10' - name: Set up node ${{ steps.versions.outputs.nodeVersion }} - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v3 + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: node-version: ${{ steps.versions.outputs.nodeVersion }} - name: Set up npm ${{ steps.versions.outputs.npmVersion }} - run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}" + run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}' - name: Install dependencies env: diff --git a/.github/workflows/phpunit-mariadb.yml b/.github/workflows/phpunit-mariadb.yml index 2cc98bd6..519f0bda 100644 --- a/.github/workflows/phpunit-mariadb.yml +++ b/.github/workflows/phpunit-mariadb.yml @@ -2,8 +2,11 @@ # # https://github.com/nextcloud/.github # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization +# +# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: MIT -name: PHPUnit mariadb +name: PHPUnit MariaDB on: pull_request @@ -15,14 +18,32 @@ concurrency: cancel-in-progress: true jobs: + matrix: + runs-on: ubuntu-latest-low + outputs: + php-version: ${{ steps.versions.outputs.php-available-list }} + server-max: ${{ steps.versions.outputs.branches-max-list }} + steps: + - name: Checkout app + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + persist-credentials: false + + - name: Get version matrix + id: versions + uses: icewind1991/nextcloud-version-matrix@8a7bac6300b2f0f3100088b297995a229558ddba # v1.3.2 + changes: - runs-on: ubuntu-latest + runs-on: ubuntu-latest-low + permissions: + contents: read + pull-requests: read outputs: src: ${{ steps.changes.outputs.src}} steps: - - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1 + - uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # v4.0.2 id: changes continue-on-error: true with: @@ -42,63 +63,68 @@ jobs: phpunit-mariadb: runs-on: ubuntu-latest - needs: changes + needs: [changes, matrix] if: needs.changes.outputs.src != 'false' strategy: matrix: - php-versions: ['8.2'] - mariadb-versions: ['10.6', '10.11'] - server-versions: ['master'] + php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }} + server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} + mariadb-versions: ['10.6', '11.4'] name: MariaDB ${{ matrix.mariadb-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} services: mariadb: - image: ghcr.io/nextcloud/continuous-integration-mariadb-${{ matrix.mariadb-versions }}:latest + image: ghcr.io/nextcloud/continuous-integration-mariadb-${{ matrix.mariadb-versions }}:latest # zizmor: ignore[unpinned-images] ports: - 4444:3306/tcp env: - MYSQL_ROOT_PASSWORD: rootpassword - options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 5 + MARIADB_ROOT_PASSWORD: rootpassword + options: --health-cmd="mariadb-admin ping" --health-interval 5s --health-timeout 2s --health-retries 5 steps: - name: Set app env + if: ${{ env.APP_NAME == '' }} run: | # Split and keep last echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV - name: Checkout server - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: + persist-credentials: false submodules: true repository: nextcloud/server ref: ${{ matrix.server-versions }} - name: Checkout app - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: + persist-credentials: false path: apps/${{ env.APP_NAME }} - name: Set up php ${{ matrix.php-versions }} - uses: shivammathur/setup-php@e6f75134d35752277f093989e72e140eaa222f35 # v2 + uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2 with: php-version: ${{ matrix.php-versions }} # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, mysql, pdo_mysql coverage: none ini-file: development + # Temporary workaround for missing pcntl_* in PHP 8.3 + ini-values: disable_functions= env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Enable ONLY_FULL_GROUP_BY MariaDB option run: | echo "SET GLOBAL sql_mode=(SELECT CONCAT(@@sql_mode,',ONLY_FULL_GROUP_BY'));" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword - echo "SELECT @@sql_mode;" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword + echo 'SELECT @@sql_mode;' | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword - name: Check composer file existence id: check_composer - uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2 + uses: andstor/file-existence-action@558493d6c74bf472d87c84eab196434afc2fa029 # v3.1.0 with: files: apps/${{ env.APP_NAME }}/composer.json @@ -106,7 +132,9 @@ jobs: # Only run if phpunit config file exists if: steps.check_composer.outputs.files_exists == 'true' working-directory: apps/${{ env.APP_NAME }} - run: composer i + run: | + composer remove nextcloud/ocp --dev --no-scripts + composer i - name: Set up Nextcloud env: @@ -121,7 +149,7 @@ jobs: continue-on-error: true working-directory: apps/${{ env.APP_NAME }} run: | - composer run --list | grep "^ test:unit " | wc -l | grep 1 + composer run --list | grep '^ test:unit ' | wc -l | grep 1 - name: PHPUnit # Only run if phpunit config file exists @@ -134,7 +162,7 @@ jobs: continue-on-error: true working-directory: apps/${{ env.APP_NAME }} run: | - composer run --list | grep "^ test:integration " | wc -l | grep 1 + composer run --list | grep '^ test:integration ' | wc -l | grep 1 - name: Run Nextcloud # Only run if phpunit integration config file exists @@ -162,7 +190,7 @@ jobs: summary: permissions: contents: none - runs-on: ubuntu-latest + runs-on: ubuntu-latest-low needs: [changes, phpunit-mariadb] if: always() diff --git a/.github/workflows/phpunit-mysql.yml b/.github/workflows/phpunit-mysql.yml index b7029d51..993e8f8e 100644 --- a/.github/workflows/phpunit-mysql.yml +++ b/.github/workflows/phpunit-mysql.yml @@ -2,6 +2,9 @@ # # https://github.com/nextcloud/.github # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization +# +# SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: MIT name: PHPUnit MySQL @@ -15,14 +18,28 @@ concurrency: cancel-in-progress: true jobs: + matrix: + runs-on: ubuntu-latest-low + outputs: + matrix: ${{ steps.versions.outputs.sparse-matrix }} + steps: + - name: Checkout app + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Get version matrix + id: versions + uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1 + with: + matrix: '{"mysql-versions": ["8.1"]}' + changes: - runs-on: ubuntu-latest + runs-on: ubuntu-latest-low outputs: src: ${{ steps.changes.outputs.src}} steps: - - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1 + - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 id: changes continue-on-error: true with: @@ -42,14 +59,11 @@ jobs: phpunit-mysql: runs-on: ubuntu-latest - needs: changes + needs: [changes, matrix] if: needs.changes.outputs.src != 'false' strategy: - matrix: - php-versions: ['8.0', '8.1', '8.2', '8.3'] - server-versions: ['master'] - mysql-versions: ['8.1'] + matrix: ${{ fromJson(needs.matrix.outputs.matrix) }} name: MySQL ${{ matrix.mysql-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} @@ -60,7 +74,7 @@ jobs: - 4444:3306/tcp env: MYSQL_ROOT_PASSWORD: rootpassword - options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 5 + options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 10 steps: - name: Set app env @@ -81,7 +95,7 @@ jobs: path: apps/${{ env.APP_NAME }} - name: Set up php ${{ matrix.php-versions }} - uses: shivammathur/setup-php@e6f75134d35752277f093989e72e140eaa222f35 # v2 + uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2 with: php-version: ${{ matrix.php-versions }} # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation @@ -98,7 +112,7 @@ jobs: - name: Check composer file existence id: check_composer - uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2 + uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0 with: files: apps/${{ env.APP_NAME }}/composer.json @@ -162,7 +176,7 @@ jobs: summary: permissions: contents: none - runs-on: ubuntu-latest + runs-on: ubuntu-latest-low needs: [changes, phpunit-mysql] if: always() diff --git a/.github/workflows/phpunit-oci.yml b/.github/workflows/phpunit-oci.yml new file mode 100644 index 00000000..2fc4e749 --- /dev/null +++ b/.github/workflows/phpunit-oci.yml @@ -0,0 +1,207 @@ +# 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 +# +# SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: MIT + +name: PHPUnit OCI + +on: pull_request + +permissions: + contents: read + +concurrency: + group: phpunit-oci-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + matrix: + runs-on: ubuntu-latest-low + outputs: + php-version: ${{ steps.versions.outputs.php-available-list }} + server-max: ${{ steps.versions.outputs.branches-max-list }} + steps: + - name: Checkout app + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + persist-credentials: false + + - name: Get version matrix + id: versions + uses: icewind1991/nextcloud-version-matrix@8a7bac6300b2f0f3100088b297995a229558ddba # v1.3.2 + + changes: + runs-on: ubuntu-latest-low + permissions: + contents: read + pull-requests: read + + outputs: + src: ${{ steps.changes.outputs.src }} + + steps: + - uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # v4.0.2 + id: changes + continue-on-error: true + with: + filters: | + src: + - '.github/workflows/**' + - 'appinfo/**' + - 'lib/**' + - 'templates/**' + - 'tests/**' + - 'vendor/**' + - 'vendor-bin/**' + - '.php-cs-fixer.dist.php' + - 'composer.json' + - 'composer.lock' + + phpunit-oci: + runs-on: ubuntu-latest + + needs: [changes, matrix] + if: needs.changes.outputs.src != 'false' + + strategy: + matrix: + php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }} + server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} + oci-versions: ['18', '21', '23'] + + name: OCI ${{ matrix.oci-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} + + services: + oracle: + image: ghcr.io/gvenzl/oracle-${{ matrix.oci-versions < 23 && 'xe' || 'free' }}:${{ matrix.oci-versions }} + + # Provide passwords and other environment variables to container + env: + ORACLE_PASSWORD: oracle + + # Forward Oracle port + ports: + - 1521:1521 + + # Provide healthcheck script options for startup + options: >- + --health-cmd healthcheck.sh + --health-interval 20s + --health-timeout 10s + --health-retries 10 + + steps: + - name: Set app env + if: ${{ env.APP_NAME == '' }} + run: | + # Split and keep last + echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV + + - name: Checkout server + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + persist-credentials: false + submodules: true + repository: nextcloud/server + ref: ${{ matrix.server-versions }} + + - name: Checkout app + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + persist-credentials: false + path: apps/${{ env.APP_NAME }} + + - name: Set up php ${{ matrix.php-versions }} + uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2 + with: + php-version: ${{ matrix.php-versions }} + # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation + extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, oci8 + coverage: none + ini-file: development + # Temporary workaround for missing pcntl_* in PHP 8.3 + ini-values: disable_functions= + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Check composer file existence + id: check_composer + uses: andstor/file-existence-action@558493d6c74bf472d87c84eab196434afc2fa029 # v3.1.0 + with: + files: apps/${{ env.APP_NAME }}/composer.json + + - name: Set up dependencies + # Only run if phpunit config file exists + if: steps.check_composer.outputs.files_exists == 'true' + working-directory: apps/${{ env.APP_NAME }} + run: | + composer remove nextcloud/ocp --dev --no-scripts + composer i + + - name: Set up Nextcloud + env: + DB_PORT: 1521 + run: | + mkdir data + ./occ maintenance:install --verbose --database=oci --database-name=${{ matrix.oci-versions < 23 && 'XE' || 'FREE' }} --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=system --database-pass=oracle --admin-user admin --admin-pass admin + ./occ app:enable --force ${{ env.APP_NAME }} + + - name: Check PHPUnit script is defined + id: check_phpunit + continue-on-error: true + working-directory: apps/${{ env.APP_NAME }} + run: | + composer run --list | grep '^ test:unit ' | wc -l | grep 1 + + - name: PHPUnit + # Only run if phpunit config file exists + if: steps.check_phpunit.outcome == 'success' + working-directory: apps/${{ env.APP_NAME }} + run: composer run test:unit + + - name: Check PHPUnit integration script is defined + id: check_integration + continue-on-error: true + working-directory: apps/${{ env.APP_NAME }} + run: | + composer run --list | grep '^ test:integration ' | wc -l | grep 1 + + - name: Run Nextcloud + # Only run if phpunit integration config file exists + if: steps.check_integration.outcome == 'success' + run: php -S localhost:8080 & + + - name: PHPUnit integration + # Only run if phpunit integration config file exists + if: steps.check_integration.outcome == 'success' + working-directory: apps/${{ env.APP_NAME }} + run: composer run test:integration + + - name: Print logs + if: always() + run: | + cat data/nextcloud.log + + - name: Skipped + # Fail the action when neither unit nor integration tests ran + if: steps.check_phpunit.outcome == 'failure' && steps.check_integration.outcome == 'failure' + run: | + echo 'Neither PHPUnit nor PHPUnit integration tests are specified in composer.json scripts' + exit 1 + + summary: + permissions: + contents: none + runs-on: ubuntu-latest-low + needs: [changes, phpunit-oci] + + if: always() + + name: phpunit-oci-summary + + steps: + - name: Summary status + run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-oci.result != 'success' }}; then exit 1; fi diff --git a/.github/workflows/phpunit-pgsql.yml b/.github/workflows/phpunit-pgsql.yml index 45a82163..e093d956 100644 --- a/.github/workflows/phpunit-pgsql.yml +++ b/.github/workflows/phpunit-pgsql.yml @@ -2,8 +2,11 @@ # # https://github.com/nextcloud/.github # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization +# +# SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: MIT -name: PHPUnit pgsql +name: PHPUnit PostgreSQL on: pull_request @@ -15,14 +18,27 @@ concurrency: cancel-in-progress: true jobs: + matrix: + runs-on: ubuntu-latest-low + outputs: + php-version: ${{ steps.versions.outputs.php-available-list }} + server-max: ${{ steps.versions.outputs.branches-max-list }} + steps: + - name: Checkout app + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Get version matrix + id: versions + uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1 + changes: - runs-on: ubuntu-latest + runs-on: ubuntu-latest-low outputs: src: ${{ steps.changes.outputs.src}} steps: - - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1 + - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 id: changes continue-on-error: true with: @@ -42,13 +58,15 @@ jobs: phpunit-pgsql: runs-on: ubuntu-latest - needs: changes + needs: [changes, matrix] if: needs.changes.outputs.src != 'false' strategy: matrix: - php-versions: ['8.2'] - server-versions: ['master'] + php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }} + server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} + + name: PostgreSQL PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} services: postgres: @@ -80,7 +98,7 @@ jobs: path: apps/${{ env.APP_NAME }} - name: Set up php ${{ matrix.php-versions }} - uses: shivammathur/setup-php@e6f75134d35752277f093989e72e140eaa222f35 # v2 + uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2 with: php-version: ${{ matrix.php-versions }} # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation @@ -92,7 +110,7 @@ jobs: - name: Check composer file existence id: check_composer - uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2 + uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v2 with: files: apps/${{ env.APP_NAME }}/composer.json @@ -156,7 +174,7 @@ jobs: summary: permissions: contents: none - runs-on: ubuntu-latest + runs-on: ubuntu-latest-low needs: [changes, phpunit-pgsql] if: always() diff --git a/.github/workflows/phpunit-sqlite.yml b/.github/workflows/phpunit-sqlite.yml index ed1151ab..12e99684 100644 --- a/.github/workflows/phpunit-sqlite.yml +++ b/.github/workflows/phpunit-sqlite.yml @@ -2,8 +2,11 @@ # # https://github.com/nextcloud/.github # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization +# +# SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: MIT -name: PHPUnit sqlite +name: PHPUnit SQLite on: pull_request @@ -15,14 +18,27 @@ concurrency: cancel-in-progress: true jobs: + matrix: + runs-on: ubuntu-latest-low + outputs: + php-version: ${{ steps.versions.outputs.php-available-list }} + server-max: ${{ steps.versions.outputs.branches-max-list }} + steps: + - name: Checkout app + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Get version matrix + id: versions + uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1 + changes: - runs-on: ubuntu-latest + runs-on: ubuntu-latest-low outputs: src: ${{ steps.changes.outputs.src}} steps: - - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1 + - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 id: changes continue-on-error: true with: @@ -42,13 +58,15 @@ jobs: phpunit-sqlite: runs-on: ubuntu-latest - needs: changes + needs: [changes, matrix] if: needs.changes.outputs.src != 'false' strategy: matrix: - php-versions: ['8.2'] - server-versions: ['master'] + php-versions: ${{ fromJson(needs.matrix.outputs.php-version) }} + server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} + + name: SQLite PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} steps: - name: Set app env @@ -69,7 +87,7 @@ jobs: path: apps/${{ env.APP_NAME }} - name: Set up php ${{ matrix.php-versions }} - uses: shivammathur/setup-php@e6f75134d35752277f093989e72e140eaa222f35 # v2 + uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2 with: php-version: ${{ matrix.php-versions }} # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation @@ -81,7 +99,7 @@ jobs: - name: Check composer file existence id: check_composer - uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2 + uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v2 with: files: apps/${{ env.APP_NAME }}/composer.json @@ -145,7 +163,7 @@ jobs: summary: permissions: contents: none - runs-on: ubuntu-latest + runs-on: ubuntu-latest-low needs: [changes, phpunit-sqlite] if: always() diff --git a/.github/workflows/phpunit-summary-when-unrelated.yml b/.github/workflows/phpunit-summary-when-unrelated.yml new file mode 100644 index 00000000..5d631863 --- /dev/null +++ b/.github/workflows/phpunit-summary-when-unrelated.yml @@ -0,0 +1,71 @@ +# 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 +# +# SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: MIT + +name: PHPUnit summary + +on: + pull_request: + paths-ignore: + - '.github/workflows/**' + - 'appinfo/**' + - 'lib/**' + - 'templates/**' + - 'tests/**' + - 'vendor/**' + - 'vendor-bin/**' + - '.php-cs-fixer.dist.php' + - 'composer.json' + - 'composer.lock' + +permissions: + contents: read + +jobs: + summary-mysql: + permissions: + contents: none + runs-on: ubuntu-latest + + name: phpunit-mysql-summary + + steps: + - name: Summary status + run: 'echo "No PHP files changed, skipped PHPUnit"' + + summary-oci: + permissions: + contents: none + runs-on: ubuntu-latest + + name: phpunit-oci-summary + + steps: + - name: Summary status + run: 'echo "No PHP files changed, skipped PHPUnit"' + + summary-pgsql: + permissions: + contents: none + runs-on: ubuntu-latest + + name: phpunit-pgsql-summary + + steps: + - name: Summary status + run: 'echo "No PHP files changed, skipped PHPUnit"' + + summary-sqlite: + permissions: + contents: none + runs-on: ubuntu-latest + + name: phpunit-sqlite-summary + + steps: + - name: Summary status + run: 'echo "No PHP files changed, skipped PHPUnit"' diff --git a/.github/workflows/release-relay.yml b/.github/workflows/release-relay.yml new file mode 100644 index 00000000..08908315 --- /dev/null +++ b/.github/workflows/release-relay.yml @@ -0,0 +1,38 @@ +# 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 +# +# SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: MIT + +name: Notify release-relay on release + +on: + release: + types: [published] + +permissions: + contents: read + +jobs: + notify: + name: Dispatch release to release-relay + runs-on: ubuntu-latest + + # Only allowed to run on nextcloud-releases repositories + if: ${{ github.repository_owner == 'nextcloud-releases' }} + + steps: + - name: Check actor permission + uses: skjnldsv/check-actor-permission@69e92a3c4711150929bca9fcf34448c5bf5526e7 # v3.0 + with: + require: write + + - name: Dispatch to release-relay + uses: peter-evans/repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v4.0.1 + with: + token: ${{ secrets.DISPATCH_PAT }} + repository: nextcloud-gmbh/release-relay + event-type: app-tagged + client-payload: '{"app": "${{ github.repository }}", "tag": "${{ github.event.release.tag_name }}"}' diff --git a/.github/workflows/sync-workflow-templates.yml b/.github/workflows/sync-workflow-templates.yml new file mode 100644 index 00000000..634dc987 --- /dev/null +++ b/.github/workflows/sync-workflow-templates.yml @@ -0,0 +1,140 @@ +# 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 +# +# SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: MIT + +# This workflow will update all workflow templates +# Additionally it will reapply `workflow.yml.patch` files after syncing and only then commit the result +name: Update workflows +on: + workflow_dispatch: + schedule: + - cron: "5 2 * * 0" + +permissions: + contents: read + +jobs: + dispatch: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + branches: + - ${{ github.event.repository.default_branch }} + - 'stable34' + - 'stable33' + - 'stable32' + + name: Update workflows in ${{ matrix.branches }} + + permissions: + contents: write + pull-requests: write + + steps: + - name: Check actor permission + uses: skjnldsv/check-actor-permission@69e92a3c4711150929bca9fcf34448c5bf5526e7 # v3.0 + with: + require: admin + + - name: Checkout workflow repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + path: source + repository: nextcloud/.github + + - name: Checkout app + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + path: target + ref: ${{ matrix.branches }} + + - name: Copy all workflow templates + run: | + echo 'SUMMARY<> $GITHUB_ENV + draft_only=0 + for workflow in ./source/workflow-templates/*.yml; do + echo "❓ Looking for $workflow" + if [ -f "$workflow" ]; then + filename=$(basename "$workflow") + target_file="./target/.github/workflows/$filename" + + # Only copy if the file exists in the target repository + if [ -f "$target_file" ]; then + if [ -f "./target/.github/actions-lock.txt" ]; then + locked_version=$(grep " $filename" ./target/.github/actions-lock.txt | cat) + else + echo "# SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors" >> ./target/.github/actions-lock.txt + echo "# SPDX-License""-Identifier: MIT" >> ./target/.github/actions-lock.txt + locked_version="" + fi + locked_version=$(echo $locked_version | cut -f 1 -d " ") + new_version=$(md5sum $workflow | cut -f 1 -d " ") + + # Only update if the action changes + if [[ "$locked_version" != "$new_version" ]]; then + echo "ℹ️ Locked version: $locked_version" + echo "ℹ️ Current version: $new_version" + echo "🆙 Updating existing workflow: $filename" + echo "- 🆙 Updated [$filename](https://github.com/nextcloud/.github/commits/master/workflow-templates/$filename)" >> $GITHUB_ENV + + cp "$workflow" "$target_file" + + # Apply patch if one exists + if [ -f "$target_file.patch" ]; then + echo "🩹 Applying patch" + cd ./target + set +e + patch -p1 < ".github/workflows/$filename.patch" + patch_worked=$? + set -e + cd - + if [[ "$patch_worked" == "0" ]]; then + echo " - Patch applied" >> $GITHUB_ENV + else + echo " - [ ] ❌ Patch failed" >> $GITHUB_ENV + draft_only=1 + fi + fi + + if [[ "$locked_version" != "" ]]; then + sed -i "s/$locked_version $filename/$new_version $filename/" ./target/.github/actions-lock.txt + else + echo "$new_version $filename" >> ./target/.github/actions-lock.txt + fi + else + echo "✅ Skipping $filename: already up to date" + fi + else + echo "⏭️ Skipping $filename: does not exist in target repository" + fi + fi + done + echo 'EOF' >> $GITHUB_ENV + echo "DRAFT_ONLY=${draft_only}" >> $GITHUB_ENV + + - name: Create Pull Request + uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1 + with: + token: ${{ secrets.COMMAND_BOT_WORKFLOWS }} + commit-message: 'ci(actions): Update workflow templates from organization template repository' + committer: GitHub + author: nextcloud-command + path: target + signoff: true + branch: 'automated/noid/${{ matrix.branches }}-update-workflows' + title: '[${{ matrix.branches }}] ci(actions): Update workflow templates from organization template repository' + draft: ${{ env.DRAFT_ONLY == 1 }} + add-paths: .github/workflows/*.yml,.github/actions-lock.txt + body: | + Automated update of all workflow templates from [nextcloud/.github](https://github.com/nextcloud/.github) + ${{ env.SUMMARY }} + labels: | + dependencies diff --git a/.github/workflows/sync-workflow-templates.yml.patch b/.github/workflows/sync-workflow-templates.yml.patch new file mode 100644 index 00000000..ce1e7b51 --- /dev/null +++ b/.github/workflows/sync-workflow-templates.yml.patch @@ -0,0 +1,9 @@ +diff --git a/.github/workflows/sync-workflow-templates.yml b/.github/workflows/sync-workflow-templates.yml +index 2dbd84b71f..304796d10c 100644 +--- a/.github/workflows/sync-workflow-templates.yml ++++ b/.github/workflows/sync-workflow-templates.yml +@@ -132,4 +132,3 @@ jobs: + ${{ env.SUMMARY }} + labels: | + dependencies +- 3. to review diff --git a/.github/workflows/update-nextcloud-ocp-approve-merge.yml b/.github/workflows/update-nextcloud-ocp-approve-merge.yml new file mode 100644 index 00000000..dfe0ef4e --- /dev/null +++ b/.github/workflows/update-nextcloud-ocp-approve-merge.yml @@ -0,0 +1,58 @@ +# 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 +# +# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: MIT + +name: Auto approve nextcloud/ocp + +on: + pull_request_target: # zizmor: ignore[dangerous-triggers] + branches: + - main + - master + - stable* + +permissions: + contents: read + +concurrency: + group: update-nextcloud-ocp-approve-merge-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + auto-approve-merge: + if: github.actor == 'nextcloud-command' + runs-on: ubuntu-latest-low + permissions: + # for hmarr/auto-approve-action to approve PRs + pull-requests: write + # for alexwilson/enable-github-automerge-action to approve PRs + contents: write + + steps: + - name: Disabled on forks + if: ${{ github.event.pull_request.head.repo.full_name != github.repository }} + run: | + echo 'Can not approve PRs from forks' + exit 1 + + - uses: mdecoleman/pr-branch-name@55795d86b4566d300d237883103f052125cc7508 # v3.0.0 + id: branchname + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + + # GitHub actions bot approve + - uses: hmarr/auto-approve-action@b40d6c9ed2fa10c9a2749eca7eb004418a705501 # v2 + if: startsWith(steps.branchname.outputs.branch, 'automated/noid/') && endsWith(steps.branchname.outputs.branch, 'update-nextcloud-ocp') + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + + # Enable GitHub auto merge + - name: Auto merge + uses: alexwilson/enable-github-automerge-action@56e3117d1ae1540309dc8f7a9f2825bc3c5f06ff # v2.0.0 + if: startsWith(steps.branchname.outputs.branch, 'automated/noid/') && endsWith(steps.branchname.outputs.branch, 'update-nextcloud-ocp') + with: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/update-nextcloud-ocp.yml b/.github/workflows/update-nextcloud-ocp.yml new file mode 100644 index 00000000..1e143aaa --- /dev/null +++ b/.github/workflows/update-nextcloud-ocp.yml @@ -0,0 +1,128 @@ +# 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 +# +# SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: MIT + +name: Update nextcloud/ocp + +on: + workflow_dispatch: + schedule: + - cron: "5 2 * * 0" + +permissions: + contents: read + issues: write + +jobs: + update-nextcloud-ocp: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + branches: + - ${{ github.event.repository.default_branch }} + - 'stable34' + - 'stable33' + - 'stable32' + + name: update-nextcloud-ocp-${{ matrix.branches }} + + steps: + - id: checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + ref: ${{ matrix.branches }} + submodules: true + continue-on-error: true + + - name: Set up php8.2 + if: steps.checkout.outcome == 'success' + uses: shivammathur/setup-php@0f7f1d08e3e32076e51cae65eb0b0c871405b16e # v2.34.1 + with: + php-version: 8.2 + # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation + extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite + coverage: none + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Read codeowners + if: steps.checkout.outcome == 'success' + id: codeowners + run: | + grep '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/appinfo/info.xml' .github/CODEOWNERS | cut -f 2- -d ' ' | xargs | awk '{ print "codeowners="$0 }' >> $GITHUB_OUTPUT + continue-on-error: true + + - name: Composer install + if: steps.checkout.outcome == 'success' + run: composer install + + - name: Composer update nextcloud/ocp + id: update_branch + if: ${{ steps.checkout.outcome == 'success' && matrix.branches != 'main' }} + run: composer require --dev 'nextcloud/ocp:dev-${{ matrix.branches }}' + + - name: Raise on issue on failure + uses: dacbd/create-issue-action@cdb57ab6ff8862aa09fee2be6ba77a59581921c2 # v2.0.0 + if: ${{ steps.checkout.outcome == 'success' && failure() && steps.update_branch.conclusion == 'failure' }} + with: + token: ${{ secrets.GITHUB_TOKEN }} + title: 'Failed to update nextcloud/ocp package on branch ${{ matrix.branches }}' + body: 'Please check the output of the GitHub action and manually resolve the issues
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
${{ steps.codeowners.outputs.codeowners }}' + + - name: Composer update nextcloud/ocp + id: update_main + if: ${{ steps.checkout.outcome == 'success' && matrix.branches == 'main' }} + run: composer require --dev nextcloud/ocp:dev-master + + - name: Raise on issue on failure + uses: dacbd/create-issue-action@cdb57ab6ff8862aa09fee2be6ba77a59581921c2 # v2.0.0 + if: ${{ steps.checkout.outcome == 'success' && failure() && steps.update_main.conclusion == 'failure' }} + with: + token: ${{ secrets.GITHUB_TOKEN }} + title: 'Failed to update nextcloud/ocp package on branch ${{ matrix.branches }}' + body: 'Please check the output of the GitHub action and manually resolve the issues
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
${{ steps.codeowners.outputs.codeowners }}' + + - name: Reset checkout 3rdparty + if: steps.checkout.outcome == 'success' + run: | + git clean -f 3rdparty + git checkout 3rdparty + continue-on-error: true + + - name: Reset checkout vendor + if: steps.checkout.outcome == 'success' + run: | + git clean -f vendor + git checkout vendor + continue-on-error: true + + - name: Reset checkout vendor-bin + if: steps.checkout.outcome == 'success' + run: | + git clean -f vendor-bin + git checkout vendor-bin + continue-on-error: true + + - name: Create Pull Request + if: steps.checkout.outcome == 'success' + uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8 + with: + token: ${{ secrets.COMMAND_BOT_PAT }} + commit-message: 'chore(dev-deps): Bump nextcloud/ocp package' + committer: GitHub + author: nextcloud-command + signoff: true + branch: 'automated/noid/${{ matrix.branches }}-update-nextcloud-ocp' + title: '[${{ matrix.branches }}] Update nextcloud/ocp dependency' + body: | + Auto-generated update of [nextcloud/ocp](https://github.com/nextcloud-deps/ocp/) dependency + labels: | + dependencies + 3. to review diff --git a/.github/workflows/update-stable-titles.yml b/.github/workflows/update-stable-titles.yml new file mode 100644 index 00000000..565e9bcc --- /dev/null +++ b/.github/workflows/update-stable-titles.yml @@ -0,0 +1,71 @@ +# SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: MIT +name: Update PRs titles on stable branches + +on: + pull_request: + types: [opened, edited] + branches: + - "stable*" + +concurrency: + group: stable-pr-title-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + update-pr-title: + runs-on: ubuntu-latest-low + permissions: + pull-requests: write + contents: read + + steps: + - name: Wait for potential title edits + run: sleep 15 + + - name: Get PR details and update title + # Renovate already have target branch in the title + if: github.event.pull_request.user.login != 'renovate[bot]' + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const { data: pr } = await github.rest.pulls.get({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.issue.number, + }); + + const baseBranch = pr.base.ref; + const currentTitle = pr.title; + + // Check if this is a stable branch + // Should not happen as we only trigger on stable* branches 🤷‍♀️ + if (!baseBranch.startsWith('stable')) { + console.log(`Not a stable branch: ${baseBranch}`); + return; + } + + const prefix = `[${baseBranch}]`; + + // Check if title already has the correct prefix and no other stable tags + const correctTagRegex = new RegExp(`^\\[${baseBranch}\\]\\s*`); + const hasOtherStableTags = /\[stable[\d.]*\]/.test(currentTitle.replace(correctTagRegex, '')); + + if (correctTagRegex.test(currentTitle) && !hasOtherStableTags) { + console.log(`Title already has correct prefix only: ${currentTitle}`); + return; + } + + // Remove all stable tags and add the correct one + const cleanTitle = currentTitle.replace(/\[stable[\d.]*\]\s*/g, '').trim(); + const newTitle = `${prefix} ${cleanTitle}`; + + console.log(`Updating title from: "${currentTitle}" to: "${newTitle}"`); + + await github.rest.pulls.update({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.issue.number, + title: newTitle, + }); diff --git a/composer.lock b/composer.lock index 585e761e..d531c257 100644 --- a/composer.lock +++ b/composer.lock @@ -231,26 +231,26 @@ }, { "name": "symfony/polyfill-php80", - "version": "v1.29.0", + "version": "v1.37.0", "source": { "type": "git", "url": "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/symfony/polyfill-php80.git", - "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b" + "reference": "dfb55726c3a76ea3b6459fcfda1ec2d80a682411" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", - "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/dfb55726c3a76ea3b6459fcfda1ec2d80a682411", + "reference": "dfb55726c3a76ea3b6459fcfda1ec2d80a682411", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "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/symfony/polyfill" + "url": "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/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -291,7 +291,7 @@ "shim" ], "support": { - "source": "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/symfony/polyfill-php80/tree/v1.29.0" + "source": "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/symfony/polyfill-php80/tree/v1.37.0" }, "funding": [ { @@ -302,25 +302,29 @@ "url": "/fabpot", "type": "github" }, + { + "url": "/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2026-04-10T16:19:22+00:00" }, { "name": "symfony/process", - "version": "v5.4.34", + "version": "v5.4.51", "source": { "type": "git", "url": "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/symfony/process.git", - "reference": "8fa22178dfc368911dbd513b431cd9b06f9afe7a" + "reference": "467bfc56f18f5ef6d5ccb09324d7e988c1c0a98f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/8fa22178dfc368911dbd513b431cd9b06f9afe7a", - "reference": "8fa22178dfc368911dbd513b431cd9b06f9afe7a", + "url": "https://api.github.com/repos/symfony/process/zipball/467bfc56f18f5ef6d5ccb09324d7e988c1c0a98f", + "reference": "467bfc56f18f5ef6d5ccb09324d7e988c1c0a98f", "shasum": "" }, "require": { @@ -353,7 +357,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "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/symfony/process/tree/v5.4.34" + "source": "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/symfony/process/tree/v5.4.51" }, "funding": [ { @@ -364,12 +368,16 @@ "url": "/fabpot", "type": "github" }, + { + "url": "/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2023-12-02T08:41:43+00:00" + "time": "2026-01-26T15:53:37+00:00" } ], "packages-dev": [ @@ -541,28 +549,36 @@ }, { "name": "composer/pcre", - "version": "3.1.2", + "version": "3.3.2", "source": { "type": "git", "url": "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/composer/pcre.git", - "reference": "4775f35b2d70865807c89d32c8e7385b86eb0ace" + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/4775f35b2d70865807c89d32c8e7385b86eb0ace", - "reference": "4775f35b2d70865807c89d32c8e7385b86eb0ace", + "url": "https://api.github.com/repos/composer/pcre/zipball/b2bed4734f0cc156ee1fe9c0da2550420d99a21e", + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e", "shasum": "" }, "require": { "php": "^7.4 || ^8.0" }, + "conflict": { + "phpstan/phpstan": "<1.11.10" + }, "require-dev": { - "phpstan/phpstan": "^1.3", - "phpstan/phpstan-strict-rules": "^1.1", - "symfony/phpunit-bridge": "^5" + "phpstan/phpstan": "^1.12 || ^2", + "phpstan/phpstan-strict-rules": "^1 || ^2", + "phpunit/phpunit": "^8 || ^9" }, "type": "library", "extra": { + "phpstan": { + "includes": [ + "extension.neon" + ] + }, "branch-alias": { "dev-main": "3.x-dev" } @@ -592,7 +608,7 @@ ], "support": { "issues": "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/composer/pcre/issues", - "source": "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/composer/pcre/tree/3.1.2" + "source": "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/composer/pcre/tree/3.3.2" }, "funding": [ { @@ -608,28 +624,28 @@ "type": "tidelift" } ], - "time": "2024-03-07T15:38:35+00:00" + "time": "2024-11-12T16:29:46+00:00" }, { "name": "composer/semver", - "version": "3.4.0", + "version": "3.4.4", "source": { "type": "git", "url": "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/composer/semver.git", - "reference": "35e8d0af4486141bc745f23a29cc2091eb624a32" + "reference": "198166618906cb2de69b95d7d47e5fa8aa1b2b95" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/35e8d0af4486141bc745f23a29cc2091eb624a32", - "reference": "35e8d0af4486141bc745f23a29cc2091eb624a32", + "url": "https://api.github.com/repos/composer/semver/zipball/198166618906cb2de69b95d7d47e5fa8aa1b2b95", + "reference": "198166618906cb2de69b95d7d47e5fa8aa1b2b95", "shasum": "" }, "require": { "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpstan/phpstan": "^1.4", - "symfony/phpunit-bridge": "^4.2 || ^5" + "phpstan/phpstan": "^1.11", + "symfony/phpunit-bridge": "^3 || ^7" }, "type": "library", "extra": { @@ -673,7 +689,7 @@ "support": { "irc": "ircs://irc.libera.chat:6697/composer", "issues": "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/composer/semver/issues", - "source": "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/composer/semver/tree/3.4.0" + "source": "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/composer/semver/tree/3.4.4" }, "funding": [ { @@ -683,26 +699,22 @@ { "url": "/composer", "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" } ], - "time": "2023-08-31T09:50:34+00:00" + "time": "2025-08-20T19:15:30+00:00" }, { "name": "composer/xdebug-handler", - "version": "3.0.3", + "version": "3.0.5", "source": { "type": "git", "url": "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/composer/xdebug-handler.git", - "reference": "ced299686f41dce890debac69273b47ffe98a40c" + "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/ced299686f41dce890debac69273b47ffe98a40c", - "reference": "ced299686f41dce890debac69273b47ffe98a40c", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/6c1925561632e83d60a44492e0b344cf48ab85ef", + "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef", "shasum": "" }, "require": { @@ -713,7 +725,7 @@ "require-dev": { "phpstan/phpstan": "^1.0", "phpstan/phpstan-strict-rules": "^1.1", - "symfony/phpunit-bridge": "^6.0" + "phpunit/phpunit": "^8.5 || ^9.6 || ^10.5" }, "type": "library", "autoload": { @@ -737,9 +749,9 @@ "performance" ], "support": { - "irc": "irc://irc.freenode.org/composer", + "irc": "ircs://irc.libera.chat:6697/composer", "issues": "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/composer/xdebug-handler/issues", - "source": "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/composer/xdebug-handler/tree/3.0.3" + "source": "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/composer/xdebug-handler/tree/3.0.5" }, "funding": [ { @@ -755,7 +767,7 @@ "type": "tidelift" } ], - "time": "2022-02-25T21:32:43+00:00" + "time": "2024-05-06T16:37:16+00:00" }, { "name": "dnoegel/php-xdg-base-dir", @@ -1014,16 +1026,16 @@ }, { "name": "fidry/cpu-core-counter", - "version": "1.1.0", + "version": "1.3.0", "source": { "type": "git", "url": "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/theofidry/cpu-core-counter.git", - "reference": "f92996c4d5c1a696a6a970e20f7c4216200fcc42" + "reference": "db9508f7b1474469d9d3c53b86f817e344732678" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/f92996c4d5c1a696a6a970e20f7c4216200fcc42", - "reference": "f92996c4d5c1a696a6a970e20f7c4216200fcc42", + "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/db9508f7b1474469d9d3c53b86f817e344732678", + "reference": "db9508f7b1474469d9d3c53b86f817e344732678", "shasum": "" }, "require": { @@ -1033,10 +1045,10 @@ "fidry/makefile": "^0.2.0", "fidry/php-cs-fixer-config": "^1.1.2", "phpstan/extension-installer": "^1.2.0", - "phpstan/phpstan": "^1.9.2", - "phpstan/phpstan-deprecation-rules": "^1.0.0", - "phpstan/phpstan-phpunit": "^1.2.2", - "phpstan/phpstan-strict-rules": "^1.4.4", + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-deprecation-rules": "^2.0.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", "phpunit/phpunit": "^8.5.31 || ^9.5.26", "webmozarts/strict-phpunit": "^7.5" }, @@ -1063,7 +1075,7 @@ ], "support": { "issues": "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/theofidry/cpu-core-counter/issues", - "source": "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/theofidry/cpu-core-counter/tree/1.1.0" + "source": "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/theofidry/cpu-core-counter/tree/1.3.0" }, "funding": [ { @@ -1071,7 +1083,59 @@ "type": "github" } ], - "time": "2024-02-07T09:43:46+00:00" + "time": "2025-08-14T07:29:31+00:00" + }, + { + "name": "kubawerlos/php-cs-fixer-custom-fixers", + "version": "v3.37.2", + "source": { + "type": "git", + "url": "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/kubawerlos/php-cs-fixer-custom-fixers.git", + "reference": "678df979ce743466b42ddb6eea46b3f4c9a7bade" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kubawerlos/php-cs-fixer-custom-fixers/zipball/678df979ce743466b42ddb6eea46b3f4c9a7bade", + "reference": "678df979ce743466b42ddb6eea46b3f4c9a7bade", + "shasum": "" + }, + "require": { + "ext-filter": "*", + "ext-tokenizer": "*", + "friendsofphp/php-cs-fixer": "^3.87", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.6.34 || ^10.5.63 || ^11.5.55" + }, + "type": "library", + "autoload": { + "psr-4": { + "PhpCsFixerCustomFixers\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kuba Werłos", + "email": "werlos@gmail.com" + } + ], + "description": "A set of custom fixers for PHP CS Fixer", + "support": { + "issues": "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/kubawerlos/php-cs-fixer-custom-fixers/issues", + "source": "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/kubawerlos/php-cs-fixer-custom-fixers/tree/v3.37.2" + }, + "funding": [ + { + "url": "/kubawerlos", + "type": "github" + } + ], + "time": "2026-05-12T16:22:19+00:00" }, { "name": "myclabs/deep-copy", @@ -1185,20 +1249,21 @@ }, { "name": "nextcloud/coding-standard", - "version": "v1.1.1", + "version": "v1.5.0", "source": { "type": "git", "url": "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/nextcloud/coding-standard.git", - "reference": "55def702fb9a37a219511e1d8c6fe8e37164c1fb" + "reference": "80547a93236fbb9c783e05f0f0899043851b0dba" }, "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/80547a93236fbb9c783e05f0f0899043851b0dba", + "reference": "80547a93236fbb9c783e05f0f0899043851b0dba", "shasum": "" }, "require": { - "php": "^7.3|^8.0", + "kubawerlos/php-cs-fixer-custom-fixers": "^3.22", + "php": "^8.0", "php-cs-fixer/shim": "^3.17" }, "type": "library", @@ -1218,11 +1283,14 @@ } ], "description": "Nextcloud coding standards for the php cs fixer", + "keywords": [ + "dev" + ], "support": { "issues": "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/nextcloud/coding-standard/issues", - "source": "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/nextcloud/coding-standard/tree/v1.1.1" + "source": "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/nextcloud/coding-standard/tree/v1.5.0" }, - "time": "2023-06-01T12:05:01+00:00" + "time": "2026-05-19T18:30:09+00:00" }, { "name": "nikic/php-parser", @@ -1400,16 +1468,16 @@ }, { "name": "php-cs-fixer/shim", - "version": "v3.45.0", + "version": "v3.95.2", "source": { "type": "git", "url": "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/PHP-CS-Fixer/shim.git", - "reference": "6612ded23a774a376efe7332b4fc8333cdd324af" + "reference": "319bd80c8db64ab5f7b79a19178299045bdb9957" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/6612ded23a774a376efe7332b4fc8333cdd324af", - "reference": "6612ded23a774a376efe7332b4fc8333cdd324af", + "url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/319bd80c8db64ab5f7b79a19178299045bdb9957", + "reference": "319bd80c8db64ab5f7b79a19178299045bdb9957", "shasum": "" }, "require": { @@ -1446,9 +1514,9 @@ "description": "A tool to automatically fix PHP code style", "support": { "issues": "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/PHP-CS-Fixer/shim/issues", - "source": "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/PHP-CS-Fixer/shim/tree/v3.45.0" + "source": "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/PHP-CS-Fixer/shim/tree/v3.95.2" }, - "time": "2023-12-30T02:07:42+00:00" + "time": "2026-05-15T09:21:09+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -3165,16 +3233,16 @@ }, { "name": "symfony/console", - "version": "v5.4.36", + "version": "v5.4.47", "source": { "type": "git", "url": "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/symfony/console.git", - "reference": "39f75d9d73d0c11952fdcecf4877b4d0f62a8f6e" + "reference": "c4ba980ca61a9eb18ee6bcc73f28e475852bb1ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/39f75d9d73d0c11952fdcecf4877b4d0f62a8f6e", - "reference": "39f75d9d73d0c11952fdcecf4877b4d0f62a8f6e", + "url": "https://api.github.com/repos/symfony/console/zipball/c4ba980ca61a9eb18ee6bcc73f28e475852bb1ed", + "reference": "c4ba980ca61a9eb18ee6bcc73f28e475852bb1ed", "shasum": "" }, "require": { @@ -3244,7 +3312,7 @@ "terminal" ], "support": { - "source": "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/symfony/console/tree/v5.4.36" + "source": "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/symfony/console/tree/v5.4.47" }, "funding": [ { @@ -3260,20 +3328,20 @@ "type": "tidelift" } ], - "time": "2024-02-20T16:33:57+00:00" + "time": "2024-11-06T11:30:55+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.5.2", + "version": "v2.5.4", "source": { "type": "git", "url": "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/symfony/deprecation-contracts.git", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" + "reference": "605389f2a7e5625f273b53960dc46aeaf9c62918" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/605389f2a7e5625f273b53960dc46aeaf9c62918", + "reference": "605389f2a7e5625f273b53960dc46aeaf9c62918", "shasum": "" }, "require": { @@ -3281,12 +3349,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "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/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "2.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "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/symfony/contracts" } }, "autoload": { @@ -3311,7 +3379,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "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/symfony/deprecation-contracts/tree/v2.5.2" + "source": "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/symfony/deprecation-contracts/tree/v2.5.4" }, "funding": [ { @@ -3327,20 +3395,20 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2024-09-25T14:11:13+00:00" }, { "name": "symfony/filesystem", - "version": "v5.4.35", + "version": "v5.4.45", "source": { "type": "git", "url": "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/symfony/filesystem.git", - "reference": "5a553607d4ffbfa9c0ab62facadea296c9db7086" + "reference": "57c8294ed37d4a055b77057827c67f9558c95c54" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/5a553607d4ffbfa9c0ab62facadea296c9db7086", - "reference": "5a553607d4ffbfa9c0ab62facadea296c9db7086", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/57c8294ed37d4a055b77057827c67f9558c95c54", + "reference": "57c8294ed37d4a055b77057827c67f9558c95c54", "shasum": "" }, "require": { @@ -3349,6 +3417,9 @@ "symfony/polyfill-mbstring": "~1.8", "symfony/polyfill-php80": "^1.16" }, + "require-dev": { + "symfony/process": "^5.4|^6.4" + }, "type": "library", "autoload": { "psr-4": { @@ -3375,7 +3446,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "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/symfony/filesystem/tree/v5.4.35" + "source": "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/symfony/filesystem/tree/v5.4.45" }, "funding": [ { @@ -3391,24 +3462,24 @@ "type": "tidelift" } ], - "time": "2024-01-23T13:51:25+00:00" + "time": "2024-10-22T13:05:35+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.29.0", + "version": "v1.37.0", "source": { "type": "git", "url": "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/symfony/polyfill-ctype.git", - "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4" + "reference": "141046a8f9477948ff284fa65be2095baafb94f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4", - "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/141046a8f9477948ff284fa65be2095baafb94f2", + "reference": "141046a8f9477948ff284fa65be2095baafb94f2", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "provide": { "ext-ctype": "*" @@ -3419,8 +3490,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "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/symfony/polyfill" + "url": "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/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -3454,7 +3525,7 @@ "portable" ], "support": { - "source": "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/symfony/polyfill-ctype/tree/v1.29.0" + "source": "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/symfony/polyfill-ctype/tree/v1.37.0" }, "funding": [ { @@ -3465,29 +3536,33 @@ "url": "/fabpot", "type": "github" }, + { + "url": "/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2026-04-10T16:19:22+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.29.0", + "version": "v1.37.0", "source": { "type": "git", "url": "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/symfony/polyfill-intl-grapheme.git", - "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f" + "reference": "4864388bfbd3001ce88e234fab652acd91fdc57e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/32a9da87d7b3245e09ac426c83d334ae9f06f80f", - "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/4864388bfbd3001ce88e234fab652acd91fdc57e", + "reference": "4864388bfbd3001ce88e234fab652acd91fdc57e", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "suggest": { "ext-intl": "For best performance" @@ -3495,8 +3570,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "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/symfony/polyfill" + "url": "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/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -3532,7 +3607,7 @@ "shim" ], "support": { - "source": "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/symfony/polyfill-intl-grapheme/tree/v1.29.0" + "source": "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/symfony/polyfill-intl-grapheme/tree/v1.37.0" }, "funding": [ { @@ -3543,29 +3618,33 @@ "url": "/fabpot", "type": "github" }, + { + "url": "/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2026-04-26T13:13:48+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.29.0", + "version": "v1.37.0", "source": { "type": "git", "url": "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/symfony/polyfill-intl-normalizer.git", - "reference": "bc45c394692b948b4d383a08d7753968bed9a83d" + "reference": "3833d7255cc303546435cb650316bff708a1c75c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/bc45c394692b948b4d383a08d7753968bed9a83d", - "reference": "bc45c394692b948b4d383a08d7753968bed9a83d", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c", + "reference": "3833d7255cc303546435cb650316bff708a1c75c", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "suggest": { "ext-intl": "For best performance" @@ -3573,8 +3652,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "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/symfony/polyfill" + "url": "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/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -3613,7 +3692,7 @@ "shim" ], "support": { - "source": "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/symfony/polyfill-intl-normalizer/tree/v1.29.0" + "source": "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/symfony/polyfill-intl-normalizer/tree/v1.37.0" }, "funding": [ { @@ -3624,29 +3703,34 @@ "url": "/fabpot", "type": "github" }, + { + "url": "/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.29.0", + "version": "v1.37.0", "source": { "type": "git", "url": "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/symfony/polyfill-mbstring.git", - "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec" + "reference": "6a21eb99c6973357967f6ce3708cd55a6bec6315" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec", - "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6a21eb99c6973357967f6ce3708cd55a6bec6315", + "reference": "6a21eb99c6973357967f6ce3708cd55a6bec6315", "shasum": "" }, "require": { - "php": ">=7.1" + "ext-iconv": "*", + "php": ">=7.2" }, "provide": { "ext-mbstring": "*" @@ -3657,8 +3741,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "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/symfony/polyfill" + "url": "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/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -3693,7 +3777,7 @@ "shim" ], "support": { - "source": "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/symfony/polyfill-mbstring/tree/v1.29.0" + "source": "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/symfony/polyfill-mbstring/tree/v1.37.0" }, "funding": [ { @@ -3704,35 +3788,39 @@ "url": "/fabpot", "type": "github" }, + { + "url": "/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2026-04-10T17:25:58+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.29.0", + "version": "v1.37.0", "source": { "type": "git", "url": "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/symfony/polyfill-php73.git", - "reference": "21bd091060673a1177ae842c0ef8fe30893114d2" + "reference": "0f68c03565dcaaf25a890667542e8bd75fe7e5bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/21bd091060673a1177ae842c0ef8fe30893114d2", - "reference": "21bd091060673a1177ae842c0ef8fe30893114d2", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/0f68c03565dcaaf25a890667542e8bd75fe7e5bb", + "reference": "0f68c03565dcaaf25a890667542e8bd75fe7e5bb", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "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/symfony/polyfill" + "url": "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/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -3769,7 +3857,7 @@ "shim" ], "support": { - "source": "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/symfony/polyfill-php73/tree/v1.29.0" + "source": "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/symfony/polyfill-php73/tree/v1.37.0" }, "funding": [ { @@ -3780,25 +3868,29 @@ "url": "/fabpot", "type": "github" }, + { + "url": "/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.5.2", + "version": "v2.5.4", "source": { "type": "git", "url": "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/symfony/service-contracts.git", - "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c" + "reference": "f37b419f7aea2e9abf10abd261832cace12e3300" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/4b426aac47d6427cc1a1d0f7e2ac724627f5966c", - "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f37b419f7aea2e9abf10abd261832cace12e3300", + "reference": "f37b419f7aea2e9abf10abd261832cace12e3300", "shasum": "" }, "require": { @@ -3814,12 +3906,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "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/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "2.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "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/symfony/contracts" } }, "autoload": { @@ -3852,7 +3944,7 @@ "standards" ], "support": { - "source": "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/symfony/service-contracts/tree/v2.5.2" + "source": "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/symfony/service-contracts/tree/v2.5.4" }, "funding": [ { @@ -3868,20 +3960,20 @@ "type": "tidelift" } ], - "time": "2022-05-30T19:17:29+00:00" + "time": "2024-09-25T14:11:13+00:00" }, { "name": "symfony/string", - "version": "v5.4.36", + "version": "v5.4.47", "source": { "type": "git", "url": "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/symfony/string.git", - "reference": "4e232c83622bd8cd32b794216aa29d0d266d353b" + "reference": "136ca7d72f72b599f2631aca474a4f8e26719799" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/4e232c83622bd8cd32b794216aa29d0d266d353b", - "reference": "4e232c83622bd8cd32b794216aa29d0d266d353b", + "url": "https://api.github.com/repos/symfony/string/zipball/136ca7d72f72b599f2631aca474a4f8e26719799", + "reference": "136ca7d72f72b599f2631aca474a4f8e26719799", "shasum": "" }, "require": { @@ -3938,7 +4030,7 @@ "utf8" ], "support": { - "source": "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/symfony/string/tree/v5.4.36" + "source": "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/symfony/string/tree/v5.4.47" }, "funding": [ { @@ -3954,7 +4046,7 @@ "type": "tidelift" } ], - "time": "2024-02-01T08:49:30+00:00" + "time": "2024-11-10T20:33:58+00:00" }, { "name": "theseer/tokenizer", @@ -4177,13 +4269,13 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, - "platform": [], - "platform-dev": [], + "platform": {}, + "platform-dev": {}, "platform-overrides": { "php": "8.0" }, - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.9.0" } diff --git a/lib/Activity/Filter.php b/lib/Activity/Filter.php index 4f5b2bd2..924ba925 100644 --- a/lib/Activity/Filter.php +++ b/lib/Activity/Filter.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore Later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Activity; use OCA\Backup\AppInfo\Application; @@ -44,14 +42,12 @@ */ class Filter implements IFilter { - /** @var IL10N */ protected $l10n; /** @var IURLGenerator */ protected $urlGenerator; - /** * Filter constructor. * @@ -63,7 +59,6 @@ public function __construct(IL10N $l10n, IURLGenerator $urlGenerator) { $this->urlGenerator = $urlGenerator; } - /** * @return string */ @@ -71,7 +66,6 @@ public function getIdentifier(): string { return Application::APP_ID; } - /** * @return string */ @@ -79,7 +73,6 @@ public function getName(): string { return $this->l10n->t('Backup'); } - /** * @return int */ @@ -87,7 +80,6 @@ public function getPriority(): int { return 70; } - /** * @param string[] $types * @@ -97,7 +89,6 @@ public function filterTypes(array $types): array { return array_merge($types, [ActivityService::TYPE_GLOBAL]); } - /** * @return string */ @@ -110,7 +101,6 @@ public function getIcon(): string { ); } - /** * @return string[] */ diff --git a/lib/Activity/GlobalSetting.php b/lib/Activity/GlobalSetting.php index 721b325f..1e63370c 100644 --- a/lib/Activity/GlobalSetting.php +++ b/lib/Activity/GlobalSetting.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Activity; use OCA\Backup\AppInfo\Application; @@ -44,7 +42,6 @@ */ class GlobalSetting extends ActivitySettings { - /** @var IL10N */ private $l10n; @@ -54,7 +51,6 @@ class GlobalSetting extends ActivitySettings { /** @var IUserSession */ private $userSession; - /** * @param IL10N $l10n * @param IGroupManager $groupManager @@ -66,7 +62,6 @@ public function __construct(IL10N $l10n, IGroupManager $groupManager, IUserSessi $this->userSession = $userSession; } - /** * @return string */ @@ -74,7 +69,6 @@ public function getIdentifier(): string { return Application::APP_ID; } - /** * @return string */ @@ -82,7 +76,6 @@ public function getName(): string { return $this->l10n->t('Update on all Backup\'s event'); } - /** * @return int */ @@ -111,7 +104,6 @@ public function canChangeMail(): bool { return $this->isAdmin(); } - /** * @return bool */ @@ -119,7 +111,6 @@ public function canChangeNotification(): bool { return $this->isAdmin(); } - /** * @return bool */ @@ -127,7 +118,6 @@ public function isDefaultEnabledMail(): bool { return false; } - /** * @return bool */ diff --git a/lib/Activity/Provider.php b/lib/Activity/Provider.php index 684fe6a6..73ff7265 100644 --- a/lib/Activity/Provider.php +++ b/lib/Activity/Provider.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore Later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Activity; use Exception; @@ -52,7 +50,6 @@ class Provider implements IProvider { use TStringTools; use TArrayTools; - /** @var IL10N */ private $l10n; @@ -62,7 +59,6 @@ class Provider implements IProvider { /** @var IURLGenerator */ private $urlGenerator; - /** * Provider constructor. * @@ -73,14 +69,13 @@ class Provider implements IProvider { public function __construct( IL10N $l10n, IManager $activityManager, - IURLGenerator $urlGenerator + IURLGenerator $urlGenerator, ) { $this->l10n = $l10n; $this->activityManager = $activityManager; $this->urlGenerator = $urlGenerator; } - /** * @param string $lang * @param IEvent $event @@ -88,7 +83,7 @@ public function __construct( * * @return IEvent */ - public function parse($lang, IEvent $event, IEvent $previousEvent = null): IEvent { + public function parse($lang, IEvent $event, ?IEvent $previousEvent = null): IEvent { $params = $event->getSubjectParameters(); $this->initActivityParser($event, $params); $this->setIcon($event); @@ -115,7 +110,6 @@ public function parse($lang, IEvent $event, IEvent $previousEvent = null): IEven return $event; } - /** * @param IEvent $event * @param array $params @@ -130,7 +124,6 @@ private function initActivityParser(IEvent $event, array $params = []): void { } } - /** * @param IEvent $event */ @@ -145,15 +138,14 @@ private function setIcon(IEvent $event): void { ); } - /** * @param IEvent $activity * @param array $params */ private function parseCreate(IEvent $activity, array $params): void { - $params['type'] = ($this->getBool('complete', $params)) ? - $this->l10n->t('complete') : - $this->l10n->t('partial'); + $params['type'] = ($this->getBool('complete', $params)) + ? $this->l10n->t('complete') + : $this->l10n->t('partial'); try { $params['downtime'] = $this->getDateDiff( @@ -179,7 +171,6 @@ private function parseCreate(IEvent $activity, array $params): void { ); } - /** * @param IEvent $activity * @param array $params @@ -196,7 +187,6 @@ private function parseRestore(IEvent $activity, array $params): void { ); } - /** * @param IEvent $activity * @param array $params @@ -213,7 +203,6 @@ private function parseRestoreFile(IEvent $activity, array $params): void { ); } - /** * @param IEvent $activity * @param string $global @@ -222,7 +211,7 @@ private function parseRestoreFile(IEvent $activity, array $params): void { protected function parseSimpleEvent( IEvent $activity, string $global, - array $params + array $params, ): void { $line = $this->l10n->t($global, $params); $line = $this->feedStringWithParams($line, $params); @@ -230,7 +219,6 @@ protected function parseSimpleEvent( $this->setSubject($activity, $line); } - /** * @param IEvent $event * @param string $line @@ -240,7 +228,6 @@ protected function setSubject(IEvent $event, string $line) { $event->setRichSubject($line); } - /** * @param array $params */ diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 67bb3d9d..42613b60 100755 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\AppInfo; use OCA\Backup\Handlers\WebfingerHandler; @@ -45,7 +43,6 @@ require_once __DIR__ . '/../../vendor/autoload.php'; - /** * Class Application * @@ -57,7 +54,6 @@ class Application extends App implements IBootstrap { public const APP_SUBJECT = 'http://nextcloud.com/'; public const APP_REL = 'https://apps.nextcloud.com/apps/backup'; - /** * Application constructor. * @@ -67,7 +63,6 @@ public function __construct(array $params = []) { parent::__construct(self::APP_ID, $params); } - /** * @param IRegistrationContext $context */ @@ -81,7 +76,6 @@ public function register(IRegistrationContext $context): void { $context->registerEventListener(LoadAdditionalScriptsEvent::class, FilesAdditionalScripts::class); } - /** * @param IBootContext $context */ diff --git a/lib/Command/DataAdd.php b/lib/Command/DataAdd.php index a4b30e17..6bf868f2 100755 --- a/lib/Command/DataAdd.php +++ b/lib/Command/DataAdd.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Command; use OC\Core\Command\Base; @@ -42,7 +40,6 @@ */ class DataAdd extends Base { - /** * DataAdd constructor. */ @@ -50,16 +47,14 @@ public function __construct() { parent::__construct(); } - /** * */ protected function configure() { $this->setName('backup:data:add') - ->setDescription('Add a new data pack to your backups'); + ->setDescription('Add a new data pack to your backups'); } - /** * @param InputInterface $input * @param OutputInterface $output diff --git a/lib/Command/DataList.php b/lib/Command/DataList.php index 2b3aa14c..7a89fc0f 100755 --- a/lib/Command/DataList.php +++ b/lib/Command/DataList.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Command; use OC\Core\Command\Base; @@ -45,8 +43,6 @@ */ class DataList extends Base { - - /** * DataList constructor. */ @@ -54,16 +50,14 @@ public function __construct() { parent::__construct(); } - /** * */ protected function configure() { $this->setName('backup:data:list') - ->setDescription('Listing configured data pack'); + ->setDescription('Listing configured data pack'); } - /** * @param InputInterface $input * @param OutputInterface $output diff --git a/lib/Command/DataRemove.php b/lib/Command/DataRemove.php index d0b9ede8..c3d4b1e1 100755 --- a/lib/Command/DataRemove.php +++ b/lib/Command/DataRemove.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Command; use OC\Core\Command\Base; @@ -44,7 +42,6 @@ */ class DataRemove extends Base { - /** * DataRemove constructor. */ @@ -52,17 +49,15 @@ public function __construct() { parent::__construct(); } - /** * */ protected function configure() { $this->setName('backup:data:remove') - ->setDescription('Removing data pack') - ->addArgument('storage_id', InputArgument::REQUIRED, 'storageId'); + ->setDescription('Removing data pack') + ->addArgument('storage_id', InputArgument::REQUIRED, 'storageId'); } - /** * @param InputInterface $input * @param OutputInterface $output diff --git a/lib/Command/ExternalAdd.php b/lib/Command/ExternalAdd.php index 14fb232c..cbed6559 100755 --- a/lib/Command/ExternalAdd.php +++ b/lib/Command/ExternalAdd.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Command; use OC\Core\Command\Base; @@ -49,11 +47,9 @@ */ class ExternalAdd extends Base { - /** @var ExternalFolderService */ private $externalFolderService; - /** * ExternalAdd constructor. * @@ -65,16 +61,14 @@ public function __construct(ExternalFolderService $externalFolderService) { $this->externalFolderService = $externalFolderService; } - /** * */ protected function configure() { $this->setName('backup:external:add') - ->setDescription('Add external filesystem to store your backups'); + ->setDescription('Add external filesystem to store your backups'); } - /** * @param InputInterface $input * @param OutputInterface $output @@ -140,7 +134,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int return 0; } - /** * @param InputInterface $input * @param OutputInterface $output @@ -155,8 +148,8 @@ private function selectStorage(InputInterface $input, OutputInterface $output): if ($storage->getRoot() !== '') { continue; } - $availableStorage[$storage->getStorageId()] = - $storage->getStorage() . ' (id:' . $storage->getStorageId() . ')'; + $availableStorage[$storage->getStorageId()] + = $storage->getStorage() . ' (id:' . $storage->getStorageId() . ')'; } if (empty($availableStorage)) { @@ -191,7 +184,6 @@ private function selectStorage(InputInterface $input, OutputInterface $output): return 0; } - /** * @param InputInterface $input * @param OutputInterface $output diff --git a/lib/Command/ExternalAppData.php b/lib/Command/ExternalAppData.php index dd2de226..f3f971fb 100755 --- a/lib/Command/ExternalAppData.php +++ b/lib/Command/ExternalAppData.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Command; use OC\Core\Command\Base; @@ -55,7 +53,6 @@ class ExternalAppData extends Base { use TDeserialize; - /** @var PointService */ private $pointService; @@ -65,7 +62,6 @@ class ExternalAppData extends Base { /** @var ConfigService */ private $configService; - /** * ExternalAppData constructor. * @@ -76,7 +72,7 @@ class ExternalAppData extends Base { public function __construct( PointService $pointService, ExternalFolderService $externalFolderService, - ConfigService $configService + ConfigService $configService, ) { parent::__construct(); @@ -85,17 +81,15 @@ public function __construct( $this->configService = $configService; } - /** * */ protected function configure() { $this->setName('backup:external:appdata') - ->setDescription('Add external filesystem to store the app\'s data') - ->addOption('unset', '', InputOption::VALUE_NONE, 'Unset the current external appdata'); + ->setDescription('Add external filesystem to store the app\'s data') + ->addOption('unset', '', InputOption::VALUE_NONE, 'Unset the current external appdata'); } - /** * @param InputInterface $input * @param OutputInterface $output @@ -157,7 +151,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int return 0; } - $storageId = $this->selectStorage($input, $output); $output->writeln(''); @@ -206,7 +199,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int return 0; } - /** * @param InputInterface $input * @param OutputInterface $output @@ -218,8 +210,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int private function selectStorage(InputInterface $input, OutputInterface $output): int { $availableStorage = []; foreach ($this->externalFolderService->getStorages() as $storage) { - $availableStorage[$storage->getStorageId()] = - $storage->getStorage() . ' (id:' . $storage->getStorageId() . ')'; + $availableStorage[$storage->getStorageId()] + = $storage->getStorage() . ' (id:' . $storage->getStorageId() . ')'; } if (empty($availableStorage)) { @@ -251,7 +243,6 @@ private function selectStorage(InputInterface $input, OutputInterface $output): return 0; } - /** * @param InputInterface $input * @param OutputInterface $output diff --git a/lib/Command/ExternalList.php b/lib/Command/ExternalList.php index 7aee6613..7b519dc5 100755 --- a/lib/Command/ExternalList.php +++ b/lib/Command/ExternalList.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Command; use OC\Core\Command\Base; @@ -47,11 +45,9 @@ */ class ExternalList extends Base { - /** @var ExternalFolderService */ private $externalFolderService; - /** * ExternalList constructor. * @@ -63,16 +59,14 @@ public function __construct(ExternalFolderService $externalFolderService) { parent::__construct(); } - /** * */ protected function configure() { $this->setName('backup:external:list') - ->setDescription('Listing configured external filesystem'); + ->setDescription('Listing configured external filesystem'); } - /** * @param InputInterface $input * @param OutputInterface $output diff --git a/lib/Command/ExternalRemove.php b/lib/Command/ExternalRemove.php index e71efb58..45d82a4d 100755 --- a/lib/Command/ExternalRemove.php +++ b/lib/Command/ExternalRemove.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Command; use OC\Core\Command\Base; @@ -45,11 +43,9 @@ */ class ExternalRemove extends Base { - /** @var ExternalFolderRequest */ private $externalFolderRequest; - /** * ExternalRemove constructor. * @@ -61,17 +57,15 @@ public function __construct(ExternalFolderRequest $externalFolderRequest) { parent::__construct(); } - /** * */ protected function configure() { $this->setName('backup:external:remove') - ->setDescription('Removing external filesystem from database') - ->addArgument('storage_id', InputArgument::REQUIRED, 'storageId'); + ->setDescription('Removing external filesystem from database') + ->addArgument('storage_id', InputArgument::REQUIRED, 'storageId'); } - /** * @param InputInterface $input * @param OutputInterface $output diff --git a/lib/Command/FileHistory.php b/lib/Command/FileHistory.php index 296da24d..9fe47a97 100755 --- a/lib/Command/FileHistory.php +++ b/lib/Command/FileHistory.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Command; use Exception; @@ -52,14 +50,12 @@ */ class FileHistory extends Base { - /** @var PointService */ private $pointService; /** @var ChunkService */ private $chunkService; - /** * PointHistory constructor. * @@ -73,7 +69,6 @@ public function __construct(PointService $pointService, ChunkService $chunkServi $this->chunkService = $chunkService; } - /** * */ @@ -81,14 +76,13 @@ protected function configure() { parent::configure(); $this->setName('backup:file:history') - ->setDescription('Get the history of a file') - ->addArgument('data', InputArgument::REQUIRED, 'name of the data pack') - ->addArgument('filename', InputArgument::REQUIRED, 'full path of the file') - ->addOption('since', '', InputOption::VALUE_REQUIRED, 'start at a specific date') - ->addOption('until', '', InputOption::VALUE_REQUIRED, 'end at a specific date'); + ->setDescription('Get the history of a file') + ->addArgument('data', InputArgument::REQUIRED, 'name of the data pack') + ->addArgument('filename', InputArgument::REQUIRED, 'full path of the file') + ->addOption('since', '', InputOption::VALUE_REQUIRED, 'start at a specific date') + ->addOption('until', '', InputOption::VALUE_REQUIRED, 'end at a specific date'); } - /** * @param InputInterface $input * @param OutputInterface $output @@ -113,7 +107,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int foreach ($points as $point) { try { $this->pointService->initBaseFolder($point); - } catch (NotFoundException | NotPermittedException $e) { + } catch (NotFoundException|NotPermittedException $e) { continue; } diff --git a/lib/Command/FileSearch.php b/lib/Command/FileSearch.php index 9e79fd48..9e16acef 100755 --- a/lib/Command/FileSearch.php +++ b/lib/Command/FileSearch.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Command; use OC\Core\Command\Base; @@ -63,14 +61,12 @@ class FileSearch extends Base { use TStringTools; use TDeserialize; - /** @var PointService */ private $pointService; /** @var ChunkService */ private $chunkService; - /** * NodeSearch constructor. * @@ -84,7 +80,6 @@ public function __construct(PointService $pointService, ChunkService $chunkServi $this->chunkService = $chunkService; } - /** * */ @@ -92,16 +87,15 @@ protected function configure() { parent::configure(); $this->setName('backup:file:search') - ->setDescription('Search a specific file in your restoring points') - ->addArgument('search', InputArgument::REQUIRED, 'path/name to search') - ->addOption( - 'point', '', InputOption::VALUE_REQUIRED, 'Id of a restoring point for targeted search' - ) - ->addOption('since', '', InputOption::VALUE_REQUIRED, 'search in a specific timeline') - ->addOption('until', '', InputOption::VALUE_REQUIRED, 'search in a specific timeline'); + ->setDescription('Search a specific file in your restoring points') + ->addArgument('search', InputArgument::REQUIRED, 'path/name to search') + ->addOption( + 'point', '', InputOption::VALUE_REQUIRED, 'Id of a restoring point for targeted search' + ) + ->addOption('since', '', InputOption::VALUE_REQUIRED, 'search in a specific timeline') + ->addOption('until', '', InputOption::VALUE_REQUIRED, 'search in a specific timeline'); } - /** * @param InputInterface $input * @param OutputInterface $output @@ -148,7 +142,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int try { try { $files = $this->searchFilesInChunkFolder($point, $chunk, $search); - } catch (NotFoundException | NotPermittedException $e) { + } catch (NotFoundException|NotPermittedException $e) { $files = $this->chunkService->searchFilesInChunk($point, $chunk, $search); } @@ -168,9 +162,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int } $output->writeln(''); } catch (ArchiveCreateException - | ArchiveNotFoundException - | NotFoundException - | NotPermittedException $e) { + |ArchiveNotFoundException + |NotFoundException + |NotPermittedException $e) { } } @@ -190,7 +184,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int return 0; } - /** * @param RestoringPoint $point * @param RestoringChunk $chunk @@ -204,7 +197,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int private function searchFilesInChunkFolder( RestoringPoint $point, RestoringChunk $chunk, - string $search + string $search, ): array { $folder = $this->chunkService->getChunkFolder($point, $chunk); diff --git a/lib/Command/PointArchive.php b/lib/Command/PointArchive.php index 0f2a7d5d..6fd1e8bd 100755 --- a/lib/Command/PointArchive.php +++ b/lib/Command/PointArchive.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Command; use OC\Core\Command\Base; @@ -59,14 +57,12 @@ */ class PointArchive extends Base { - /** @var OccService */ private $occService; /** @var OutputService */ private $outputService; - /** * PointArchive constructor. * @@ -75,7 +71,7 @@ class PointArchive extends Base { */ public function __construct( OccService $occService, - OutputService $outputService + OutputService $outputService, ) { parent::__construct(); @@ -83,7 +79,6 @@ public function __construct( $this->outputService = $outputService; } - /** * */ @@ -91,14 +86,13 @@ protected function configure() { parent::configure(); $this->setName('backup:point:archive') - ->setDescription('Archive a restoring point') - ->addArgument('pointId', InputArgument::REQUIRED, 'id of the restoring point to comment') - ->addOption('remote', '', InputOption::VALUE_REQUIRED, 'address of the remote instance') - ->addOption('external', '', InputOption::VALUE_REQUIRED, 'id of the external folder') - ->addOption('all-storages', '', InputOption::VALUE_NONE, 'duplicate action on all storages'); + ->setDescription('Archive a restoring point') + ->addArgument('pointId', InputArgument::REQUIRED, 'id of the restoring point to comment') + ->addOption('remote', '', InputOption::VALUE_REQUIRED, 'address of the remote instance') + ->addOption('external', '', InputOption::VALUE_REQUIRED, 'id of the external folder') + ->addOption('all-storages', '', InputOption::VALUE_NONE, 'duplicate action on all storages'); } - /** * @param InputInterface $input * @param OutputInterface $output @@ -123,7 +117,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $point = $this->occService->getRestoringPointBasedOnParams($input); $point->setInstance() - ->setArchive(true); + ->setArchive(true); $this->occService->updatePointBasedOnParams($point, $input); diff --git a/lib/Command/PointComment.php b/lib/Command/PointComment.php index 0eb0dc6c..3c1c3890 100755 --- a/lib/Command/PointComment.php +++ b/lib/Command/PointComment.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Command; use OC\Core\Command\Base; @@ -59,14 +57,12 @@ */ class PointComment extends Base { - /** @var OccService */ private $occService; /** @var OutputService */ private $outputService; - /** * PointUnarchive constructor. * @@ -75,7 +71,7 @@ class PointComment extends Base { */ public function __construct( OccService $occService, - OutputService $outputService + OutputService $outputService, ) { parent::__construct(); @@ -83,7 +79,6 @@ public function __construct( $this->outputService = $outputService; } - /** * */ @@ -91,15 +86,14 @@ protected function configure() { parent::configure(); $this->setName('backup:point:comment') - ->setDescription('Add a description to a restoring point') - ->addArgument('pointId', InputArgument::REQUIRED, 'id of the restoring point to comment') - ->addArgument('comment', InputArgument::REQUIRED, 'comment') - ->addOption('remote', '', InputOption::VALUE_REQUIRED, 'address of the remote instance') - ->addOption('external', '', InputOption::VALUE_REQUIRED, 'id of the external folder') - ->addOption('all-storages', '', InputOption::VALUE_NONE, 'duplicate action on all storages'); + ->setDescription('Add a description to a restoring point') + ->addArgument('pointId', InputArgument::REQUIRED, 'id of the restoring point to comment') + ->addArgument('comment', InputArgument::REQUIRED, 'comment') + ->addOption('remote', '', InputOption::VALUE_REQUIRED, 'address of the remote instance') + ->addOption('external', '', InputOption::VALUE_REQUIRED, 'id of the external folder') + ->addOption('all-storages', '', InputOption::VALUE_NONE, 'duplicate action on all storages'); } - /** * @param InputInterface $input * @param OutputInterface $output diff --git a/lib/Command/PointCreate.php b/lib/Command/PointCreate.php index 23bf6864..d84873cd 100755 --- a/lib/Command/PointCreate.php +++ b/lib/Command/PointCreate.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Command; use OC\Core\Command\Base; @@ -55,14 +53,12 @@ */ class PointCreate extends Base { - /** @var PointService */ private $pointService; /** @var OutputService */ private $outputService; - /** * PointCreate constructor. * @@ -76,7 +72,6 @@ public function __construct(PointService $pointService, OutputService $outputSer $this->outputService = $outputService; } - /** * */ @@ -84,15 +79,14 @@ protected function configure() { parent::configure(); $this->setName('backup:point:create') - ->setDescription('Generate a restoring point of the instance (complete or incremental)') - ->addArgument('comment', InputArgument::OPTIONAL, 'set a comment to the restoring point', '') - ->addOption('generate-log', '', InputOption::VALUE_NONE, 'generate a log file') - ->addOption( - 'differential', '', InputOption::VALUE_NONE, 'create an differential restoring point' - ); + ->setDescription('Generate a restoring point of the instance (complete or incremental)') + ->addArgument('comment', InputArgument::OPTIONAL, 'set a comment to the restoring point', '') + ->addOption('generate-log', '', InputOption::VALUE_NONE, 'generate a log file') + ->addOption( + 'differential', '', InputOption::VALUE_NONE, 'create an differential restoring point' + ); } - /** * @param InputInterface $input * @param OutputInterface $output diff --git a/lib/Command/PointDelete.php b/lib/Command/PointDelete.php index cd036edb..2035e93a 100755 --- a/lib/Command/PointDelete.php +++ b/lib/Command/PointDelete.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Command; use OC\Core\Command\Base; @@ -57,7 +55,6 @@ */ class PointDelete extends Base { - /** @var PointService */ private $pointService; @@ -67,7 +64,6 @@ class PointDelete extends Base { /** @var ExternalFolderService */ private $externalFolderService; - /** * PointCreate constructor. * @@ -78,7 +74,7 @@ class PointDelete extends Base { public function __construct( PointService $pointService, RemoteService $remoteService, - ExternalFolderService $externalFolderService + ExternalFolderService $externalFolderService, ) { parent::__construct(); @@ -87,7 +83,6 @@ public function __construct( $this->externalFolderService = $externalFolderService; } - /** * */ @@ -95,22 +90,21 @@ protected function configure() { parent::configure(); $this->setName('backup:point:delete') - ->setDescription('Locally delete a restoring point') - ->addArgument('pointId', InputArgument::REQUIRED, 'id of the restoring point to delete') - ->addOption( - 'all-storages', '', InputOption::VALUE_NONE, 'remove restoring point from all storage' - ) - ->addOption( - 'remote', '', InputOption::VALUE_REQUIRED, - 'remove a restoring point from a remote instance (or local)', '' - ) - ->addOption( - 'external', '', InputOption::VALUE_REQUIRED, - 'remove a restoring point from an external folder', '' - ); + ->setDescription('Locally delete a restoring point') + ->addArgument('pointId', InputArgument::REQUIRED, 'id of the restoring point to delete') + ->addOption( + 'all-storages', '', InputOption::VALUE_NONE, 'remove restoring point from all storage' + ) + ->addOption( + 'remote', '', InputOption::VALUE_REQUIRED, + 'remove a restoring point from a remote instance (or local)', '' + ) + ->addOption( + 'external', '', InputOption::VALUE_REQUIRED, + 'remove a restoring point from an external folder', '' + ); } - /** * @param InputInterface $input * @param OutputInterface $output diff --git a/lib/Command/PointDetails.php b/lib/Command/PointDetails.php index acfd4d5f..c9ea98ce 100755 --- a/lib/Command/PointDetails.php +++ b/lib/Command/PointDetails.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Command; use OC\Core\Command\Base; @@ -72,7 +70,6 @@ class PointDetails extends Base { use TArrayTools; use TStringTools; - /** @var RemoteService */ private $remoteService; @@ -88,7 +85,6 @@ class PointDetails extends Base { /** @var PackService */ private $packService; - /** * PointDetails constructor. * @@ -99,11 +95,11 @@ class PointDetails extends Base { * @param PackService $packService */ public function __construct( - RemoteService $remoteService, - PointService $pointService, + RemoteService $remoteService, + PointService $pointService, ExternalFolderService $externalFolderService, - ChunkService $chunkService, - PackService $packService + ChunkService $chunkService, + PackService $packService, ) { parent::__construct(); @@ -114,7 +110,6 @@ public function __construct( $this->packService = $packService; } - /** * */ @@ -122,13 +117,12 @@ protected function configure() { parent::configure(); $this->setName('backup:point:details') - ->setDescription('Details on a restoring point') - ->addArgument('pointId', InputArgument::REQUIRED, 'Id of the restoring point') - ->addOption('remote', '', InputOption::VALUE_REQUIRED, 'address of the remote instance') - ->addOption('external', '', InputOption::VALUE_REQUIRED, 'id of the external folder'); + ->setDescription('Details on a restoring point') + ->addArgument('pointId', InputArgument::REQUIRED, 'Id of the restoring point') + ->addOption('remote', '', InputOption::VALUE_REQUIRED, 'address of the remote instance') + ->addOption('external', '', InputOption::VALUE_REQUIRED, 'id of the external folder'); } - /** * @param InputInterface $input * @param OutputInterface $output @@ -206,8 +200,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int $checked = 'missing chunk'; } - $checked = - ($checked === $chunk->getChecksum()) ? 'ok' : 'checksum'; + $checked + = ($checked === $chunk->getChecksum()) ? 'ok' : 'checksum'; $table->appendRow( [ @@ -227,8 +221,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int if ($remote) { $source = ' on ' . $remote . ''; } elseif ($external) { - $source = ' at ' . $externalFolder->getStorageId() . ':' . - $externalFolder->getRoot() . ''; + $source = ' at ' . $externalFolder->getStorageId() . ':' + . $externalFolder->getRoot() . ''; } $output->writeln(''); @@ -238,24 +232,22 @@ protected function execute(InputInterface $input, OutputInterface $output): int } $output->writeln( - 'Status of the restoring point ' . $source . ': <' . $color . '>' . - RestoringHealth::$DEF[$point->getHealth()->getStatus()] . '' + 'Status of the restoring point ' . $source . ': <' . $color . '>' + . RestoringHealth::$DEF[$point->getHealth()->getStatus()] . '' ); - return 0; } - /** * @param Table $table * @param RestoringPoint $point * @param RestoringChunk $chunk */ private function displayDetailsPacked( - Table $table, + Table $table, RestoringPoint $point, - RestoringChunk $chunk + RestoringChunk $chunk, ): void { $fresh = true; $health = $point->getHealth(); diff --git a/lib/Command/PointDownload.php b/lib/Command/PointDownload.php index 52a0d400..94c25f09 100755 --- a/lib/Command/PointDownload.php +++ b/lib/Command/PointDownload.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Command; use OC\Core\Command\Base; @@ -73,7 +71,6 @@ */ class PointDownload extends Base { - /** @var PointRequest */ private $pointRequest; @@ -104,7 +101,6 @@ class PointDownload extends Base { /** @var MetadataService */ private $metadataService; - /** * PointDownload constructor. * @@ -129,7 +125,7 @@ public function __construct( ExternalFolderService $externalFolderService, OutputService $outputService, ConfigService $configService, - MetadataService $metadataService + MetadataService $metadataService, ) { parent::__construct(); @@ -145,22 +141,20 @@ public function __construct( $this->metadataService = $metadataService; } - /** * */ protected function configure() { $this->setName('backup:point:download') - ->setDescription('Download restoring point from remote instance') - ->addArgument('pointId', InputArgument::REQUIRED, 'Id of the restoring point') - ->addOption('remote', '', InputOption::VALUE_REQUIRED, 'address of the remote instance') - ->addOption('external', '', InputOption::VALUE_REQUIRED, 'storageId of the external storage') - ->addOption( - 'no-check', '', InputOption::VALUE_NONE, 'do not check integrity of restoring point' - ); + ->setDescription('Download restoring point from remote instance') + ->addArgument('pointId', InputArgument::REQUIRED, 'Id of the restoring point') + ->addOption('remote', '', InputOption::VALUE_REQUIRED, 'address of the remote instance') + ->addOption('external', '', InputOption::VALUE_REQUIRED, 'storageId of the external storage') + ->addOption( + 'no-check', '', InputOption::VALUE_NONE, 'do not check integrity of restoring point' + ); } - /** * @param InputInterface $input * @param OutputInterface $output @@ -214,7 +208,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int } $point->setInstance() - ->unsetHealth(); + ->unsetHealth(); $this->pointRequest->save($point); $this->pointService->saveMetadata($point); @@ -242,7 +236,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int // $point = $this->getRestoringPoint($remote, $external, $pointId); - // echo json_encode($point->getHealth()); // $checks = $this->remoteService->verifyPoint($point); @@ -277,7 +270,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int // } } - /** * @param OutputInterface $output * @param string|null $remote @@ -301,7 +293,7 @@ private function downloadMissingFiles( OutputInterface $output, ?string $remote, ?int $external, - RestoringPoint $point + RestoringPoint $point, ): void { $health = $point->getHealth(); foreach ($health->getParts() as $partHealth) { @@ -310,8 +302,8 @@ private function downloadMissingFiles( } $output->write( - ' * Downloading ' . $partHealth->getDataName() . - '/' . $partHealth->getChunkName() . '/' . $partHealth->getPartName() . ': ' + ' * Downloading ' . $partHealth->getDataName() + . '/' . $partHealth->getChunkName() . '/' . $partHealth->getPartName() . ': ' ); $chunk = $this->chunkService->getChunkFromRP( @@ -346,7 +338,6 @@ private function downloadMissingFiles( } } - /** * @param string|null $remote * @param int|null $external @@ -367,7 +358,7 @@ private function downloadMissingFiles( private function getRestoringPoint( ?string $remote, ?int $external, - string $pointId + string $pointId, ): RestoringPoint { if (!is_null($remote)) { return $this->remoteService->getRestoringPoint($remote, $pointId); diff --git a/lib/Command/PointHistory.php b/lib/Command/PointHistory.php index 9b7fca9a..ced06d7e 100755 --- a/lib/Command/PointHistory.php +++ b/lib/Command/PointHistory.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Command; use OC\Core\Command\Base; @@ -46,14 +44,12 @@ class PointHistory extends Base { use TNCLogger; - /** @var PointService */ private $pointService; /** @var ChunkService */ private $chunkService; - /** * PointHistory constructor. * @@ -67,7 +63,6 @@ public function __construct(PointService $pointService, ChunkService $chunkServi $this->chunkService = $chunkService; } - /** * */ @@ -75,10 +70,9 @@ protected function configure() { parent::configure(); $this->setName('backup:point:history') - ->setDescription('Get the history of your restoring point'); + ->setDescription('Get the history of your restoring point'); } - /** * @param InputInterface $input * @param OutputInterface $output @@ -91,7 +85,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int 'visit the Activity App or use ./occ backup:point:list to get available restoring point' ); - return 0; } } diff --git a/lib/Command/PointList.php b/lib/Command/PointList.php index 310c8bbc..5a7c1e14 100755 --- a/lib/Command/PointList.php +++ b/lib/Command/PointList.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Command; use OC\Core\Command\Base; @@ -56,7 +54,6 @@ class PointList extends Base { use TStringTools; - /** @var PointService */ private $pointService; @@ -66,7 +63,6 @@ class PointList extends Base { /** @var RemoteStreamService */ private $remoteStreamService; - /** * PointList constructor. * @@ -77,7 +73,7 @@ class PointList extends Base { public function __construct( OutputService $outputService, PointService $pointService, - RemoteStreamService $remoteStreamService + RemoteStreamService $remoteStreamService, ) { $this->outputService = $outputService; $this->pointService = $pointService; @@ -86,28 +82,26 @@ public function __construct( parent::__construct(); } - /** * */ protected function configure() { $this->setName('backup:point:list') - ->setDescription('List restoring point') - ->addOption( - 'local', '', InputOption::VALUE_NONE, - 'list restoring point from local only' - ) - ->addOption( - 'remote', '', InputOption::VALUE_REQUIRED, - 'list restoring point from a remote instance (or local)', '' - ) - ->addOption( - 'external', '', InputOption::VALUE_REQUIRED, - 'list restoring point from an external folder', '' - ); + ->setDescription('List restoring point') + ->addOption( + 'local', '', InputOption::VALUE_NONE, + 'list restoring point from local only' + ) + ->addOption( + 'remote', '', InputOption::VALUE_REQUIRED, + 'list restoring point from a remote instance (or local)', '' + ) + ->addOption( + 'external', '', InputOption::VALUE_REQUIRED, + 'list restoring point from an external folder', '' + ); } - /** * @param InputInterface $input * @param OutputInterface $output @@ -157,14 +151,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int $comment = $point->getComment(); try { $this->remoteStreamService->verifySubSign($point); - } catch (SignatoryException | SignatureException $e) { + } catch (SignatoryException|SignatureException $e) { $comment = ''; } $table->appendRow( [ - '' . (($point->isLocked()) ? 'L' : '') . - (($point->isArchive()) ? 'A' : '') . ' ' + '' . (($point->isLocked()) ? 'L' : '') + . (($point->isArchive()) ? 'A' : '') . ' ' . (($fresh) ? $displayPointId : ''), ($fresh) ? date('Y-m-d H:i:s', $point->getDate()) : '', ($fresh) ? $point->getNCVersion() : '', @@ -185,7 +179,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int return 0; } - /** * @param RestoringPoint $point * @@ -216,7 +209,6 @@ private function displayStyleHealth(RestoringPoint $point): string { return '<' . $embed . '>' . $def . ''; } - /** * @param RestoringPoint $point * diff --git a/lib/Command/PointPack.php b/lib/Command/PointPack.php index f15785cc..1bde1e1f 100755 --- a/lib/Command/PointPack.php +++ b/lib/Command/PointPack.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Command; use OC\Core\Command\Base; @@ -53,7 +51,6 @@ */ class PointPack extends Base { - /** @var PointService */ private $pointService; @@ -63,7 +60,6 @@ class PointPack extends Base { /** @var OutputService */ private $outputService; - /** * PointPack constructor. * @@ -74,7 +70,7 @@ class PointPack extends Base { public function __construct( PointService $pointService, PackService $packService, - OutputService $outputService + OutputService $outputService, ) { parent::__construct(); @@ -83,7 +79,6 @@ public function __construct( $this->outputService = $outputService; } - /** * */ @@ -91,12 +86,11 @@ protected function configure() { parent::configure(); $this->setName('backup:point:pack') - ->setDescription('Increase compression of a restoring point and prepare for upload') - ->addArgument('pointId', InputArgument::REQUIRED, 'Id of the restoring point') - ->addOption('generate-log', '', InputOption::VALUE_NONE, 'generate a log file'); + ->setDescription('Increase compression of a restoring point and prepare for upload') + ->addArgument('pointId', InputArgument::REQUIRED, 'Id of the restoring point') + ->addOption('generate-log', '', InputOption::VALUE_NONE, 'generate a log file'); } - /** * @param InputInterface $input * @param OutputInterface $output @@ -115,7 +109,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int if ($input->getOption('generate-log')) { try { $this->outputService->openFile($point, 'occ backup:point:pack'); - } catch (NotPermittedException | LockedException $e) { + } catch (NotPermittedException|LockedException $e) { } } diff --git a/lib/Command/PointPurge.php b/lib/Command/PointPurge.php index 28ae98cd..34e6dba5 100755 --- a/lib/Command/PointPurge.php +++ b/lib/Command/PointPurge.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Command; use OC\Core\Command\Base; @@ -43,11 +41,9 @@ */ class PointPurge extends Base { - /** @var PointService */ private $pointService; - /** * PointPurge constructor. * @@ -59,7 +55,6 @@ public function __construct(PointService $pointService) { $this->pointService = $pointService; } - /** * */ @@ -67,10 +62,9 @@ protected function configure() { parent::configure(); $this->setName('backup:point:purge') - ->setDescription('Remove old restoring points, based on current settings'); + ->setDescription('Remove old restoring points, based on current settings'); } - /** * @param InputInterface $input * @param OutputInterface $output diff --git a/lib/Command/PointRestore.php b/lib/Command/PointRestore.php index 6b90beeb..6c607f47 100755 --- a/lib/Command/PointRestore.php +++ b/lib/Command/PointRestore.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Command; use Exception; @@ -81,7 +79,6 @@ class PointRestore extends Base { use TStringTools; use TArrayTools; - /** @var PointService */ private $pointService; @@ -103,14 +100,12 @@ class PointRestore extends Base { /** @var OutputService */ private $outputService; - /** @var OutputInterface */ private $output; /** @var InputInterface */ private $input; - /** * PointRestore constructor. * @@ -129,7 +124,7 @@ public function __construct( RestoreService $restoreService, ActivityService $activityService, ConfigService $configService, - OutputService $outputService + OutputService $outputService, ) { parent::__construct(); @@ -142,23 +137,21 @@ public function __construct( $this->outputService = $outputService; } - /** * */ protected function configure() { $this->setName('backup:point:restore') - ->setDescription('Restore a restoring point') - ->addArgument('pointId', InputArgument::REQUIRED, 'Id of the restoring point') - ->addOption('force', '', InputOption::VALUE_NONE, 'Force the restoring process') - ->addOption('do-not-ask-data', '', InputOption::VALUE_NONE, 'Do not ask for path on data') - ->addOption('do-not-ask-sql', '', InputOption::VALUE_NONE, 'Do not ask for params on sqldump') - ->addOption('file', '', InputOption::VALUE_REQUIRED, 'restore only a specific file') - ->addOption('chunk', '', InputOption::VALUE_REQUIRED, 'location of the file') - ->addOption('data', '', InputOption::VALUE_REQUIRED, 'location of the file'); + ->setDescription('Restore a restoring point') + ->addArgument('pointId', InputArgument::REQUIRED, 'Id of the restoring point') + ->addOption('force', '', InputOption::VALUE_NONE, 'Force the restoring process') + ->addOption('do-not-ask-data', '', InputOption::VALUE_NONE, 'Do not ask for path on data') + ->addOption('do-not-ask-sql', '', InputOption::VALUE_NONE, 'Do not ask for params on sqldump') + ->addOption('file', '', InputOption::VALUE_REQUIRED, 'restore only a specific file') + ->addOption('chunk', '', InputOption::VALUE_REQUIRED, 'location of the file') + ->addOption('data', '', InputOption::VALUE_REQUIRED, 'location of the file'); } - /** * @param InputInterface $input * @param OutputInterface $output @@ -190,8 +183,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int if ($point->isStatus(RestoringPoint::STATUS_PACKING) && !$force) { throw new RestoringPointNotFoundException( 'the restoring point does not seems to be fully unpacked, meaning not all data are available.' - . "\n" . - 'Finish the unpacking process, or use --force to see how the restoring process goes and hope for the best' + . "\n" + . 'Finish the unpacking process, or use --force to see how the restoring process goes and hope for the best' ); } @@ -277,13 +270,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int ] ); - $this->displayResume($point); return 0; } - /** * @param RestoringPoint $point * @@ -312,7 +303,6 @@ public function restorePointComplete(RestoringPoint $point): void { } } - /** * @param RestoringPoint $point * @param RestoringData $data @@ -340,10 +330,10 @@ private function restorePointData(RestoringPoint $point, RestoringData $data): v $this->output->writeln('ok'); } catch ( ArchiveCreateException - | ArchiveNotFoundException - | NotFoundException - | NotPermittedException - | RestoreChunkException $e) { + |ArchiveNotFoundException + |NotFoundException + |NotPermittedException + |RestoreChunkException $e) { $this->output->writeln('' . $e->getMessage() . ''); } } @@ -351,7 +341,6 @@ private function restorePointData(RestoringPoint $point, RestoringData $data): v $data->setRestoredRoot($root); } - /** * @param RestoringPoint $point * @param RestoringData $data @@ -397,7 +386,6 @@ private function restorePointSqlDump(RestoringPoint $point, RestoringData $data) $data->setRestoredRoot(json_encode($sqlParams)); } - /** * @param RestoringData $data * @@ -444,7 +432,6 @@ private function requestDataRoot(RestoringData $data): string { return $root; } - /** * @param string $type * @param array $fromConfig @@ -595,7 +582,6 @@ private function requestSqlParams(string $type = '', array $fromConfig = []): ar } } - /** * @param RestoringPoint $point * @@ -617,7 +603,6 @@ private function getSqlParamsFromConfig(RestoringPoint $point): array { ]; } - /** * @param RestoringPoint $point */ @@ -675,7 +660,6 @@ private function updateConfig(RestoringPoint $point): void { ); } - /** * @param RestoringPoint $point * @param string $configFile @@ -729,8 +713,6 @@ private function compareConfigDataRoot(array &$CONFIG, string $used): void { } } - - // private function getConfigSqlParams(); /** @@ -772,7 +754,6 @@ private function compareConfigSqlParams(array $sqlParams, array &$CONFIG, string } } - /** * @param RestoringPoint $point * @param RestoringChunk $chunk @@ -792,21 +773,20 @@ private function importSqlDump(RestoringPoint $point, RestoringChunk $chunk, arr throw new RestoreChunkException('cannot open stream'); } } catch (ArchiveCreateException - | ArchiveNotFoundException - | RestoreChunkException - | NotFoundException - | NotPermittedException $e) { + |ArchiveNotFoundException + |RestoreChunkException + |NotFoundException + |NotPermittedException $e) { throw new SqlImportException($e->getMessage()); } -// $config = $this->extractDatabaseConfig(); + // $config = $this->extractDatabaseConfig(); $sqlDump = $this->pointService->getSqlDump($sqlParams); $sqlDump->setup($sqlParams); $sqlDump->import($sqlParams, $stream); } - /** * @param RestoringPoint $point * @param string|null $filename @@ -825,7 +805,7 @@ private function restoreUniqueFile( RestoringPoint $point, ?string $filename, ?string $dataName, - ?string $chunkName + ?string $chunkName, ): void { if (is_null($filename)) { throw new InvalidOptionException('must specify --file option'); @@ -853,9 +833,9 @@ private function restoreUniqueFile( $root = $data->getAbsolutePath(); $chunk = $file->getRestoringChunk(); $this->output->write( - ' > restoring ' . $file->getName() . ' (' . $this->humanReadable($file->getFilesize()) . - ') from ' . $chunk->getPath() . $chunk->getName() . '' . - ' (rewind: ' . $this->getDateDiff($point->getDate(), time()) . '): ' + ' > restoring ' . $file->getName() . ' (' . $this->humanReadable($file->getFilesize()) + . ') from ' . $chunk->getPath() . $chunk->getName() . '' + . ' (rewind: ' . $this->getDateDiff($point->getDate(), time()) . '): ' ); // TODO: display $root and add a confirmation step @@ -880,15 +860,14 @@ private function restoreUniqueFile( // TODO: files:scan file ? } catch (ArchiveCreateException - | ArchiveNotFoundException - | NotFoundException - | NotPermittedException - | RestoreChunkException $e) { + |ArchiveNotFoundException + |NotFoundException + |NotPermittedException + |RestoreChunkException $e) { $this->output->writeln('' . $e->getMessage() . ''); } } - /** * ugly but it does it job. * @@ -916,7 +895,6 @@ private function displaySqlParams(array $sql, bool $oneLine = false): string { return ''; } - /** * @param RestoringPoint $point */ @@ -961,7 +939,6 @@ private function displayResume(RestoringPoint $point): void { } } - /** * */ diff --git a/lib/Command/PointScan.php b/lib/Command/PointScan.php index f419665b..000bb32a 100755 --- a/lib/Command/PointScan.php +++ b/lib/Command/PointScan.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Command; use OC\Core\Command\Base; @@ -53,7 +51,6 @@ class PointScan extends Base { use TStringTools; - /** @var PointRequest */ private $pointRequest; @@ -66,14 +63,12 @@ class PointScan extends Base { /** @var OutputService */ private $outputService; - /** @var OutputInterface */ private $output; /** @var InputInterface */ private $input; - /** * PointScan constructor. * @@ -84,7 +79,7 @@ class PointScan extends Base { public function __construct( PointRequest $pointRequest, PointService $pointService, - ChunkService $chunkService + ChunkService $chunkService, ) { parent::__construct(); @@ -93,20 +88,18 @@ public function __construct( $this->pointService = $pointService; } - /** * */ protected function configure() { $this->setName('backup:point:scan') - ->setDescription( - 'Scan a folder containing the data of a restoring point to add it in the list of available restoring point' - ) - ->addOption('owner', '', InputOption::VALUE_REQUIRED, 'owner of the metadata file') - ->addOption('file', '', InputOption::VALUE_REQUIRED, 'file_id of the metadata file'); + ->setDescription( + 'Scan a folder containing the data of a restoring point to add it in the list of available restoring point' + ) + ->addOption('owner', '', InputOption::VALUE_REQUIRED, 'owner of the metadata file') + ->addOption('file', '', InputOption::VALUE_REQUIRED, 'file_id of the metadata file'); } - /** * @param InputInterface $input * @param OutputInterface $output diff --git a/lib/Command/PointUnarchive.php b/lib/Command/PointUnarchive.php index 1cde35b5..f5c9cffe 100755 --- a/lib/Command/PointUnarchive.php +++ b/lib/Command/PointUnarchive.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Command; use OC\Core\Command\Base; @@ -59,14 +57,12 @@ */ class PointUnarchive extends Base { - /** @var OccService */ private $occService; /** @var OutputService */ private $outputService; - /** * PointUnarchive constructor. * @@ -75,7 +71,7 @@ class PointUnarchive extends Base { */ public function __construct( OccService $occService, - OutputService $outputService + OutputService $outputService, ) { parent::__construct(); @@ -83,7 +79,6 @@ public function __construct( $this->outputService = $outputService; } - /** * */ @@ -91,14 +86,13 @@ protected function configure() { parent::configure(); $this->setName('backup:point:unarchive') - ->setDescription('Unarchive a restoring point') - ->addArgument('pointId', InputArgument::REQUIRED, 'id of the restoring point to comment') - ->addOption('remote', '', InputOption::VALUE_REQUIRED, 'address of the remote instance') - ->addOption('external', '', InputOption::VALUE_REQUIRED, 'id of the external folder') - ->addOption('all-storages', '', InputOption::VALUE_NONE, 'duplicate action on all storages'); + ->setDescription('Unarchive a restoring point') + ->addArgument('pointId', InputArgument::REQUIRED, 'id of the restoring point to comment') + ->addOption('remote', '', InputOption::VALUE_REQUIRED, 'address of the remote instance') + ->addOption('external', '', InputOption::VALUE_REQUIRED, 'id of the external folder') + ->addOption('all-storages', '', InputOption::VALUE_NONE, 'duplicate action on all storages'); } - /** * @param InputInterface $input * @param OutputInterface $output @@ -123,7 +117,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $point = $this->occService->getRestoringPointBasedOnParams($input); $point->setInstance() - ->setArchive(false); + ->setArchive(false); $this->occService->updatePointBasedOnParams($point, $input); diff --git a/lib/Command/PointUnlock.php b/lib/Command/PointUnlock.php index e64c023d..74885c93 100755 --- a/lib/Command/PointUnlock.php +++ b/lib/Command/PointUnlock.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Command; use OC\Core\Command\Base; @@ -46,14 +44,12 @@ */ class PointUnlock extends Base { - /** @var MetadataService */ private $metadataService; /** @var PointService */ private $pointService; - /** * PointUnlock constructor. * @@ -62,7 +58,7 @@ class PointUnlock extends Base { */ public function __construct( PointService $pointService, - MetadataService $metadataService + MetadataService $metadataService, ) { parent::__construct(); @@ -70,7 +66,6 @@ public function __construct( $this->metadataService = $metadataService; } - /** * */ @@ -78,11 +73,10 @@ protected function configure() { parent::configure(); $this->setName('backup:point:unlock') - ->setDescription('Unlock a restoring point') - ->addArgument('pointId', InputArgument::REQUIRED, 'id of the restoring point to unlock'); + ->setDescription('Unlock a restoring point') + ->addArgument('pointId', InputArgument::REQUIRED, 'id of the restoring point to unlock'); } - /** * @param InputInterface $input * @param OutputInterface $output diff --git a/lib/Command/PointUnpack.php b/lib/Command/PointUnpack.php index 47e0b34c..862e02e2 100755 --- a/lib/Command/PointUnpack.php +++ b/lib/Command/PointUnpack.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Command; use OC\Core\Command\Base; @@ -54,7 +52,6 @@ */ class PointUnpack extends Base { - /** @var PointService */ private $pointService; @@ -67,7 +64,6 @@ class PointUnpack extends Base { /** @var OutputService */ private $outputService; - /** * PointUnpack constructor. * @@ -80,7 +76,7 @@ public function __construct( PointService $pointService, PackService $packService, RemoteStreamService $remoteStreamService, - OutputService $outputService + OutputService $outputService, ) { parent::__construct(); @@ -90,7 +86,6 @@ public function __construct( $this->outputService = $outputService; } - /** * */ @@ -98,12 +93,11 @@ protected function configure() { parent::configure(); $this->setName('backup:point:unpack') - ->setDescription('Increase compression of a restoring point and prepare for upload') - ->addArgument('pointId', InputArgument::REQUIRED, 'Id of the restoring point') - ->addOption('generate-log', '', InputOption::VALUE_NONE, 'generate a log file'); + ->setDescription('Increase compression of a restoring point and prepare for upload') + ->addArgument('pointId', InputArgument::REQUIRED, 'Id of the restoring point') + ->addOption('generate-log', '', InputOption::VALUE_NONE, 'generate a log file'); } - /** * @param InputInterface $input * @param OutputInterface $output @@ -123,13 +117,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int if ($input->getOption('generate-log')) { try { $this->outputService->openFile($point, 'occ backup:point:unpack'); - } catch (NotPermittedException | LockedException $e) { + } catch (NotPermittedException|LockedException $e) { } } $this->packService->unpackPoint($point); - // set Archive flag up after unpack $point->setArchive(true); diff --git a/lib/Command/PointUpload.php b/lib/Command/PointUpload.php index e85c50fe..e7bf76af 100755 --- a/lib/Command/PointUpload.php +++ b/lib/Command/PointUpload.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Command; use OC\Core\Command\Base; @@ -55,7 +53,6 @@ */ class PointUpload extends Base { - /** @var PointService */ private $pointService; @@ -65,7 +62,6 @@ class PointUpload extends Base { /** @var OutputService */ private $outputService; - /** * PointUpload constructor. * @@ -76,7 +72,7 @@ class PointUpload extends Base { public function __construct( PointService $pointService, UploadService $uploadService, - OutputService $outputService + OutputService $outputService, ) { parent::__construct(); @@ -85,20 +81,18 @@ public function __construct( $this->outputService = $outputService; } - /** * */ protected function configure() { $this->setName('backup:point:upload') - ->setDescription('Upload a local restoring point on others instances') - ->addArgument('point', InputArgument::REQUIRED, 'Id of the restoring point') - ->addOption('remote', '', InputOption::VALUE_REQUIRED, 'address of the remote instance', '') - ->addOption('external', '', InputOption::VALUE_REQUIRED, 'id of the external folder', '') - ->addOption('generate-log', '', InputOption::VALUE_NONE, 'generate a log file'); + ->setDescription('Upload a local restoring point on others instances') + ->addArgument('point', InputArgument::REQUIRED, 'Id of the restoring point') + ->addOption('remote', '', InputOption::VALUE_REQUIRED, 'address of the remote instance', '') + ->addOption('external', '', InputOption::VALUE_REQUIRED, 'id of the external folder', '') + ->addOption('generate-log', '', InputOption::VALUE_NONE, 'generate a log file'); } - /** * @param InputInterface $input * @param OutputInterface $output @@ -119,7 +113,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int try { $this->pointService->initBaseFolder($point); $this->outputService->openFile($point, 'occ backup:point:upload'); - } catch (NotPermittedException | LockedException $e) { + } catch (NotPermittedException|LockedException $e) { } } diff --git a/lib/Command/Reset.php b/lib/Command/Reset.php index 4a3a7ccb..a64bc929 100755 --- a/lib/Command/Reset.php +++ b/lib/Command/Reset.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Command; use OC\Core\Command\Base; @@ -51,7 +49,6 @@ */ class Reset extends Base { - /** @var CoreRequestBuilder */ private $coreRequestBuilder; @@ -61,7 +58,6 @@ class Reset extends Base { /** @var ConfigService */ private $configService; - /** * Reset constructor. * @@ -72,7 +68,7 @@ class Reset extends Base { public function __construct( CoreRequestBuilder $coreRequestBuilder, PointService $pointService, - ConfigService $configService + ConfigService $configService, ) { parent::__construct(); @@ -81,19 +77,17 @@ public function __construct( $this->configService = $configService; } - /** * */ protected function configure() { $this->setName('backup:reset') - ->setDescription('Remove all data related to the Backup App') - ->addOption( - 'uninstall', '', InputOption::VALUE_NONE, 'Also uninstall the app from the instance' - ); + ->setDescription('Remove all data related to the Backup App') + ->addOption( + 'uninstall', '', InputOption::VALUE_NONE, 'Also uninstall the app from the instance' + ); } - /** * @param InputInterface $input * @param OutputInterface $output @@ -139,7 +133,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->coreRequestBuilder->cleanDatabase(); try { $this->pointService->destroyBackupFS(); - } catch (NotFoundException | NotPermittedException | ExternalFolderNotFoundException $e) { + } catch (NotFoundException|NotPermittedException|ExternalFolderNotFoundException $e) { } $this->configService->setAppValue(ConfigService::LAST_FULL_RP, ''); diff --git a/lib/Command/SetupExport.php b/lib/Command/SetupExport.php index 58bb38c5..4b317b53 100755 --- a/lib/Command/SetupExport.php +++ b/lib/Command/SetupExport.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Command; use Exception; @@ -46,11 +44,9 @@ */ class SetupExport extends Base { - /** @var ExportService */ private $exportService; - /** * SetupExport constructor. * @@ -62,17 +58,15 @@ public function __construct(ExportService $exportService) { $this->exportService = $exportService; } - /** * */ protected function configure() { $this->setName('backup:setup:export') - ->setDescription('Export your setup for easier restoration') - ->addOption('key', '', InputOption::VALUE_NONE, 'use a generated key to encrypt the data'); + ->setDescription('Export your setup for easier restoration') + ->addOption('key', '', InputOption::VALUE_NONE, 'use a generated key to encrypt the data'); } - /** * @param InputInterface $input * @param OutputInterface $output diff --git a/lib/Command/SetupImport.php b/lib/Command/SetupImport.php index 0aecde81..d61267fe 100755 --- a/lib/Command/SetupImport.php +++ b/lib/Command/SetupImport.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Command; use Exception; @@ -57,7 +55,6 @@ class SetupImport extends Base { use TArrayTools; use TDeserialize; - /** @var RemoteRequest */ private $remoteRequest; @@ -70,7 +67,6 @@ class SetupImport extends Base { /** @var ConfigService */ private $configService; - /** * SetupImport constructor. * @@ -82,7 +78,7 @@ public function __construct( RemoteRequest $remoteRequest, EncryptService $encryptService, RemoteStreamService $remoteStreamService, - ConfigService $configService + ConfigService $configService, ) { parent::__construct(); @@ -92,17 +88,15 @@ public function __construct( $this->configService = $configService; } - /** * */ protected function configure() { $this->setName('backup:setup:import') - ->setDescription('Import your setup for easier restoration') - ->addOption('key', '', InputOption::VALUE_REQUIRED, 'key used when exporting the setup', ''); + ->setDescription('Import your setup for easier restoration') + ->addOption('key', '', InputOption::VALUE_REQUIRED, 'key used when exporting the setup', ''); } - /** * @param InputInterface $input * @param OutputInterface $output @@ -135,7 +129,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int ); } - $storedPairs = $this->getArray('signatory', $setup); if (sizeof($storedPairs) === 1) { $stored = array_shift($storedPairs); diff --git a/lib/Controller/LocalController.php b/lib/Controller/LocalController.php index 8045f85d..534823c9 100755 --- a/lib/Controller/LocalController.php +++ b/lib/Controller/LocalController.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Controller; use Exception; @@ -72,7 +70,6 @@ class LocalController extends OcsController { use TNCLogger; use TDeserialize; - /** @var IUserSession */ private $userSession; @@ -103,7 +100,6 @@ class LocalController extends OcsController { /** @var ConfigService */ private $configService; - /** * LocalController constructor. * @@ -132,7 +128,7 @@ public function __construct( ExternalFolderService $externalFolderService, ExportService $exportService, RestoreService $restoreService, - ConfigService $configService + ConfigService $configService, ) { parent::__construct($appName, $request); @@ -148,7 +144,6 @@ public function __construct( $this->configService = $configService; } - /** * @param string $type * @param string $param @@ -160,7 +155,6 @@ public function initAction(string $type, string $param = ''): DataResponse { switch ($type) { case 'scan': return $this->initActionScanLocalFolder((int)$param); - case 'backup': if ($param === 'full') { return $this->initActionForceFullBackup(); @@ -172,7 +166,6 @@ public function initAction(string $type, string $param = ''): DataResponse { throw new OCSException('unknown action', Http::STATUS_BAD_REQUEST); } - /** * @return DataResponse * @throws SignatureException @@ -183,7 +176,6 @@ public function getRestoringPoints(): DataResponse { return new DataResponse($points); } - /** * @return DataResponse */ @@ -194,7 +186,6 @@ public function getSettings(): DataResponse { return new DataResponse($settings); } - /** * @param array $settings * @@ -216,7 +207,6 @@ public function setSettings(array $settings): DataResponse { return new DataResponse(array_merge($settings, $this->cronService->nextBackups())); } - /** * @param string $encrypted * @@ -239,7 +229,6 @@ public function setupExport(string $encrypted): DataResponse { } } - /** * @return DataResponse * @throws OCSException @@ -254,7 +243,6 @@ public function getAppData(): DataResponse { } } - /** * @param int $storageId * @param string $root @@ -276,7 +264,6 @@ public function setAppData(int $storageId, string $root): DataResponse { } } - /** * @return DataResponse * @throws OCSException @@ -289,7 +276,6 @@ public function getExternalFolder(): DataResponse { } } - /** * @param int $storageId * @param string $root @@ -322,7 +308,6 @@ public function setExternalFolder(int $storageId, string $root): DataResponse { } } - /** * @param int $storageId * @@ -339,7 +324,6 @@ public function unsetExternalFolder(int $storageId): DataResponse { } } - /** * @param int $fileId * @@ -388,7 +372,6 @@ private function initActionScanLocalFolder(int $fileId): DataResponse { } } - /** * @param int $fileId * @param string $owner @@ -420,7 +403,6 @@ public function actionFromFileId(int $fileId, string $owner, ?Folder &$folder = throw new RestoringPointException(); } - /** * @return DataResponse * @throws OCSException @@ -435,7 +417,6 @@ private function initActionForceFullBackup(): DataResponse { return new DataResponse(['message' => 'full backup should be initiated in the next few minutes']); } - /** * @return DataResponse */ diff --git a/lib/Cron/Backup.php b/lib/Cron/Backup.php index 94226ab0..a4c9286a 100644 --- a/lib/Cron/Backup.php +++ b/lib/Cron/Backup.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,16 +27,15 @@ * */ - namespace OCA\Backup\Cron; -use OCP\AppFramework\Utility\ITimeFactory; -use OCP\BackgroundJob\TimedJob; use OCA\Backup\Exceptions\JobsTimeSlotException; use OCA\Backup\Service\ConfigService; use OCA\Backup\Service\CronService; use OCA\Backup\Service\PointService; use OCA\Backup\Tools\Traits\TNCLogger; +use OCP\AppFramework\Utility\ITimeFactory; +use OCP\BackgroundJob\TimedJob; use Psr\Log\LoggerInterface; use Throwable; @@ -63,13 +61,12 @@ public function __construct( private PointService $pointService, private CronService $cronService, private ConfigService $configService, - private LoggerInterface $loggerInterface + private LoggerInterface $loggerInterface, ) { parent::__construct($time); $this->setInterval(900); } - /** * @param $argument */ @@ -87,7 +84,6 @@ protected function run($argument): void { } } - /** * */ @@ -101,7 +97,6 @@ private function manage(): void { $this->runBackup($time); } - /** * @param int $time */ @@ -113,7 +108,6 @@ private function runBackup(int $time): void { } } - private function runFullBackup(): void { try { $generateLogs = $this->configService->getAppValueBool(ConfigService::GENERATE_LOGS); @@ -129,7 +123,6 @@ private function runFullBackup(): void { } } - /** * */ diff --git a/lib/Cron/Event.php b/lib/Cron/Event.php index c8ee371b..10a5fec0 100644 --- a/lib/Cron/Event.php +++ b/lib/Cron/Event.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,11 +27,8 @@ * */ - namespace OCA\Backup\Cron; -use OCP\AppFramework\Utility\ITimeFactory; -use OCP\BackgroundJob\TimedJob; use OCA\Backup\Db\EventRequest; use OCA\Backup\Model\BackupEvent; use OCA\Backup\Service\ConfigService; @@ -40,6 +36,8 @@ use OCA\Backup\Service\FilesService; use OCA\Backup\Service\PointService; use OCA\Backup\Tools\Traits\TArrayTools; +use OCP\AppFramework\Utility\ITimeFactory; +use OCP\BackgroundJob\TimedJob; /** * Class Event @@ -65,13 +63,12 @@ public function __construct( private PointService $pointService, private FilesService $filesService, private CronService $cronService, - private ConfigService $configService + private ConfigService $configService, ) { parent::__construct($time); $this->setInterval(1); } - /** * @param $argument */ @@ -87,7 +84,6 @@ protected function run($argument) { } } - /** * @param BackupEvent $event */ @@ -101,26 +97,24 @@ private function scanLocalFolder(BackupEvent $event): void { $this->successEvent($event); } - /** * @param BackupEvent $event * @param string $message */ private function failEvent(BackupEvent $event, string $message): void { $event->setResult(['status' => 0, 'message' => $message]) - ->setStatus(BackupEvent::STATUS_DONE); + ->setStatus(BackupEvent::STATUS_DONE); $this->eventRequest->update($event); } - /** * @param BackupEvent $event * @param string $message */ private function successEvent(BackupEvent $event, string $message = ''): void { $event->setResult(['status' => 1, 'message' => $message]) - ->setStatus(BackupEvent::STATUS_DONE); + ->setStatus(BackupEvent::STATUS_DONE); $this->eventRequest->update($event); } diff --git a/lib/Cron/Manage.php b/lib/Cron/Manage.php index cf34e095..e72cafdb 100644 --- a/lib/Cron/Manage.php +++ b/lib/Cron/Manage.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,11 +27,8 @@ * */ - namespace OCA\Backup\Cron; -use OCP\AppFramework\Utility\ITimeFactory; -use OCP\BackgroundJob\TimedJob; use OCA\Backup\Exceptions\ExternalFolderNotFoundException; use OCA\Backup\Exceptions\JobsTimeSlotException; use OCA\Backup\Model\RestoringPoint; @@ -43,6 +39,8 @@ use OCA\Backup\Service\PackService; use OCA\Backup\Service\PointService; use OCA\Backup\Service\UploadService; +use OCP\AppFramework\Utility\ITimeFactory; +use OCP\BackgroundJob\TimedJob; use Throwable; /** @@ -73,13 +71,12 @@ public function __construct( private UploadService $uploadService, private ExternalFolderService $externalFolderService, private OutputService $outputService, - private ConfigService $configService + private ConfigService $configService, ) { parent::__construct($time); $this->setInterval(3600); } - /** * @param $argument */ @@ -96,7 +93,6 @@ protected function run($argument) { } } - /** * @throws JobsTimeSlotException */ diff --git a/lib/Db/ChangesRequest.php b/lib/Db/ChangesRequest.php index dcbc7bcc..0a00d9ee 100644 --- a/lib/Db/ChangesRequest.php +++ b/lib/Db/ChangesRequest.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Db; use OCA\Backup\Exceptions\ChangedFileNotFoundException; @@ -36,7 +34,6 @@ class ChangesRequest extends ChangesRequestBuilder { - /** * @param ChangedFile $file */ @@ -48,7 +45,6 @@ public function insert(ChangedFile $file): void { $qb->execute(); } - /** * @return ChangedFile[] */ @@ -58,7 +54,6 @@ public function getAll(): array { return $this->getItemsFromRequest($qb); } - /** * @param string $hash * @@ -72,7 +67,6 @@ public function getByHash(string $hash): ChangedFile { return $this->getItemFromRequest($qb); } - /** * @param ChangedFile $file */ @@ -84,7 +78,6 @@ public function insertIfNotFound(ChangedFile $file): void { } } - /** * */ diff --git a/lib/Db/ChangesRequestBuilder.php b/lib/Db/ChangesRequestBuilder.php index d6273264..674d6cbb 100644 --- a/lib/Db/ChangesRequestBuilder.php +++ b/lib/Db/ChangesRequestBuilder.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Db; use OCA\Backup\Exceptions\ChangedFileNotFoundException; @@ -45,7 +43,6 @@ class ChangesRequestBuilder extends CoreRequestBuilder { use TArrayTools; - /** * @return CoreQueryBuilder */ @@ -56,7 +53,6 @@ protected function getChangesInsertSql(): CoreQueryBuilder { return $qb; } - /** * @return CoreQueryBuilder */ @@ -67,7 +63,6 @@ protected function getChangesUpdateSql(): CoreQueryBuilder { return $qb; } - /** * @return CoreQueryBuilder */ @@ -82,7 +77,6 @@ protected function getChangesSelectSql(): CoreQueryBuilder { return $qb; } - /** * @return CoreQueryBuilder */ @@ -93,7 +87,6 @@ protected function getChangesDeleteSql(): CoreQueryBuilder { return $qb; } - /** * @param CoreQueryBuilder $qb * @@ -104,7 +97,7 @@ public function getItemFromRequest(CoreQueryBuilder $qb): ChangedFile { /** @var ChangedFile $changed */ try { $changed = $qb->asItem(ChangedFile::class); - } catch (RowNotFoundException | InvalidItemException $e) { + } catch (RowNotFoundException|InvalidItemException $e) { throw new ChangedFileNotFoundException(); } diff --git a/lib/Db/CoreQueryBuilder.php b/lib/Db/CoreQueryBuilder.php index ba19753e..d8ed0618 100644 --- a/lib/Db/CoreQueryBuilder.php +++ b/lib/Db/CoreQueryBuilder.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Db; use OCA\Backup\Tools\Db\ExtendedQueryBuilder; @@ -40,7 +38,6 @@ */ class CoreQueryBuilder extends ExtendedQueryBuilder { - /** * CoreQueryBuilder constructor. */ @@ -48,7 +45,6 @@ public function __construct() { parent::__construct(); } - /** * Limit the request to the Id * @@ -58,7 +54,6 @@ public function limitToId(int $id): void { $this->limitInt('id', $id); } - /** * @param string $uid */ @@ -66,7 +61,6 @@ public function limitToUid(string $uid): void { $this->limit('uid', $uid); } - /** * @param string $instance */ @@ -74,7 +68,6 @@ public function limitToInstance(string $instance): void { $this->limit('instance', $instance, '', false); } - /** * @param string $parent */ diff --git a/lib/Db/CoreRequestBuilder.php b/lib/Db/CoreRequestBuilder.php index 98e0d98e..ecd1f2c9 100644 --- a/lib/Db/CoreRequestBuilder.php +++ b/lib/Db/CoreRequestBuilder.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Db; use Exception; @@ -52,7 +50,6 @@ class CoreRequestBuilder { public const TABLE_AUTHTOKEN = 'authtoken'; - /** @var array */ public static $tables = [ self::TABLE_FILE_CHANGES => [ @@ -102,11 +99,9 @@ class CoreRequestBuilder { ] ]; - /** @var ConfigService */ protected $configService; - /** * CoreQueryBuilder constructor. * @@ -116,7 +111,6 @@ public function __construct(ConfigService $configService) { $this->configService = $configService; } - /** * @return CoreQueryBuilder */ @@ -124,7 +118,6 @@ public function getQueryBuilder(): CoreQueryBuilder { return new CoreQueryBuilder(); } - /** * */ @@ -139,7 +132,6 @@ public function cleanDatabase(): void { } } - public function uninstall(): void { $this->uninstallAppTables(); $this->uninstallFromMigrations(); @@ -163,7 +155,6 @@ public function uninstallAppTables() { $schema->performDropTableCalls(); } - /** * */ @@ -185,7 +176,6 @@ public function uninstallFromJobs(): void { // $qb->execute(); } - /** * @param string $table */ diff --git a/lib/Db/EventRequest.php b/lib/Db/EventRequest.php index 18b5b118..dd07e954 100644 --- a/lib/Db/EventRequest.php +++ b/lib/Db/EventRequest.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Db; use OCA\Backup\Model\BackupEvent; @@ -42,27 +40,25 @@ class EventRequest extends EventRequestBuilder { public function save(BackupEvent $event): void { $qb = $this->getEventInsertSql(); $qb->setValue('type', $qb->createNamedParameter($event->getType())) - ->setValue('author', $qb->createNamedParameter($event->getAuthor())) - ->setValue('status', $qb->createNamedParameter($event->getStatus())) - ->setValue('data', $qb->createNamedParameter(json_encode($event->getData()))) - ->setValue('result', $qb->createNamedParameter(json_encode($event->getResult()))); + ->setValue('author', $qb->createNamedParameter($event->getAuthor())) + ->setValue('status', $qb->createNamedParameter($event->getStatus())) + ->setValue('data', $qb->createNamedParameter(json_encode($event->getData()))) + ->setValue('result', $qb->createNamedParameter(json_encode($event->getResult()))); $qb->execute(); } - /** * @param BackupEvent $event */ public function update(BackupEvent $event): void { $qb = $this->getEventUpdateSql(); $qb->set('status', $qb->createNamedParameter($event->getStatus())) - ->set('result', $qb->createNamedParameter(json_encode($event->getResult()))); + ->set('result', $qb->createNamedParameter(json_encode($event->getResult()))); $qb->execute(); } - /** * @return BackupEvent[] */ diff --git a/lib/Db/EventRequestBuilder.php b/lib/Db/EventRequestBuilder.php index 15d080ca..99c682fd 100644 --- a/lib/Db/EventRequestBuilder.php +++ b/lib/Db/EventRequestBuilder.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Db; use OCA\Backup\Exceptions\BackupEventNotFoundException; @@ -45,7 +43,6 @@ class EventRequestBuilder extends CoreRequestBuilder { use TArrayTools; - /** * @return CoreQueryBuilder */ @@ -56,7 +53,6 @@ protected function getEventInsertSql(): CoreQueryBuilder { return $qb; } - /** * @return CoreQueryBuilder */ @@ -67,7 +63,6 @@ protected function getEventUpdateSql(): CoreQueryBuilder { return $qb; } - /** * @return CoreQueryBuilder */ @@ -82,7 +77,6 @@ protected function getEventSelectSql(): CoreQueryBuilder { return $qb; } - /** * @return CoreQueryBuilder */ @@ -93,7 +87,6 @@ protected function getEventDeleteSql(): CoreQueryBuilder { return $qb; } - /** * @param CoreQueryBuilder $qb * @@ -104,7 +97,7 @@ public function getItemFromRequest(CoreQueryBuilder $qb): BackupEvent { /** @var BackupEvent $remote */ try { $remote = $qb->asItem(BackupEvent::class); - } catch (RowNotFoundException | InvalidItemException $e) { + } catch (RowNotFoundException|InvalidItemException $e) { throw new BackupEventNotFoundException(); } diff --git a/lib/Db/ExternalFolderRequest.php b/lib/Db/ExternalFolderRequest.php index ff8ae039..78f1bfe1 100644 --- a/lib/Db/ExternalFolderRequest.php +++ b/lib/Db/ExternalFolderRequest.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Db; use OCA\Backup\Exceptions\ExternalFolderNotFoundException; @@ -41,19 +39,17 @@ */ class ExternalFolderRequest extends ExternalFolderRequestBuilder { - /** * @param ExternalFolder $folder */ public function save(ExternalFolder $folder): void { $qb = $this->getExternalFolderInsertSql(); $qb->setValue('storage_id', $qb->createNamedParameter($folder->getStorageId())) - ->setValue('root', $qb->createNamedParameter($folder->getRoot())); + ->setValue('root', $qb->createNamedParameter($folder->getRoot())); $qb->execute(); } - /** * @param int $storageId */ @@ -64,7 +60,6 @@ public function remove(int $storageId): void { $qb->execute(); } - /** * @return ExternalFolder[] */ @@ -74,7 +69,6 @@ public function getAll(): array { return $this->getItemsFromRequest($qb); } - /** * @param int $mountId * @@ -88,7 +82,6 @@ public function getById(int $mountId): ExternalFolder { return $this->getItemFromRequest($qb); } - /** * @param int $storageId * diff --git a/lib/Db/ExternalFolderRequestBuilder.php b/lib/Db/ExternalFolderRequestBuilder.php index a682ee14..06a112a8 100644 --- a/lib/Db/ExternalFolderRequestBuilder.php +++ b/lib/Db/ExternalFolderRequestBuilder.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Db; use OCA\Backup\Exceptions\ExternalFolderNotFoundException; @@ -45,7 +43,6 @@ class ExternalFolderRequestBuilder extends CoreRequestBuilder { use TArrayTools; - /** * @return CoreQueryBuilder */ @@ -56,7 +53,6 @@ protected function getExternalFolderInsertSql(): CoreQueryBuilder { return $qb; } - /** * @return CoreQueryBuilder */ @@ -67,7 +63,6 @@ protected function getExternalFolderUpdateSql(): CoreQueryBuilder { return $qb; } - /** * @return CoreQueryBuilder */ @@ -82,7 +77,6 @@ protected function getExternalFolderSelectSql(): CoreQueryBuilder { return $qb; } - /** * @return CoreQueryBuilder */ @@ -93,7 +87,6 @@ protected function getExternalFolderDeleteSql(): CoreQueryBuilder { return $qb; } - /** * @param CoreQueryBuilder $qb * @@ -104,7 +97,7 @@ public function getItemFromRequest(CoreQueryBuilder $qb): ExternalFolder { /** @var ExternalFolder $remote */ try { $remote = $qb->asItem(ExternalFolder::class); - } catch (RowNotFoundException | InvalidItemException $e) { + } catch (RowNotFoundException|InvalidItemException $e) { throw new ExternalFolderNotFoundException(); } diff --git a/lib/Db/PointRequest.php b/lib/Db/PointRequest.php index 7a76ca68..548fe533 100644 --- a/lib/Db/PointRequest.php +++ b/lib/Db/PointRequest.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Db; use OCA\Backup\Exceptions\RestoringPointNotFoundException; @@ -41,7 +39,6 @@ */ class PointRequest extends PointRequestBuilder { - /** * @param RestoringPoint $point * @@ -51,14 +48,14 @@ public function save(RestoringPoint $point): int { $qb = $this->getPointInsertSql(); $qb->setValue('uid', $qb->createNamedParameter($point->getId())) - ->setValue('instance', $qb->createNamedParameter($point->getInstance())) - ->setValue('parent', $qb->createNamedParameter($point->getParent())) - ->setValue('status', $qb->createNamedParameter($point->getStatus())) - ->setValue('archive', $qb->createNamedParameter(($point->isArchive()) ? 1 : 0)) - ->setValue('lock', $qb->createNamedParameter($point->getLock())) - ->setValue('notes', $qb->createNamedParameter(json_encode($point->getNotes()))) - ->setValue('metadata', $qb->createNamedParameter(json_encode($point->getMetadata()))) - ->setValue('date', $qb->createNamedParameter($point->getDate())); + ->setValue('instance', $qb->createNamedParameter($point->getInstance())) + ->setValue('parent', $qb->createNamedParameter($point->getParent())) + ->setValue('status', $qb->createNamedParameter($point->getStatus())) + ->setValue('archive', $qb->createNamedParameter(($point->isArchive()) ? 1 : 0)) + ->setValue('lock', $qb->createNamedParameter($point->getLock())) + ->setValue('notes', $qb->createNamedParameter(json_encode($point->getNotes()))) + ->setValue('metadata', $qb->createNamedParameter(json_encode($point->getMetadata()))) + ->setValue('date', $qb->createNamedParameter($point->getDate())); if ($point->hasHealth()) { $qb->setValue('health', $qb->createNamedParameter(json_encode($point->getHealth()))); @@ -67,7 +64,6 @@ public function save(RestoringPoint $point): int { return $qb->execute(); } - /** * @param RestoringPoint $point * @param bool $updateMetadata @@ -93,7 +89,6 @@ public function update(RestoringPoint $point, bool $updateMetadata = false): voi $qb->execute(); } - /** * @param RestoringPoint $point */ @@ -106,7 +101,6 @@ public function updateStatus(RestoringPoint $point): void { $qb->execute(); } - /** * */ @@ -132,7 +126,6 @@ public function deletePoint(string $pointId): void { $qb->execute(); } - /** * @param RestoringPoint $point */ @@ -144,7 +137,6 @@ public function updateLock(RestoringPoint $point): void { $qb->execute(); } - /** * @param int $since * @param int $until @@ -172,7 +164,6 @@ public function getLocal(int $since = 0, int $until = 0, bool $asc = true): arra return $this->getItemsFromRequest($qb); } - /** * @param string $pointId * @@ -187,7 +178,6 @@ public function getLocalById(string $pointId): RestoringPoint { return $this->getItemFromRequest($qb); } - /** * @param string $pointId * @param string $instance @@ -205,7 +195,6 @@ public function getById(string $pointId, string $instance = ''): RestoringPoint return $this->getItemFromRequest($qb); } - /** * @param string $instance * diff --git a/lib/Db/PointRequestBuilder.php b/lib/Db/PointRequestBuilder.php index 19bb08f0..e814fe6d 100644 --- a/lib/Db/PointRequestBuilder.php +++ b/lib/Db/PointRequestBuilder.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Db; use OCA\Backup\Exceptions\RestoringPointNotFoundException; @@ -45,7 +43,6 @@ class PointRequestBuilder extends CoreRequestBuilder { use TArrayTools; - /** * @return CoreQueryBuilder */ @@ -56,7 +53,6 @@ protected function getPointInsertSql(): CoreQueryBuilder { return $qb; } - /** * Base of the Sql Update request * @@ -69,7 +65,6 @@ protected function getPointUpdateSql(): CoreQueryBuilder { return $qb; } - /** * Base of the Sql Select request for Shares * @@ -86,7 +81,6 @@ protected function getPointSelectSql(): CoreQueryBuilder { return $qb; } - /** * Base of the Sql Delete request * @@ -99,7 +93,6 @@ protected function getPointDeleteSql(): CoreQueryBuilder { return $qb; } - /** * @param CoreQueryBuilder $qb * @@ -110,7 +103,7 @@ public function getItemFromRequest(CoreQueryBuilder $qb): RestoringPoint { /** @var RestoringPoint $restoringPoint */ try { $restoringPoint = $qb->asItem(RestoringPoint::class); - } catch (RowNotFoundException | InvalidItemException $e) { + } catch (RowNotFoundException|InvalidItemException $e) { throw new RestoringPointNotFoundException(); } diff --git a/lib/Db/RemoteRequest.php b/lib/Db/RemoteRequest.php index 411af423..e0b54d20 100644 --- a/lib/Db/RemoteRequest.php +++ b/lib/Db/RemoteRequest.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Db; use OCA\Backup\Exceptions\RemoteInstanceNotFoundException; @@ -42,7 +40,6 @@ */ class RemoteRequest extends RemoteRequestBuilder { - /** * create a new Person in the database. * @@ -58,15 +55,14 @@ public function save(RemoteInstance $remote, bool $force = false): int { } $qb = $this->getRemoteInsertSql(); $qb->setValue('uid', $qb->createNamedParameter($remote->getUid(true))) - ->setValue('instance', $qb->createNamedParameter($remote->getInstance())) - ->setValue('href', $qb->createNamedParameter($remote->getId())) - ->setValue('exchange', $qb->createNamedParameter($remote->getExchange())) - ->setValue('item', $qb->createNamedParameter(json_encode($remote->getOrigData()))); + ->setValue('instance', $qb->createNamedParameter($remote->getInstance())) + ->setValue('href', $qb->createNamedParameter($remote->getId())) + ->setValue('exchange', $qb->createNamedParameter($remote->getExchange())) + ->setValue('item', $qb->createNamedParameter(json_encode($remote->getOrigData()))); return $qb->execute(); } - /** * @param RemoteInstance $remote * @param bool $force @@ -80,16 +76,15 @@ public function update(RemoteInstance $remote, bool $force = false) { $qb = $this->getRemoteUpdateSql(); $qb->set('uid', $qb->createNamedParameter($remote->getUid(true))) - ->set('href', $qb->createNamedParameter($remote->getId())) - ->set('exchange', $qb->createNamedParameter($remote->getExchange())) - ->set('item', $qb->createNamedParameter(json_encode($remote->getOrigData()))); + ->set('href', $qb->createNamedParameter($remote->getId())) + ->set('exchange', $qb->createNamedParameter($remote->getExchange())) + ->set('item', $qb->createNamedParameter(json_encode($remote->getOrigData()))); $qb->limitToInstance($remote->getInstance()); $qb->execute(); } - /** * @return RemoteInstance[] */ @@ -109,7 +104,6 @@ public function getOutgoing(): array { return $this->getItemsFromRequest($qb); } - /** * @return RemoteInstance * @throws RemoteInstanceNotFoundException @@ -134,7 +128,6 @@ public function getFromHref(string $href): RemoteInstance { return $this->getItemFromRequest($qb); } - /** * @param RemoteInstance $remoteInstance * @param bool $force @@ -150,7 +143,6 @@ public function insertOrUpdate(RemoteInstance $remoteInstance, bool $force = fal } } - /** * @param string $address */ diff --git a/lib/Db/RemoteRequestBuilder.php b/lib/Db/RemoteRequestBuilder.php index aee2a14a..31054096 100644 --- a/lib/Db/RemoteRequestBuilder.php +++ b/lib/Db/RemoteRequestBuilder.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Db; use OCA\Backup\Exceptions\RemoteInstanceNotFoundException; @@ -45,7 +43,6 @@ class RemoteRequestBuilder extends CoreRequestBuilder { use TArrayTools; - /** * @return CoreQueryBuilder */ @@ -56,7 +53,6 @@ protected function getRemoteInsertSql(): CoreQueryBuilder { return $qb; } - /** * @return CoreQueryBuilder */ @@ -67,7 +63,6 @@ protected function getRemoteUpdateSql(): CoreQueryBuilder { return $qb; } - /** * @return CoreQueryBuilder */ @@ -82,7 +77,6 @@ protected function getRemoteSelectSql(): CoreQueryBuilder { return $qb; } - /** * @return CoreQueryBuilder */ @@ -93,7 +87,6 @@ protected function getRemoteDeleteSql(): CoreQueryBuilder { return $qb; } - /** * @param CoreQueryBuilder $qb * @@ -104,7 +97,7 @@ public function getItemFromRequest(CoreQueryBuilder $qb): RemoteInstance { /** @var RemoteInstance $remote */ try { $remote = $qb->asItem(RemoteInstance::class); - } catch (RowNotFoundException | InvalidItemException $e) { + } catch (RowNotFoundException|InvalidItemException $e) { throw new RemoteInstanceNotFoundException(); } @@ -119,7 +112,7 @@ public function getItemFromRequest(CoreQueryBuilder $qb): RemoteInstance { */ public function getItemsFromRequest( CoreQueryBuilder $qb, - bool $includeExtraDataOnSerialize = false + bool $includeExtraDataOnSerialize = false, ): array { /** @var RemoteInstance[] $result */ return $qb->asItems( diff --git a/lib/Db/RestoringDataRequest.php b/lib/Db/RestoringDataRequest.php index 791e152b..d6009e78 100644 --- a/lib/Db/RestoringDataRequest.php +++ b/lib/Db/RestoringDataRequest.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Db; use OCA\Backup\Model\RestoringData; @@ -43,14 +41,13 @@ public function save(RestoringData $data): void { $qb = $this->getRestoringDataInsertSql(); $qb->setValue('name', $qb->createNamedParameter($data->getName())) - ->setValue('type', $qb->createNamedParameter($data->getType())) - ->setValue('root', $qb->createNamedParameter($data->getRoot())) - ->setValue('path', $qb->createNamedParameter($data->getPath())); + ->setValue('type', $qb->createNamedParameter($data->getType())) + ->setValue('root', $qb->createNamedParameter($data->getRoot())) + ->setValue('path', $qb->createNamedParameter($data->getPath())); // ->setValue('static', $qb->createNamedParameter(($data->isStatic() ? '1' : '0'))); $qb->execute(); } - /** * @return RestoringData[] */ diff --git a/lib/Db/RestoringDataRequestBuilder.php b/lib/Db/RestoringDataRequestBuilder.php index 252bb710..df30ca75 100644 --- a/lib/Db/RestoringDataRequestBuilder.php +++ b/lib/Db/RestoringDataRequestBuilder.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Db; use OCA\Backup\Exceptions\RestoringDataNotFoundException; @@ -45,7 +43,6 @@ class RestoringDataRequestBuilder extends CoreRequestBuilder { use TArrayTools; - /** * @return CoreQueryBuilder */ @@ -56,7 +53,6 @@ protected function getRestoringDataInsertSql(): CoreQueryBuilder { return $qb; } - /** * @return CoreQueryBuilder */ @@ -67,7 +63,6 @@ protected function getRestoringDataUpdateSql(): CoreQueryBuilder { return $qb; } - /** * @return CoreQueryBuilder */ @@ -82,7 +77,6 @@ protected function getRestoringDataSelectSql(): CoreQueryBuilder { return $qb; } - /** * @return CoreQueryBuilder */ @@ -93,7 +87,6 @@ protected function getRestoringDataDeleteSql(): CoreQueryBuilder { return $qb; } - /** * @param CoreQueryBuilder $qb * @@ -104,7 +97,7 @@ public function getItemFromRequest(CoreQueryBuilder $qb): RestoringData { /** @var RestoringData $data */ try { $data = $qb->asItem(RestoringData::class); - } catch (RowNotFoundException | InvalidItemException $e) { + } catch (RowNotFoundException|InvalidItemException $e) { throw new RestoringDataNotFoundException(); } diff --git a/lib/Exceptions/ArchiveCreateException.php b/lib/Exceptions/ArchiveCreateException.php index 230eda8d..00f1d971 100644 --- a/lib/Exceptions/ArchiveCreateException.php +++ b/lib/Exceptions/ArchiveCreateException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/ArchiveFileNotFoundException.php b/lib/Exceptions/ArchiveFileNotFoundException.php index d5023483..771a89c9 100644 --- a/lib/Exceptions/ArchiveFileNotFoundException.php +++ b/lib/Exceptions/ArchiveFileNotFoundException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/ArchiveNotFoundException.php b/lib/Exceptions/ArchiveNotFoundException.php index c11db2fb..b82cddeb 100644 --- a/lib/Exceptions/ArchiveNotFoundException.php +++ b/lib/Exceptions/ArchiveNotFoundException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/BackupAppCopyException.php b/lib/Exceptions/BackupAppCopyException.php index 3984686b..726cbfc4 100644 --- a/lib/Exceptions/BackupAppCopyException.php +++ b/lib/Exceptions/BackupAppCopyException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/BackupEventNotFoundException.php b/lib/Exceptions/BackupEventNotFoundException.php index bd8967a1..ff9739fc 100644 --- a/lib/Exceptions/BackupEventNotFoundException.php +++ b/lib/Exceptions/BackupEventNotFoundException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/BackupScriptNotFoundException.php b/lib/Exceptions/BackupScriptNotFoundException.php index a5729623..7d5b6ae3 100644 --- a/lib/Exceptions/BackupScriptNotFoundException.php +++ b/lib/Exceptions/BackupScriptNotFoundException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/ChangedFileNotFoundException.php b/lib/Exceptions/ChangedFileNotFoundException.php index 108f35d7..dc8009b8 100644 --- a/lib/Exceptions/ChangedFileNotFoundException.php +++ b/lib/Exceptions/ChangedFileNotFoundException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/EncryptException.php b/lib/Exceptions/EncryptException.php index 60f991f5..3a8928c1 100644 --- a/lib/Exceptions/EncryptException.php +++ b/lib/Exceptions/EncryptException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/EncryptionKeyException.php b/lib/Exceptions/EncryptionKeyException.php index adec9187..2f80a72f 100644 --- a/lib/Exceptions/EncryptionKeyException.php +++ b/lib/Exceptions/EncryptionKeyException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/ExternalAppdataException.php b/lib/Exceptions/ExternalAppdataException.php index 709e222c..9487abc2 100644 --- a/lib/Exceptions/ExternalAppdataException.php +++ b/lib/Exceptions/ExternalAppdataException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/ExternalFolderNotFoundException.php b/lib/Exceptions/ExternalFolderNotFoundException.php index 36a3bc4a..ec30b603 100644 --- a/lib/Exceptions/ExternalFolderNotFoundException.php +++ b/lib/Exceptions/ExternalFolderNotFoundException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/JobsTimeSlotException.php b/lib/Exceptions/JobsTimeSlotException.php index dea98c0f..a8ddd181 100644 --- a/lib/Exceptions/JobsTimeSlotException.php +++ b/lib/Exceptions/JobsTimeSlotException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/MetadataException.php b/lib/Exceptions/MetadataException.php index 23a7b138..52109ee2 100644 --- a/lib/Exceptions/MetadataException.php +++ b/lib/Exceptions/MetadataException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/PackDecryptException.php b/lib/Exceptions/PackDecryptException.php index c640b66f..6e954108 100644 --- a/lib/Exceptions/PackDecryptException.php +++ b/lib/Exceptions/PackDecryptException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/PackEncryptException.php b/lib/Exceptions/PackEncryptException.php index cb4e4f2b..6b0e846c 100644 --- a/lib/Exceptions/PackEncryptException.php +++ b/lib/Exceptions/PackEncryptException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/ParentRestoringPointNotFoundException.php b/lib/Exceptions/ParentRestoringPointNotFoundException.php index 3750410d..8d42ed5f 100644 --- a/lib/Exceptions/ParentRestoringPointNotFoundException.php +++ b/lib/Exceptions/ParentRestoringPointNotFoundException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/RemoteInstanceDuplicateException.php b/lib/Exceptions/RemoteInstanceDuplicateException.php index c40cb950..ae202a8f 100644 --- a/lib/Exceptions/RemoteInstanceDuplicateException.php +++ b/lib/Exceptions/RemoteInstanceDuplicateException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/RemoteInstanceException.php b/lib/Exceptions/RemoteInstanceException.php index 9f729e16..b93246fa 100644 --- a/lib/Exceptions/RemoteInstanceException.php +++ b/lib/Exceptions/RemoteInstanceException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/RemoteInstanceNotFoundException.php b/lib/Exceptions/RemoteInstanceNotFoundException.php index fc983be8..78d11d28 100644 --- a/lib/Exceptions/RemoteInstanceNotFoundException.php +++ b/lib/Exceptions/RemoteInstanceNotFoundException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/RemoteInstanceUidException.php b/lib/Exceptions/RemoteInstanceUidException.php index b20c0fb4..5e8ac36c 100644 --- a/lib/Exceptions/RemoteInstanceUidException.php +++ b/lib/Exceptions/RemoteInstanceUidException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/RemoteRequestException.php b/lib/Exceptions/RemoteRequestException.php index c47b389c..178f6ccd 100644 --- a/lib/Exceptions/RemoteRequestException.php +++ b/lib/Exceptions/RemoteRequestException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/RemoteResourceNotFoundException.php b/lib/Exceptions/RemoteResourceNotFoundException.php index 28ce38fe..fc11ca6e 100644 --- a/lib/Exceptions/RemoteResourceNotFoundException.php +++ b/lib/Exceptions/RemoteResourceNotFoundException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/RestoreChunkException.php b/lib/Exceptions/RestoreChunkException.php index d1f6ad77..5eb42ab2 100644 --- a/lib/Exceptions/RestoreChunkException.php +++ b/lib/Exceptions/RestoreChunkException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/RestoringChunkNotFoundException.php b/lib/Exceptions/RestoringChunkNotFoundException.php index 939180ab..e840ff99 100644 --- a/lib/Exceptions/RestoringChunkNotFoundException.php +++ b/lib/Exceptions/RestoringChunkNotFoundException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/RestoringChunkPartNotFoundException.php b/lib/Exceptions/RestoringChunkPartNotFoundException.php index e7c96433..dc175ea6 100644 --- a/lib/Exceptions/RestoringChunkPartNotFoundException.php +++ b/lib/Exceptions/RestoringChunkPartNotFoundException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/RestoringDataNotFoundException.php b/lib/Exceptions/RestoringDataNotFoundException.php index 0f53ac7f..0a60b287 100644 --- a/lib/Exceptions/RestoringDataNotFoundException.php +++ b/lib/Exceptions/RestoringDataNotFoundException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/RestoringPointException.php b/lib/Exceptions/RestoringPointException.php index 01708455..0b273a9d 100644 --- a/lib/Exceptions/RestoringPointException.php +++ b/lib/Exceptions/RestoringPointException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/RestoringPointLockException.php b/lib/Exceptions/RestoringPointLockException.php index f0a57f60..654328c1 100644 --- a/lib/Exceptions/RestoringPointLockException.php +++ b/lib/Exceptions/RestoringPointLockException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/RestoringPointNotFoundException.php b/lib/Exceptions/RestoringPointNotFoundException.php index 77c6bbae..566d73ba 100644 --- a/lib/Exceptions/RestoringPointNotFoundException.php +++ b/lib/Exceptions/RestoringPointNotFoundException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/RestoringPointNotInitiatedException.php b/lib/Exceptions/RestoringPointNotInitiatedException.php index 3148620f..de8606af 100644 --- a/lib/Exceptions/RestoringPointNotInitiatedException.php +++ b/lib/Exceptions/RestoringPointNotInitiatedException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/RestoringPointPackException.php b/lib/Exceptions/RestoringPointPackException.php index ba3463d6..91819625 100644 --- a/lib/Exceptions/RestoringPointPackException.php +++ b/lib/Exceptions/RestoringPointPackException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/RestoringPointUploadException.php b/lib/Exceptions/RestoringPointUploadException.php index ef1fc61d..35b08cdb 100644 --- a/lib/Exceptions/RestoringPointUploadException.php +++ b/lib/Exceptions/RestoringPointUploadException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/SettingsException.php b/lib/Exceptions/SettingsException.php index eef37bc9..3ad34608 100644 --- a/lib/Exceptions/SettingsException.php +++ b/lib/Exceptions/SettingsException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/SqlDumpException.php b/lib/Exceptions/SqlDumpException.php index c2df806d..6195f1d2 100644 --- a/lib/Exceptions/SqlDumpException.php +++ b/lib/Exceptions/SqlDumpException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/SqlImportException.php b/lib/Exceptions/SqlImportException.php index 48370547..9c0a41bf 100644 --- a/lib/Exceptions/SqlImportException.php +++ b/lib/Exceptions/SqlImportException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Exceptions/SqlParamsException.php b/lib/Exceptions/SqlParamsException.php index 31179b4a..08a2a169 100644 --- a/lib/Exceptions/SqlParamsException.php +++ b/lib/Exceptions/SqlParamsException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Exceptions; use Exception; diff --git a/lib/Handlers/WebfingerHandler.php b/lib/Handlers/WebfingerHandler.php index d9f612e0..b587c51c 100644 --- a/lib/Handlers/WebfingerHandler.php +++ b/lib/Handlers/WebfingerHandler.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Handlers; use OC\URLGenerator; @@ -51,7 +49,6 @@ class WebfingerHandler implements IHandler { use TArrayTools; - /** @var URLGenerator */ private $urlGenerator; @@ -61,7 +58,6 @@ class WebfingerHandler implements IHandler { /** @var ConfigService */ private $configService; - /** * WebfingerHandler constructor. * @@ -72,14 +68,13 @@ class WebfingerHandler implements IHandler { public function __construct( IURLGenerator $urlGenerator, RemoteStreamService $remoteStreamService, - ConfigService $configService + ConfigService $configService, ) { $this->urlGenerator = $urlGenerator; $this->remoteStreamService = $remoteStreamService; $this->configService = $configService; } - /** * @param string $service * @param IRequestContext $context diff --git a/lib/IRemoteRequest.php b/lib/IRemoteRequest.php index e0c71444..53de06b2 100644 --- a/lib/IRemoteRequest.php +++ b/lib/IRemoteRequest.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup; use OCA\Backup\Tools\IDeserializable; diff --git a/lib/ISqlDump.php b/lib/ISqlDump.php index 4f55f299..d19d9cce 100644 --- a/lib/ISqlDump.php +++ b/lib/ISqlDump.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup; use OCA\Backup\Exceptions\SqlParamsException; @@ -44,14 +42,12 @@ interface ISqlDump { public const DB_USER = 'dbuser'; public const DB_PASS = 'dbpassword'; - /** * @param array $params * @param string $filename */ public function export(array $params, string $filename): void; - /** * @param array $params * @@ -59,7 +55,6 @@ public function export(array $params, string $filename): void; */ public function setup(array $params): void; - /** * @param array $params * @param resource $read diff --git a/lib/Listeners/FilesAdditionalScripts.php b/lib/Listeners/FilesAdditionalScripts.php index 8cac0bd6..f3d1b8c5 100644 --- a/lib/Listeners/FilesAdditionalScripts.php +++ b/lib/Listeners/FilesAdditionalScripts.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Listeners; use OCA\Backup\AppInfo\Application; @@ -41,14 +39,12 @@ class FilesAdditionalScripts implements IEventListener { - /** @var IUserSession */ private $userSession; /** @var IGroupManager */ private $groupManager; - /** * FilesAdditionalScripts constructor. * @@ -57,13 +53,12 @@ class FilesAdditionalScripts implements IEventListener { */ public function __construct( IUserSession $userSession, - IGroupManager $groupManager + IGroupManager $groupManager, ) { $this->userSession = $userSession; $this->groupManager = $groupManager; } - /** * @param Event $event */ diff --git a/lib/Listeners/NodeEvent.php b/lib/Listeners/NodeEvent.php index 7a267b40..56028e21 100644 --- a/lib/Listeners/NodeEvent.php +++ b/lib/Listeners/NodeEvent.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Listeners; use OCA\Backup\AppInfo\Application; @@ -51,14 +49,12 @@ class NodeEvent implements IEventListener { use TNCLogger; - /** @var FilesService */ private $filesService; /** @var ConfigService */ private $configService; - /** * NodeEvent constructor. * @@ -72,7 +68,6 @@ public function __construct(FilesService $filesService, ConfigService $configSer $this->setup('app', Application::APP_ID); } - /** * @param Event $event */ diff --git a/lib/Migration/Version0023Date20210907122531.php b/lib/Migration/Version0023Date20210907122531.php index 9e814526..87c435ae 100644 --- a/lib/Migration/Version0023Date20210907122531.php +++ b/lib/Migration/Version0023Date20210907122531.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Migration; use Closure; @@ -45,14 +43,12 @@ */ class Version0023Date20210907122531 extends SimpleMigrationStep { - /** * @param IDBConnection $connection */ public function __construct(IDBConnection $connection) { } - /** * @param IOutput $output * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` @@ -65,7 +61,6 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); - /** * BACKUP_CHANGE */ @@ -94,7 +89,6 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt $table->addUniqueIndex(['hash']); } - /** * BACKUP_DATA */ @@ -137,7 +131,6 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt $table->setPrimaryKey(['id']); } - /** * BACKUP_POINT */ @@ -221,7 +214,6 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt $table->addIndex(['instance']); } - /** * BACKUP_EXTERNAL */ @@ -257,7 +249,6 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt $table->addIndex(['storage_id']); } - /** * BACKUP_REMOTE */ @@ -313,7 +304,6 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt $table->addIndex(['href']); } - /** * BACKUP_EVENT */ diff --git a/lib/Mockup/OC/Config.php b/lib/Mockup/OC/Config.php index 22df3fae..cbe9a8ad 100644 --- a/lib/Mockup/OC/Config.php +++ b/lib/Mockup/OC/Config.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OC; use OCP\IConfig; diff --git a/lib/Mockup/OC/Logger.php b/lib/Mockup/OC/Logger.php index ff20e54f..c9ff830f 100644 --- a/lib/Mockup/OC/Logger.php +++ b/lib/Mockup/OC/Logger.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OC; use OCP\ILogger; diff --git a/lib/Mockup/OCP/IConfig.php b/lib/Mockup/OCP/IConfig.php index c26b974f..4d04fcc7 100644 --- a/lib/Mockup/OCP/IConfig.php +++ b/lib/Mockup/OCP/IConfig.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCP; interface IConfig { diff --git a/lib/Mockup/OCP/ILogger.php b/lib/Mockup/OCP/ILogger.php index 1e06acff..0f4c3896 100644 --- a/lib/Mockup/OCP/ILogger.php +++ b/lib/Mockup/OCP/ILogger.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCP; interface ILogger { diff --git a/lib/Model/ArchiveFile.php b/lib/Model/ArchiveFile.php index c6eaab22..392e787c 100644 --- a/lib/Model/ArchiveFile.php +++ b/lib/Model/ArchiveFile.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Model; use JsonSerializable; @@ -43,18 +41,15 @@ class ArchiveFile implements JsonSerializable, IDeserializable { use TArrayTools; - /** @var string */ private $name; /** @var int */ private $filesize; - /** @var RestoringChunk */ private $restoringChunk; - /** * ArchiveFile constructor. * @@ -66,7 +61,6 @@ public function __construct(string $name = '', int $filesize = 0) { $this->filesize = $filesize; } - /** * @return string */ @@ -121,7 +115,6 @@ public function getRestoringChunk(): RestoringChunk { return $this->restoringChunk; } - /** * @param array $data * @@ -134,7 +127,6 @@ public function import(array $data): IDeserializable { return $this; } - /** * @return array */ diff --git a/lib/Model/BackupEvent.php b/lib/Model/BackupEvent.php index 5e69ec7f..f161395c 100644 --- a/lib/Model/BackupEvent.php +++ b/lib/Model/BackupEvent.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Model; use JsonSerializable; @@ -49,7 +47,6 @@ class BackupEvent implements JsonSerializable, IQueryRow, IDeserializable { public const STATUS_QUEUE = 0; public const STATUS_DONE = 1; - /** @var int */ private $id = 0; @@ -68,14 +65,12 @@ class BackupEvent implements JsonSerializable, IQueryRow, IDeserializable { /** @var array */ private $result = []; - /** * BackupEvent constructor. */ public function __construct() { } - /** * @param int $id * @@ -94,7 +89,6 @@ public function getId(): int { return $this->id; } - /** * @param string $author * @@ -113,7 +107,6 @@ public function getAuthor(): string { return $this->author; } - /** * @param string $type * @@ -132,7 +125,6 @@ public function getType(): string { return $this->type; } - /** * @param int $status * @@ -151,7 +143,6 @@ public function getStatus(): int { return $this->status; } - /** * @param array $data * @@ -170,7 +161,6 @@ public function getData(): array { return $this->data; } - /** * @param array $result * @@ -189,7 +179,6 @@ public function getResult(): array { return $this->result; } - /** * @param array $data * @@ -197,16 +186,15 @@ public function getResult(): array { */ public function importFromDatabase(array $data): IQueryRow { $this->setId($this->getInt('id', $data)) - ->setAuthor($this->get('author', $data)) - ->setType($this->get('type', $data)) - ->setStatus($this->getInt('status', $data)) - ->setData($this->getArray('data', $data)) - ->setResult($this->getArray('result', $data)); + ->setAuthor($this->get('author', $data)) + ->setType($this->get('type', $data)) + ->setStatus($this->getInt('status', $data)) + ->setData($this->getArray('data', $data)) + ->setResult($this->getArray('result', $data)); return $this; } - /** * @param array $data * @@ -214,16 +202,15 @@ public function importFromDatabase(array $data): IQueryRow { */ public function import(array $data): IDeserializable { $this->setId($this->getInt('id', $data)) - ->setAuthor($this->get('author', $data)) - ->setType($this->get('type', $data)) - ->setStatus($this->getInt('status', $data)) - ->setData($this->getArray('data', $data)) - ->setResult($this->getArray('result', $data)); + ->setAuthor($this->get('author', $data)) + ->setType($this->get('type', $data)) + ->setStatus($this->getInt('status', $data)) + ->setData($this->getArray('data', $data)) + ->setResult($this->getArray('result', $data)); return $this; } - /** * @return array */ diff --git a/lib/Model/ChangedFile.php b/lib/Model/ChangedFile.php index 002e5492..3fe624c2 100644 --- a/lib/Model/ChangedFile.php +++ b/lib/Model/ChangedFile.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Model; use JsonSerializable; @@ -43,14 +41,12 @@ class ChangedFile implements IQueryRow, JsonSerializable { use TArrayTools; - /** @var string */ private $path = ''; /** @var string */ private $hash = ''; - /** * ChangedFile constructor. * @@ -62,7 +58,6 @@ public function __construct(string $path = '') { } } - /** * @param string $path * @@ -82,7 +77,6 @@ public function getPath(): string { return $this->path; } - /** * @param string $hash * @@ -101,7 +95,6 @@ public function getHash(): string { return $this->hash; } - /** * @param array $data * diff --git a/lib/Model/ChunkPartHealth.php b/lib/Model/ChunkPartHealth.php index af2194a7..8dc14737 100644 --- a/lib/Model/ChunkPartHealth.php +++ b/lib/Model/ChunkPartHealth.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Model; use JsonSerializable; @@ -43,13 +41,11 @@ class ChunkPartHealth implements IDeserializable, JsonSerializable { use TArrayTools; - public const STATUS_UNKNOWN = 0; public const STATUS_OK = 1; public const STATUS_MISSING = 2; public const STATUS_CHECKSUM = 3; - public static $DEF_STATUS = [ self::STATUS_UNKNOWN => 'unknown', self::STATUS_OK => 'ok', @@ -72,7 +68,6 @@ class ChunkPartHealth implements IDeserializable, JsonSerializable { /** @var int */ private $status = 0; - /** * ChunkPartHealth constructor. * @@ -82,7 +77,6 @@ public function __construct(bool $packed = false) { $this->packed = $packed; } - /** * @param bool $packed * @@ -101,7 +95,6 @@ public function isPacked(): bool { return $this->packed; } - /** * @param string $partName * @@ -120,7 +113,6 @@ public function getPartName(): string { return $this->partName; } - /** * @param string $chunkName * @@ -139,7 +131,6 @@ public function getChunkName(): string { return $this->chunkName; } - /** * @param string $dataName * @@ -158,7 +149,6 @@ public function getDataName(): string { return $this->dataName; } - /** * @param int $status * @@ -177,7 +167,6 @@ public function getStatus(): int { return $this->status; } - /** * @param array $data * @@ -185,15 +174,14 @@ public function getStatus(): int { */ public function import(array $data): IDeserializable { $this->setStatus($this->getInt('status', $data)) - ->setPacked($this->getBool('packed', $data)) - ->setPartName($this->get('part', $data)) - ->setChunkName($this->get('chunk', $data)) - ->setDataName($this->get('data', $data)); + ->setPacked($this->getBool('packed', $data)) + ->setPartName($this->get('part', $data)) + ->setChunkName($this->get('chunk', $data)) + ->setDataName($this->get('data', $data)); return $this; } - /** * @return array */ diff --git a/lib/Model/ExternalFolder.php b/lib/Model/ExternalFolder.php index a3ad8b71..868f0fde 100644 --- a/lib/Model/ExternalFolder.php +++ b/lib/Model/ExternalFolder.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Model; use JsonSerializable; @@ -48,7 +46,6 @@ class ExternalFolder implements JsonSerializable, IQueryRow, IDeserializable { use TArrayTools; use TStringTools; - /** @var int */ private $storageId = 0; @@ -61,7 +58,6 @@ class ExternalFolder implements JsonSerializable, IQueryRow, IDeserializable { /** @var Folder */ private $rootFolder; - /** * ExternalFolder constructor. */ @@ -70,7 +66,6 @@ public function __construct(int $storageId = 0, string $storage = '') { $this->storage = $storage; } - /** * @param int $storageId * @@ -89,7 +84,6 @@ public function getStorageId(): int { return $this->storageId; } - /** * @param string $storage * @@ -108,7 +102,6 @@ public function getStorage(): string { return $this->storage; } - /** * @param string $root * @@ -127,7 +120,6 @@ public function getRoot(): string { return $this->root; } - /** * @param Folder $rootFolder * @@ -153,7 +145,6 @@ public function hasRootFolder(): bool { return !is_null($this->rootFolder); } - /** * @param array $data * @@ -161,12 +152,11 @@ public function hasRootFolder(): bool { */ public function importFromDatabase(array $data): IQueryRow { $this->setStorageId($this->getInt('storage_id', $data)) - ->setRoot($this->get('root', $data)); + ->setRoot($this->get('root', $data)); return $this; } - /** * @param array $data * @@ -175,8 +165,8 @@ public function importFromDatabase(array $data): IQueryRow { */ public function import(array $data): IDeserializable { $this->setStorageId($this->getInt('storageId', $data)) - ->setStorage($this->get('storage', $data)) - ->setRoot($this->get('root', $data)); + ->setStorage($this->get('storage', $data)) + ->setRoot($this->get('root', $data)); if ($this->getStorageId() === 0) { throw new InvalidItemException(); @@ -185,7 +175,6 @@ public function import(array $data): IDeserializable { return $this; } - /** * @return array */ diff --git a/lib/Model/RemoteInstance.php b/lib/Model/RemoteInstance.php index 28759a5f..625fd1cd 100644 --- a/lib/Model/RemoteInstance.php +++ b/lib/Model/RemoteInstance.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Model; use JsonSerializable; @@ -47,15 +45,12 @@ class RemoteInstance extends NCSignatory implements IQueryRow, IDeserializable, JsonSerializable { use TArrayTools; - public const LOCAL = 'local'; public const ALL = 'all'; - public const EXCHANGE_IN = 1; public const EXCHANGE_OUT = 2; - public const UID = 'uid'; public const ROOT = 'root'; public const AUTH_SIGNED = 'auth-signed'; @@ -68,7 +63,6 @@ class RemoteInstance extends NCSignatory implements IQueryRow, IDeserializable, public const RP_UPLOAD = 'restoringPoint.upload'; public const RP_DOWNLOAD = 'restoringPoint.download'; - /** @var int */ private $dbId = 0; @@ -114,7 +108,6 @@ class RemoteInstance extends NCSignatory implements IQueryRow, IDeserializable, /** @var bool */ private $includeExtraDataOnSerialize = false; - /** * @param int $dbId * @@ -133,7 +126,6 @@ public function getDbId(): int { return $this->dbId; } - /** * @return string */ @@ -152,7 +144,6 @@ public function setRoot(string $root): self { return $this; } - /** * @param int $exchange * @@ -192,7 +183,6 @@ public function isIncoming(): bool { return (($this->getExchange() & self::EXCHANGE_IN) !== 0); } - /** * @param bool $outgoing * @@ -214,7 +204,6 @@ public function isOutgoing(): bool { return (($this->getExchange() & self::EXCHANGE_OUT) !== 0); } - /** * @param string $RPList * @@ -233,7 +222,6 @@ public function getRPList(): string { return $this->RPList; } - /** * @param string $RPHealth * @@ -252,7 +240,6 @@ public function getRPHealth(): string { return $this->RPHealth; } - /** * @param string $RPGet * @@ -271,7 +258,6 @@ public function getRPGet(): string { return $this->RPGet; } - /** * @param string $RPDownload * @@ -290,7 +276,6 @@ public function getRPDownload(): string { return $this->RPDownload; } - /** * @param string $RPCreate * @@ -309,7 +294,6 @@ public function getRPCreate(): string { return $this->RPCreate; } - /** * @param string $RPDelete * @@ -328,7 +312,6 @@ public function getRPDelete(): string { return $this->RPDelete; } - /** * @param string $RPUpdate * @@ -347,7 +330,6 @@ public function getRPUpdate(): string { return $this->RPUpdate; } - /** * @param string $RPUpload * @@ -366,7 +348,6 @@ public function getRPUpload(): string { return $this->RPUpload; } - /** * @return $this */ @@ -400,7 +381,6 @@ public function getUid(bool $shorten = false): string { return $this->uid; } - /** * @param string $authSigned * @@ -419,7 +399,6 @@ public function getAuthSigned(): string { return $this->authSigned; } - /** * @param bool $identityAuthed * @@ -447,7 +426,6 @@ public function mustBeIdentityAuthed(): void { } } - /** * @param array $data * @@ -462,7 +440,6 @@ public function import(array $data): IDeserializable { return $this; } - /** * @param array $data * @@ -472,15 +449,15 @@ public function importSignatory(array $data): self { // parent::importSignatory($data); $this->setRoot($this->get(self::ROOT, $data)) - ->setRPList($this->get(self::RP_LIST, $data)) - ->setRPCreate($this->get(self::RP_CREATE, $data)) - ->setRPDelete($this->get(self::RP_DELETE, $data)) - ->setRPUpdate($this->get(self::RP_UPDATE, $data)) - ->setRPGet($this->get(self::RP_GET, $data)) - ->setRPHealth($this->get(self::RP_HEALTH, $data)) - ->setRPUpload($this->get(self::RP_UPLOAD, $data)) - ->setRPDownload($this->get(self::RP_DOWNLOAD, $data)) - ->setUid($this->get(self::UID, $data)); + ->setRPList($this->get(self::RP_LIST, $data)) + ->setRPCreate($this->get(self::RP_CREATE, $data)) + ->setRPDelete($this->get(self::RP_DELETE, $data)) + ->setRPUpdate($this->get(self::RP_UPDATE, $data)) + ->setRPGet($this->get(self::RP_GET, $data)) + ->setRPHealth($this->get(self::RP_HEALTH, $data)) + ->setRPUpload($this->get(self::RP_UPLOAD, $data)) + ->setRPDownload($this->get(self::RP_DOWNLOAD, $data)) + ->setUid($this->get(self::UID, $data)); $algo = ''; $authSigned = trim($this->get(self::AUTH_SIGNED, $data), ':'); @@ -489,12 +466,11 @@ public function importSignatory(array $data): self { } $this->setAuthSigned($authSigned) - ->setAlgorithm($algo); + ->setAlgorithm($algo); return $this; } - /** * @return array */ @@ -502,8 +478,8 @@ public function jsonSerialize(): array { $data = [ self::UID => $this->getUid(true), self::ROOT => $this->getRoot(), - 'restoringPoint' => - [ + 'restoringPoint' + => [ 'list' => $this->getRPList(), 'create' => $this->getRPCreate(), 'delete' => $this->getRPDelete(), @@ -531,7 +507,6 @@ public function jsonSerialize(): array { return array_filter(array_merge($data, parent::jsonSerialize())); } - /** * @param array $data * diff --git a/lib/Model/RestoringChunk.php b/lib/Model/RestoringChunk.php index 951bf291..c333b600 100644 --- a/lib/Model/RestoringChunk.php +++ b/lib/Model/RestoringChunk.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Model; use JsonSerializable; @@ -47,7 +45,6 @@ class RestoringChunk implements JsonSerializable, IDeserializable { use TStringTools; use TDeserialize; - /** @var string */ private $name = ''; @@ -84,7 +81,6 @@ class RestoringChunk implements JsonSerializable, IDeserializable { /** @var bool */ private $staticName; - /** * RestoringChunk constructor. */ @@ -109,7 +105,6 @@ public function __construct(string $name = '', bool $staticName = false) { } } - /** * @return string */ @@ -128,7 +123,6 @@ public function setName(string $name): self { return $this; } - /** * @param bool $staticName * @@ -147,7 +141,6 @@ public function isStaticName(): bool { return $this->staticName; } - /** * @return string */ @@ -166,7 +159,6 @@ public function setPath(string $path): self { return $this; } - /** * @param string $type * @@ -185,7 +177,6 @@ public function getType(): string { return $this->type; } - /** * @param int $compression * @@ -204,7 +195,6 @@ public function getCompression(): int { return $this->compression; } - /** * @return string */ @@ -220,7 +210,6 @@ public function getFilename(): string { return $this->getName() . '.zip'; } - /** * @return int */ @@ -243,7 +232,6 @@ public function setCount(int $count = -1): self { return $this; } - /** * @return ArchiveFile[] */ @@ -273,7 +261,6 @@ public function addFile(ArchiveFile $file): self { return $this; } - /** * @return RestoringChunkPart[] */ @@ -299,7 +286,6 @@ public function hasParts(): bool { return !empty($this->parts); } - /** * @param RestoringChunkPart $part * @@ -311,7 +297,6 @@ public function addPart(RestoringChunkPart $part): self { return $this; } - /** * @return int */ @@ -330,7 +315,6 @@ public function setSize(int $size): self { return $this; } - /** * @return string */ @@ -349,7 +333,6 @@ public function setChecksum(string $checksum): self { return $this; } - /** * @param string $content * @@ -368,7 +351,6 @@ public function getContent(): string { return $this->content; } - /** * @param array $data * @@ -376,25 +358,23 @@ public function getContent(): string { */ public function import(array $data): IDeserializable { $this->setName($this->get('name', $data)) - ->setPath($this->get('path', $data)) - ->setType($this->get('type', $data)) - ->setCompression($this->getInt('compression', $data)) + ->setPath($this->get('path', $data)) + ->setType($this->get('type', $data)) + ->setCompression($this->getInt('compression', $data)) // ->setFiles($this->getArray('files', $data, [])) - ->setCount($this->getInt('count', $data)) - ->setSize($this->getInt('size', $data)) - ->setContent($this->get('content', $data)) - ->setStaticName($this->getBool('staticName', $data)) - ->setChecksum($this->get('checksum', $data)); + ->setCount($this->getInt('count', $data)) + ->setSize($this->getInt('size', $data)) + ->setContent($this->get('content', $data)) + ->setStaticName($this->getBool('staticName', $data)) + ->setChecksum($this->get('checksum', $data)); /** @var RestoringChunkPart[] $parts */ $parts = $this->deserializeArray($this->getArray('parts', $data), RestoringChunkPart::class); $this->setParts($parts); - return $this; } - /** * @return array */ @@ -404,7 +384,6 @@ public function getResume(): array { ]; } - /** * @return array */ diff --git a/lib/Model/RestoringChunkPart.php b/lib/Model/RestoringChunkPart.php index c6fd8a24..fc9ac8b2 100644 --- a/lib/Model/RestoringChunkPart.php +++ b/lib/Model/RestoringChunkPart.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Model; use JsonSerializable; @@ -45,7 +43,6 @@ class RestoringChunkPart implements JsonSerializable, IDeserializable { use TArrayTools; use TStringTools; - /** @var string */ private $name; @@ -67,7 +64,6 @@ class RestoringChunkPart implements JsonSerializable, IDeserializable { /** @var string */ private $encryptedChecksum = ''; - /** * RestoringChunkPart constructor. * @@ -79,7 +75,6 @@ public function __construct(string $name = '', int $order = 0) { $this->order = $order; } - /** * @param string $ext * @@ -104,7 +99,6 @@ public function setName(string $name): self { return $this; } - /** * @param int $order * @@ -123,7 +117,6 @@ public function getOrder(): int { return $this->order; } - /** * @param bool $encrypted * @@ -143,7 +136,6 @@ public function isEncrypted(): bool { return $this->encrypted; } - /** * @param string $algorithm * @@ -162,7 +154,6 @@ public function getAlgorithm(): string { return $this->algorithm; } - /** * @return string */ @@ -181,7 +172,6 @@ public function setChecksum(string $checksum): self { return $this; } - /** * @return string */ @@ -200,7 +190,6 @@ public function setEncryptedChecksum(string $encryptedChecksum): self { return $this; } - /** * @return string */ @@ -212,7 +201,6 @@ public function getCurrentChecksum(): string { return $this->getChecksum(); } - /** * @param string $content * @@ -231,7 +219,6 @@ public function getContent(): string { return $this->content; } - /** * @param array $data * @@ -239,17 +226,16 @@ public function getContent(): string { */ public function import(array $data): IDeserializable { $this->setName($this->get('name', $data)) - ->setOrder($this->getInt('order', $data)) - ->setContent($this->get('content', $data)) - ->setEncrypted($this->getBool('encrypted', $data)) - ->setAlgorithm($this->get('algorithm', $data)) - ->setChecksum($this->get('checksum', $data)) - ->setEncryptedChecksum($this->get('encryptedChecksum', $data)); + ->setOrder($this->getInt('order', $data)) + ->setContent($this->get('content', $data)) + ->setEncrypted($this->getBool('encrypted', $data)) + ->setAlgorithm($this->get('algorithm', $data)) + ->setChecksum($this->get('checksum', $data)) + ->setEncryptedChecksum($this->get('encryptedChecksum', $data)); return $this; } - /** * @return array */ diff --git a/lib/Model/RestoringData.php b/lib/Model/RestoringData.php index bb623ab7..95a79b6f 100644 --- a/lib/Model/RestoringData.php +++ b/lib/Model/RestoringData.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Model; use JsonSerializable; @@ -47,7 +45,6 @@ class RestoringData implements IDeserializable, JsonSerializable { use TStringTools; use TDeserialize; - public const INTERNAL_DATA = 0; public const ROOT_DISK = 1; public const ROOT_NEXTCLOUD = 2; @@ -74,7 +71,6 @@ class RestoringData implements IDeserializable, JsonSerializable { self::ROOT_APPS => 'apps' ]; - // filtering folders from the 'core' data public static $FILTER_FROM_NC = [ 'apps/', @@ -82,7 +78,6 @@ class RestoringData implements IDeserializable, JsonSerializable { 'config/' ]; - /** @var string */ private $name; @@ -110,7 +105,6 @@ class RestoringData implements IDeserializable, JsonSerializable { /** @var bool */ private $locked = false; - /** * RestoringChunk constructor. * @@ -128,7 +122,6 @@ public function __construct(int $type = 0, string $path = '', string $name = '') } } - /** * @return string */ @@ -147,7 +140,6 @@ public function setName(string $name): RestoringData { return $this; } - /** * @return int */ @@ -166,7 +158,6 @@ public function setType(int $type): RestoringData { return $this; } - /** * @return string */ @@ -203,7 +194,6 @@ public function setRoot(string $root): RestoringData { return $this; } - /** * @return string */ @@ -221,7 +211,6 @@ public function getAbsolutePath(): string { return $path; } - /** * @param string $restoredRoot * @@ -240,7 +229,6 @@ public function getRestoredRoot(): string { return $this->restoredRoot; } - /** * @param string $path * @@ -270,7 +258,6 @@ public function setFiles(array $files): RestoringData { return $this; } - /** * @param bool $locked */ @@ -285,7 +272,6 @@ public function isLocked(): bool { return $this->locked; } - /** * @return string */ @@ -304,7 +290,6 @@ public function setUniqueFile(string $file): RestoringData { return $this; } - /** * @return RestoringChunk[] */ @@ -334,7 +319,6 @@ public function addChunk(RestoringChunk $chunk): RestoringData { return $this; } - // /** // * @param RestoringChunk $chunk // * @@ -354,7 +338,6 @@ public function addChunk(RestoringChunk $chunk): RestoringData { // return $this; // } - /** * @param array $data * @@ -373,7 +356,6 @@ public function import(array $data): IDeserializable { return $this; } - /** * @return array */ diff --git a/lib/Model/RestoringHealth.php b/lib/Model/RestoringHealth.php index 79d3f6f2..e9b7d7a2 100644 --- a/lib/Model/RestoringHealth.php +++ b/lib/Model/RestoringHealth.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Model; use JsonSerializable; @@ -50,19 +48,16 @@ class RestoringHealth implements IDeserializable, JsonSerializable { use TDeserialize; use TNCLogger; - public const STATUS_ISSUE = 0; public const STATUS_ORPHAN = 1; public const STATUS_OK = 9; - public static $DEF = [ self::STATUS_ISSUE => 'not complete', self::STATUS_ORPHAN => 'without parent', self::STATUS_OK => 'ok' ]; - /** @var int */ private $status = 0; @@ -72,7 +67,6 @@ class RestoringHealth implements IDeserializable, JsonSerializable { /** @var int */ private $checked = 0; - /** * RestoringHealth constructor. */ @@ -80,7 +74,6 @@ public function __construct() { $this->setup('app', Application::APP_ID); } - /** * @param int $status * @@ -99,7 +92,6 @@ public function getStatus(): int { return $this->status; } - /** * @param int $checked * @@ -118,7 +110,6 @@ public function getChecked(): int { return $this->checked; } - /** * @param ChunkPartHealth[] $parts */ @@ -163,7 +154,6 @@ public function getPart(string $chunkName, string $partName): ChunkPartHealth { return $this->parts[$chunkName . '-' . $partName]; } - /** * @param string $chunkName * @param string $partName @@ -179,7 +169,6 @@ private function generateName(string $chunkName, string $partName = ''): string return $k; } - /** * @param array $data * @@ -206,7 +195,6 @@ public function import(array $data): IDeserializable { return $this; } - /** * @return array */ diff --git a/lib/Model/RestoringPoint.php b/lib/Model/RestoringPoint.php index 3f8f856f..42391148 100644 --- a/lib/Model/RestoringPoint.php +++ b/lib/Model/RestoringPoint.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Model; use JsonSerializable; @@ -54,7 +52,6 @@ class RestoringPoint implements IDeserializable, IQueryRow, ISignedModel, JsonSe use TDeserialize; use TNCLogger; - public const STATUS_UNPACKED = 0; public const STATUS_PACKED = 1; public const STATUS_COMPRESSED = 2; @@ -64,8 +61,8 @@ class RestoringPoint implements IDeserializable, IQueryRow, ISignedModel, JsonSe public const LOCK_TIMEOUT = 1800; - public static $DEF_STATUS = - [ + public static $DEF_STATUS + = [ self::STATUS_PACKED => 'packed', self::STATUS_COMPRESSED => 'compressed', self::STATUS_ENCRYPTED => 'encrypted', @@ -75,7 +72,6 @@ class RestoringPoint implements IDeserializable, IQueryRow, ISignedModel, JsonSe public const STATUS_ISSUE = 32; - /** @var string */ private $id = ''; @@ -130,7 +126,6 @@ class RestoringPoint implements IDeserializable, IQueryRow, ISignedModel, JsonSe /** @var bool */ private $package = false; - /** * RestoringPoint constructor. */ @@ -138,7 +133,6 @@ public function __construct() { $this->notes = new SimpleDataStore(); } - /** * @param string $id * @@ -157,7 +151,6 @@ public function getId(): string { return $this->id; } - /** * @param string $instance * @@ -176,7 +169,6 @@ public function getInstance(): string { return $this->instance; } - /** * @param string $parent * @@ -195,7 +187,6 @@ public function getParent(): string { return $this->parent; } - /** * @param int $status * @@ -246,7 +237,6 @@ public function isStatus(int $flag): bool { return (($this->getStatus() & $flag) !== 0); } - /** * @param int $duration * @@ -265,7 +255,6 @@ public function getDuration(): int { return $this->duration; } - /** * @param bool $archive * @@ -284,7 +273,6 @@ public function isArchive(): bool { return $this->archive; } - /** * @param int $lock * @@ -310,7 +298,6 @@ public function isLocked(): bool { return ($this->getLock() > (time() - self::LOCK_TIMEOUT)); } - /** * @param SimpleDataStore $notes * @@ -338,7 +325,6 @@ public function getNotes(): SimpleDataStore { return $this->notes; } - /** * @param int $date * @@ -391,7 +377,6 @@ public function getNCInt(): int { return 1 * $nc[3] + 100 * $nc[2] + 10000 * $nc[1] + 1000000 * $nc[0]; } - /** * @param string $comment * @@ -410,7 +395,6 @@ public function getComment(): string { return $this->comment; } - /** * @return bool */ @@ -436,7 +420,6 @@ public function getBaseFolder(): ISimpleFolder { return $this->baseFolder; } - /** * @return bool */ @@ -462,7 +445,6 @@ public function getAppDataRootWrapper(): AppDataRootWrapper { return $this->appDataRootWrapper; } - /** * @return RestoringData[] */ @@ -508,7 +490,6 @@ public function getData(string $dataName): RestoringData { throw new RestoringDataNotFoundException(); } - /** * @return bool */ @@ -543,7 +524,6 @@ public function unsetHealth(): self { return $this; } - /** * @param string $signature * @@ -562,7 +542,6 @@ public function getSignature(): string { return $this->signature; } - /** * @param string $subSignature * @@ -581,7 +560,6 @@ public function getSubSignature(): string { return $this->subSignature; } - /** * @param bool $package * @@ -600,7 +578,6 @@ public function isPackage(): bool { return $this->package; } - /** * @return array */ @@ -611,7 +588,6 @@ public function getMetadata(): array { return $arr; } - /** * @param array $data * @@ -620,13 +596,13 @@ public function getMetadata(): array { */ public function importFromDatabase(array $data): IQueryRow { $this->setId($this->get('uid', $data)) - ->setInstance($this->get('instance', $data)) - ->setParent($this->get('parent', $data)) - ->setArchive($this->getBool('archive', $data)) - ->setLock($this->getInt('lock', $data)) - ->setStatus($this->getInt('status', $data)) - ->setNotes(new SimpleDataStore($this->getArray('notes', $data))) - ->setDate($this->getInt('date', $data)); + ->setInstance($this->get('instance', $data)) + ->setParent($this->get('parent', $data)) + ->setArchive($this->getBool('archive', $data)) + ->setLock($this->getInt('lock', $data)) + ->setStatus($this->getInt('status', $data)) + ->setNotes(new SimpleDataStore($this->getArray('notes', $data))) + ->setDate($this->getInt('date', $data)); if ($this->getId() === '') { throw new InvalidItemException(); @@ -634,10 +610,10 @@ public function importFromDatabase(array $data): IQueryRow { $metadata = new SimpleDataStore($this->getArray('metadata', $data)); $this->setNc($metadata->gArray('nc')) - ->setSignature($metadata->g('signature')) - ->setSubSignature($metadata->g('subSignature')) - ->setComment($metadata->g('comment')) - ->setDuration($metadata->gInt('duration')); + ->setSignature($metadata->g('signature')) + ->setSubSignature($metadata->g('subSignature')) + ->setComment($metadata->g('comment')) + ->setDuration($metadata->gInt('duration')); try { /** @var RestoringHealth $health */ @@ -653,7 +629,6 @@ public function importFromDatabase(array $data): IQueryRow { return $this; } - /** * @param array $data * @@ -662,17 +637,17 @@ public function importFromDatabase(array $data): IQueryRow { */ public function import(array $data): IDeserializable { $this->setId($this->get('id', $data)) - ->setInstance($this->get('instance', $data)) - ->setParent($this->get('parent', $data)) - ->setArchive($this->getBool('archive', $data)) - ->setStatus($this->getInt('status', $data, -1)) - ->setDuration($this->getInt('duration', $data)) - ->setNotes(new SimpleDataStore($this->getArray('notes', $data))) - ->setDate($this->getInt('date', $data)) - ->setSignature($this->get('signature', $data)) - ->setSubSignature($this->get('subSignature', $data)) - ->setComment($this->get('comment', $data)) - ->setNc($this->getArray('nc', $data)); + ->setInstance($this->get('instance', $data)) + ->setParent($this->get('parent', $data)) + ->setArchive($this->getBool('archive', $data)) + ->setStatus($this->getInt('status', $data, -1)) + ->setDuration($this->getInt('duration', $data)) + ->setNotes(new SimpleDataStore($this->getArray('notes', $data))) + ->setDate($this->getInt('date', $data)) + ->setSignature($this->get('signature', $data)) + ->setSubSignature($this->get('subSignature', $data)) + ->setComment($this->get('comment', $data)) + ->setNc($this->getArray('nc', $data)); if ($this->getId() === '' || $this->getStatus() === -1) { throw new InvalidItemException(); @@ -692,7 +667,6 @@ public function import(array $data): IDeserializable { return $this; } - /** * @return array */ @@ -707,7 +681,6 @@ public function signedData(): array { ]; } - /** * @return array */ @@ -721,7 +694,6 @@ public function subSignedData(): array { ]; } - /** * @return array */ diff --git a/lib/RemoteRequest/CoreRequest.php b/lib/RemoteRequest/CoreRequest.php index 8bf5a5f4..fbb1b5be 100644 --- a/lib/RemoteRequest/CoreRequest.php +++ b/lib/RemoteRequest/CoreRequest.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\RemoteRequest; use OCA\Backup\Tools\Model\NCSignedRequest; @@ -41,7 +39,6 @@ */ class CoreRequest { - /** @var NCSignedRequest */ private $signedRequest; @@ -51,7 +48,6 @@ class CoreRequest { /** @var array */ private $outcome = []; - /** * CoreRequest constructor. */ @@ -59,7 +55,6 @@ public function __construct() { $this->config = new SimpleDataStore(); } - /** * @param NCSignedRequest $signedRequest */ @@ -74,7 +69,6 @@ public function getSignedRequest(): NCSignedRequest { return $this->signedRequest; } - /** * @param SimpleDataStore $config */ @@ -82,7 +76,6 @@ public function config(SimpleDataStore $config): void { $this->config = $config; } - /** * @param array $outcome */ diff --git a/lib/RemoteRequest/CreateRestoringPoint.php b/lib/RemoteRequest/CreateRestoringPoint.php index 50e0e2ba..fca302c0 100644 --- a/lib/RemoteRequest/CreateRestoringPoint.php +++ b/lib/RemoteRequest/CreateRestoringPoint.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\RemoteRequest; use OCA\Backup\AppInfo\Application; @@ -54,14 +52,12 @@ class CreateRestoringPoint extends CoreRequest implements IRemoteRequest { use TDeserialize; use TNCLogger; - /** @var PointRequest */ private $pointRequest; /** @var PointService */ private $pointService; - /** * ListRestoringPoint constructor. * @@ -77,7 +73,6 @@ public function __construct(PointRequest $pointRequest, PointService $pointServi $this->setup('app', Application::APP_ID); } - /** * * @throws InvalidItemException @@ -110,7 +105,6 @@ public function execute(): void { $this->setOutcome($this->serialize($stored)); } - /** * @param array $data * diff --git a/lib/RemoteRequest/DeleteRestoringPoint.php b/lib/RemoteRequest/DeleteRestoringPoint.php index 34ac745f..afd7fcc7 100644 --- a/lib/RemoteRequest/DeleteRestoringPoint.php +++ b/lib/RemoteRequest/DeleteRestoringPoint.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\RemoteRequest; use OCA\Backup\AppInfo\Application; @@ -52,14 +50,12 @@ class DeleteRestoringPoint extends CoreRequest implements IRemoteRequest { use TNCLogger; use TDeserialize; - /** @var PointRequest */ private $pointRequest; /** @var PointService */ private $pointService; - /** * DeleteRestoringPoint constructor. * @@ -74,7 +70,6 @@ public function __construct(PointRequest $pointRequest, PointService $pointServi $this->setup('app', Application::APP_ID); } - /** * @throws NotFoundException * @throws NotPermittedException @@ -89,10 +84,9 @@ public function execute(): void { $this->pointService->delete($point); } catch (RestoringPointNotFoundException $e) { } -// $this->setOutcome($this->serialize($point)); + // $this->setOutcome($this->serialize($point)); } - /** * @param array $data * diff --git a/lib/RemoteRequest/DownloadRestoringChunk.php b/lib/RemoteRequest/DownloadRestoringChunk.php index 4ba5d812..9b1f7529 100644 --- a/lib/RemoteRequest/DownloadRestoringChunk.php +++ b/lib/RemoteRequest/DownloadRestoringChunk.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\RemoteRequest; use OCA\Backup\AppInfo\Application; @@ -56,7 +54,6 @@ class DownloadRestoringChunk extends CoreRequest implements IRemoteRequest { use TDeserialize; use TNCLogger; - /** @var PointService */ private $pointService; @@ -66,7 +63,6 @@ class DownloadRestoringChunk extends CoreRequest implements IRemoteRequest { /** @var PackService */ private $packService; - /** * DownloadRestoringChunk constructor. * @@ -76,7 +72,7 @@ class DownloadRestoringChunk extends CoreRequest implements IRemoteRequest { public function __construct( PointService $pointService, ChunkService $chunkService, - PackService $packService + PackService $packService, ) { parent::__construct(); @@ -87,7 +83,6 @@ public function __construct( $this->setup('app', Application::APP_ID); } - /** * @throws RestoringPointNotInitiatedException * @throws RestoringChunkNotFoundException @@ -110,13 +105,12 @@ public function execute(): void { $this->setOutcome($this->serialize($part)); } catch (RestoringPointNotFoundException - | InvalidItemException - | NotFoundException - | NotPermittedException $e) { + |InvalidItemException + |NotFoundException + |NotPermittedException $e) { } } - /** * @param array $data * diff --git a/lib/RemoteRequest/GetRestoringPoint.php b/lib/RemoteRequest/GetRestoringPoint.php index 75cc86ac..eab0e632 100644 --- a/lib/RemoteRequest/GetRestoringPoint.php +++ b/lib/RemoteRequest/GetRestoringPoint.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\RemoteRequest; use OCA\Backup\AppInfo\Application; @@ -52,14 +50,12 @@ class GetRestoringPoint extends CoreRequest implements IRemoteRequest { use TDeserialize; use TNCLogger; - /** @var PointRequest */ private $pointRequest; /** @var PointService */ private $pointService; - /** * ListRestoringPoint constructor. * @@ -74,7 +70,6 @@ public function __construct(PointRequest $pointRequest, PointService $pointServi $this->setup('app', Application::APP_ID); } - /** * @throws NotFoundException * @throws NotPermittedException @@ -97,7 +92,6 @@ public function execute(): void { } } - /** * @param array $data * diff --git a/lib/RemoteRequest/ListRestoringPoint.php b/lib/RemoteRequest/ListRestoringPoint.php index cb0d7fbc..7285c5aa 100644 --- a/lib/RemoteRequest/ListRestoringPoint.php +++ b/lib/RemoteRequest/ListRestoringPoint.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\RemoteRequest; use OCA\Backup\AppInfo\Application; @@ -46,11 +44,9 @@ class ListRestoringPoint extends CoreRequest implements IRemoteRequest { use TNCLogger; - /** @var PointRequest */ private $pointRequest; - /** * ListRestoringPoint constructor. * @@ -63,7 +59,6 @@ public function __construct(PointRequest $pointRequest) { $this->setup('app', Application::APP_ID); } - /** * */ @@ -75,7 +70,6 @@ public function execute(): void { $this->setOutcome($points); } - public function import(array $data): IDeserializable { return $this; } diff --git a/lib/RemoteRequest/UpdateRestoringPoint.php b/lib/RemoteRequest/UpdateRestoringPoint.php index 26da79a8..070b5b45 100644 --- a/lib/RemoteRequest/UpdateRestoringPoint.php +++ b/lib/RemoteRequest/UpdateRestoringPoint.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\RemoteRequest; use OCA\Backup\AppInfo\Application; @@ -55,14 +53,12 @@ class UpdateRestoringPoint extends CoreRequest implements IRemoteRequest { use TDeserialize; use TNCLogger; - /** @var PointRequest */ private $pointRequest; /** @var PointService */ private $pointService; - /** * UpdateRestoringPoint constructor. * @@ -77,7 +73,6 @@ public function __construct(PointRequest $pointRequest, PointService $pointServi $this->setup('app', Application::APP_ID); } - /** * @throws NotFoundException * @throws NotPermittedException @@ -102,7 +97,6 @@ public function execute(): void { $this->setOutcome($this->serialize($stored)); } - /** * @param array $data * diff --git a/lib/RemoteRequest/UploadRestoringChunk.php b/lib/RemoteRequest/UploadRestoringChunk.php index 99f98ced..adf8f655 100644 --- a/lib/RemoteRequest/UploadRestoringChunk.php +++ b/lib/RemoteRequest/UploadRestoringChunk.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\RemoteRequest; use OCA\Backup\AppInfo\Application; @@ -56,7 +54,6 @@ class UploadRestoringChunk extends CoreRequest implements IRemoteRequest { use TDeserialize; use TNCLogger; - /** @var PointService */ private $pointService; @@ -66,7 +63,6 @@ class UploadRestoringChunk extends CoreRequest implements IRemoteRequest { /** @var PackService */ private $packService; - /** * UploadRestoringChunk constructor. * @@ -77,7 +73,7 @@ class UploadRestoringChunk extends CoreRequest implements IRemoteRequest { public function __construct( PointService $pointService, ChunkService $chunkService, - PackService $packService + PackService $packService, ) { parent::__construct(); @@ -88,7 +84,6 @@ public function __construct( $this->setup('app', Application::APP_ID); } - /** * @throws RestoringChunkNotFoundException * @throws RestoringPointNotInitiatedException @@ -112,13 +107,12 @@ public function execute(): void { $this->setOutcome($this->serialize($point)); } catch (RestoringPointNotFoundException - | InvalidItemException - | NotFoundException - | NotPermittedException $e) { + |InvalidItemException + |NotFoundException + |NotPermittedException $e) { } } - /** * @param array $data * diff --git a/lib/Service/ActivityService.php b/lib/Service/ActivityService.php index 1c9ea8b1..4f9eb464 100644 --- a/lib/Service/ActivityService.php +++ b/lib/Service/ActivityService.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Service; use OCA\Backup\AppInfo\Application; @@ -50,14 +48,12 @@ class ActivityService { public const LIMIT_TO_GROUP = 'admin'; - /** @var IActivityManager */ private $activityManager; /** @var IGroupManager */ private $groupManager; - /** * ActivityService constructor. * @@ -69,7 +65,6 @@ public function __construct(IActivityManager $activityManager, IGroupManager $gr $this->groupManager = $groupManager; } - /** * @param string $subject * @param array $params @@ -83,7 +78,6 @@ public function newActivity(string $subject, array $params = []): void { $this->publishActivity($activity, $adminGroup->getUsers()); } - /** * @param string $type * @@ -92,12 +86,11 @@ public function newActivity(string $subject, array $params = []): void { private function generateActivity(string $type): IEvent { $event = $this->activityManager->generateEvent(); $event->setApp(Application::APP_ID) - ->setType($type); + ->setType($type); return $event; } - /** * @param IEvent $event * @param IUser[] $users diff --git a/lib/Service/ChunkService.php b/lib/Service/ChunkService.php index 67025d08..547e14ab 100644 --- a/lib/Service/ChunkService.php +++ b/lib/Service/ChunkService.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Service; use Exception; @@ -69,12 +67,10 @@ class ChunkService { use TFileTools; use TDeserialize; - public const BACKUP_SCRIPT = 'restore.php'; public const APP_ZIP = 'app.zip'; public const PREFIX = '.backup.'; - /** @var FilesService */ private $filesService; @@ -90,7 +86,6 @@ class ChunkService { /** @var ConfigService */ private $configService; - /** * ChunkService constructor. * @@ -104,7 +99,7 @@ public function __construct( EncryptService $encryptService, CronService $cronService, OutputService $outputService, - ConfigService $configService + ConfigService $configService, ) { $this->filesService = $filesService; $this->encryptService = $encryptService; @@ -113,7 +108,6 @@ public function __construct( $this->configService = $configService; } - /** * @param RestoringPoint $point * @@ -149,7 +143,6 @@ public function createChunks(RestoringPoint $point): void { } } - /** * @param RestoringPoint $point * @param RestoringChunk $chunk @@ -167,7 +160,7 @@ public function restoreUniqueFile( RestoringPoint $point, RestoringChunk $chunk, string $root, - string $filename + string $filename, ): void { if ($filename === '') { throw new ArchiveFileNotFoundException(); @@ -176,7 +169,6 @@ public function restoreUniqueFile( $this->restoreChunk($point, $chunk, $root, $filename); } - /** * @param RestoringPoint $point * @param RestoringChunk $chunk @@ -194,7 +186,7 @@ public function restoreChunk( RestoringPoint $point, RestoringChunk $chunk, string $root, - string $filename = '' + string $filename = '', ): void { if (!is_dir($root)) { if (!@mkdir($root, 0755, true)) { @@ -209,7 +201,6 @@ public function restoreChunk( unlink($root . self::PREFIX . $chunk->getName()); } - /** * Set $stream to true if the returned ZipArchive will have its method getStream() called * In this case, the generated temporary file need to be removed manually: unlink($zip->filename); @@ -227,7 +218,7 @@ public function restoreChunk( public function openZipArchive( RestoringPoint $point, RestoringChunk $chunk, - bool $stream = false + bool $stream = false, ): ZipArchive { $folder = $this->getChunkFolder($point, $chunk); $file = $folder->getFile($chunk->getFilename()); @@ -265,7 +256,6 @@ public function closeZipArchive(ZipArchive $zip): void { $zip->close(); } - /** * @param RestoringPoint $point * @param RestoringChunk $chunk @@ -280,7 +270,6 @@ public function listFilesFromChunk(RestoringPoint $point, RestoringChunk $chunk) $this->listFilesFromZip($chunk, $zip); } - /** * @param RestoringChunk $chunk * @param ZipArchive $zip @@ -298,7 +287,6 @@ public function listFilesFromZip(RestoringChunk $chunk, ZipArchive $zip): void { $chunk->setFiles($files); } - /** * @param ZipArchive $zip * @param string $root @@ -314,7 +302,6 @@ function (ArchiveFile $entry) { $zip->extractTo($root, $files); } - // /** // * @param Backup $backup // * @param RestoringChunk $archive @@ -358,7 +345,6 @@ private function fillChunks(RestoringPoint $point, RestoringData $data) { } } - /** * @param RestoringPoint $point * @param RestoringData $data @@ -376,7 +362,7 @@ public function createSingleFileChunk( RestoringData $data, string $filename, string $path, - string $type = '' + string $type = '', ): void { $chunk = new RestoringChunk($data->getName()); $chunk->setCount(1); @@ -390,7 +376,6 @@ public function createSingleFileChunk( $this->updateChecksum($point, $chunk); } - /** * @param RestoringPoint $point * @param RestoringChunk $chunk @@ -405,7 +390,7 @@ private function createSingleFileZip( RestoringPoint $point, RestoringChunk $chunk, string $filename, - string $path + string $path, ): void { $zip = $this->generateZip($point, $chunk); $read = fopen($path, 'rb'); @@ -413,7 +398,6 @@ private function createSingleFileZip( $zip->finalize(); } - /** * @param RestoringPoint $point * @param RestoringData $data @@ -427,7 +411,7 @@ private function createSingleFileZip( private function generateChunk( RestoringPoint $point, RestoringData $data, - array &$files + array &$files, ): RestoringChunk { $chunk = new RestoringChunk($data->getName()); $chunkSize = $this->configService->getAppValueInt(ConfigService::CHUNK_SIZE) * 1024 * 1024; @@ -468,7 +452,6 @@ private function generateChunk( return $chunk; } - /** * @param RestoringPoint $point * @param RestoringChunk $chunk @@ -512,7 +495,6 @@ public function finalizeZip(ZipStreamer $zip, RestoringChunk $archive): void { $zip->finalize(); } - /** * @param RestoringPoint $point * @param RestoringChunk $chunk @@ -530,7 +512,6 @@ private function finalizeChunk(RestoringPoint $point, RestoringChunk $chunk) { } } - /** * @param RestoringPoint $point * @param RestoringChunk $chunk @@ -542,7 +523,6 @@ private function updateChecksum(RestoringPoint $point, RestoringChunk $chunk): v $chunk->setChecksum($sum); } - /** * @param RestoringPoint $point * @param RestoringChunk $chunk @@ -575,7 +555,6 @@ public function getChecksum(RestoringPoint $point, RestoringChunk $chunk): strin return $this->getChecksumFromStream($stream); } - // /** // * @param Backup $backup // * @param RestoringChunk $archive @@ -674,7 +653,6 @@ public function getChecksum(RestoringPoint $point, RestoringChunk $chunk): strin // $this->encryptService->decryptFile($stream, $write, $key); // } - /** * @param RestoringPoint $point * @@ -718,7 +696,6 @@ public function copyApp(RestoringPoint $point): void { } } - /** * @param RestoringPoint $point * @@ -742,7 +719,6 @@ public function generateInternalData(RestoringPoint $point): void { $point->addRestoringData($data); } - /** * @param RestoringPoint $point * @param string $dataName @@ -760,7 +736,6 @@ public function getDataFromRP(RestoringPoint $point, string $dataName): Restorin throw new RestoringDataNotFoundException(); } - /** * @param RestoringPoint $point * @param string $chunk @@ -781,7 +756,6 @@ public function getDataWithChunk(RestoringPoint $point, string $chunk): Restorin throw new RestoringChunkNotFoundException(); } - /** * @param RestoringPoint $point * @param string $chunk @@ -793,7 +767,7 @@ public function getDataWithChunk(RestoringPoint $point, string $chunk): Restorin public function getChunkFromRP( RestoringPoint $point, string $chunk, - string $dataName = '' + string $dataName = '', ): RestoringChunk { foreach ($point->getRestoringData() as $restoringData) { if ($dataName !== '' && $restoringData->getName() !== $dataName) { @@ -810,7 +784,6 @@ public function getChunkFromRP( throw new RestoringChunkNotFoundException(); } - /** * @param RestoringPoint $point * @param RestoringChunk $restoringChunk @@ -819,11 +792,10 @@ public function getChunkContent(RestoringPoint $point, RestoringChunk $restoring try { $file = $this->getChunkResource($point, $restoringChunk); $restoringChunk->setContent(base64_encode($file->getContent())); - } catch (NotFoundException | NotPermittedException $e) { + } catch (NotFoundException|NotPermittedException $e) { } } - /** * @param RestoringPoint $point * @param RestoringChunk $chunk @@ -839,7 +811,6 @@ public function getChunkResource(RestoringPoint $point, RestoringChunk $chunk): return $folder->getFile($chunk->getFilename()); } - /** * @param RestoringPoint $point * @param RestoringChunk $chunk @@ -871,7 +842,6 @@ function (ArchiveFile $file) use ($search): ?ArchiveFile { ); } - /** * @param RestoringPoint $point * @param RestoringData $data @@ -883,24 +853,23 @@ function (ArchiveFile $file) use ($search): ?ArchiveFile { public function getArchiveFileFromData( RestoringPoint $point, RestoringData $data, - string $filename + string $filename, ): ArchiveFile { foreach ($data->getChunks() as $chunk) { try { return $this->getArchiveFileFromChunk($point, $chunk, $filename); } catch ( ArchiveCreateException - | ArchiveNotFoundException - | ArchiveFileNotFoundException - | NotFoundException - | NotPermittedException $e) { + |ArchiveNotFoundException + |ArchiveFileNotFoundException + |NotFoundException + |NotPermittedException $e) { } } throw new ArchiveFileNotFoundException(); } - /** * @param RestoringPoint $point * @param RestoringChunk $chunk @@ -916,7 +885,7 @@ public function getArchiveFileFromData( public function getArchiveFileFromChunk( RestoringPoint $point, RestoringChunk $chunk, - string $filename + string $filename, ): ArchiveFile { if (empty($chunk->getFiles())) { $this->listFilesFromChunk($point, $chunk); @@ -945,7 +914,6 @@ function (ArchiveFile $file) use ($filename): ?ArchiveFile { return $file; } - /** * @throws RestoringPointNotInitiatedException * @throws NotPermittedException @@ -957,7 +925,6 @@ public function removeChunkFile(RestoringPoint $point, RestoringChunk $chunk) { $file->delete(); } - /** * @param RestoringPoint $point * @param RestoringChunk $chunk @@ -969,7 +936,7 @@ public function removeChunkFile(RestoringPoint $point, RestoringChunk $chunk) { public function getChunkFolder( RestoringPoint $point, RestoringChunk $chunk, - string &$path = '' + string &$path = '', ): ISimpleFolder { if (!$point->hasBaseFolder() || !$point->hasAppDataRootWrapper()) { throw new RestoringPointNotInitiatedException('Restoring Point is not initiated'); @@ -989,7 +956,6 @@ public function getChunkFolder( return $folder; } - /** * @param string $line * @param bool $ln diff --git a/lib/Service/ConfigService.php b/lib/Service/ConfigService.php index 4ace7ba6..216e2b2b 100644 --- a/lib/Service/ConfigService.php +++ b/lib/Service/ConfigService.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Service; use Exception; @@ -43,7 +41,6 @@ class ConfigService { use TArrayTools; - public const MAINTENANCE = 'maintenance'; public const DATA_DIRECTORY = 'datadirectory'; public const LOGFILE = 'logfile'; @@ -82,7 +79,6 @@ class ConfigService { public const CHUNK_SIZE = 'chunk_size'; public const CHUNK_PART_SIZE = 'chunk_part_size'; - /** @var array */ public $defaults = [ self::CRON_ENABLED => 0, @@ -118,14 +114,12 @@ class ConfigService { self::CHUNK_PART_SIZE => 100 ]; - /** @var IConfig */ private $config; /** @var int */ private $externalEnabled = -1; - /** * ConfigService constructor. * @@ -135,7 +129,6 @@ public function __construct(IConfig $config) { $this->config = $config; } - /** * @param string $key * @param string $default @@ -196,7 +189,6 @@ public function getAppValueArray(string $key): array { return json_decode($this->getAppValue($key), true); } - /** * @param string $key */ @@ -242,7 +234,6 @@ public function setAppValueArray(string $key, array $value): void { $this->config->setAppValue(Application::APP_ID, $key, json_encode($value)); } - /** * */ @@ -250,7 +241,6 @@ public function unsetAppConfig(): void { $this->config->deleteAppValues(Application::APP_ID); } - /** * @param string $key * @@ -260,7 +250,6 @@ public function getSystemValue(string $key): string { return $this->config->getSystemValue($key); } - /** * @param string $key * @@ -275,7 +264,6 @@ public function getSystemValueArray(string $key): array { return $result; } - /** * @param string $key * @@ -310,7 +298,6 @@ public function setSystemValueBool(string $key, bool $value): void { $this->config->setSystemValue($key, $value); } - /** * @param bool $maintenance */ @@ -333,7 +320,6 @@ public function configureRequest(NCRequest $request, bool $longTimeout = false): } } - /** * @return string */ @@ -345,7 +331,6 @@ public function getTempFileName(): string { return $tmpPath; } - /** * @return bool */ @@ -353,7 +338,6 @@ public function isRemoteEnabled(): bool { return $this->getAppValueBool(self::REMOTE_ENABLED); } - /** * @return bool */ @@ -370,7 +354,6 @@ public function isExternalEnabled(): bool { return ($this->externalEnabled === 1); } - /** * @return array */ @@ -392,7 +375,6 @@ public function getSettings(): array { ]; } - /** * @param array $settings * diff --git a/lib/Service/CronService.php b/lib/Service/CronService.php index 2ddb8e89..12d51762 100644 --- a/lib/Service/CronService.php +++ b/lib/Service/CronService.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Service; use OCA\Backup\Exceptions\JobsTimeSlotException; @@ -43,12 +41,10 @@ class CronService { use TArrayTools; - public const MARGIN = 1800; public const HOURS_FOR_NEXT = 4000; public const LOCK_TIMEOUT = 3600; - /** @var RemoteStreamService */ private $remoteStreamService; @@ -61,11 +57,9 @@ class CronService { /** @var ConfigService */ private $configService; - /** @var bool */ private $ranFromCron = false; - /** * CronService constructor. * @@ -78,7 +72,7 @@ public function __construct( RemoteStreamService $remoteStreamService, ExternalFolderService $externalFolderService, OutputService $outputService, - ConfigService $configService + ConfigService $configService, ) { $this->remoteStreamService = $remoteStreamService; $this->externalFolderService = $externalFolderService; @@ -86,7 +80,6 @@ public function __construct( $this->configService = $configService; } - /** * @return int[] */ @@ -131,7 +124,6 @@ public function nextBackups(): array { ]; } - /** * @return array * @throws SettingsException @@ -146,7 +138,6 @@ public function getTime(): array { return [$st, $end]; } - /** * @param int $time * @@ -189,7 +180,6 @@ public function verifyTime(int $time = 0): bool { return ($timeStart < $time && $time < $timeEnd); } - /** * @param int $time * @@ -209,7 +199,6 @@ public function verifyFullBackup(int $time): bool { return ($last + $delay - self::MARGIN < $time); } - /** * @param int $time * @@ -236,7 +225,6 @@ private function isWeekEnd(int $time): bool { return ((int)date('N', $time) >= 6); } - /** * @param string $line * @param bool $ln @@ -245,7 +233,6 @@ private function o(string $line, bool $ln = true): void { $this->outputService->o($line, $ln); } - /** * we assume that calling this method indicate the process was initiated from BackgroundJobs * @@ -267,7 +254,6 @@ public function isRunnable(): bool { return ($this->configService->getAppValueInt(ConfigService::CRON_LOCK) < time() - self::LOCK_TIMEOUT); } - /** * @param bool $verifyTime * diff --git a/lib/Service/EncryptService.php b/lib/Service/EncryptService.php index 95c2f289..18ed4543 100644 --- a/lib/Service/EncryptService.php +++ b/lib/Service/EncryptService.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Service; use Exception; @@ -46,7 +44,6 @@ class EncryptService { use TArrayTools; - public const BLOCK_SIZE = 500; public const CUSTOM_CHUNK_SIZE = 1048576; public const KEY_LENGTH = 32; @@ -63,7 +60,6 @@ class EncryptService { public const STRING = 'string'; public const STRING_NONCE = 'string-nonce'; - public static $EXPORT = [ self::AES_GCM, self::AES_GCM_NONCE, @@ -72,11 +68,9 @@ class EncryptService { self::CHACHA ]; - /** @var ConfigService */ private $configService; - /** * EncryptService constructor. */ @@ -84,7 +78,6 @@ public function __construct(ConfigService $configService) { $this->configService = $configService; } - /** * @param string $plain * @param string $generatedKey @@ -113,7 +106,6 @@ public function encryptString(string $plain, string &$generatedKey = ''): string return base64_encode($encrypted); } - /** * @param string $encrypted * @param string $key @@ -141,7 +133,6 @@ public function decryptString(string $encrypted, string $key): string { return $plain; } - /** * @param string $input * @param string $output @@ -164,7 +155,6 @@ public function encryptFile(string $input, string $output, string $name): string return self::AES_GCM; } - /** * @param string $input * @param string $output @@ -191,7 +181,6 @@ public function encryptFileGCM(string $input, string $output, string $name): voi sodium_memzero($plain); } - /** * @param string $input * @param string $output @@ -223,7 +212,6 @@ public function encryptFileCBC(string $input, string $output): void { fclose($write); } - /** * @param string $input * @param string $output @@ -251,7 +239,6 @@ public function encryptFileChacha(string $input, string $output): void { fclose($write); } - /** * @param string $input * @param string $output @@ -302,7 +289,6 @@ public function decryptFile(string $input, string $output, string $name, string } } - /** * @param string $input * @param string $output @@ -334,7 +320,6 @@ public function decryptFileGCM(string $input, string $output, string $name): voi fclose($write); } - /** * @param string $input * @param string $output @@ -366,7 +351,6 @@ public function decryptFileCBC(string $input, string $output): void { fclose($write); } - /** * @param string $input * @param string $output @@ -394,7 +378,6 @@ public function decryptFileChacha(string $input, string $output): void { fclose($write); } - /** * @param string $input * @param string $output @@ -409,7 +392,6 @@ public function decryptFileNone(string $input, string $output): void { fclose($write); } - /** * @param bool $generate * @@ -433,7 +415,6 @@ public function getEncryptionKeys(bool $generate = false): array { return $keys; } - /** * @throws EncryptionKeyException */ @@ -457,7 +438,6 @@ public function getEncryptionKey(string $type, bool $storeIt = true): string { return $key; } - /** * @param string $type * @@ -481,7 +461,6 @@ private function generateKey(string $type): string { throw new EncryptionKeyException('unknown key type'); } - /** * @return bool */ diff --git a/lib/Service/ExportService.php b/lib/Service/ExportService.php index 5b6f1bee..2d987f36 100644 --- a/lib/Service/ExportService.php +++ b/lib/Service/ExportService.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Service; use OCA\Backup\Tools\Exceptions\SignatoryException; @@ -41,7 +39,6 @@ */ class ExportService { - /** @var RemoteService */ private $remoteService; @@ -54,7 +51,6 @@ class ExportService { /** @var ConfigService */ private $configService; - /** * ExportService constructor. * @@ -67,7 +63,7 @@ public function __construct( RemoteService $remoteService, RemoteStreamService $remoteStreamService, EncryptService $encryptService, - ConfigService $configService + ConfigService $configService, ) { $this->remoteService = $remoteService; $this->remoteStreamService = $remoteStreamService; @@ -75,7 +71,6 @@ public function __construct( $this->configService = $configService; } - /** * @param bool $encrypted * @param string $key diff --git a/lib/Service/ExternalFolderService.php b/lib/Service/ExternalFolderService.php index c8feb747..f3aea18d 100644 --- a/lib/Service/ExternalFolderService.php +++ b/lib/Service/ExternalFolderService.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Service; use Exception; @@ -81,7 +79,6 @@ class ExternalFolderService { use TNCLogger; use TFileTools; - /** @var GlobalStoragesService */ private $globalStoragesService; @@ -94,7 +91,6 @@ class ExternalFolderService { /** @var ConfigService */ private $configService; - /** * ExternalFolderService constructor. * @@ -105,7 +101,7 @@ class ExternalFolderService { public function __construct( ExternalFolderRequest $externalFolderRequest, OutputService $outputService, - ConfigService $configService + ConfigService $configService, ) { try { $this->globalStoragesService = OC::$server->get(GlobalStoragesService::class); @@ -119,7 +115,6 @@ public function __construct( $this->setup('app', 'backup'); } - /** * @return ExternalFolder[] */ @@ -147,7 +142,6 @@ public function getByStorageId(int $storageId): ExternalFolder { return $this->externalFolderRequest->getByStorageId($storageId); } - /** * @param ExternalFolder $external * @@ -173,12 +167,12 @@ public function getRestoringPoints(ExternalFolder $external): array { try { $points[] = $this->getRestoringPoint($external, $node->getName()); } catch ( - ExternalFolderNotFoundException | - RestoringChunkPartNotFoundException | - RestoringPointException | - RestoringPointNotFoundException | - RestoringPointPackException | - GenericFileException | + ExternalFolderNotFoundException| + RestoringChunkPartNotFoundException| + RestoringPointException| + RestoringPointNotFoundException| + RestoringPointPackException| + GenericFileException| NotPermittedException $e) { } } @@ -186,7 +180,6 @@ public function getRestoringPoints(ExternalFolder $external): array { return $points; } - /** * @param ExternalFolder $external * @param string $pointId @@ -204,7 +197,7 @@ public function getRestoringPoints(ExternalFolder $external): array { public function getRestoringPoint( ExternalFolder $external, string $pointId, - bool $current = false + bool $current = false, ): RestoringPoint { $folder = $this->getExternalPointFolder($external, $pointId, false); @@ -225,16 +218,15 @@ public function getRestoringPoint( return $point; } catch ( - InvalidItemException | - NotFoundException | - NotPermittedException | + InvalidItemException| + NotFoundException| + NotPermittedException| LockedException $e) { } throw new RestoringPointNotFoundException(); } - /** * @param ExternalFolder $external * @param RestoringPoint $point @@ -256,14 +248,13 @@ public function uploadPart( RestoringPoint $point, RestoringHealth $health, RestoringChunk $chunk, - RestoringChunkPart $part + RestoringChunkPart $part, ): void { $folder = $this->getExternalChunkFolder($external, $point, $chunk, true); $folder->newFile($part->getName(), base64_decode($part->getContent())); $this->updateChunkPartHealth($external, $point, $health, $chunk, $part); } - /** * @param ExternalFolder $external * @param RestoringPoint $point @@ -283,7 +274,7 @@ public function downloadPart( ExternalFolder $external, RestoringPoint $point, RestoringChunk $chunk, - RestoringChunkPart $part + RestoringChunkPart $part, ): void { $folder = $this->getExternalChunkFolder($external, $point, $chunk, true); @@ -296,7 +287,6 @@ public function downloadPart( $part->setContent(base64_encode($file->getContent())); } - /** * @param ExternalFolder $external * @@ -354,7 +344,6 @@ public function initRootFolder(ExternalFolder $external): void { throw new ExternalFolderNotFoundException(); } - /** * @param ExternalFolder $folder * @param RestoringPoint $point @@ -366,7 +355,7 @@ public function initRootFolder(ExternalFolder $external): void { */ public function confirmPoint( ExternalFolder $folder, - RestoringPoint $point + RestoringPoint $point, ): RestoringPoint { try { $stored = $this->getRestoringPoint($folder, $point->getId(), true); @@ -395,7 +384,6 @@ public function confirmPoint( return $stored; } - /** * @param string $pointId */ @@ -408,7 +396,6 @@ public function deletePoint(string $pointId): void { } } - /** * @param ExternalFolder $external * @param string $pointId @@ -431,7 +418,6 @@ public function deletePointExternal(ExternalFolder $external, string $pointId): $folder->delete(); } - /** * @param ExternalFolder $external * @param RestoringPoint $point @@ -458,7 +444,7 @@ public function createPoint(ExternalFolder $external, RestoringPoint $point): Re throw new RestoringPointNotFoundException('restoring point not created'); } } catch (NotPermittedException - | RestoringPointNotFoundException $e) { + |RestoringPointNotFoundException $e) { $this->o('' . $e->getMessage() . ''); throw $e; } @@ -468,7 +454,6 @@ public function createPoint(ExternalFolder $external, RestoringPoint $point): Re return $stored; } - /** * @param RestoringPoint $point * @param ExternalFolder|null $external @@ -495,7 +480,6 @@ public function updateMetadata(RestoringPoint $point, ?ExternalFolder $external } } - /** * @param ExternalFolder $external * @param RestoringPoint $point @@ -514,7 +498,7 @@ public function updateMetadata(RestoringPoint $point, ?ExternalFolder $external public function updateMetadataFile( ExternalFolder $external, RestoringPoint $point, - bool $create = true + bool $create = true, ): File { $folder = $this->getExternalPointFolder($external, $point->getId()); try { @@ -534,8 +518,8 @@ public function updateMetadataFile( /** @var RestoringPoint $stored */ $stored = $this->deserializeJson($metadataFile->getContent(), RestoringPoint::class); $stored->setComment($point->getComment()) - ->setArchive($point->isArchive()) - ->setSubSignature($point->getSubSignature()); + ->setArchive($point->isArchive()) + ->setSubSignature($point->getSubSignature()); } catch (Exception $e) { $stored = $point; } @@ -545,7 +529,6 @@ public function updateMetadataFile( return $metadataFile; } - /** * @param ExternalFolder $external * @param RestoringPoint $point @@ -569,7 +552,6 @@ public function getCurrentHealth(ExternalFolder $external, RestoringPoint $point return $stored->getHealth(); } - /** * Update $point with it, but also returns the generated RestoringHealth * @@ -602,9 +584,9 @@ public function generateHealth(ExternalFolder $external, RestoringPoint $point): } $partHealth->setDataName($data->getName()) - ->setChunkName($chunk->getName()) - ->setPartName($part->getName()) - ->setStatus($status); + ->setChunkName($chunk->getName()) + ->setPartName($part->getName()) + ->setStatus($status); $health->addPart($partHealth); } } @@ -619,13 +601,12 @@ public function generateHealth(ExternalFolder $external, RestoringPoint $point): } $health->setChecked(time()) - ->setStatus($globalStatus); + ->setStatus($globalStatus); $point->setHealth($health); return $health; } - /** * Update $point with it, but also returns the generated RestoringHealth * @@ -643,14 +624,13 @@ public function updateChunkPartHealth( RestoringPoint $point, RestoringHealth $health, RestoringChunk $chunk, - RestoringChunkPart $part + RestoringChunkPart $part, ): void { $partHealth = $health->getPart($chunk->getName(), $part->getName()); $status = $this->generatePartHealthStatus($external, $point, $chunk, $part); $partHealth->setStatus($status); } - /** * @param ExternalFolder $external * @param RestoringPoint $point @@ -663,7 +643,7 @@ private function generatePartHealthStatus( ExternalFolder $external, RestoringPoint $point, RestoringChunk $chunk, - RestoringChunkPart $part + RestoringChunkPart $part, ): int { try { $checksum = $this->getChecksum($external, $point, $chunk, $part); @@ -677,7 +657,6 @@ private function generatePartHealthStatus( } } - /** * @param ExternalFolder $external * @param RestoringPoint $point @@ -691,7 +670,7 @@ public function getChecksum( ExternalFolder $external, RestoringPoint $point, RestoringChunk $chunk, - RestoringChunkPart $part + RestoringChunkPart $part, ): string { try { $path = ''; @@ -716,7 +695,6 @@ public function getChecksum( return $this->getChecksumFromStream($stream); } - /** * @param ExternalFolder $external * @param string $pointId @@ -731,7 +709,7 @@ public function getChecksum( public function getExternalPointFolder( ExternalFolder $external, string $pointId, - bool $create = true + bool $create = true, ): Folder { $this->initRootFolder($external); $folder = $external->getRootFolder(); @@ -755,7 +733,6 @@ public function getExternalPointFolder( return $node; } - /** * @param ExternalFolder $external * @param RestoringPoint $point @@ -772,7 +749,7 @@ public function getExternalChunkFolder( ExternalFolder $external, RestoringPoint $point, RestoringChunk $chunk, - bool $pack = false + bool $pack = false, ): Folder { $folder = $this->getExternalPointFolder($external, $point->getId()); @@ -790,9 +767,7 @@ public function getExternalChunkFolder( $folder = $sub; } - return $folder; - // not sure this is useful in the end. if (!$pack) { return $folder; @@ -810,7 +785,6 @@ public function getExternalChunkFolder( return $sub; } - /** * @return ExternalFolder[] * @throws InsufficientDataForMeaningfulAnswerException @@ -876,7 +850,6 @@ public function getStorageById(int $storageId): ExternalFolder { throw new ExternalFolderNotFoundException('storage not found'); } - /** * Process storage ready for mounting * based on apps/files_external/lib/Config/ConfigAdapter.php @@ -923,7 +896,6 @@ private function constructStorage(StorageConfig $storageConfig): IStorage { return $storageConfig->getAuthMechanism()->wrapStorage($storage); } - /** * @param string $line * @param bool $ln @@ -932,7 +904,6 @@ private function o(string $line, bool $ln = true): void { $this->outputService->o($line, $ln); } - /** * @param ExternalFolder $storage */ @@ -940,7 +911,6 @@ public function save(ExternalFolder $storage) { $this->externalFolderRequest->save($storage); } - /** * @param int $storageId */ diff --git a/lib/Service/FilesService.php b/lib/Service/FilesService.php index f1f27d87..ccb21afc 100644 --- a/lib/Service/FilesService.php +++ b/lib/Service/FilesService.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Service; use OC; @@ -66,7 +64,6 @@ class FilesService { public const APP_ROOT = __DIR__ . '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/../../'; - /** @var IRootFolder */ private $rootFolder; @@ -76,7 +73,6 @@ class FilesService { /** @var ConfigService */ private $configService; - /** * FilesService constructor. * @@ -87,7 +83,7 @@ class FilesService { public function __construct( IRootFolder $rootFolder, ChangesRequest $changesRequest, - ConfigService $configService + ConfigService $configService, ) { $this->rootFolder = $rootFolder; $this->changesRequest = $changesRequest; @@ -96,7 +92,6 @@ public function __construct( $this->setup('app', Application::APP_ID); } - /** * @param RestoringData $data * @param string $path @@ -140,7 +135,6 @@ public function fillRestoringData(RestoringData $data, string $path): void { } } - /** * @param RestoringData $data */ @@ -176,7 +170,6 @@ public function initRestoringData(RestoringData $data): void { } } - /** * @param string $path * @@ -205,7 +198,6 @@ public function getFilesFromApp(string $path = ''): array { return $files; } - /** * @param ChangedFile $file */ @@ -213,7 +205,6 @@ public function changedFile(ChangedFile $file): void { $this->changesRequest->insertIfNotFound($file); } - /** * @param int $fileId * @param string $owner @@ -242,8 +233,8 @@ public function getPointFromFileId(int $fileId, string $owner, ?Folder &$folder return $point; } catch (InvalidItemException - | NotPermittedException - | LockedException $e) { + |NotPermittedException + |LockedException $e) { continue; } } @@ -251,7 +242,6 @@ public function getPointFromFileId(int $fileId, string $owner, ?Folder &$folder throw new RestoringPointNotFoundException(); } - /** * @param Folder $node * @param string $path @@ -282,7 +272,6 @@ public function getPackFolder(Folder $node, string $path): Folder { return $node; } - /** * @param Folder $input * @param ISimpleFolder $output @@ -295,7 +284,7 @@ public function getPackFolder(Folder $node, string $path): Folder { public function copyFileToAppData( Folder $input, ISimpleFolder $output, - string $filename + string $filename, ): void { /** @var File $orig */ $orig = $input->get($filename); diff --git a/lib/Service/MetadataService.php b/lib/Service/MetadataService.php index b3f3d1f8..77efa278 100644 --- a/lib/Service/MetadataService.php +++ b/lib/Service/MetadataService.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Service; use OCA\Backup\Db\PointRequest; @@ -46,7 +44,6 @@ class MetadataService { public const METADATA_FILE = 'restoring-point.data'; - /** @var PointRequest */ private $pointRequest; @@ -56,7 +53,6 @@ class MetadataService { /** @var ExternalFolderService */ private $externalFolderService; - /** * MetadataService constructor. * @@ -67,14 +63,13 @@ class MetadataService { public function __construct( PointRequest $pointRequest, RemoteService $remoteService, - ExternalFolderService $externalFolderService + ExternalFolderService $externalFolderService, ) { $this->pointRequest = $pointRequest; $this->remoteService = $remoteService; $this->externalFolderService = $externalFolderService; } - /** * @param RestoringPoint $point * @@ -93,7 +88,6 @@ public function saveMetadata(RestoringPoint $point) { $file->putContent(json_encode($point, JSON_PRETTY_PRINT)); } - /** * @param RestoringPoint $point */ @@ -102,7 +96,6 @@ public function globalUpdate(RestoringPoint $point) { $this->remoteService->updateMetadata($point); } - /** * @throws NotPermittedException * @throws NotFoundException diff --git a/lib/Service/OccService.php b/lib/Service/OccService.php index 9f4a83da..9fd10272 100644 --- a/lib/Service/OccService.php +++ b/lib/Service/OccService.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Service; use OCA\Backup\Exceptions\ExternalFolderNotFoundException; @@ -54,7 +52,6 @@ */ class OccService { - /** @var PointService */ private $pointService; @@ -70,7 +67,6 @@ class OccService { /** @var MetadataService */ private $metadataService; - /** * OccService constructor. * @@ -85,7 +81,7 @@ public function __construct( RemoteService $remoteService, RemoteStreamService $remoteStreamService, ExternalFolderService $externalFolderService, - MetadataService $metadataService + MetadataService $metadataService, ) { $this->pointService = $pointService; $this->remoteService = $remoteService; @@ -95,7 +91,6 @@ public function __construct( $this->metadataService = $metadataService; } - /** * @param InputInterface $input * @@ -129,7 +124,6 @@ public function getRestoringPointBasedOnParams(InputInterface $input): Restoring return $this->pointService->getLocalRestoringPoint($pointId); } - /** * @param RestoringPoint $point * @param InputInterface $input diff --git a/lib/Service/OutputService.php b/lib/Service/OutputService.php index 5cd1a9c2..04ec4fbb 100644 --- a/lib/Service/OutputService.php +++ b/lib/Service/OutputService.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Service; use OCA\Backup\Model\ChunkPartHealth; @@ -46,7 +44,6 @@ */ class OutputService { - /** @var OutputInterface */ private $output; @@ -56,7 +53,6 @@ class OutputService { /** @var resource */ private $openedFile; - public function __construct() { } @@ -82,7 +78,6 @@ public function o(string $line, bool $ln = true): void { } } - /** * @param bool $debug */ @@ -97,7 +92,6 @@ public function isDebug(): bool { return $this->debug; } - /** * @param RestoringPoint $point * @param string $reason @@ -126,7 +120,6 @@ public function openFile(RestoringPoint $point, string $reason = ''): void { fputs($this->openedFile, date('Y-m-d H:i:s') . ' - Opening log session: ' . $reason . "\n"); } - /** * @return bool */ @@ -138,7 +131,6 @@ public function setOutput(OutputInterface $output): void { $this->output = $output; } - /** * @param RestoringHealth $health * diff --git a/lib/Service/PackService.php b/lib/Service/PackService.php index edef03b7..3602443e 100644 --- a/lib/Service/PackService.php +++ b/lib/Service/PackService.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Service; use Exception; @@ -70,11 +68,9 @@ class PackService { use TNCLogger; use TFileTools; - public const CHUNK_ENTRY = 'pack'; public const GZ_CHUNK_ENTRY = 'gz_pack'; - /** @var PointRequest */ private $pointRequest; @@ -99,7 +95,6 @@ class PackService { /** @var ConfigService */ private $configService; - /** * PackService constructor. * @@ -120,7 +115,7 @@ public function __construct( EncryptService $encryptService, CronService $cronService, OutputService $outputService, - ConfigService $configService + ConfigService $configService, ) { $this->pointRequest = $pointRequest; $this->metadataService = $metadataService; @@ -132,7 +127,6 @@ public function __construct( $this->configService = $configService; } - /** * @param RestoringPoint $point * @param bool $force @@ -201,9 +195,9 @@ public function packPoint(RestoringPoint $point, bool $force = false): void { } } catch (Throwable $t) { $point->setStatus(RestoringPoint::STATUS_ISSUE) - ->getNotes() - ->s('pack_error', $t->getMessage()) - ->sInt('pack_date', time()); + ->getNotes() + ->s('pack_error', $t->getMessage()) + ->sInt('pack_date', time()); // $this->pointRequest->update($point); $this->metadataService->unlock($point); @@ -218,10 +212,10 @@ public function packPoint(RestoringPoint $point, bool $force = false): void { $this->o(' > removing status processing, adding status packed'); $point->removeStatus(RestoringPoint::STATUS_PACKING) - ->addStatus(RestoringPoint::STATUS_PACKED) - ->getNotes() - ->u('pack_error') - ->u('pack_date'); + ->addStatus(RestoringPoint::STATUS_PACKED) + ->getNotes() + ->u('pack_error') + ->u('pack_date'); try { $this->remoteStreamService->signPoint($point); @@ -231,7 +225,7 @@ public function packPoint(RestoringPoint $point, bool $force = false): void { $this->pointRequest->update($point, true); try { $this->metadataService->saveMetadata($point); - } catch (NotFoundException | NotPermittedException $e) { + } catch (NotFoundException|NotPermittedException $e) { $this->e( $e, [ @@ -245,7 +239,6 @@ public function packPoint(RestoringPoint $point, bool $force = false): void { $this->metadataService->unlock($point); } - /** * @param RestoringPoint $point * @param RestoringChunk $chunk @@ -266,7 +259,6 @@ public function packChunk(RestoringPoint $point, RestoringChunk $chunk): void { $this->wrapStoreParts($point, $chunk, $parts); } - /** * @param RestoringPoint $point * @param RestoringChunk $chunk @@ -302,7 +294,6 @@ private function packChunkTempFile(RestoringPoint $point, RestoringChunk $chunk) return $tmpPath; } - /** * @param RestoringPoint $point * @param string $filename @@ -349,7 +340,6 @@ private function packChunkCompress(string $filename): string { return $tmpPath; } - /** * @param string $filename * @@ -419,7 +409,6 @@ private function packExplode(string $filename): array { } } - /** * @param RestoringPoint $point * @param RestoringChunk $chunk @@ -486,7 +475,6 @@ private function packEncrypt(array $parts, string $chunkName): array { return $encrypted; } - /** * @param RestoringPoint $point * @param RestoringChunk $chunk @@ -548,7 +536,6 @@ private function storeParts(RestoringPoint $point, RestoringChunk $chunk, array } } - /** * @param RestoringPoint $point * @param string $partName @@ -563,14 +550,13 @@ public function getPartFromPoint( RestoringPoint $point, string $partName, string $chunkName, - string $dataName + string $dataName, ): RestoringChunkPart { $chunk = $this->chunkService->getChunkFromRP($point, $chunkName, $dataName); return $this->getPartFromChunk($chunk, $partName); } - /** * @param RestoringChunk $chunk * @param $partName @@ -588,7 +574,6 @@ public function getPartFromChunk(RestoringChunk $chunk, $partName): RestoringChu throw new RestoringChunkPartNotFoundException(); } - /** * @param RestoringPoint $point * @param RestoringChunk $chunk @@ -599,16 +584,15 @@ public function getPartFromChunk(RestoringChunk $chunk, $partName): RestoringChu public function getChunkPartContent( RestoringPoint $point, RestoringChunk $chunk, - RestoringChunkPart $part + RestoringChunkPart $part, ): void { try { $file = $this->getPartResource($point, $chunk, $part); $part->setContent(base64_encode($file->getContent())); - } catch (NotFoundException | NotPermittedException $e) { + } catch (NotFoundException|NotPermittedException $e) { } } - /** * @param RestoringPoint $point * @param RestoringChunk $chunk @@ -622,14 +606,13 @@ public function getChunkPartContent( public function getPartResource( RestoringPoint $point, RestoringChunk $chunk, - RestoringChunkPart $part + RestoringChunkPart $part, ): ISimpleFile { $folder = $this->getPackFolder($point, $chunk); return $folder->getFile($part->getName()); } - /** * @param RestoringPoint $point * @@ -684,7 +667,7 @@ public function unpackPoint(RestoringPoint $point): void { try { $this->o(' * removing old chunk parts'); $this->removeOldChunkPartFiles($point, $oldChunk); - } catch (RestoringPointNotInitiatedException | NotPermittedException $e) { + } catch (RestoringPointNotInitiatedException|NotPermittedException $e) { } } catch (Throwable $t) { $completed = false; @@ -695,16 +678,16 @@ public function unpackPoint(RestoringPoint $point): void { if ($completed) { $this->o(' > removing status packed'); $point->setStatus(RestoringPoint::STATUS_UNPACKED) - ->removeStatus(RestoringPoint::STATUS_PACKING) - ->removeStatus(RestoringPoint::STATUS_COMPRESSED) - ->removeStatus(RestoringPoint::STATUS_ENCRYPTED) - ->unsetNotes(); + ->removeStatus(RestoringPoint::STATUS_PACKING) + ->removeStatus(RestoringPoint::STATUS_COMPRESSED) + ->removeStatus(RestoringPoint::STATUS_ENCRYPTED) + ->unsetNotes(); try { $this->remoteStreamService->signPoint($point); $this->pointRequest->update($point, true); $this->metadataService->saveMetadata($point); - } catch (SignatoryException | NotFoundException | NotPermittedException $e) { + } catch (SignatoryException|NotFoundException|NotPermittedException $e) { } } @@ -712,7 +695,6 @@ public function unpackPoint(RestoringPoint $point): void { $this->metadataService->unlock($point); } - /** * @param RestoringPoint $point * @param RestoringChunk $chunk @@ -741,7 +723,6 @@ public function unpackChunk(RestoringPoint $point, RestoringChunk $chunk): void $chunk->setParts([]); } - /** * @param RestoringPoint $point * @param RestoringChunk $chunk @@ -781,7 +762,6 @@ private function putOutParts(RestoringPoint $point, RestoringChunk $chunk): arra return $temp; } - /** * @param RestoringPoint $point * @param RestoringChunk $chunk @@ -814,7 +794,6 @@ private function wrapPackDecrypt(RestoringPoint $point, RestoringChunk $chunk, a return $parts; } - /** * @param RestoringChunkPart[] $parts * @param RestoringChunk $chunk @@ -847,8 +826,8 @@ private function packDecrypt(array $parts, RestoringChunk $chunk): array { // TODO checksums // echo '-checksum: ' . $this->getTempChecksum($new->getName()) . "\n"; } catch (PackDecryptException - | SodiumException - | EncryptionKeyException $e) { + |SodiumException + |EncryptionKeyException $e) { $this->o('' . $e->getMessage() . ''); } @@ -858,7 +837,6 @@ private function packDecrypt(array $parts, RestoringChunk $chunk): array { return $decrypted; } - /** * @param RestoringChunkPart[] $parts * @@ -892,7 +870,6 @@ private function wrapPackImplode(array $parts): string { } } - /** * @param RestoringChunkPart[] $parts * @@ -914,7 +891,6 @@ private function packImplode(array $parts): string { return $tmpPath; } - /** * @param RestoringPoint $point * @param string $filename @@ -979,7 +955,6 @@ private function packChunkExtract(string $zipName, string &$type = ''): string { return $tmp; } - /** * @param string $zipName * @param string $type @@ -999,7 +974,6 @@ private function confirmUnpackedChunkContent(string $zipName, string $type): voi } } - /** * @param RestoringPoint $point * @param RestoringChunk $chunk @@ -1014,7 +988,7 @@ public function getPackFolder( RestoringPoint $point, RestoringChunk $chunk, string &$path = '', - string &$sub = '' + string &$sub = '', ): ISimpleFolder { if (!$point->hasBaseFolder() || !$point->hasAppDataRootWrapper()) { throw new RestoringPointNotInitiatedException('Restoring Point is not initiated'); @@ -1035,7 +1009,6 @@ public function getPackFolder( return $folder; } - /** * @param RestoringPoint $point * @param RestoringChunk $chunk @@ -1058,7 +1031,6 @@ private function wrapRecreateChunk(RestoringPoint $point, RestoringChunk $chunk, } } - /** * @param RestoringPoint $point * @param RestoringChunk $chunk @@ -1085,7 +1057,6 @@ private function recreateChunk(RestoringPoint $point, RestoringChunk $chunk, str fclose($read); } - /** * @param RestoringPoint $point * @param RestoringChunk $chunk @@ -1104,7 +1075,6 @@ private function removeOldChunkPartFiles(RestoringPoint $point, RestoringChunk $ } } - /** * @param RestoringPoint $point * @param RestoringChunk[] $chunks @@ -1119,7 +1089,6 @@ private function removeOldChunkFiles(RestoringPoint $point, array $chunks): void } } - /** * @param string $tmpPath * @@ -1135,7 +1104,6 @@ public function getTempChecksum(string $tmpPath): string { return $this->getChecksumFromStream($stream); } - /** * @param RestoringPoint $point * @param RestoringChunk $chunk @@ -1147,7 +1115,7 @@ public function getTempChecksum(string $tmpPath): string { public function getChecksum( RestoringPoint $point, RestoringChunk $chunk, - RestoringChunkPart $part + RestoringChunkPart $part, ): string { try { $path = ''; @@ -1172,7 +1140,6 @@ public function getChecksum( return $this->getChecksumFromStream($stream); } - /** * @throws NotPermittedException * @throws RestoringPointNotInitiatedException @@ -1180,7 +1147,7 @@ public function getChecksum( public function saveChunkPartContent( RestoringPoint $point, RestoringChunk $chunk, - RestoringChunkPart $part + RestoringChunkPart $part, ) { if ($part->getContent() === '') { return; @@ -1195,11 +1162,10 @@ public function saveChunkPartContent( } $file->putContent(base64_decode($part->getContent())); - } catch (NotPermittedException | NotFoundException $e) { + } catch (NotPermittedException|NotFoundException $e) { } } - /** * @param string $line * @param bool $ln diff --git a/lib/Service/PointService.php b/lib/Service/PointService.php index 3270ce6c..0ad6ed3a 100644 --- a/lib/Service/PointService.php +++ b/lib/Service/PointService.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Service; use Exception; @@ -88,12 +86,10 @@ class PointService { use TStringTools; use TDeserialize; - public const NOBACKUP_FILE = '.nobackup'; public const NOINDEX_FILE = '.noindex'; // so that fulltextsearch does not index backup public const SQL_DUMP_FILE = 'backup.sql'; - /** @var PointRequest */ private $pointRequest; @@ -136,7 +132,6 @@ class PointService { /** @var bool */ private $backupFSInitiated = false; - /** * PointService constructor. * @@ -165,7 +160,7 @@ public function __construct( FilesService $filesService, OutputService $outputService, ActivityService $activityService, - ConfigService $configService + ConfigService $configService, ) { $this->pointRequest = $pointRequest; $this->changesRequest = $changesRequest; @@ -183,7 +178,6 @@ public function __construct( $this->setup('app', 'backup'); } - /** * If $instance is empty, will returns RestoringPoint without checking the origin. * Use getLocalRestoringPoint() to limit the search to local RestoringPoint @@ -198,7 +192,6 @@ public function getRestoringPoint(string $pointId, string $instance = ''): Resto return $this->pointRequest->getById($pointId, $instance); } - /** * @param string $pointId * @@ -209,7 +202,6 @@ public function getLocalRestoringPoint(string $pointId): RestoringPoint { return $this->pointRequest->getLocalById($pointId); } - /** * @param int $since * @param int $until @@ -221,7 +213,6 @@ public function getLocalRestoringPoints(int $since = 0, int $until = 0, bool $as return $this->pointRequest->getLocal($since, $until, $asc); } - /** * @param bool $complete * @param string $comment @@ -301,7 +292,6 @@ public function create(bool $complete, string $comment = '', string $log = ''): return $point; } - /** * @param RestoringPoint $point * @param bool $updateMetadata @@ -323,7 +313,6 @@ public function update(RestoringPoint $point, bool $updateMetadata = false): voi } } - /** * update small complementary infos like Commend and Archive flag * @@ -345,14 +334,13 @@ public function updateSubInfos(RestoringPoint $point): void { $this->initBaseFolder($stored); $stored->setComment($point->getComment()) - ->setArchive($point->isArchive()) - ->setSubSignature($point->getSubSignature()); + ->setArchive($point->isArchive()) + ->setSubSignature($point->getSubSignature()); $this->pointRequest->update($stored, true); $this->metadataService->saveMetadata($stored); } - /** * @param RestoringPoint $point * @@ -368,7 +356,6 @@ public function delete(RestoringPoint $point): void { $this->pointRequest->deletePoint($point->getId()); } - /** * @param bool $complete * @@ -407,7 +394,6 @@ private function initRestoringPoint(bool $complete): RestoringPoint { return $point; } - /** * @param RestoringPoint $point * @param bool $complete @@ -443,7 +429,6 @@ private function addingRestoringData(RestoringPoint $point, bool $complete): voi $this->addCustomApps($point); } - /** * @param RestoringPoint $point * @@ -461,7 +446,6 @@ private function initParent(RestoringPoint $point): void { $point->setParent($parentId); } - /** * @param RestoringPoint $point */ @@ -487,7 +471,6 @@ private function addCustomApps(RestoringPoint $point): void { } } - /** * @param RestoringPoint $point */ @@ -503,7 +486,6 @@ private function addDifferentialData(RestoringPoint $point): void { $point->addRestoringData($data); } - /** * @param RestoringPoint $point * @@ -544,7 +526,6 @@ private function backupSql(RestoringPoint $point) { $point->addRestoringData($data); } - /** // TODO: add a way to get sql params from current config/config.php directly * * @return array @@ -596,13 +577,11 @@ public function getSqlDump(array $params = []): ISqlDump { return $sqlDump; } - public function loadSqlDump() { new SqlDumpMySQL(); new SqlDumpPgSQL(); } - public function generatePointFromFolder(int $fileId, string $owner): RestoringPoint { $point = $this->filesService->getPointFromFileId($fileId, $owner, $folder); $this->initBaseFolder($point); @@ -631,7 +610,6 @@ public function generatePointFromFolder(int $fileId, string $owner): RestoringPo return $point; } - /** * @return RestoringPoint[] * @throws ExternalFolderNotFoundException @@ -651,7 +629,6 @@ public function scanFoldersFromAppData(): array { return []; } - /** * @param string $pointId * @@ -691,7 +668,6 @@ public function generatePointFromAppData(string $pointId): RestoringPoint { return $point; } - /** * @return ExternalFolder * @throws ExternalAppdataException @@ -716,7 +692,6 @@ public function getExternalAppData(): ExternalFolder { return $external; } - /** * @param int $storageId * @param string $root @@ -729,7 +704,7 @@ public function setExternalAppData(int $storageId, string $root = ''): void { if ($storageId === 0) { try { $this->destroyBackupFS(); - } catch (ExternalFolderNotFoundException | NotFoundException | NotPermittedException $e) { + } catch (ExternalFolderNotFoundException|NotFoundException|NotPermittedException $e) { $this->deleteAllPoints(); } @@ -747,14 +722,13 @@ public function setExternalAppData(int $storageId, string $root = ''): void { try { $this->destroyBackupFS(); - } catch (ExternalFolderNotFoundException | NotFoundException | NotPermittedException $e) { + } catch (ExternalFolderNotFoundException|NotFoundException|NotPermittedException $e) { $this->deleteAllPoints(); } $this->configService->setAppValueArray(ConfigService::EXTERNAL_APPDATA, $this->serialize($external)); } - /** * @throws NotPermittedException * @throws NotFoundException @@ -799,7 +773,6 @@ private function initBackupFS(bool $force = false): void { $this->backupFSInitiated = true; } - /** * This will destroy all backup stored locally * (from this instance and from remote instance using this instance as storage) @@ -820,11 +793,9 @@ public function destroyBackupFS(): void { } } - public function deleteAllPoints(): void { } - /** * @param string $instance * @@ -834,7 +805,6 @@ public function getRPByInstance(string $instance): array { return $this->pointRequest->getByInstance($instance); } - /** * TODO: explode the method as some part of the process is external folder related... * @@ -848,7 +818,7 @@ public function getRPByInstance(string $instance): array { public function getRPFromInstances( bool $local = false, string $remote = '', - string $external = '' + string $external = '', ): array { if ($local) { $instances = [RemoteInstance::LOCAL]; @@ -893,8 +863,8 @@ function (ExternalFolder $externalFolder): string { } } } catch (RemoteInstanceException - | RemoteInstanceNotFoundException - | RemoteResourceNotFoundException $e) { + |RemoteInstanceNotFoundException + |RemoteResourceNotFoundException $e) { continue; } @@ -914,7 +884,7 @@ function (ExternalFolder $externalFolder): string { try { $this->remoteStreamService->verifyPoint($item); - } catch (SignatoryException | SignatureException $e) { + } catch (SignatoryException|SignatureException $e) { $this->e($e); $this->o(' ! cannot confirm integrity'); $issue = 'cannot confirm integrity'; @@ -933,7 +903,6 @@ function (ExternalFolder $externalFolder): string { return $this->orderByDate($points, $dates); } - /** * @param array $points * @param array $dates @@ -977,7 +946,6 @@ public function purgeRestoringPoints(): void { public function purgeRemoteRestoringPoints(): void { } - /** * @param RestoringPoint $point * @@ -1004,7 +972,6 @@ public function initBaseFolder(RestoringPoint $point): void { $point->setBaseFolder($folder); } - /** * Update $point with it, but also returns the generated RestoringHealth * @@ -1037,8 +1004,8 @@ public function generateHealth(RestoringPoint $point, bool $updateDb = false): R } $chunkHealth->setDataName($data->getName()) - ->setChunkName($chunk->getName()) - ->setStatus($status); + ->setChunkName($chunk->getName()) + ->setStatus($status); $health->addPart($chunkHealth); } } @@ -1052,7 +1019,7 @@ public function generateHealth(RestoringPoint $point, bool $updateDb = false): R } $health->setStatus($globalStatus) - ->setChecked(time()); + ->setChecked(time()); $point->setHealth($health); if ($updateDb) { @@ -1062,13 +1029,12 @@ public function generateHealth(RestoringPoint $point, bool $updateDb = false): R return $health; } - private function generateHealthPacked( RestoringHealth $health, RestoringPoint $point, RestoringData $data, RestoringChunk $chunk, - int &$globalStatus + int &$globalStatus, ): void { foreach ($chunk->getParts() as $part) { $partHealth = new ChunkPartHealth(true); @@ -1078,14 +1044,13 @@ private function generateHealthPacked( } $partHealth->setDataName($data->getName()) - ->setChunkName($chunk->getName()) - ->setPartName($part->getName()) - ->setStatus($status); + ->setChunkName($chunk->getName()) + ->setPartName($part->getName()) + ->setStatus($status); $health->addPart($partHealth); } } - /** * @param RestoringPoint $point * @param RestoringChunk $chunk @@ -1105,7 +1070,6 @@ private function generateChunkHealthStatus(RestoringPoint $point, RestoringChunk } } - /** * @param RestoringPoint $point * @param RestoringChunk $chunk @@ -1116,7 +1080,7 @@ private function generateChunkHealthStatus(RestoringPoint $point, RestoringChunk private function generatePartHealthStatus( RestoringPoint $point, RestoringChunk $chunk, - RestoringChunkPart $part + RestoringChunkPart $part, ): int { try { $checksum = $this->packService->getChecksum($point, $chunk, $part); @@ -1130,7 +1094,6 @@ private function generatePartHealthStatus( } } - /** * @param RestoringPoint $point * @param string $data @@ -1142,7 +1105,7 @@ private function generatePartHealthStatus( * @throws RestoringChunkNotFoundException */ public function getChunkContent( - RestoringPoint $point, string $data, string $chunk + RestoringPoint $point, string $data, string $chunk, ): RestoringChunk { $this->initBaseFolder($point); @@ -1152,7 +1115,6 @@ public function getChunkContent( return $restoringChunk; } - /** * @param RestoringPoint $point * @@ -1164,7 +1126,6 @@ public function saveMetadata(RestoringPoint $point): void { $this->metadataService->saveMetadata($point); } - /** * @param string $line * @param bool $ln diff --git a/lib/Service/RemoteService.php b/lib/Service/RemoteService.php index 9571e3f0..eb43c0fa 100644 --- a/lib/Service/RemoteService.php +++ b/lib/Service/RemoteService.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Service; use Exception; @@ -60,7 +58,6 @@ class RemoteService { use TNCLogger; use TDeserialize; - /** @var RemoteRequest */ private $remoteRequest; @@ -76,7 +73,6 @@ class RemoteService { /** @var ConfigService */ private $configService; - /** * RemoteService constructor. * @@ -91,7 +87,7 @@ public function __construct( RemoteStreamService $remoteStreamService, ChunkService $chunkService, OutputService $outputService, - ConfigService $configService + ConfigService $configService, ) { $this->remoteRequest = $remoteRequest; $this->remoteStreamService = $remoteStreamService; @@ -102,7 +98,6 @@ public function __construct( $this->setup('app', Application::APP_ID); } - /** * @return RemoteInstance[] */ @@ -127,7 +122,6 @@ public function getAll(bool $includeExtraDataOnSerialize = false): array { return $this->remoteRequest->getAll($includeExtraDataOnSerialize); } - /** * @param string $instance * @@ -156,7 +150,7 @@ public function getByInstance(string $instance): RemoteInstance { public function getRestoringPoint( string $instance, string $pointId, - bool $current = false + bool $current = false, ): RestoringPoint { if (!$this->configService->isRemoteEnabled()) { throw new RemoteInstanceNotFoundException(); @@ -181,7 +175,6 @@ public function getRestoringPoint( throw new RestoringPointNotFoundException(); } - /** * @param string $instance * @@ -203,7 +196,6 @@ public function getRestoringPoints(string $instance): array { return $this->deserializeArray($result, RestoringPoint::class); } - /** * @param RemoteInstance $remote * @param RestoringPoint $point @@ -238,10 +230,10 @@ public function createPoint(RemoteInstance $remote, RestoringPoint $point): Rest throw new RestoringPointNotFoundException('restoring point not created'); } } catch (RemoteInstanceException - | RemoteResourceNotFoundException - | RestoringPointNotFoundException - | SignatoryException - | RemoteInstanceNotFoundException $e) { + |RemoteResourceNotFoundException + |RestoringPointNotFoundException + |SignatoryException + |RemoteInstanceNotFoundException $e) { $this->o('' . $e->getMessage() . ''); throw $e; } @@ -251,7 +243,6 @@ public function createPoint(RemoteInstance $remote, RestoringPoint $point): Rest return $stored; } - /** * @param RestoringPoint $point * @param RemoteInstance|null $remote @@ -278,7 +269,6 @@ public function updateMetadata(RestoringPoint $point, ?RemoteInstance $remote = } } - /** * @param string $pointId */ @@ -295,7 +285,6 @@ public function deletePoint(string $pointId): void { } } - /** * @param RemoteInstance $remote * @param string $pointId @@ -330,9 +319,9 @@ public function deletePointRemote(RemoteInstance $remote, string $pointId): void // throw new RestoringPointNotFoundException(''); // } } catch (RemoteInstanceException - | RemoteResourceNotFoundException - | RestoringPointNotFoundException - | RemoteInstanceNotFoundException $e) { + |RemoteResourceNotFoundException + |RestoringPointNotFoundException + |RemoteInstanceNotFoundException $e) { throw $e; } } @@ -369,9 +358,9 @@ public function updateMetadataFile(RemoteInstance $remote, RestoringPoint $point throw new RestoringPointNotFoundException('restoring point not updated'); } } catch (RemoteInstanceException - | RemoteResourceNotFoundException - | RestoringPointNotFoundException - | RemoteInstanceNotFoundException $e) { + |RemoteResourceNotFoundException + |RestoringPointNotFoundException + |RemoteInstanceNotFoundException $e) { throw $e; } } @@ -391,7 +380,7 @@ public function uploadPart( string $instance, RestoringPoint $point, RestoringChunk $chunk, - RestoringChunkPart $part + RestoringChunkPart $part, ): void { if (!$this->configService->isRemoteEnabled()) { return; @@ -414,7 +403,6 @@ public function uploadPart( return; } - /** * @param string $instance * @param RestoringPoint $point @@ -431,7 +419,7 @@ public function downloadPart( string $instance, RestoringPoint $point, RestoringChunk $chunk, - RestoringChunkPart $part + RestoringChunkPart $part, ): void { if (!$this->configService->isRemoteEnabled()) { return; @@ -455,7 +443,6 @@ public function downloadPart( } } - /** * @param RemoteInstance $remote * @@ -469,7 +456,7 @@ public function downloadPart( */ public function confirmPoint( RemoteInstance $remote, - RestoringPoint $point + RestoringPoint $point, ): RestoringPoint { if (!$this->configService->isRemoteEnabled()) { throw new RestoringPointNotFoundException(); @@ -483,7 +470,7 @@ public function confirmPoint( throw $e; } catch ( RemoteInstanceNotFoundException - | RemoteResourceNotFoundException $e) { + |RemoteResourceNotFoundException $e) { $this->o(' ! cannot communicate with remote instance'); throw $e; } catch (RestoringPointNotFoundException $e) { @@ -500,7 +487,6 @@ public function confirmPoint( return $stored; } - /** * @param RemoteInstance $remote * @param RestoringPoint $point @@ -514,7 +500,7 @@ public function confirmPoint( */ public function getCurrentHealth( RemoteInstance $remote, - RestoringPoint $point + RestoringPoint $point, ): RestoringHealth { if (!$this->configService->isRemoteEnabled()) { throw new RestoringPointNotFoundException(); @@ -528,7 +514,6 @@ public function getCurrentHealth( return $stored->getHealth(); } - /** * @param string $line * @param bool $ln diff --git a/lib/Service/RemoteStreamService.php b/lib/Service/RemoteStreamService.php index 78cb4cf7..8022dc9b 100644 --- a/lib/Service/RemoteStreamService.php +++ b/lib/Service/RemoteStreamService.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Service; use JsonSerializable; @@ -67,7 +65,6 @@ class RemoteStreamService extends NCSignature { use TStringTools; use TNCWellKnown; - /** @var IURLGenerator */ private $urlGenerator; @@ -77,7 +74,6 @@ class RemoteStreamService extends NCSignature { /** @var ConfigService */ private $configService; - /** * RemoteStreamService constructor. * @@ -88,7 +84,7 @@ class RemoteStreamService extends NCSignature { public function __construct( IURLGenerator $urlGenerator, RemoteRequest $remoteRequest, - ConfigService $configService + ConfigService $configService, ) { $this->urlGenerator = $urlGenerator; $this->remoteRequest = $remoteRequest; @@ -97,7 +93,6 @@ public function __construct( $this->setup('app', 'backup'); } - /** * Returns the Signatory model for the Backup app. * Can be signed with a confirmKey. @@ -171,7 +166,6 @@ public function getAppSignatory(bool $generate = true, string $confirmKey = ''): return $app; } - /** * */ @@ -184,7 +178,6 @@ public function resetAppSignatory(): void { } } - /** * Add a remote instance, based on the address * @@ -206,7 +199,6 @@ public function retrieveRemoteInstance(string $instance): RemoteInstance { return $remoteInstance; } - /** * retrieve Signatory. * @@ -240,7 +232,6 @@ public function retrieveSignatory(string $keyId, bool $refresh = true): NCSignat return $remoteInstance; } - /** * shortcut to requestRemoteInstance that return result if available, or exception. * @@ -262,10 +253,10 @@ public function resultRequestRemoteInstance( int $type = Request::TYPE_GET, ?JsonSerializable $object = null, array $params = [], - bool $longTimeout = false + bool $longTimeout = false, ): array { - $signedRequest = - $this->requestRemoteInstance($instance, $item, $type, $object, $params, $longTimeout); + $signedRequest + = $this->requestRemoteInstance($instance, $item, $type, $object, $params, $longTimeout); if (!$signedRequest->getOutgoingRequest()->hasResult()) { throw new RemoteInstanceException(); @@ -279,7 +270,6 @@ public function resultRequestRemoteInstance( throw new RemoteInstanceException($this->get('message', $result->getAsArray())); } - /** * Send a request to a remote instance, based on: * - instance: address as saved in database, @@ -305,7 +295,7 @@ private function requestRemoteInstance( int $type = Request::TYPE_GET, ?JsonSerializable $object = null, array $params = [], - bool $longTimeout = false + bool $longTimeout = false, ): NCSignedRequest { $request = new NCRequest('', $type); $this->configService->configureRequest($request, $longTimeout); @@ -326,14 +316,13 @@ private function requestRemoteInstance( // $app->setAlgorithm(NC22Signatory::SHA512); $signedRequest = $this->signOutgoingRequest($request, $app); $this->doRequest($signedRequest->getOutgoingRequest(), false); - } catch (RequestNetworkException | SignatoryException $e) { + } catch (RequestNetworkException|SignatoryException $e) { throw new RemoteInstanceException($e->getMessage()); } return $signedRequest; } - /** * get the value of an entry from the Signatory of the RemoteInstance. * @@ -356,7 +345,6 @@ private function getRemoteInstanceEntry(string $instance, string $item, array $p return $this->feedStringWithParams($value, $params); } - /** * Confirm the Auth of a RemoteInstance, based on the result from a request * @@ -382,7 +370,6 @@ private function confirmAuth(RemoteInstance $remote, string $auth): void { } } - /** * @param RestoringPoint $point * @@ -403,7 +390,6 @@ public function verifyPoint(RestoringPoint $point) { $this->verifyModel($point, $this->getAppSignatory()->getPublicKey()); } - /** * @param RestoringPoint $point * diff --git a/lib/Service/RestoreService.php b/lib/Service/RestoreService.php index 8ed5bb58..f0a71ece 100644 --- a/lib/Service/RestoreService.php +++ b/lib/Service/RestoreService.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Service; use DateTime; @@ -64,7 +62,6 @@ class RestoreService { use TStringTools; use TFileTools; - /** @var IRootFolder */ private $rootFolder; @@ -77,7 +74,6 @@ class RestoreService { /** @var ConfigService */ private $configService; - /** * RestoreService constructor. * @@ -90,7 +86,7 @@ public function __construct( IRootFolder $rootFolder, CoreRequestBuilder $coreRequestBuilder, FilesService $filesService, - ConfigService $configService + ConfigService $configService, ) { $this->rootFolder = $rootFolder; $this->coreRequestBuilder = $coreRequestBuilder; @@ -98,7 +94,6 @@ public function __construct( $this->configService = $configService; } - /** * */ @@ -108,7 +103,6 @@ public function finalizeFullRestore(): void { $this->coreRequestBuilder->emptyTable(CoreRequestBuilder::TABLE_AUTHTOKEN); } - /** * @param int $fileId * @param string $owner @@ -140,7 +134,6 @@ public function actionFromFileId(int $fileId, string $owner, ?Folder &$folder = throw new RestoringPointException(); } - /** * @param Folder $folder * @param string $id @@ -177,12 +170,12 @@ public function restoreMetadataFromFolder(Folder $folder, string $id): Restoring $data = $this->generateRestoringDataFromFolder($folder, $isPacked); if ($isPacked) { $point->addStatus(RestoringPoint::STATUS_UNKNOWN) - ->addStatus(RestoringPoint::STATUS_PACKED) - ->addStatus(RestoringPoint::STATUS_PACKING); + ->addStatus(RestoringPoint::STATUS_PACKED) + ->addStatus(RestoringPoint::STATUS_PACKING); } $point->setRestoringData($data) - ->setArchive(true); + ->setArchive(true); /** @var File $metadata */ try { @@ -199,7 +192,6 @@ public function restoreMetadataFromFolder(Folder $folder, string $id): Restoring return $point; } - /** * @param Folder $folder * @param bool $isPacked @@ -228,7 +220,6 @@ private function generateRestoringDataFromFolder(Folder $folder, bool &$isPacked return $result; } - /** * @param string $dataName * @@ -264,7 +255,6 @@ private function generateRestoringDataBasedOnDataName(string $dataName): Restori return $data; } - /** * @param RestoringData $data * @param Folder $folder @@ -278,7 +268,7 @@ private function generateRestoringDataBasedOnDataName(string $dataName): Restori private function generateChunkPartsFromFolder( RestoringData $data, Folder $folder, - bool &$isPacked + bool &$isPacked, ): void { foreach ($folder->getDirectoryListing() as $node) { /** @var Folder $node */ @@ -303,7 +293,7 @@ private function generateChunkPartsFromFolder( $chunk = new RestoringChunk(); $chunk->setName($chunkName) - ->setPath('/' . $folder->getName() . '/' . $chunkName . '/'); + ->setPath('/' . $folder->getName() . '/' . $chunkName . '/'); try { /** @var File $chunkFile */ @@ -320,7 +310,7 @@ private function generateChunkPartsFromFolder( /** @var File $chunkFile */ $chunkFile = $node->get($chunkName . '.zip.gz'); $chunk->setSize($chunkFile->getSize()) - ->setCompression(1); + ->setCompression(1); $read = $chunkFile->fopen('rb'); $chunk->setChecksum($this->getChecksumFromStream($read)); diff --git a/lib/Service/UploadService.php b/lib/Service/UploadService.php index 3d1faa64..d236cc08 100644 --- a/lib/Service/UploadService.php +++ b/lib/Service/UploadService.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Service; use Exception; @@ -65,8 +63,6 @@ class UploadService { use TStringTools; use TNCLogger; - - /** @var PointService */ private $pointService; @@ -94,7 +90,6 @@ class UploadService { /** @var ConfigService */ private $configService; - /** * UploadService constructor. * @@ -117,7 +112,7 @@ public function __construct( MetadataService $metadataService, CronService $cronService, OutputService $outputService, - ConfigService $configService + ConfigService $configService, ) { $this->pointService = $pointService; $this->chunkService = $chunkService; @@ -132,7 +127,6 @@ public function __construct( $this->setup('app', Application::APP_ID); } - /** * @param RestoringPoint $point * @@ -152,7 +146,6 @@ public function initUpload(RestoringPoint $point): void { $this->pointService->initBaseFolder($point); } - /** * @param RestoringPoint $point */ @@ -160,7 +153,6 @@ public function closeUpload(RestoringPoint $point): void { $this->metadataService->unlock($point); } - /** * @param RestoringPoint $point * @@ -179,7 +171,6 @@ public function uploadPoint(RestoringPoint $point): void { $this->closeUpload($point); } - /** * @param RestoringPoint $point * @param string $instance @@ -233,7 +224,6 @@ public function uploadToRemoteInstances(RestoringPoint $point, string $instance } } - /** * @param string $instance * @param RestoringPoint $point @@ -244,7 +234,7 @@ public function uploadToRemoteInstances(RestoringPoint $point, string $instance private function uploadMissingFilesToRemoteInstance( string $instance, RestoringPoint $point, - RestoringHealth $health + RestoringHealth $health, ): void { foreach ($health->getParts() as $partHealth) { if ($partHealth->getStatus() === ChunkPartHealth::STATUS_OK) { @@ -281,17 +271,16 @@ private function uploadMissingFilesToRemoteInstance( $this->o('ok'); } catch ( RestoringChunkNotFoundException - | RemoteInstanceException - | RemoteInstanceNotFoundException - | RestoringChunkPartNotFoundException - | RestoringPointNotInitiatedException - | RemoteResourceNotFoundException $e) { + |RemoteInstanceException + |RemoteInstanceNotFoundException + |RestoringChunkPartNotFoundException + |RestoringPointNotInitiatedException + |RemoteResourceNotFoundException $e) { $this->o('' . get_class($e) . $e->getMessage() . ''); } } } - /** * @param RestoringPoint $point * @param int $storageId @@ -311,8 +300,8 @@ public function uploadToExternalFolder(RestoringPoint $point, int $storageId = 0 foreach ($externals as $external) { try { $this->o( - ' - checking external folder ' . $external->getStorageId() . - ':' . $external->getRoot() . '' + ' - checking external folder ' . $external->getStorageId() + . ':' . $external->getRoot() . '' ); $stored = $this->externalFolderService->confirmPoint($external, $point); @@ -358,15 +347,14 @@ public function uploadToExternalFolder(RestoringPoint $point, int $storageId = 0 throw $e; } catch (Exception $e) { $this->o( - ' ! issue while checking external folder: ' . get_class($e) . - ' ' . $e->getMessage() . '' + ' ! issue while checking external folder: ' . get_class($e) + . ' ' . $e->getMessage() . '' ); continue; } } } - /** * @param ExternalFolder $external * @param RestoringPoint $point @@ -380,7 +368,7 @@ public function uploadToExternalFolder(RestoringPoint $point, int $storageId = 0 private function uploadMissingFilesToExternalFolder( ExternalFolder $external, RestoringPoint $point, - RestoringHealth $health + RestoringHealth $health, ): void { $this->pointService->initBaseFolder($point); foreach ($health->getParts() as $partHealth) { @@ -417,13 +405,13 @@ private function uploadMissingFilesToExternalFolder( $this->externalFolderService->uploadPart($external, $point, $health, $chunk, $part); $this->o('ok'); } catch ( - RestoringChunkNotFoundException | - RestoringPointNotInitiatedException | - RestoringPointException | - RestoringPointNotFoundException | - ExternalFolderNotFoundException | - GenericFileException | - NotPermittedException | + RestoringChunkNotFoundException| + RestoringPointNotInitiatedException| + RestoringPointException| + RestoringPointNotFoundException| + ExternalFolderNotFoundException| + GenericFileException| + NotPermittedException| LockedException $e) { $this->o('' . get_class($e) . ' ' . $e->getMessage() . ''); $this->e($e); @@ -431,7 +419,6 @@ private function uploadMissingFilesToExternalFolder( } } - /** * @param string $line * @param bool $ln diff --git a/lib/Settings/Admin.php b/lib/Settings/Admin.php index 71bdcb63..08da54fa 100644 --- a/lib/Settings/Admin.php +++ b/lib/Settings/Admin.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Settings; use Exception; @@ -43,14 +41,12 @@ */ class Admin implements ISettings { - /** * Admin constructor. */ public function __construct() { } - /** * @return TemplateResponse * @throws Exception @@ -59,7 +55,6 @@ public function getForm(): TemplateResponse { return new TemplateResponse(Application::APP_ID, 'settings.admin', []); } - /** * @return string */ @@ -67,7 +62,6 @@ public function getSection(): string { return Application::APP_ID; } - /** * @return int */ diff --git a/lib/Settings/AdminSection.php b/lib/Settings/AdminSection.php index b6303f57..e995fd27 100644 --- a/lib/Settings/AdminSection.php +++ b/lib/Settings/AdminSection.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Settings; use OCA\Backup\AppInfo\Application; @@ -43,14 +41,12 @@ */ class AdminSection implements IIconSection { - /** @var IL10N */ private $l10n; /** @var IURLGenerator */ private $urlGenerator; - /** * @param IL10N $l10n * @param IURLGenerator $urlGenerator diff --git a/lib/SqlDump/SqlDumpMySQL.php b/lib/SqlDump/SqlDumpMySQL.php index c8601448..6892eda6 100644 --- a/lib/SqlDump/SqlDumpMySQL.php +++ b/lib/SqlDump/SqlDumpMySQL.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\SqlDump; use Ifsnop\Mysqldump\Mysqldump; @@ -47,18 +45,15 @@ class SqlDumpMySQL implements ISqlDump { use TArrayTools; - /** @var ConfigService */ private $configService; - /** * SqlDumpMySQL constructor. */ public function __construct() { } - /** * @param array $params * @param string $filename @@ -68,7 +63,7 @@ public function __construct() { */ public function export(array $params, string $filename): void { $connect = sprintf('mysql:host=%s;dbname=%s', $params[ISqlDump::DB_HOST], $params[ISqlDump::DB_NAME]); - if (false === empty($params[ISqlDump::DB_PORT])) { + if (empty($params[ISqlDump::DB_PORT]) === false) { $connect .= sprintf(';port=%u', $params[ISqlDump::DB_PORT]); } $settings = [ @@ -95,7 +90,6 @@ public function export(array $params, string $filename): void { } } - /** * @param array $params * @@ -132,7 +126,6 @@ public function setup(array $params): void { } } - /** * @param array $params * @param resource $read diff --git a/lib/SqlDump/SqlDumpPgSQL.php b/lib/SqlDump/SqlDumpPgSQL.php index 2011de37..9044beff 100644 --- a/lib/SqlDump/SqlDumpPgSQL.php +++ b/lib/SqlDump/SqlDumpPgSQL.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\SqlDump; use OCA\Backup\Exceptions\SqlDumpException; @@ -46,14 +44,12 @@ class SqlDumpPgSQL implements ISqlDump { use TArrayTools; - /** * SqlDumpPgSQL constructor. */ public function __construct() { } - /** * @param array $params * @param string $filename @@ -65,9 +61,9 @@ public function export(array $params, string $filename): void { try { $dump = PostgreSql::create(); $dump->setDbName($this->get(ISqlDump::DB_NAME, $params)) - ->setUserName($this->get(ISqlDump::DB_USER, $params)) - ->setPassword($this->get(ISqlDump::DB_PASS, $params)) - ->setHost($this->get(ISqlDump::DB_HOST, $params)); + ->setUserName($this->get(ISqlDump::DB_USER, $params)) + ->setPassword($this->get(ISqlDump::DB_PASS, $params)) + ->setHost($this->get(ISqlDump::DB_HOST, $params)); $port = $this->getInt(ISqlDump::DB_PORT, $params); if ($port > 0) { @@ -75,13 +71,12 @@ public function export(array $params, string $filename): void { } $dump->addExtraOption('--clean --inserts') - ->dumpToFile($filename); + ->dumpToFile($filename); } catch (Throwable $t) { throw new SqlDumpException($t->getMessage()); } } - /** * @param array $params * @@ -98,10 +93,10 @@ public function setup(array $params): void { } $sql = pg_connect( - 'host=' . $this->get(ISqlDump::DB_HOST, $params) . - ' dbname=' . $this->get(ISqlDump::DB_NAME, $params) . - ' user=' . $this->get(ISqlDump::DB_USER, $params) . - ' password=' . $this->get(ISqlDump::DB_PASS, $params) + 'host=' . $this->get(ISqlDump::DB_HOST, $params) + . ' dbname=' . $this->get(ISqlDump::DB_NAME, $params) + . ' user=' . $this->get(ISqlDump::DB_USER, $params) + . ' password=' . $this->get(ISqlDump::DB_PASS, $params) ); if (is_bool($sql) || is_null($sql)) { @@ -119,7 +114,6 @@ public function setup(array $params): void { } } - /** * @param array $params * @param resource $read @@ -128,10 +122,10 @@ public function setup(array $params): void { */ public function import(array $params, $read): bool { $sql = pg_connect( - 'host=' . $this->get(ISqlDump::DB_HOST, $params) . - ' dbname=' . $this->get(ISqlDump::DB_NAME, $params) . - ' user=' . $this->get(ISqlDump::DB_USER, $params) . - ' password=' . $this->get(ISqlDump::DB_PASS, $params) + 'host=' . $this->get(ISqlDump::DB_HOST, $params) + . ' dbname=' . $this->get(ISqlDump::DB_NAME, $params) + . ' user=' . $this->get(ISqlDump::DB_USER, $params) + . ' password=' . $this->get(ISqlDump::DB_PASS, $params) ); $request = ''; diff --git a/lib/Tools/ActivityPub/NCSignature.php b/lib/Tools/ActivityPub/NCSignature.php index d2198671..697b47df 100644 --- a/lib/Tools/ActivityPub/NCSignature.php +++ b/lib/Tools/ActivityPub/NCSignature.php @@ -1,4 +1,5 @@ getDataBody()); $signedRequest->setOutgoingRequest($request) - ->setSignatory($signatory); + ->setSignatory($signatory); $this->setOutgoingSignatureHeader($signedRequest); $this->setOutgoingClearSignature($signedRequest); @@ -135,7 +130,6 @@ public function signOutgoingRequest(NCRequest $request, NCSignatory $signatory): return $signedRequest; } - /** * @param NCSignedRequest $signedRequest * @@ -157,7 +151,6 @@ private function verifyIncomingRequestTime(NCSignedRequest $signedRequest): void } } - /** * @param NCSignedRequest $signedRequest * @@ -198,7 +191,6 @@ private function setIncomingSignatureHeader(NCSignedRequest $signedRequest): voi $signedRequest->setSignatureHeader(new SimpleDataStore($sign)); } - /** * @param NCSignedRequest $signedRequest * @@ -216,7 +208,7 @@ private function setIncomingClearSignature(NCSignedRequest $signedRequest): void throw new SignatureException('missing elements in \'headers\''); } - $target = strtolower($request->getMethod()) . " " . $request->getRequestUri(); + $target = strtolower($request->getMethod()) . ' ' . $request->getRequestUri(); $estimated = ['(request-target): ' . $target]; foreach ($headers as $key) { @@ -233,7 +225,6 @@ private function setIncomingClearSignature(NCSignedRequest $signedRequest): void $signedRequest->setClearSignature(implode("\n", $estimated)); } - /** * @param NCSignedRequest $signedRequest * @@ -248,7 +239,6 @@ private function parseIncomingSignatureHeader(NCSignedRequest $signedRequest): v $signedRequest->setSignedSignature($data->g('signature')); } - /** * @param NCSignedRequest $signedRequest * @@ -267,7 +257,6 @@ private function verifyIncomingRequestSignature(NCSignedRequest $signedRequest) } } - /** * @param NCSignedRequest $signedRequest * @@ -292,7 +281,6 @@ private function verifySignedRequest(NCSignedRequest $signedRequest) { } } - /** * @param NCSignedRequest $signedRequest */ @@ -301,15 +289,14 @@ private function setOutgoingSignatureHeader(NCSignedRequest $signedRequest): voi $data = new SimpleDataStore(); $data->s('(request-target)', NCRequest::method($request->getType()) . ' ' . $request->getPath()) - ->sInt('content-length', strlen($signedRequest->getBody())) - ->s('date', gmdate($this->dateHeader)) - ->s('digest', $signedRequest->getDigest()) - ->s('host', $request->getHost()); + ->sInt('content-length', strlen($signedRequest->getBody())) + ->s('date', gmdate($this->dateHeader)) + ->s('digest', $signedRequest->getDigest()) + ->s('host', $request->getHost()); $signedRequest->setSignatureHeader($data); } - /** * @param NCSignedRequest $signedRequest */ @@ -330,7 +317,6 @@ private function setOutgoingClearSignature(NCSignedRequest $signedRequest): void $signedRequest->setClearSignature(implode("\n", $signing)); } - /** * @param NCSignedRequest $signedRequest * @@ -342,7 +328,6 @@ private function setOutgoingSignedSignature(NCSignedRequest $signedRequest): voi $signedRequest->setSignedSignature($signed); } - /** * @param NCSignedRequest $signedRequest * @@ -361,7 +346,6 @@ private function signingOutgoingRequest(NCSignedRequest $signedRequest): void { $signedRequest->getOutgoingRequest()->addHeader('Signature', implode(',', $signatureElements)); } - /** * @param NCSignedRequest $signedRequest * @@ -371,7 +355,6 @@ private function getUsedEncryption(NCSignedRequest $signedRequest): string { switch ($signedRequest->getSignatureHeader()->g('algorithm')) { case 'rsa-sha512': return NCSignatory::SHA512; - case 'rsa-sha256': default: return NCSignatory::SHA256; @@ -387,14 +370,12 @@ private function getChosenEncryption(NCSignatory $signatory): string { switch ($signatory->getAlgorithm()) { case NCSignatory::SHA512: return 'ras-sha512'; - case NCSignatory::SHA256: default: return 'ras-sha256'; } } - /** * @param NCSignatory $signatory * @@ -404,7 +385,6 @@ public function getOpenSSLAlgo(NCSignatory $signatory): int { switch ($signatory->getAlgorithm()) { case NCSignatory::SHA512: return OPENSSL_ALGO_SHA512; - case NCSignatory::SHA256: default: return OPENSSL_ALGO_SHA256; diff --git a/lib/Tools/Db/ExtendedQueryBuilder.php b/lib/Tools/Db/ExtendedQueryBuilder.php index f36da947..38c9eaf8 100644 --- a/lib/Tools/Db/ExtendedQueryBuilder.php +++ b/lib/Tools/Db/ExtendedQueryBuilder.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Db; use DateInterval; @@ -50,14 +48,12 @@ class ExtendedQueryBuilder extends QueryBuilder { use TArrayTools; - /** @var string */ private $defaultSelectAlias = ''; /** @var array */ private $defaultValues = []; - public function __construct() { parent::__construct( OC::$server->get(IDBConnection::class), @@ -66,7 +62,6 @@ public function __construct() { ); } - /** * @param string $alias * @@ -85,7 +80,6 @@ public function getDefaultSelectAlias(): string { return $this->defaultSelectAlias; } - /** * @return array */ @@ -131,7 +125,6 @@ public function chunk(int $offset, int $limit): void { } } - /** * Limit the request to the Id * @@ -204,7 +197,6 @@ public function limitToToken(string $token): void { $this->limit('token', $token); } - /** * Limit the request to the creation * @@ -222,7 +214,6 @@ public function limitToCreation(int $delay = 0): self { return $this; } - /** * @param string $field * @param DateTime $date @@ -246,7 +237,6 @@ public function limitToDBFieldDateTime(string $field, DateTime $date, bool $orNu $this->andWhere($orX); } - /** * @param int $timestamp * @param string $field @@ -273,7 +263,6 @@ public function limitToSince(int $timestamp, string $field): void { $this->andWhere($orX); } - /** * @param string $field * @param string $value @@ -287,7 +276,6 @@ public function searchInDBField(string $field, string $value): void { $this->andWhere($expr->iLike($field, $this->createNamedParameter($value))); } - /** * @param string $field * @param string $value @@ -298,7 +286,6 @@ public function like(string $field, string $value, string $alias = '', bool $cs $this->andWhere($this->exprLike($field, $value, $alias, $cs)); } - /** * @param string $field * @param string $value @@ -393,7 +380,6 @@ public function lt(string $field, int $value, bool $lte = false, string $alias = $this->andWhere($this->exprLt($field, $value, $lte, $alias)); } - /** * @param string $field * @param string $value @@ -409,13 +395,12 @@ public function exprLike(string $field, string $value, string $alias = '', bool $expr = $this->expr(); if ($cs) { - return (string) $expr->like($field, $this->createNamedParameter($value)); + return (string)$expr->like($field, $this->createNamedParameter($value)); } else { - return (string) $expr->iLike($field, $this->createNamedParameter($value)); + return (string)$expr->iLike($field, $this->createNamedParameter($value)); } } - /** * @param string $field * @param string $value @@ -431,18 +416,17 @@ public function exprLimit(string $field, string $value, string $alias = '', bool $expr = $this->expr(); if ($value === '') { - return (string) $expr->emptyString($field); + return (string)$expr->emptyString($field); } if ($cs) { - return (string) $expr->eq($field, $this->createNamedParameter($value)); + return (string)$expr->eq($field, $this->createNamedParameter($value)); } else { $func = $this->func(); - return (string) $expr->eq($func->lower($field), $func->lower($this->createNamedParameter($value))); + return (string)$expr->eq($func->lower($field), $func->lower($this->createNamedParameter($value))); } } - /** * @param string $field * @param int $value @@ -457,10 +441,9 @@ public function exprLimitInt(string $field, int $value, string $alias = ''): str $expr = $this->expr(); - return (string) $expr->eq($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT)); + return (string)$expr->eq($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT)); } - /** * @param string $field * @param bool $value @@ -475,7 +458,7 @@ public function exprLimitBool(string $field, bool $value, string $alias = ''): s $expr = $this->expr(); - return (string) $expr->eq($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_BOOL)); + return (string)$expr->eq($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_BOOL)); } /** @@ -488,7 +471,7 @@ public function exprLimitBool(string $field, bool $value, string $alias = ''): s public function exprLimitEmpty( string $field, bool $orNull = false, - string $alias = '' + string $alias = '', ): ICompositeExpression { if ($this->getType() === DBALQueryBuilder::SELECT) { $field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field; @@ -514,7 +497,7 @@ public function exprLimitEmpty( public function exprLimitNull( string $field, bool $orEmpty = false, - string $alias = '' + string $alias = '', ): ICompositeExpression { if ($this->getType() === DBALQueryBuilder::SELECT) { $field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field; @@ -530,7 +513,6 @@ public function exprLimitNull( return $orX; } - /** * @param string $field * @param array $values @@ -543,7 +525,7 @@ public function exprLimitArray( string $field, array $values, string $alias = '', - bool $cs = true + bool $cs = true, ): ICompositeExpression { if ($this->getType() === DBALQueryBuilder::SELECT) { $field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field; @@ -561,7 +543,6 @@ public function exprLimitArray( return $andX; } - /** * @param string $field * @param array $values @@ -576,10 +557,9 @@ public function exprLimitInArray(string $field, array $values, string $alias = ' $expr = $this->expr(); - return (string) $expr->in($field, $this->createNamedParameter($values, IQueryBuilder::PARAM_STR_ARRAY)); + return (string)$expr->in($field, $this->createNamedParameter($values, IQueryBuilder::PARAM_STR_ARRAY)); } - /** * @param string $field * @param int $flag @@ -594,13 +574,12 @@ public function exprLimitBitwise(string $field, int $flag, string $alias = ''): $expr = $this->expr(); - return (string) $expr->gt( + return (string)$expr->gt( $expr->bitwiseAnd($field, $flag), $this->createNamedParameter(0, IQueryBuilder::PARAM_INT) ); } - /** * @param string $field * @param int $value @@ -617,9 +596,9 @@ public function exprLt(string $field, int $value, bool $lte = false, string $ali $expr = $this->expr(); if ($lte) { - return (string) $expr->lte($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT)); + return (string)$expr->lte($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT)); } else { - return (string) $expr->lt($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT)); + return (string)$expr->lt($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT)); } } @@ -639,13 +618,12 @@ public function exprGt(string $field, int $value, bool $gte = false, string $ali $expr = $this->expr(); if ($gte) { - return (string) $expr->gte($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT)); + return (string)$expr->gte($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT)); } else { - return (string) $expr->gt($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT)); + return (string)$expr->gt($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT)); } } - /** * @param string $field * @param string $value @@ -656,7 +634,6 @@ public function unlike(string $field, string $value, string $alias = '', bool $c $this->andWhere($this->exprUnlike($field, $value, $alias, $cs)); } - /** * @param string $field * @param string $value @@ -731,7 +708,6 @@ public function filterBitwise(string $field, int $flag, string $alias = ''): voi $this->andWhere($this->exprFilterBitwise($field, $flag, $alias)); } - /** * @param string $field * @param string $value @@ -747,15 +723,14 @@ public function exprUnlike(string $field, string $value, string $alias = '', boo $expr = $this->expr(); if ($cs) { - return (string) $expr->notLike($field, $this->createNamedParameter($value)); + return (string)$expr->notLike($field, $this->createNamedParameter($value)); } else { $func = $this->func(); - return (string) $expr->notLike($func->lower($field), $func->lower($this->createNamedParameter($value))); + return (string)$expr->notLike($func->lower($field), $func->lower($this->createNamedParameter($value))); } } - /** * @param string $field * @param string $value @@ -771,18 +746,17 @@ public function exprFilter(string $field, string $value, string $alias = '', boo $expr = $this->expr(); if ($value === '') { - return (string) $expr->nonEmptyString($field); + return (string)$expr->nonEmptyString($field); } if ($cs) { - return (string) $expr->neq($field, $this->createNamedParameter($value)); + return (string)$expr->neq($field, $this->createNamedParameter($value)); } else { $func = $this->func(); - return (string) $expr->neq($func->lower($field), $func->lower($this->createNamedParameter($value))); + return (string)$expr->neq($func->lower($field), $func->lower($this->createNamedParameter($value))); } } - /** * @param string $field * @param int $value @@ -797,10 +771,9 @@ public function exprFilterInt(string $field, int $value, string $alias = ''): st $expr = $this->expr(); - return (string) $expr->neq($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT)); + return (string)$expr->neq($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT)); } - /** * @param string $field * @param bool $value @@ -815,7 +788,7 @@ public function exprFilterBool(string $field, bool $value, string $alias = ''): $expr = $this->expr(); - return (string) $expr->neq($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_BOOL)); + return (string)$expr->neq($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_BOOL)); } /** @@ -828,7 +801,7 @@ public function exprFilterBool(string $field, bool $value, string $alias = ''): public function exprFilterEmpty( string $field, bool $norNull = false, - string $alias = '' + string $alias = '', ): ICompositeExpression { if ($this->getType() === DBALQueryBuilder::SELECT) { $field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field; @@ -854,7 +827,7 @@ public function exprFilterEmpty( public function exprFilterNull( string $field, bool $norEmpty = false, - string $alias = '' + string $alias = '', ): ICompositeExpression { if ($this->getType() === DBALQueryBuilder::SELECT) { $field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field; @@ -870,7 +843,6 @@ public function exprFilterNull( return $andX; } - /** * @param string $field * @param array $values @@ -883,7 +855,7 @@ public function exprFilterArray( string $field, array $values, string $alias = '', - bool $cs = true + bool $cs = true, ): ICompositeExpression { if ($this->getType() === DBALQueryBuilder::SELECT) { $field = (($alias === '') ? $this->getDefaultSelectAlias() : $alias) . '.' . $field; @@ -901,7 +873,6 @@ public function exprFilterArray( return $orX; } - /** * @param string $field * @param array $values @@ -916,10 +887,9 @@ public function exprFilterInArray(string $field, array $values, string $alias = $expr = $this->expr(); - return (string) $expr->notIn($field, $this->createNamedParameter($values, IQueryBuilder::PARAM_STR_ARRAY)); + return (string)$expr->notIn($field, $this->createNamedParameter($values, IQueryBuilder::PARAM_STR_ARRAY)); } - /** * @param string $field * @param int $flag @@ -934,13 +904,12 @@ public function exprFilterBitwise(string $field, int $flag, string $alias = ''): $expr = $this->expr(); - return (string) $expr->eq( + return (string)$expr->eq( $expr->bitwiseAnd($field, $flag), $this->createNamedParameter(0, IQueryBuilder::PARAM_INT) ); } - /** * @param string $object * @param array $params @@ -963,7 +932,6 @@ public function asItems(string $object, array $params = []): array { return $this->getRows([$this, 'parseSimpleSelectSql'], $object, $params); } - /** * @param string $field * @param array $params @@ -990,7 +958,6 @@ public function asItemsFromField(string $field, array $params = []): array { return $this->getRows([$this, 'parseSimpleSelectSql'], $field, $params); } - /** * @param array $data * @param ExtendedQueryBuilder $qb @@ -1004,7 +971,7 @@ private function parseSimpleSelectSql( array $data, ExtendedQueryBuilder $qb, string $object, - array $params + array $params, ): IQueryRow { $fromField = $this->get('modelFromField', $params); if ($fromField !== '') { @@ -1033,7 +1000,6 @@ private function parseSimpleSelectSql( return $item; } - /** * @param callable $method * @param string $object @@ -1054,7 +1020,6 @@ public function getRow(callable $method, string $object = '', array $params = [] return $method($data, $this, $object, $params); } - /** * @param callable $method * @param string $object @@ -1076,7 +1041,6 @@ public function getRows(callable $method, string $object = '', array $params = [ return $rows; } - /** * @param string $table * @param array $fields @@ -1087,7 +1051,7 @@ public function getRows(callable $method, string $object = '', array $params = [ public function generateSelect( string $table, array $fields, - string $alias = '' + string $alias = '', ): self { $selectFields = array_map( function (string $item) use ($alias) { @@ -1100,13 +1064,12 @@ function (string $item) use ($alias) { ); $this->select($selectFields) - ->from($table, $alias) - ->setDefaultSelectAlias($alias); + ->from($table, $alias) + ->setDefaultSelectAlias($alias); return $this; } - /** * @param array $fields * @param string $alias @@ -1119,7 +1082,7 @@ public function generateSelectAlias( array $fields, string $alias, string $prefix, - array $default = [] + array $default = [], ): self { $prefix = trim($prefix) . '_'; foreach ($default as $k => $v) { diff --git a/lib/Tools/Db/IQueryRow.php b/lib/Tools/Db/IQueryRow.php index 15e695b9..4d9292d5 100644 --- a/lib/Tools/Db/IQueryRow.php +++ b/lib/Tools/Db/IQueryRow.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Db; /** diff --git a/lib/Tools/Exceptions/ArrayNotFoundException.php b/lib/Tools/Exceptions/ArrayNotFoundException.php index 9d3b92d5..2cae82ce 100644 --- a/lib/Tools/Exceptions/ArrayNotFoundException.php +++ b/lib/Tools/Exceptions/ArrayNotFoundException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Exceptions; use Exception; diff --git a/lib/Tools/Exceptions/DateTimeException.php b/lib/Tools/Exceptions/DateTimeException.php index 08e6e425..af32641d 100644 --- a/lib/Tools/Exceptions/DateTimeException.php +++ b/lib/Tools/Exceptions/DateTimeException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Exceptions; use Exception; diff --git a/lib/Tools/Exceptions/InvalidItemException.php b/lib/Tools/Exceptions/InvalidItemException.php index 619e873c..5cd3f640 100644 --- a/lib/Tools/Exceptions/InvalidItemException.php +++ b/lib/Tools/Exceptions/InvalidItemException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Exceptions; use Exception; diff --git a/lib/Tools/Exceptions/InvalidOriginException.php b/lib/Tools/Exceptions/InvalidOriginException.php index 64dde0c8..f72be764 100644 --- a/lib/Tools/Exceptions/InvalidOriginException.php +++ b/lib/Tools/Exceptions/InvalidOriginException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Exceptions; use Exception; diff --git a/lib/Tools/Exceptions/ItemNotFoundException.php b/lib/Tools/Exceptions/ItemNotFoundException.php index 70d2d2b7..22a03708 100644 --- a/lib/Tools/Exceptions/ItemNotFoundException.php +++ b/lib/Tools/Exceptions/ItemNotFoundException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Exceptions; use Exception; diff --git a/lib/Tools/Exceptions/JsonNotRequestedException.php b/lib/Tools/Exceptions/JsonNotRequestedException.php index 8c241ec8..0db31665 100644 --- a/lib/Tools/Exceptions/JsonNotRequestedException.php +++ b/lib/Tools/Exceptions/JsonNotRequestedException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Exceptions; use Exception; diff --git a/lib/Tools/Exceptions/MalformedArrayException.php b/lib/Tools/Exceptions/MalformedArrayException.php index e0ce4856..61c73fb3 100644 --- a/lib/Tools/Exceptions/MalformedArrayException.php +++ b/lib/Tools/Exceptions/MalformedArrayException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Exceptions; use Exception; diff --git a/lib/Tools/Exceptions/RequestContentException.php b/lib/Tools/Exceptions/RequestContentException.php index 522abef0..9521a333 100644 --- a/lib/Tools/Exceptions/RequestContentException.php +++ b/lib/Tools/Exceptions/RequestContentException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Exceptions; use Exception; diff --git a/lib/Tools/Exceptions/RequestNetworkException.php b/lib/Tools/Exceptions/RequestNetworkException.php index d0ff30e8..3fc5bbd0 100644 --- a/lib/Tools/Exceptions/RequestNetworkException.php +++ b/lib/Tools/Exceptions/RequestNetworkException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Exceptions; use Exception; diff --git a/lib/Tools/Exceptions/RequestResultNotJsonException.php b/lib/Tools/Exceptions/RequestResultNotJsonException.php index 5390d470..3c167177 100644 --- a/lib/Tools/Exceptions/RequestResultNotJsonException.php +++ b/lib/Tools/Exceptions/RequestResultNotJsonException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Exceptions; use Exception; diff --git a/lib/Tools/Exceptions/RequestResultSizeException.php b/lib/Tools/Exceptions/RequestResultSizeException.php index c44e0667..7b922737 100644 --- a/lib/Tools/Exceptions/RequestResultSizeException.php +++ b/lib/Tools/Exceptions/RequestResultSizeException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Exceptions; use Exception; diff --git a/lib/Tools/Exceptions/RequestServerException.php b/lib/Tools/Exceptions/RequestServerException.php index 60d14904..a6186811 100644 --- a/lib/Tools/Exceptions/RequestServerException.php +++ b/lib/Tools/Exceptions/RequestServerException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Exceptions; use Exception; diff --git a/lib/Tools/Exceptions/RowNotFoundException.php b/lib/Tools/Exceptions/RowNotFoundException.php index 98a11f03..7453128e 100644 --- a/lib/Tools/Exceptions/RowNotFoundException.php +++ b/lib/Tools/Exceptions/RowNotFoundException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Exceptions; use Exception; diff --git a/lib/Tools/Exceptions/SignatoryException.php b/lib/Tools/Exceptions/SignatoryException.php index 7efe316d..6aed9281 100644 --- a/lib/Tools/Exceptions/SignatoryException.php +++ b/lib/Tools/Exceptions/SignatoryException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Exceptions; use Exception; diff --git a/lib/Tools/Exceptions/SignatureException.php b/lib/Tools/Exceptions/SignatureException.php index 9ca8824c..dc3d4cf7 100644 --- a/lib/Tools/Exceptions/SignatureException.php +++ b/lib/Tools/Exceptions/SignatureException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Exceptions; use Exception; diff --git a/lib/Tools/Exceptions/UnknownTypeException.php b/lib/Tools/Exceptions/UnknownTypeException.php index cc2dd9d0..be46ea1d 100644 --- a/lib/Tools/Exceptions/UnknownTypeException.php +++ b/lib/Tools/Exceptions/UnknownTypeException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Exceptions; use Exception; diff --git a/lib/Tools/Exceptions/WellKnownLinkNotFoundException.php b/lib/Tools/Exceptions/WellKnownLinkNotFoundException.php index d5c97095..e3971dea 100644 --- a/lib/Tools/Exceptions/WellKnownLinkNotFoundException.php +++ b/lib/Tools/Exceptions/WellKnownLinkNotFoundException.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Exceptions; use Exception; diff --git a/lib/Tools/IDeserializable.php b/lib/Tools/IDeserializable.php index 925aea5f..f552ca32 100644 --- a/lib/Tools/IDeserializable.php +++ b/lib/Tools/IDeserializable.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools; interface IDeserializable { diff --git a/lib/Tools/ISignedModel.php b/lib/Tools/ISignedModel.php index 3054d243..4acc1077 100644 --- a/lib/Tools/ISignedModel.php +++ b/lib/Tools/ISignedModel.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Some tools for myself. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools; interface ISignedModel { @@ -45,7 +43,6 @@ public function setSignature(string $signature): self; */ public function getSignature(): string; - /** * returns array/data to be signed to identify the model * diff --git a/lib/Tools/Model/NCRequest.php b/lib/Tools/Model/NCRequest.php index 3aaa0c4a..31d25d4b 100644 --- a/lib/Tools/Model/NCRequest.php +++ b/lib/Tools/Model/NCRequest.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,14 +27,12 @@ * */ - namespace OCA\Backup\Tools\Model; use OCP\Http\Client\IClient; class NCRequest extends Request { - /** @var IClient */ private $client; @@ -51,7 +48,6 @@ class NCRequest extends Request { /** @var NCRequestResult[] */ private $previousResults = []; - /** * @param IClient $client * @@ -70,7 +66,6 @@ public function getClient(): IClient { return $this->client; } - /** * @return array */ @@ -89,7 +84,6 @@ public function setClientOptions(array $clientOptions): self { return $this; } - /** * @return bool */ @@ -108,7 +102,6 @@ public function setLocalAddressAllowed(bool $allowed): self { return $this; } - /** * @return bool */ @@ -152,7 +145,6 @@ public function getAllResults(): array { return array_values(array_merge([$this->getResult()], $this->previousResults)); } - /** * @return array */ diff --git a/lib/Tools/Model/NCRequestResult.php b/lib/Tools/Model/NCRequestResult.php index 591ff0b3..036a924c 100644 --- a/lib/Tools/Model/NCRequestResult.php +++ b/lib/Tools/Model/NCRequestResult.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Model; use GuzzleHttp\Exception\BadResponseException; @@ -40,13 +38,11 @@ class NCRequestResult implements JsonSerializable { use TArrayTools; - public const TYPE_STRING = 0; public const TYPE_BINARY = 1; public const TYPE_JSON = 2; public const TYPE_XRD = 3; - /** @var int */ private $statusCode = 0; @@ -65,7 +61,6 @@ class NCRequestResult implements JsonSerializable { /** @var BadResponseException */ private $exception = null; - /** * NCRequestResult constructor. * @@ -86,7 +81,6 @@ public function __construct(?IResponse $response, ?BadResponseException $e = nul $this->generateMeta(); } - /** * @return int */ @@ -105,7 +99,6 @@ public function setStatusCode(int $statusCode): self { return $this; } - /** * @return array */ @@ -143,7 +136,6 @@ public function withinHeader(string $key, string $needle): bool { return false; } - /** * @param string $content * @@ -155,7 +147,6 @@ public function setContent(string $content): self { return $this; } - /** * @return string * @throws RequestContentException @@ -179,7 +170,6 @@ public function getAsArray(): array { return $this->contentAsArray; } - /** * @return string */ @@ -187,7 +177,6 @@ public function getBinary() { return $this->content; } - /** * @return int */ @@ -215,7 +204,6 @@ public function isContentType(int $type): bool { return ($this->contentType === $type); } - /** * */ @@ -272,7 +260,6 @@ private function generateContentAsArray(): void { } } - /** * @param BadResponseException $e * @@ -299,7 +286,6 @@ public function hasException(): bool { return (!is_null($this->exception)); } - /** * @return array */ diff --git a/lib/Tools/Model/NCSignatory.php b/lib/Tools/Model/NCSignatory.php index b802836e..c289a0b2 100644 --- a/lib/Tools/Model/NCSignatory.php +++ b/lib/Tools/Model/NCSignatory.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Model; use JsonSerializable; @@ -38,11 +36,9 @@ class NCSignatory implements IDeserializable, JsonSerializable { use TArrayTools; - public const SHA256 = 'sha256'; public const SHA512 = 'sha512'; - /** @var string */ private $instance = ''; @@ -67,7 +63,6 @@ class NCSignatory implements IDeserializable, JsonSerializable { /** @var string */ private $algorithm = self::SHA256; - /** * NC22Signatory constructor. * @@ -77,7 +72,6 @@ public function __construct(string $id = '') { $this->id = self::removeFragment($id); } - /** * @param string $instance * @@ -96,7 +90,6 @@ public function getInstance(): string { return $this->instance; } - /** * @return array */ @@ -116,7 +109,6 @@ public function setOrigData(array $data): self { return $this; } - /** * @return string */ @@ -135,7 +127,6 @@ public function setId(string $id): self { return $this; } - /** * @param string $keyId * @@ -154,7 +145,6 @@ public function getKeyId(): string { return $this->keyId; } - /** * @param string $keyOwner * @@ -173,7 +163,6 @@ public function getKeyOwner(): string { return $this->keyOwner; } - /** * @param string $publicKey * @@ -224,7 +213,6 @@ public function hasPrivateKey(): bool { return ($this->privateKey !== ''); } - /** * @param string $algorithm * @@ -243,7 +231,6 @@ public function getAlgorithm(): string { return $this->algorithm; } - /** * @param array $data * @@ -261,15 +248,14 @@ public function import(array $data): IDeserializable { return $this; } - /** * @return array */ public function jsonSerialize(): array { return [ 'id' => $this->getId(), - 'publicKey' => - [ + 'publicKey' + => [ 'id' => $this->getKeyId(), 'owner' => $this->getKeyOwner(), 'publicKeyPem' => $this->getPublicKey() @@ -277,7 +263,6 @@ public function jsonSerialize(): array { ]; } - /** * @param string $id * diff --git a/lib/Tools/Model/NCSignedRequest.php b/lib/Tools/Model/NCSignedRequest.php index 95b2eba3..4d907af7 100644 --- a/lib/Tools/Model/NCSignedRequest.php +++ b/lib/Tools/Model/NCSignedRequest.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Model; use JsonSerializable; @@ -36,7 +34,6 @@ class NCSignedRequest implements JsonSerializable { - /** @var string */ private $body = ''; @@ -70,12 +67,10 @@ class NCSignedRequest implements JsonSerializable { /** @var NCSignatory */ private $signatory; - public function __construct(string $body = '') { $this->setBody($body); } - /** * IRequest of the incoming request * incoming @@ -97,7 +92,6 @@ public function setIncomingRequest(IRequest $request): self { return $this; } - /** * NCRequest of the outgoing request * outgoing @@ -119,7 +113,6 @@ public function getOutgoingRequest(): NCRequest { return $this->outgoingRequest; } - /** * Body content of the request * incoming/outgoing @@ -137,12 +130,11 @@ public function getBody(): string { */ public function setBody(string $body): self { $this->body = $body; - $this->setDigest('SHA-256=' . base64_encode(hash("sha256", utf8_encode($body), true))); + $this->setDigest('SHA-256=' . base64_encode(hash('sha256', utf8_encode($body), true))); return $this; } - /** * Timestamp of the request * incoming (outgoing ?) @@ -164,7 +156,6 @@ public function setTime(int $time): self { return $this; } - /** * Origin of the request, based on the keyId * incoming @@ -186,7 +177,6 @@ public function setOrigin(string $origin): self { return $this; } - /** * @return string */ @@ -205,7 +195,6 @@ public function setDigest(string $digest): self { return $this; } - /** * Data from the 'Signature' header * incoming/outgoing @@ -227,7 +216,6 @@ public function setSignatureHeader(SimpleDataStore $signatureHeader): self { return $this; } - /** * _Clear_ value of the Signature. * incoming/outgoing @@ -252,7 +240,6 @@ public function getClearSignature(): string { return $this->clearSignature; } - /** * _Signed_ value of the signature. * /!\ base64_encoded, not RAW /!\ @@ -276,7 +263,6 @@ public function getSignedSignature(): string { return $this->signedSignature; } - /** * Host/Address to be used in the signature. * incoming/outgoing @@ -301,7 +287,6 @@ public function getHost(): string { return $this->host; } - /** * Signatory used to sign the request * incoming/outgoing @@ -326,7 +311,6 @@ public function hasSignatory(): bool { return ($this->signatory !== null); } - /** * @return array */ diff --git a/lib/Tools/Model/NCWebfinger.php b/lib/Tools/Model/NCWebfinger.php index c2297fdf..1f2d1210 100644 --- a/lib/Tools/Model/NCWebfinger.php +++ b/lib/Tools/Model/NCWebfinger.php @@ -1,4 +1,5 @@ get($key, $this->properties); } - /** * @return NCWellKnownLink[] */ diff --git a/lib/Tools/Model/NCWellKnownLink.php b/lib/Tools/Model/NCWellKnownLink.php index 614477a7..27147f91 100644 --- a/lib/Tools/Model/NCWellKnownLink.php +++ b/lib/Tools/Model/NCWellKnownLink.php @@ -1,4 +1,5 @@ setProperties($this->getArray('properties', $json)); } - /** * @return string */ @@ -110,7 +106,6 @@ public function setRel(string $rel): self { return $this; } - /** * @return string */ @@ -129,7 +124,6 @@ public function setType(string $type): self { return $this; } - /** * @return string */ @@ -148,7 +142,6 @@ public function setHref(string $href): self { return $this; } - /** * @return array */ @@ -176,7 +169,6 @@ public function getTitle(string $key): string { return $this->get($key, $this->properties); } - /** * @return array */ @@ -204,7 +196,6 @@ public function getProperty(string $key): string { return $this->get($key, $this->properties); } - /** * @return array */ diff --git a/lib/Tools/Model/Request.php b/lib/Tools/Model/Request.php index f267685a..186e1bc2 100644 --- a/lib/Tools/Model/Request.php +++ b/lib/Tools/Model/Request.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Model; use JsonSerializable; @@ -37,17 +35,14 @@ class Request implements JsonSerializable { use TArrayTools; - public const TYPE_GET = 0; public const TYPE_POST = 1; public const TYPE_PUT = 2; public const TYPE_DELETE = 3; - public const QS_VAR_DUPLICATE = 1; public const QS_VAR_ARRAY = 2; - /** @var string */ private $protocol = ''; @@ -108,7 +103,6 @@ class Request implements JsonSerializable { /** @var string */ private $contentType = ''; - /** * Request constructor. * @@ -122,7 +116,6 @@ public function __construct(string $url = '', int $type = 0, bool $binary = fals $this->binary = $binary; } - /** * @param string $protocol * @@ -170,7 +163,6 @@ public function setUsedProtocol(string $protocol): Request { return $this; } - /** * @return string * @deprecated - 19 - use getHost(); @@ -209,7 +201,6 @@ public function setHost(string $host): Request { return $this; } - /** * @return int */ @@ -228,7 +219,6 @@ public function setPort(int $port): Request { return $this; } - /** * @param string $instance * @@ -250,7 +240,6 @@ public function setInstance(string $instance): Request { return $this; } - /** * @return string */ @@ -263,7 +252,6 @@ public function getInstance(): string { return $instance; } - /** * @param string $url * @@ -321,7 +309,6 @@ public function isBinary(): bool { return $this->binary; } - /** * @param bool $verifyPeer * @@ -340,7 +327,6 @@ public function isVerifyPeer(): bool { return $this->verifyPeer; } - /** * @param bool $httpErrorsAllowed * @@ -359,7 +345,6 @@ public function isHttpErrorsAllowed(): bool { return $this->httpErrorsAllowed; } - /** * @param bool $followLocation * @@ -378,7 +363,6 @@ public function isFollowLocation(): bool { return $this->followLocation; } - /** * @return string * @deprecated - 19 - use getParametersUrl() + addParam() @@ -414,7 +398,6 @@ public function getParametersUrl(): string { return $url; } - /** * @return string */ @@ -422,7 +405,6 @@ public function getPath(): string { return $this->baseUrl . $this->url; } - /** * @return string * @deprecated - 19 - use getPath() @@ -431,7 +413,6 @@ public function getUrl(): string { return $this->getPath(); } - /** * @return string */ @@ -441,7 +422,6 @@ public function getCompleteUrl(): string { return $this->getUsedProtocol() . '://' . $this->getHost() . $port . $this->getParametersUrl(); } - /** * @return int */ @@ -449,7 +429,6 @@ public function getType(): int { return $this->type; } - public function addHeader($key, $value): Request { $header = $this->get($key, $this->headers); if ($header !== '') { @@ -481,7 +460,6 @@ public function setHeaders(array $headers): Request { return $this; } - /** * @return array */ @@ -500,7 +478,6 @@ public function setCookies(array $cookies): Request { return $this; } - /** * @param int $queryStringType * @@ -519,7 +496,6 @@ public function getQueryStringType(): int { return $this->queryStringType; } - /** * @return array */ @@ -527,7 +503,6 @@ public function getData(): array { return $this->data; } - /** * @param array $data * @@ -539,7 +514,6 @@ public function setData(array $data): Request { return $this; } - /** * @param string $data * @@ -551,7 +525,6 @@ public function setDataJson(string $data): Request { return $this; } - /** * @param JsonSerializable $data * @@ -563,7 +536,6 @@ public function setDataSerialize(JsonSerializable $data): Request { return $this; } - /** * @return array */ @@ -582,7 +554,6 @@ public function setParams(array $params): Request { return $this; } - /** * @param string $k * @param string $v @@ -595,7 +566,6 @@ public function addParam(string $k, string $v): Request { return $this; } - /** * @param string $k * @param int $v @@ -608,7 +578,6 @@ public function addParamInt(string $k, int $v): Request { return $this; } - /** * @param string $k * @param string $v @@ -621,7 +590,6 @@ public function addData(string $k, string $v): Request { return $this; } - /** * @param string $k * @param int $v @@ -634,7 +602,6 @@ public function addDataInt(string $k, int $v): Request { return $this; } - /** * @return string */ @@ -670,7 +637,6 @@ public function getUrlParams(): string { ); } - /** * @param int $type * @@ -684,7 +650,6 @@ public function getQueryString(): string { switch ($this->getQueryStringType()) { case self::QS_VAR_ARRAY: return '?' . http_build_query($this->getParams()); - case self::QS_VAR_DUPLICATE: default: return '?' . preg_replace( @@ -693,7 +658,6 @@ public function getQueryString(): string { } } - /** * @return int */ @@ -712,7 +676,6 @@ public function setTimeout(int $timeout): Request { return $this; } - /** * @return string */ @@ -731,7 +694,6 @@ public function setUserAgent(string $userAgent): Request { return $this; } - /** * @return int */ @@ -750,7 +712,6 @@ public function setResultCode(int $resultCode): Request { return $this; } - /** * @return string */ @@ -769,7 +730,6 @@ public function setContentType(string $contentType): Request { return $this; } - /** * @return array */ @@ -793,7 +753,6 @@ public function jsonSerialize(): array { ]; } - /** * @param string $type * @@ -814,7 +773,6 @@ public static function type(string $type): int { return 0; } - public static function method(int $type): string { switch ($type) { case self::TYPE_GET: diff --git a/lib/Tools/Model/SimpleDataStore.php b/lib/Tools/Model/SimpleDataStore.php index 574614f7..d195930e 100644 --- a/lib/Tools/Model/SimpleDataStore.php +++ b/lib/Tools/Model/SimpleDataStore.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Model; use JsonSerializable; @@ -42,11 +40,9 @@ class SimpleDataStore implements JsonSerializable { use TArrayTools; - /** @var array */ private $data; - /** * SimpleDataStore constructor. * @@ -64,7 +60,6 @@ public function default(array $default = []): void { $this->data = array_merge($default, $this->data); } - /** * @param string $key * @param string $value @@ -115,7 +110,6 @@ public function a(string $key, string $value): self { return $this; } - /** * @param string $key * @param int $value @@ -153,7 +147,6 @@ public function aInt(string $key, int $value): self { return $this; } - /** * @param string $key * @param bool $value @@ -191,7 +184,6 @@ public function aBool(string $key, bool $value): self { return $this; } - /** * @param string $key * @param array $values @@ -229,7 +221,6 @@ public function aArray(string $key, array $values): self { return $this; } - /** * @param string $key * @param JsonSerializable $value @@ -242,7 +233,6 @@ public function sObj(string $key, JsonSerializable $value): self { return $this; } - /** * @param string $key * @param string $class @@ -260,7 +250,6 @@ public function gObjs(string $key, string $class = ''): array { return array_filter($result); } - /** * @param string $key * @param string $class @@ -317,7 +306,6 @@ public function aObj(string $key, JsonSerializable $value): self { return $this; } - /** * @param string $key * @param SimpleDataStore $data @@ -355,7 +343,6 @@ public function gData(string $key): SimpleDataStore { return new SimpleDataStore($this->getArray($key, $this->data)); } - /** * @param string $key * @@ -370,7 +357,6 @@ public function gItem(string $key) { return $this->data[$key]; } - /** * @return array */ @@ -389,7 +375,6 @@ public function sAll(array $data): self { return $this; } - public function keys(): array { return array_keys($this->data); } @@ -403,7 +388,6 @@ public function hasKey(string $key): bool { return (array_key_exists($key, $this->data)); } - /** * @param array $keys * @@ -426,7 +410,6 @@ public function hasKeys(array $keys, bool $must = false): bool { return true; } - /** * @param array $keys * @param bool $must @@ -449,7 +432,6 @@ public function haveKey(string $key): bool { return $this->hasKey($key); } - /** * @param string $json * diff --git a/lib/Tools/Model/TreeNode.php b/lib/Tools/Model/TreeNode.php index babca354..b635cfdc 100644 --- a/lib/Tools/Model/TreeNode.php +++ b/lib/Tools/Model/TreeNode.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,12 +27,10 @@ * */ - namespace OCA\Backup\Tools\Model; class TreeNode { - /** @var self[] */ private $children = []; @@ -43,7 +40,6 @@ class TreeNode { /** @var SimpleDataStore */ private $item; - /** @var self */ private $currentChild; @@ -53,7 +49,6 @@ class TreeNode { /** @var bool */ private $splited = false; - /** * NC22TreeNode constructor. * @@ -76,7 +71,6 @@ public function isRoot(): bool { return (is_null($this->parent)); } - /** * @param array $children * @@ -99,7 +93,6 @@ public function addChild(TreeNode $child): self { return $this; } - /** * @return SimpleDataStore */ @@ -109,7 +102,6 @@ public function getItem(): SimpleDataStore { return $this->item; } - /** * @return TreeNode */ @@ -117,7 +109,6 @@ public function getParent(): TreeNode { return $this->parent; } - /** * @return $this */ @@ -129,7 +120,6 @@ public function getRoot(): TreeNode { return $this->getParent()->getRoot(); } - /** * @return TreeNode[] */ @@ -141,7 +131,6 @@ public function getPath(): array { return array_merge($this->parent->getPath(), [$this]); } - /** * @return int */ @@ -153,7 +142,6 @@ public function getLevel(): int { return $this->getParent()->getLevel() + 1; } - /** * @return TreeNode|null */ @@ -177,7 +165,6 @@ public function current(): ?TreeNode { return $this->next(); } - /** * @return TreeNode */ @@ -194,7 +181,6 @@ public function haveNext(): bool { return !empty($this->children); } - /** * @return bool */ diff --git a/lib/Tools/Traits/TArrayTools.php b/lib/Tools/Traits/TArrayTools.php index ced17987..17f4524f 100644 --- a/lib/Tools/Traits/TArrayTools.php +++ b/lib/Tools/Traits/TArrayTools.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Traits; use Exception; @@ -46,7 +44,6 @@ trait TArrayTools { public static $TYPE_INTEGER = 'Integer'; public static $TYPE_SERIALIZABLE = 'Serializable'; - /** * @param string $k * @param array $arr @@ -80,7 +77,6 @@ protected function get(string $k, array $arr, string $default = ''): string { return (string)$arr[$k]; } - /** * @param string $k * @param array $arr @@ -114,7 +110,6 @@ protected function getInt(string $k, array $arr, int $default = 0): int { return intval($arr[$k]); } - /** * @param string $k * @param array $arr @@ -148,7 +143,6 @@ protected function getFloat(string $k, array $arr, float $default = 0): float { return intval($arr[$k]); } - /** * @param string $k * @param array $arr @@ -190,7 +184,6 @@ protected function getBool(string $k, array $arr, bool $default = false): bool { return $default; } - /** * @param string $k * @param array $arr @@ -215,7 +208,6 @@ protected function getObj(string $k, array $arr, ?JsonSerializable $default = nu return $arr[$k]; } - /** * @param string $k * @param array $arr @@ -258,7 +250,6 @@ protected function getArray(string $k, array $arr, array $default = []): array { return $r; } - /** * @param string $k * @param array $arr @@ -287,7 +278,6 @@ public function validKey(string $k, array $arr): bool { return false; } - /** * @param string $k * @param array $arr @@ -314,7 +304,6 @@ protected function getList(string $k, array $arr, array $import, array $default return $r; } - /** * @param string $k * @param string $value @@ -337,7 +326,6 @@ protected function extractArray(string $k, string $value, array $list) { throw new ArrayNotFoundException(); } - /** * @param string $key * @param array $arr @@ -393,7 +381,6 @@ public function typeOf(string $key, array $arr, bool $root = true): string { throw new ItemNotFoundException(); } - /** * @param array $keys * @param array $arr @@ -410,7 +397,6 @@ protected function mustContains(array $keys, array $arr) { } } - /** * @param array $arr */ diff --git a/lib/Tools/Traits/TAsync.php b/lib/Tools/Traits/TAsync.php index cc29458d..48df7332 100644 --- a/lib/Tools/Traits/TAsync.php +++ b/lib/Tools/Traits/TAsync.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Traits; use JsonSerializable; @@ -36,11 +34,9 @@ trait TAsync { use TNCSetup; - /** @var string */ public static $SETUP_TIME_LIMIT = 'async_time_limit'; - /** * Hacky way to async the rest of the process without keeping client on hold. * diff --git a/lib/Tools/Traits/TConsoleTree.php b/lib/Tools/Traits/TConsoleTree.php index 4d5ebf44..ec01b7b1 100644 --- a/lib/Tools/Traits/TConsoleTree.php +++ b/lib/Tools/Traits/TConsoleTree.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Traits; use OCA\Backup\Tools\Model\TreeNode; @@ -36,7 +34,6 @@ trait TConsoleTree { - /** * @param TreeNode $root * @param callable $method @@ -49,7 +46,7 @@ public function drawTree( 'height' => 1, 'node-spacing' => 0, 'item-spacing' => 0, - ] + ], ): void { $config = array_merge( [ diff --git a/lib/Tools/Traits/TDeserialize.php b/lib/Tools/Traits/TDeserialize.php index bc7c7832..2f16a2e4 100644 --- a/lib/Tools/Traits/TDeserialize.php +++ b/lib/Tools/Traits/TDeserialize.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Traits; use JsonSerializable; @@ -37,7 +35,6 @@ trait TDeserialize { - /** * @param JsonSerializable $model * @@ -56,7 +53,6 @@ public function serializeArray(array $data): array { return json_decode(json_encode($data), true); } - /** * @param array $data * @param string $class @@ -76,7 +72,6 @@ public function deserialize(array $data, string $class): IDeserializable { return $item; } - /** * @param array $data * @param string $class @@ -104,7 +99,6 @@ public function deserializeArray(array $data, string $class, bool $associative = return $arr; } - /** * @param string $json * @param string $class @@ -126,7 +120,6 @@ public function deserializeList(string $json, string $class): array { return $arr; } - /** * @param string $json * @param string $class diff --git a/lib/Tools/Traits/TFileTools.php b/lib/Tools/Traits/TFileTools.php index b328dd8e..fb26aa8c 100644 --- a/lib/Tools/Traits/TFileTools.php +++ b/lib/Tools/Traits/TFileTools.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Some tools for myself. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Traits; trait TFileTools { diff --git a/lib/Tools/Traits/TNCController.php b/lib/Tools/Traits/TNCController.php index d10b785a..45222e6a 100644 --- a/lib/Tools/Traits/TNCController.php +++ b/lib/Tools/Traits/TNCController.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Traits; use OC; @@ -54,7 +52,7 @@ trait TNCController { public function publicPageJsonLimited(): void { if (!$this->jsonRequested()) { if (!OC::$server->get(IUserSession::class) - ->isLoggedIn()) { + ->isLoggedIn()) { throw new NotLoggedInException(); } @@ -62,7 +60,6 @@ public function publicPageJsonLimited(): void { } } - /** * @return bool */ @@ -76,7 +73,6 @@ public function jsonRequested(): bool { )); } - /** * @param array $needles * @@ -95,7 +91,6 @@ public function areWithinAcceptHeader(array $needles): bool { return false; } - /** * @param string $header * diff --git a/lib/Tools/Traits/TNCLocalSignatory.php b/lib/Tools/Traits/TNCLocalSignatory.php index 5d67495a..773f4942 100644 --- a/lib/Tools/Traits/TNCLocalSignatory.php +++ b/lib/Tools/Traits/TNCLocalSignatory.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Traits; use OC; @@ -41,7 +39,6 @@ trait TNCLocalSignatory { public static $SIGNATORIES_APP = 'signatories'; - /** * @param NCSignatory $signatory * @param bool $generate @@ -58,9 +55,9 @@ public function fillSimpleSignatory(NCSignatory $signatory, bool $generate = fal $sign = $this->getArray($signatory->getId(), $signatories); if (!empty($sign)) { $signatory->setKeyId($this->get('keyId', $sign)) - ->setKeyOwner($this->get('keyOwner', $sign)) - ->setPublicKey($this->get('publicKey', $sign)) - ->setPrivateKey($this->get('privateKey', $sign)); + ->setKeyOwner($this->get('keyOwner', $sign)) + ->setPublicKey($this->get('publicKey', $sign)) + ->setPrivateKey($this->get('privateKey', $sign)); return; } @@ -72,7 +69,6 @@ public function fillSimpleSignatory(NCSignatory $signatory, bool $generate = fal $this->createSimpleSignatory($signatory); } - /** * @param NCSignatory $signatory */ @@ -82,8 +78,8 @@ public function createSimpleSignatory(NCSignatory $signatory): void { $signatory->setKeyOwner($signatory->getId()); $this->generateKeys($signatory); - $signatories = - json_decode(OC::$server->get(IConfig::class)->getAppValue($app, 'key_pairs', '[]'), true); + $signatories + = json_decode(OC::$server->get(IConfig::class)->getAppValue($app, 'key_pairs', '[]'), true); $signatories[$signatory->getId()] = [ 'keyId' => $signatory->getKeyId(), 'keyOwner' => $signatory->getKeyOwner(), @@ -94,7 +90,6 @@ public function createSimpleSignatory(NCSignatory $signatory): void { OC::$server->get(IConfig::class)->setAppValue($app, 'key_pairs', json_encode($signatories)); } - /** * @param NCSignatory $signatory */ diff --git a/lib/Tools/Traits/TNCLogger.php b/lib/Tools/Traits/TNCLogger.php index 7b93bf3d..45a8b4e4 100644 --- a/lib/Tools/Traits/TNCLogger.php +++ b/lib/Tools/Traits/TNCLogger.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Traits; use Exception; @@ -40,7 +38,6 @@ trait TNCLogger { use TNCSetup; - public static $EMERGENCY = 4; public static $ALERT = 3; public static $CRITICAL = 3; @@ -50,7 +47,6 @@ trait TNCLogger { public static $INFO = 1; public static $DEBUG = 0; - /** * @param Throwable $t * @param array $serializable @@ -71,17 +67,16 @@ public function throwable(Throwable $t, int $level = 3, array $serializable = [] } $this->logger() - ->log( - $level, - $message, - [ - 'app' => $this->setup('app'), - 'exception' => $t - ] - ); + ->log( + $level, + $message, + [ + 'app' => $this->setup('app'), + 'exception' => $t + ] + ); } - /** * @param Exception $e * @param array $serializable @@ -111,17 +106,16 @@ public function exception(Exception $e, $level = 3, array $serializable = []): v } $this->logger() - ->log( - $level, - $message, - [ - 'app' => $this->setup('app'), - 'exception' => $e - ] - ); + ->log( + $level, + $message, + [ + 'app' => $this->setup('app'), + 'exception' => $e + ] + ); } - /** * @param string $message * @param bool $trace @@ -168,7 +162,6 @@ public function debug(string $message, array $serializable = []): void { $this->log($debugLevel, $message, ($this->appConfig('debug_trace') === '1'), $serializable); } - /** * @param int $level * @param string $message @@ -184,10 +177,9 @@ public function log(int $level, string $message, bool $trace = false, array $ser } $this->logger() - ->log($level, $message, $opts); + ->log($level, $message, $opts); } - /** * @return LoggerInterface */ diff --git a/lib/Tools/Traits/TNCRequest.php b/lib/Tools/Traits/TNCRequest.php index 5f2cda3e..c8ad178c 100644 --- a/lib/Tools/Traits/TNCRequest.php +++ b/lib/Tools/Traits/TNCRequest.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Traits; use Exception; @@ -44,14 +42,12 @@ trait TNCRequest { use TNCLogger; - /** * @param int $size */ public function setMaxDownloadSize(int $size) { } - /** * @param NCRequest $request * @@ -65,7 +61,6 @@ public function retrieveJson(NCRequest $request): array { return $requestResult->getAsArray(); } - /** * @param NCRequest $request * @param bool $exceptionOnIssue @@ -75,7 +70,7 @@ public function retrieveJson(NCRequest $request): array { public function doRequest(NCRequest $request, bool $exceptionOnIssue = true): void { $request->setClient( $this->clientService() - ->newClient() + ->newClient() ); $this->generationClientOptions($request); @@ -101,7 +96,6 @@ public function doRequest(NCRequest $request, bool $exceptionOnIssue = true): vo } } - /** * @return IClientService */ @@ -113,7 +107,6 @@ public function clientService(): IClientService { } } - /** * @param NCRequest $request */ @@ -151,7 +144,6 @@ private function generationClientOptions(NCRequest $request) { $request->setClientOptions($options); } - /** * @param NCRequest $request * diff --git a/lib/Tools/Traits/TNCSetup.php b/lib/Tools/Traits/TNCSetup.php index 7cd6de57..a09a4519 100644 --- a/lib/Tools/Traits/TNCSetup.php +++ b/lib/Tools/Traits/TNCSetup.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Traits; use OC; @@ -37,11 +35,9 @@ trait TNCSetup { use TArrayTools; - /** @var array */ private $_setup = []; - /** * @param string $key * @param string $value diff --git a/lib/Tools/Traits/TNCSignatory.php b/lib/Tools/Traits/TNCSignatory.php index 4324e470..a6b886f1 100644 --- a/lib/Tools/Traits/TNCSignatory.php +++ b/lib/Tools/Traits/TNCSignatory.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Traits; use OCA\Backup\Tools\Exceptions\InvalidOriginException; @@ -42,7 +40,6 @@ trait TNCSignatory { use TNCRequest; - /** * return Signatory by its Id from cache or from direct request. * Should be overwritten. @@ -64,7 +61,6 @@ public function retrieveSignatory(string $keyId, bool $refresh = false): NCSigna return $signatory; } - /** * @param NCSignatory $signatory * @param string $keyId @@ -77,7 +73,7 @@ public function downloadSignatory( NCSignatory $signatory, string $keyId = '', array $params = [], - ?NCRequest $request = null + ?NCRequest $request = null, ): void { if (is_null($request)) { $request = new NCRequest(); @@ -97,7 +93,6 @@ public function downloadSignatory( } } - /** * @param NCSignatory $signatory * @param array $json @@ -107,7 +102,7 @@ public function downloadSignatory( */ public function updateSignatory(NCSignatory $signatory, array $json, string $keyId = ''): void { $signatory->setOrigData($json) - ->import($json); + ->import($json); if ($keyId === '') { $keyId = $signatory->getKeyId(); @@ -126,7 +121,6 @@ public function updateSignatory(NCSignatory $signatory, array $json, string $key } } - /** * @param string $keyId * @@ -142,7 +136,6 @@ public function getKeyOrigin(string $keyId) { throw new InvalidOriginException('cannot retrieve origin from ' . $keyId); } - /** * @param NCSignatory $signatory * @param string $digest @@ -153,7 +146,7 @@ public function generateKeys( NCSignatory $signatory, string $digest = 'rsa', int $bits = 2048, - int $type = OPENSSL_KEYTYPE_RSA + int $type = OPENSSL_KEYTYPE_RSA, ) { $res = openssl_pkey_new( [ @@ -170,7 +163,6 @@ public function generateKeys( $signatory->setPrivateKey($privateKey); } - /** * @param string $clear * @param NCSignatory $signatory @@ -189,7 +181,6 @@ public function signString(string $clear, NCSignatory $signatory): string { return base64_encode($signed); } - /** * @param ISignedModel $model * @param NCSignatory $signatory @@ -202,7 +193,6 @@ public function signModel(ISignedModel $model, NCSignatory $signatory): void { $model->setSignature($signature); } - /** * @param string $clear * @param string $signed @@ -215,7 +205,7 @@ public function verifyString( string $clear, string $signed, string $publicKey, - string $algo = NCSignatory::SHA256 + string $algo = NCSignatory::SHA256, ) { if (openssl_verify($clear, base64_decode($signed), $publicKey, $algo) !== 1) { throw new SignatureException('signature issue'); @@ -232,7 +222,7 @@ public function verifyString( public function verifyModel( ISignedModel $model, string $publicKey, - string $algo = NCSignatory::SHA256 + string $algo = NCSignatory::SHA256, ): void { $string = json_encode($model->signedData()); $this->verifyString($string, $model->getSignature(), $publicKey, $algo); diff --git a/lib/Tools/Traits/TNCWellKnown.php b/lib/Tools/Traits/TNCWellKnown.php index d51ade58..b58af8d3 100644 --- a/lib/Tools/Traits/TNCWellKnown.php +++ b/lib/Tools/Traits/TNCWellKnown.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Traits; use OCA\Backup\Tools\Exceptions\RequestNetworkException; @@ -43,7 +41,6 @@ trait TNCWellKnown { public static $WEBFINGER = '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/.well-known/webfinger'; - /** * @param string $host * @param string $subject @@ -67,7 +64,6 @@ public function getResourceData(string $host, string $subject, string $rel): Sim return new SimpleDataStore($data); } - /** * @param string $host * @param string $subject @@ -81,7 +77,6 @@ public function getLink(string $host, string $subject, string $rel): NCWellKnown return $this->extractLink($rel, $this->getWebfinger($host, $subject)); } - /** * @param string $host * @param string $subject @@ -108,7 +103,6 @@ public function getWebfinger(string $host, string $subject, string $rel = ''): N return new NCWebfinger($result); } - /** * @param string $rel * @param NCWebfinger $webfinger diff --git a/lib/Tools/Traits/TStringTools.php b/lib/Tools/Traits/TStringTools.php index ad6648c7..40ce6ee5 100644 --- a/lib/Tools/Traits/TStringTools.php +++ b/lib/Tools/Traits/TStringTools.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Tools\Traits; use DateTime; @@ -37,7 +35,6 @@ trait TStringTools { use TArrayTools; - /** * @param int $length * @@ -58,7 +55,6 @@ protected function token(int $length = 15): string { return $str; } - /** * Generate uuid: 2b5a7a87-8db1-445f-a17b-405790f91c80 * @@ -84,7 +80,6 @@ protected function uuid(int $length = 0): string { return $uuid; } - /** * @param string $line * @param int $length @@ -124,7 +119,6 @@ protected function commonPart(string $str1, string $str2, bool $cs = true): stri return substr($str1, 0, $i); } - /** * @param string $line * @param array $params @@ -140,7 +134,6 @@ protected function feedStringWithParams(string $line, array $params): string { return $line; } - /** * @param int $words * @@ -155,7 +148,6 @@ public function generateRandomSentence(int $words = 5): string { return implode(' ', $sentence); } - /** * @param int $length * @@ -174,7 +166,6 @@ public function generateRandomWord(int $length = 8): string { return implode('', $word); } - /** * @param int $bytes * @@ -191,7 +182,6 @@ public function humanReadable(int $bytes): string { return round($bytes / pow(1024, $e), 2) . ' ' . $s[$e]; } - /** * @param int $first * @param int $second @@ -204,7 +194,7 @@ public function getDateDiff( int $first, int $second = 0, bool $short = false, - array $words = [] + array $words = [], ): string { if ($second === 0) { $first = time() - $first; @@ -249,10 +239,10 @@ public function getDateDiff( } return $f->diff($s)->format( - '%a ' . $days . - ', %h ' . $hours . - ', %i ' . $minutes . - ' and %s ' . $seconds + '%a ' . $days + . ', %h ' . $hours + . ', %i ' . $minutes + . ' and %s ' . $seconds ); } } diff --git a/lib/Wrappers/AppDataRootWrapper.php b/lib/Wrappers/AppDataRootWrapper.php index 2808fce9..6c6737de 100644 --- a/lib/Wrappers/AppDataRootWrapper.php +++ b/lib/Wrappers/AppDataRootWrapper.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup\Wrappers; use OC; @@ -55,21 +53,18 @@ */ class AppDataRootWrapper { - /** @var ISimpleRoot */ private $simpleRoot; /** @var ExternalFolder */ private $externalFolder; - /** * */ public function __construct() { } - /** * @param ISimpleRoot $simpleRoot * @@ -88,7 +83,6 @@ public function getSimpleRoot(): ISimpleRoot { return $this->simpleRoot; } - /** * @param ExternalFolder $externalFolder * @@ -107,7 +101,6 @@ public function getExternalFolder(): ExternalFolder { return $this->externalFolder; } - /** * @return bool */ @@ -115,7 +108,6 @@ public function isSimpleRoot(): bool { return !is_null($this->simpleRoot); } - /** * @return array */ @@ -152,7 +144,6 @@ function (ISimpleFolder $folder): string { } } - /** * @return Folder * @throws NotFoundException @@ -183,7 +174,6 @@ public function getNode(string $path): Node { return $this->getRoot()->get($path); } - /** * @param string $path * @@ -194,7 +184,6 @@ public function newFile(string $path): File { return $this->getRoot()->newFile($path, ''); } - /** * @param string $path * @@ -224,7 +213,6 @@ public function getFolder(string $path): ISimpleFolder { return new SimpleFolder($folder); } - /** * @param string $path * @@ -259,7 +247,6 @@ public function newFolder(string $path): ISimpleFolder { return new SimpleFolder($folder); } - /** * based on OC\Files\AppData\AppData::getAppDataFolderName() which is private. * diff --git a/restore.php b/restore.php index f7c1777b..0465480a 100644 --- a/restore.php +++ b/restore.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - namespace OCA\Backup; use Composer\Autoload\ClassLoader; @@ -46,7 +44,7 @@ use ZipArchive; echo "\n" . 'At this moment, this script will not works. Sorry.' . "\n"; -echo 'Please follow online documentation to restore your backup.'. "\n\n"; +echo 'Please follow online documentation to restore your backup.' . "\n\n"; exit(); @@ -57,7 +55,6 @@ exit(); } - /** * init few stuff. */ @@ -66,7 +63,6 @@ $verbose = true; } - /** * loading libs. */ @@ -112,7 +108,6 @@ loadClasses($classes, $mockup); - /** * generate Container. */ @@ -124,7 +119,6 @@ $container->registerInterface(IConfig::class, Config::class); $container->registerInterface(ILogger::class, Logger::class); - /** * init Services. */ @@ -142,12 +136,10 @@ exit(); } - if ($verbose) { echo 'App is ready.' . "\n"; } - /** * init input/output */ @@ -163,7 +155,6 @@ $output->writeln(''); } - /** * parsing backup.json */ @@ -189,13 +180,11 @@ $cliService->displayBackupResume($backup); - /** * let's start based on Options */ try { switch ($input->getArgument('action')) { - case 'details': $cliService->displayBackupDetails($backup); break; @@ -217,12 +206,10 @@ exit(); } - /** * The End. */ - /** * @return bool */ @@ -252,7 +239,6 @@ function extractAppFiles(): bool { } } - /** * @param array $classes * @param array $mockups @@ -280,7 +266,6 @@ function loadClasses(array $classes, array $mockups): ClassLoader { return $loader; } - /** * @return InputDefinition */ diff --git a/templates/settings.admin.php b/templates/settings.admin.php index 1d7985e8..dbdba3a2 100644 --- a/templates/settings.admin.php +++ b/templates/settings.admin.php @@ -2,7 +2,6 @@ declare(strict_types=1); - /** * Nextcloud - Backup now. Restore later. * @@ -28,7 +27,6 @@ * */ - use OCA\Backup\AppInfo\Application; use OCP\Util;