diff --git a/.github/workflows/lint-info-xml.yml b/.github/workflows/lint-info-xml.yml new file mode 100644 index 0000000..5342376 --- /dev/null +++ b/.github/workflows/lint-info-xml.yml @@ -0,0 +1,42 @@ +# 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: 2021-2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: MIT + +name: Lint info.xml + +on: pull_request + +permissions: + contents: read + +concurrency: + group: lint-info-xml-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + + xml-linters: + runs-on: ubuntu-latest-low + strategy: + fail-fast: false + matrix: + APP_NAME: [ 'socialsharing_diaspora', 'socialsharing_email', 'socialsharing_facebook', 'socialsharing_telegram', 'socialsharing_twitter' ] + + + name: info.xml lint + steps: + - name: Checkout + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Download schema + run: wget https://raw.githubusercontent.com/nextcloud/appstore/master/nextcloudappstore/api/v1/release/info.xsd + + - name: Lint info.xml + uses: ChristophWurst/xmllint-action@36f2a302f84f8c83fceea0b9c59e1eb4a616d3c1 # v1.2 + with: + xml-file: ./${matrix.APP_NAME}/appinfo/info.xml + xml-schema-file: ./info.xsd diff --git a/.github/workflows/lint-php-cs.yml b/.github/workflows/lint-php-cs.yml new file mode 100644 index 0000000..c9948fa --- /dev/null +++ b/.github/workflows/lint-php-cs.yml @@ -0,0 +1,60 @@ +# 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: 2021-2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: MIT + +name: Lint php-cs + +on: pull_request + +permissions: + contents: read + +concurrency: + group: lint-php-cs-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + lint: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + APP_NAME: [ 'socialsharing_diaspora', 'socialsharing_email', 'socialsharing_facebook', 'socialsharing_telegram', 'socialsharing_twitter' ] + + + name: php-cs + + steps: + - name: Checkout + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Get php version + id: versions + uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1 + with: + filename: ./socialsharing_diaspora/appinfo/info.xml + + - name: Set up php${{ steps.versions.outputs.php-available }} + uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1 + with: + php-version: ${{ steps.versions.outputs.php-available }} + 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 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Install dependencies + run: | + cd ${matrix.APP_NAME} + composer remove nextcloud/ocp --dev + composer i + + - name: Lint + run: | + cd ${matrix.APP_NAME} + 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 new file mode 100644 index 0000000..e901bd4 --- /dev/null +++ b/.github/workflows/lint-php.yml @@ -0,0 +1,77 @@ +# 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: 2021-2024 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: MIT + +name: Lint php + +on: pull_request + +permissions: + contents: read + +concurrency: + group: lint-php-${{ github.head_ref || github.run_id }} + 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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - name: Get version matrix + id: versions + uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.0.0 + with: + filename: ./socialsharing_diaspora/appinfo/info.xml + + php-lint: + runs-on: ubuntu-latest + needs: matrix + strategy: + fail-fast: false + matrix: + php-versions: ${{fromJson(needs.matrix.outputs.php-versions)}} + APP_NAME: [ 'socialsharing_diaspora', 'socialsharing_email', 'socialsharing_facebook', 'socialsharing_telegram', 'socialsharing_twitter' ] + + + name: php-lint + + steps: + - name: Checkout + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Set up php ${{ matrix.php-versions }} + uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.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 + coverage: none + ini-file: development + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Lint + run: | + cd ${matrix.APP_NAME} + composer run lint + + summary: + permissions: + contents: none + runs-on: ubuntu-latest-low + needs: php-lint + + if: always() + + name: php-lint-summary + + steps: + - name: Summary status + run: if ${{ needs.php-lint.result != 'success' && needs.php-lint.result != 'skipped' }}; then exit 1; fi diff --git a/.github/workflows/psalm-matrix.yml b/.github/workflows/psalm-matrix.yml new file mode 100644 index 0000000..6ad0ad2 --- /dev/null +++ b/.github/workflows/psalm-matrix.yml @@ -0,0 +1,102 @@ +# 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: Static analysis + +on: + pull_request: + push: + branches: + - master + - main + - stable* + +concurrency: + group: psalm-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + matrix: + runs-on: ubuntu-latest-low + outputs: + ocp-matrix: ${{ steps.merge-matrix.outputs.merged-matrix }} + steps: + - name: Checkout app + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - name: Get version matrix + id: versions + uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1 + with: + filename: ./socialsharing_diaspora/appinfo/info.xml + # Merge the base matrix with custom elements + - name: Merge matrix with custom elements + id: merge-matrix + run: | + # Custom matrix elements you want to add + custom_matrix='{"APP_NAME": [ "socialsharing_diaspora", "socialsharing_email", "socialsharing_facebook", "socialsharing_telegram", "socialsharing_twitter" ]}' + + # Base matrix from the previous job + base_matrix='${{ steps.versions.outputs.ocp-matrix }}' + + # Merge the base matrix with custom matrix using jq + merged_matrix=$(echo "$base_matrix" | jq --argjson custom "$custom_matrix" '. + $custom') + + # Set the merged matrix as the output + echo "::set-output name=merged-matrix::$merged_matrix" + + static-analysis: + runs-on: ubuntu-latest + needs: matrix + strategy: + # do not stop on another job's failure + fail-fast: false + matrix: ${{ fromJson(needs.matrix.outputs.ocp-matrix) }} + + name: static-psalm-analysis ${{ matrix.ocp-version }} + steps: + - name: Checkout + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Set up php${{ matrix.php-versions }} + uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.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 + coverage: none + ini-file: development + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Install dependencies + run: | + cs ${matrix.APP_NAME} + composer remove nextcloud/ocp --dev + composer i + + + - name: Install dependencies + run: | + cs ${matrix.APP_NAME} + composer require --dev 'nextcloud/ocp:${{ matrix.ocp-version }}' --ignore-platform-reqs --with-dependencies + + - name: Run coding standards check + run: | + cs ${matrix.APP_NAME} + composer run psalm + + summary: + runs-on: ubuntu-latest-low + needs: static-analysis + + if: always() + + name: static-psalm-analysis-summary + + steps: + - name: Summary status + run: if ${{ needs.static-analysis.result != 'success' }}; then exit 1; fi diff --git a/socialsharing_diaspora/.php-cs-fixer.dist.php b/socialsharing_diaspora/.php-cs-fixer.dist.php new file mode 100644 index 0000000..31a73f5 --- /dev/null +++ b/socialsharing_diaspora/.php-cs-fixer.dist.php @@ -0,0 +1,12 @@ +getFinder() + ->in(__DIR__ . '/lib'); +return $config; diff --git a/socialsharing_diaspora/appinfo/info.xml b/socialsharing_diaspora/appinfo/info.xml index 2a2ada2..22fc100 100644 --- a/socialsharing_diaspora/appinfo/info.xml +++ b/socialsharing_diaspora/appinfo/info.xml @@ -10,7 +10,7 @@ https://raw.githubusercontent.com/nextcloud/socialsharing/master/socialsharing_diaspora/screenshots/preview.png SocialSharingDiaspora - + https://github.com/nextcloud/socialsharing https://github.com/nextcloud/socialsharing diff --git a/socialsharing_diaspora/composer.json b/socialsharing_diaspora/composer.json new file mode 100644 index 0000000..506da24 --- /dev/null +++ b/socialsharing_diaspora/composer.json @@ -0,0 +1,24 @@ +{ + "require": { + "php": ">=8.0" + }, + "scripts": { + "lint": "find . -name \\*.php -not -path './vendor/*' -print0 | xargs -0 -n1 php -l", + "cs:check": "php-cs-fixer fix --dry-run --diff", + "cs:fix": "php-cs-fixer fix", + "psalm": "psalm.phar --no-cache", + "psalm:update-baseline": "psalm.phar --threads=1 --update-baseline", + "psalm:update-baseline:force": "psalm.phar --threads=1 --update-baseline --set-baseline=tests/psalm-baseline.xml" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3", + "nextcloud/coding-standard": "^1", + "psalm/phar": "^5.26", + "nextcloud/ocp": "dev-master" + }, + "config": { + "platform": { + "php": "8.0" + } + } +} \ No newline at end of file diff --git a/socialsharing_diaspora/composer.lock b/socialsharing_diaspora/composer.lock new file mode 100644 index 0000000..2e43667 --- /dev/null +++ b/socialsharing_diaspora/composer.lock @@ -0,0 +1,447 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "79e6391b32591471039a4ff999b31230", + "packages": [], + "packages-dev": [ + { + "name": "kubawerlos/php-cs-fixer-custom-fixers", + "version": "v3.22.0", + "source": { + "type": "git", + "url": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers.git", + "reference": "8701394f0c7cd450ac4fa577d24589122c1d5d5e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kubawerlos/php-cs-fixer-custom-fixers/zipball/8701394f0c7cd450ac4fa577d24589122c1d5d5e", + "reference": "8701394f0c7cd450ac4fa577d24589122c1d5d5e", + "shasum": "" + }, + "require": { + "ext-filter": "*", + "ext-tokenizer": "*", + "friendsofphp/php-cs-fixer": "^3.61.1", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.6.4 || ^10.5.29" + }, + "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": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers/issues", + "source": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers/tree/v3.22.0" + }, + "time": "2024-08-16T20:44:35+00:00" + }, + { + "name": "nextcloud/coding-standard", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/nextcloud/coding-standard.git", + "reference": "e88acb0df6217b808d1632286ddfec9267a102e4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/e88acb0df6217b808d1632286ddfec9267a102e4", + "reference": "e88acb0df6217b808d1632286ddfec9267a102e4", + "shasum": "" + }, + "require": { + "kubawerlos/php-cs-fixer-custom-fixers": "^3.22", + "php": "^7.3|^8.0", + "php-cs-fixer/shim": "^3.17" + }, + "type": "library", + "autoload": { + "psr-4": { + "Nextcloud\\CodingStandard\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christoph Wurst", + "email": "christoph@winzerhof-wurst.at" + } + ], + "description": "Nextcloud coding standards for the php cs fixer", + "support": { + "issues": "https://github.com/nextcloud/coding-standard/issues", + "source": "https://github.com/nextcloud/coding-standard/tree/v1.3.1" + }, + "time": "2024-09-19T09:07:10+00:00" + }, + { + "name": "nextcloud/ocp", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/nextcloud-deps/ocp.git", + "reference": "8076405cf21b59fe1b935562041f96393abf6d8e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/8076405cf21b59fe1b935562041f96393abf6d8e", + "reference": "8076405cf21b59fe1b935562041f96393abf6d8e", + "shasum": "" + }, + "require": { + "php": "~8.0 || ~8.1 || ~8.2 || ~8.3", + "psr/clock": "^1.0", + "psr/container": "^2.0.2", + "psr/event-dispatcher": "^1.0", + "psr/log": "^1.1.4" + }, + "default-branch": true, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "31.0.0-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "AGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Christoph Wurst", + "email": "christoph@winzerhof-wurst.at" + } + ], + "description": "Composer package containing Nextcloud's public API (classes, interfaces)", + "support": { + "issues": "https://github.com/nextcloud-deps/ocp/issues", + "source": "https://github.com/nextcloud-deps/ocp/tree/master" + }, + "time": "2024-09-23T14:11:16+00:00" + }, + { + "name": "php-cs-fixer/shim", + "version": "v3.64.0", + "source": { + "type": "git", + "url": "https://github.com/PHP-CS-Fixer/shim.git", + "reference": "81ccfd24baf3a10810dab1152c403981a790b837" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/81ccfd24baf3a10810dab1152c403981a790b837", + "reference": "81ccfd24baf3a10810dab1152c403981a790b837", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-tokenizer": "*", + "php": "^7.4 || ^8.0" + }, + "replace": { + "friendsofphp/php-cs-fixer": "self.version" + }, + "suggest": { + "ext-dom": "For handling output formats in XML", + "ext-mbstring": "For handling non-UTF8 characters." + }, + "bin": [ + "php-cs-fixer", + "php-cs-fixer.phar" + ], + "type": "application", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Dariusz Rumiński", + "email": "dariusz.ruminski@gmail.com" + } + ], + "description": "A tool to automatically fix PHP code style", + "support": { + "issues": "https://github.com/PHP-CS-Fixer/shim/issues", + "source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.64.0" + }, + "time": "2024-08-30T23:10:11+00:00" + }, + { + "name": "psalm/phar", + "version": "5.26.1", + "source": { + "type": "git", + "url": "https://github.com/psalm/phar.git", + "reference": "8a38e7ad04499a0ccd2c506fd1da6fc01fff4547" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/psalm/phar/zipball/8a38e7ad04499a0ccd2c506fd1da6fc01fff4547", + "reference": "8a38e7ad04499a0ccd2c506fd1da6fc01fff4547", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "vimeo/psalm": "*" + }, + "bin": [ + "psalm.phar" + ], + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Composer-based Psalm Phar", + "support": { + "issues": "https://github.com/psalm/phar/issues", + "source": "https://github.com/psalm/phar/tree/5.26.1" + }, + "time": "2024-09-09T16:22:43+00:00" + }, + { + "name": "psr/clock", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/clock.git", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Clock\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for reading the clock.", + "homepage": "https://github.com/php-fig/clock", + "keywords": [ + "clock", + "now", + "psr", + "psr-20", + "time" + ], + "support": { + "issues": "https://github.com/php-fig/clock/issues", + "source": "https://github.com/php-fig/clock/tree/1.0.0" + }, + "time": "2022-11-25T14:36:26+00:00" + }, + { + "name": "psr/container", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/2.0.2" + }, + "time": "2021-11-05T16:47:00+00:00" + }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00" + }, + { + "name": "psr/log", + "version": "1.1.4", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/1.1.4" + }, + "time": "2021-05-03T11:20:27+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": { + "nextcloud/ocp": 20 + }, + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=8.0" + }, + "platform-dev": [], + "platform-overrides": { + "php": "8.0" + }, + "plugin-api-version": "2.6.0" +} diff --git a/socialsharing_diaspora/lib/AppInfo/Application.php b/socialsharing_diaspora/lib/AppInfo/Application.php index 4d23ac5..fee1781 100644 --- a/socialsharing_diaspora/lib/AppInfo/Application.php +++ b/socialsharing_diaspora/lib/AppInfo/Application.php @@ -29,26 +29,28 @@ use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventListener; use OCP\Util; -use Psr\Log\LoggerInterface; +/** + * @implements IEventListener<\OCA\Files\Event\LoadSidebar|\OCA\Files\Event\LoadAdditionalScriptsEvent> + */ class Application extends App implements IBootstrap, IEventListener { - public const APP_ID = 'socialsharing_diaspora'; + public const APP_ID = 'socialsharing_diaspora'; public function __construct() { parent::__construct(self::APP_ID); - } + } - public function register(IRegistrationContext $context): void { - $context->registerEventListener(\OCA\Files\Event\LoadSidebar::class, self::class); - $context->registerEventListener(\OCA\Files\Event\LoadAdditionalScriptsEvent::class, self::class); - } + public function register(IRegistrationContext $context): void { + $context->registerEventListener(\OCA\Files\Event\LoadSidebar::class, self::class); + $context->registerEventListener(\OCA\Files\Event\LoadAdditionalScriptsEvent::class, self::class); + } - public function boot(IBootContext $context): void { - } + public function boot(IBootContext $context): void { + } - public function handle(Event $event): void { - Util::addScript(self::APP_ID, self::APP_ID, 'files'); - Util::addStyle(self::APP_ID, self::APP_ID); - } + public function handle(Event $event): void { + Util::addScript(self::APP_ID, self::APP_ID, 'files'); + Util::addStyle(self::APP_ID, self::APP_ID); + } } diff --git a/socialsharing_diaspora/psalm.xml b/socialsharing_diaspora/psalm.xml new file mode 100644 index 0000000..ae047bd --- /dev/null +++ b/socialsharing_diaspora/psalm.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/socialsharing_diaspora/tests/psalm-baseline.xml b/socialsharing_diaspora/tests/psalm-baseline.xml new file mode 100644 index 0000000..5a96be5 --- /dev/null +++ b/socialsharing_diaspora/tests/psalm-baseline.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/socialsharing_diaspora/tests/stub.phpstub b/socialsharing_diaspora/tests/stub.phpstub new file mode 100644 index 0000000..35d9dc8 --- /dev/null +++ b/socialsharing_diaspora/tests/stub.phpstub @@ -0,0 +1,1116 @@ + + */ + public array $propertyMap = ['{DAV:}displayname' => ['displayname', 'string'], '{urn:ietf:params:xml:ns:caldav}calendar-description' => ['description', 'string'], '{urn:ietf:params:xml:ns:caldav}calendar-timezone' => ['timezone', 'string'], '{http://apple.com/ns/ical/}calendar-order' => ['calendarorder', 'int'], '{http://apple.com/ns/ical/}calendar-color' => ['calendarcolor', 'string'], '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => ['deleted_at', 'int']]; + /** + * List of subscription properties, and how they map to database field names. + * + * @var array + */ + public array $subscriptionPropertyMap = ['{DAV:}displayname' => ['displayname', 'string'], '{http://apple.com/ns/ical/}refreshrate' => ['refreshrate', 'string'], '{http://apple.com/ns/ical/}calendar-order' => ['calendarorder', 'int'], '{http://apple.com/ns/ical/}calendar-color' => ['calendarcolor', 'string'], '{http://calendarserver.org/ns/}subscribed-strip-todos' => ['striptodos', 'bool'], '{http://calendarserver.org/ns/}subscribed-strip-alarms' => ['stripalarms', 'string'], '{http://calendarserver.org/ns/}subscribed-strip-attachments' => ['stripattachments', 'string']]; + /** @var array parameters to index */ + public static array $indexParameters = ['ATTENDEE' => ['CN'], 'ORGANIZER' => ['CN']]; + /** + * @var string[] Map of uid => display name + */ + protected array $userDisplayNames; + + public function __construct(\OCP\IDBConnection $db, \OCA\DAV\Connector\Sabre\Principal $principalBackend, \OCP\IUserManager $userManager, \OCP\IGroupManager $groupManager, \OCP\Security\ISecureRandom $random, \Psr\Log\LoggerInterface $logger, \OCP\EventDispatcher\IEventDispatcher $dispatcher, \OCP\IConfig $config, bool $legacyEndpoint = false) + { + } + + /** + * Return the number of calendars for a principal + * + * By default this excludes the automatically generated birthday calendar + * + * @param $principalUri + * @param bool $excludeBirthday + * @return int + */ + public function getCalendarsForUserCount($principalUri, $excludeBirthday = true) + { + } + + /** + * @return array{id: int, deleted_at: int}[] + */ + public function getDeletedCalendars(int $deletedBefore): array + { + } + + /** + * Returns a list of calendars for a principal. + * + * Every project is an array with the following keys: + * * id, a unique id that will be used by other functions to modify the + * calendar. This can be the same as the uri or a database key. + * * uri, which the basename of the uri with which the calendar is + * accessed. + * * principaluri. The owner of the calendar. Almost always the same as + * principalUri passed to this method. + * + * Furthermore it can contain webdav properties in clark notation. A very + * common one is '{DAV:}displayname'. + * + * Many clients also require: + * {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set + * For this property, you can just return an instance of + * Sabre\CalDAV\Property\SupportedCalendarComponentSet. + * + * If you return {http://sabredav.org/ns}read-only and set the value to 1, + * ACL will automatically be put in read-only mode. + * + * @param string $principalUri + * @return array + */ + public function getCalendarsForUser($principalUri) + { + } + + /** + * @param $principalUri + * @return array + */ + public function getUsersOwnCalendars($principalUri) + { + } + + /** + * @return array + */ + public function getPublicCalendars() + { + } + + /** + * @param string $uri + * @return array + * @throws NotFound + */ + public function getPublicCalendar($uri) + { + } + + /** + * @param string $principal + * @param string $uri + * @return array|null + */ + public function getCalendarByUri($principal, $uri) + { + } + + /** + * @return array{id: int, uri: string, '{http://calendarserver.org/ns/}getctag': string, '{http://sabredav.org/ns}sync-token': int, '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set': SupportedCalendarComponentSet, '{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp': ScheduleCalendarTransp, '{urn:ietf:params:xml:ns:caldav}calendar-timezone': ?string }|null + */ + public function getCalendarById(int $calendarId): ?array + { + } + + /** + * @param $subscriptionId + */ + public function getSubscriptionById($subscriptionId) + { + } + + /** + * Creates a new calendar for a principal. + * + * If the creation was a success, an id must be returned that can be used to reference + * this calendar in other methods, such as updateCalendar. + * + * @param string $principalUri + * @param string $calendarUri + * @param array $properties + * @return int + * + * @throws CalendarException + */ + public function createCalendar($principalUri, $calendarUri, array $properties) + { + } + + /** + * Updates properties for a calendar. + * + * The list of mutations is stored in a Sabre\DAV\PropPatch object. + * To do the actual updates, you must tell this object which properties + * you're going to process with the handle() method. + * + * Calling the handle method is like telling the PropPatch object "I + * promise I can handle updating this property". + * + * Read the PropPatch documentation for more info and examples. + * + * @param mixed $calendarId + * @param PropPatch $propPatch + * @return void + */ + public function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch) + { + } + + /** + * Delete a calendar and all it's objects + * + * @param mixed $calendarId + * @return void + */ + public function deleteCalendar($calendarId, bool $forceDeletePermanently = false) + { + } + + public function restoreCalendar(int $id): void + { + } + + /** + * Delete all of an user's shares + * + * @param string $principaluri + * @return void + */ + public function deleteAllSharesByUser($principaluri) + { + } + + /** + * Returns all calendar objects within a calendar. + * + * Every item contains an array with the following keys: + * * calendardata - The iCalendar-compatible calendar data + * * uri - a unique key which will be used to construct the uri. This can + * be any arbitrary string, but making sure it ends with '.ics' is a + * good idea. This is only the basename, or filename, not the full + * path. + * * lastmodified - a timestamp of the last modification time + * * etag - An arbitrary string, surrounded by double-quotes. (e.g.: + * '"abcdef"') + * * size - The size of the calendar objects, in bytes. + * * component - optional, a string containing the type of object, such + * as 'vevent' or 'vtodo'. If specified, this will be used to populate + * the Content-Type header. + * + * Note that the etag is optional, but it's highly encouraged to return for + * speed reasons. + * + * The calendardata is also optional. If it's not returned + * 'getCalendarObject' will be called later, which *is* expected to return + * calendardata. + * + * If neither etag or size are specified, the calendardata will be + * used/fetched to determine these numbers. If both are specified the + * amount of times this is needed is reduced by a great degree. + * + * @param mixed $calendarId + * @param int $calendarType + * @return array + */ + public function getCalendarObjects($calendarId, $calendarType = self::CALENDAR_TYPE_CALENDAR): array + { + } + + public function getDeletedCalendarObjects(int $deletedBefore): array + { + } + + /** + * Return all deleted calendar objects by the given principal that are not + * in deleted calendars. + * + * @param string $principalUri + * @return array + * @throws Exception + */ + public function getDeletedCalendarObjectsByPrincipal(string $principalUri): array + { + } + + /** + * Returns information from a single calendar object, based on it's object + * uri. + * + * The object uri is only the basename, or filename and not a full path. + * + * The returned array must have the same keys as getCalendarObjects. The + * 'calendardata' object is required here though, while it's not required + * for getCalendarObjects. + * + * This method must return null if the object did not exist. + * + * @param mixed $calendarId + * @param string $objectUri + * @param int $calendarType + * @return array|null + */ + public function getCalendarObject($calendarId, $objectUri, int $calendarType = self::CALENDAR_TYPE_CALENDAR) + { + } + + /** + * Returns a list of calendar objects. + * + * This method should work identical to getCalendarObject, but instead + * return all the calendar objects in the list as an array. + * + * If the backend supports this, it may allow for some speed-ups. + * + * @param mixed $calendarId + * @param string[] $uris + * @param int $calendarType + * @return array + */ + public function getMultipleCalendarObjects($calendarId, array $uris, $calendarType = self::CALENDAR_TYPE_CALENDAR): array + { + } + + /** + * Creates a new calendar object. + * + * The object uri is only the basename, or filename and not a full path. + * + * It is possible return an etag from this function, which will be used in + * the response to this PUT request. Note that the ETag must be surrounded + * by double-quotes. + * + * However, you should only really return this ETag if you don't mangle the + * calendar-data. If the result of a subsequent GET to this object is not + * the exact same as this request body, you should omit the ETag. + * + * @param mixed $calendarId + * @param string $objectUri + * @param string $calendarData + * @param int $calendarType + * @return string + */ + public function createCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) + { + } + + /** + * Updates an existing calendarobject, based on it's uri. + * + * The object uri is only the basename, or filename and not a full path. + * + * It is possible return an etag from this function, which will be used in + * the response to this PUT request. Note that the ETag must be surrounded + * by double-quotes. + * + * However, you should only really return this ETag if you don't mangle the + * calendar-data. If the result of a subsequent GET to this object is not + * the exact same as this request body, you should omit the ETag. + * + * @param mixed $calendarId + * @param string $objectUri + * @param string $calendarData + * @param int $calendarType + * @return string + */ + public function updateCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) + { + } + + /** + * Moves a calendar object from calendar to calendar. + * + * @param int $sourceCalendarId + * @param int $targetCalendarId + * @param int $objectId + * @param string $oldPrincipalUri + * @param string $newPrincipalUri + * @param int $calendarType + * @return bool + * @throws Exception + */ + public function moveCalendarObject(int $sourceCalendarId, int $targetCalendarId, int $objectId, string $oldPrincipalUri, string $newPrincipalUri, int $calendarType = self::CALENDAR_TYPE_CALENDAR): bool + { + } + + /** + * @param int $calendarObjectId + * @param int $classification + */ + public function setClassification($calendarObjectId, $classification) + { + } + + /** + * Deletes an existing calendar object. + * + * The object uri is only the basename, or filename and not a full path. + * + * @param mixed $calendarId + * @param string $objectUri + * @param int $calendarType + * @param bool $forceDeletePermanently + * @return void + */ + public function deleteCalendarObject($calendarId, $objectUri, $calendarType = self::CALENDAR_TYPE_CALENDAR, bool $forceDeletePermanently = false) + { + } + + /** + * @param mixed $objectData + * + * @throws Forbidden + */ + public function restoreCalendarObject(array $objectData): void + { + } + + /** + * Performs a calendar-query on the contents of this calendar. + * + * The calendar-query is defined in RFC4791 : CalDAV. Using the + * calendar-query it is possible for a client to request a specific set of + * object, based on contents of iCalendar properties, date-ranges and + * iCalendar component types (VTODO, VEVENT). + * + * This method should just return a list of (relative) urls that match this + * query. + * + * The list of filters are specified as an array. The exact array is + * documented by Sabre\CalDAV\CalendarQueryParser. + * + * Note that it is extremely likely that getCalendarObject for every path + * returned from this method will be called almost immediately after. You + * may want to anticipate this to speed up these requests. + * + * This method provides a default implementation, which parses *all* the + * iCalendar objects in the specified calendar. + * + * This default may well be good enough for personal use, and calendars + * that aren't very large. But if you anticipate high usage, big calendars + * or high loads, you are strongly advised to optimize certain paths. + * + * The best way to do so is override this method and to optimize + * specifically for 'common filters'. + * + * Requests that are extremely common are: + * * requests for just VEVENTS + * * requests for just VTODO + * * requests with a time-range-filter on either VEVENT or VTODO. + * + * ..and combinations of these requests. It may not be worth it to try to + * handle every possible situation and just rely on the (relatively + * easy to use) CalendarQueryValidator to handle the rest. + * + * Note that especially time-range-filters may be difficult to parse. A + * time-range filter specified on a VEVENT must for instance also handle + * recurrence rules correctly. + * A good example of how to interpret all these filters can also simply + * be found in Sabre\CalDAV\CalendarQueryFilter. This class is as correct + * as possible, so it gives you a good idea on what type of stuff you need + * to think of. + * + * @param mixed $calendarId + * @param array $filters + * @param int $calendarType + * @return array + */ + public function calendarQuery($calendarId, array $filters, $calendarType = self::CALENDAR_TYPE_CALENDAR): array + { + } + + /** + * custom Nextcloud search extension for CalDAV + * + * TODO - this should optionally cover cached calendar objects as well + * + * @param string $principalUri + * @param array $filters + * @param integer|null $limit + * @param integer|null $offset + * @return array + */ + public function calendarSearch($principalUri, array $filters, $limit = null, $offset = null) + { + } + + /** + * used for Nextcloud's calendar API + * + * @param array $calendarInfo + * @param string $pattern + * @param array $searchProperties + * @param array $options + * @param integer|null $limit + * @param integer|null $offset + * + * @return array + */ + public function search(array $calendarInfo, $pattern, array $searchProperties, array $options, $limit, $offset) + { + } + + /** + * @param string $principalUri + * @param string $pattern + * @param array $componentTypes + * @param array $searchProperties + * @param array $searchParameters + * @param array $options + * @return array + */ + public function searchPrincipalUri(string $principalUri, string $pattern, array $componentTypes, array $searchProperties, array $searchParameters, array $options = []): array + { + } + + /** + * Searches through all of a users calendars and calendar objects to find + * an object with a specific UID. + * + * This method should return the path to this object, relative to the + * calendar home, so this path usually only contains two parts: + * + * calendarpath/objectpath.ics + * + * If the uid is not found, return null. + * + * This method should only consider * objects that the principal owns, so + * any calendars owned by other principals that also appear in this + * collection should be ignored. + * + * @param string $principalUri + * @param string $uid + * @return string|null + */ + public function getCalendarObjectByUID($principalUri, $uid) + { + } + + public function getCalendarObjectById(string $principalUri, int $id): ?array + { + } + + /** + * The getChanges method returns all the changes that have happened, since + * the specified syncToken in the specified calendar. + * + * This function should return an array, such as the following: + * + * [ + * 'syncToken' => 'The current synctoken', + * 'added' => [ + * 'new.txt', + * ], + * 'modified' => [ + * 'modified.txt', + * ], + * 'deleted' => [ + * 'foo.php.bak', + * 'old.txt' + * ] + * ); + * + * The returned syncToken property should reflect the *current* syncToken + * of the calendar, as reported in the {http://sabredav.org/ns}sync-token + * property This is * needed here too, to ensure the operation is atomic. + * + * If the $syncToken argument is specified as null, this is an initial + * sync, and all members should be reported. + * + * The modified property is an array of nodenames that have changed since + * the last token. + * + * The deleted property is an array with nodenames, that have been deleted + * from collection. + * + * The $syncLevel argument is basically the 'depth' of the report. If it's + * 1, you only have to report changes that happened only directly in + * immediate descendants. If it's 2, it should also include changes from + * the nodes below the child collections. (grandchildren) + * + * The $limit argument allows a client to specify how many results should + * be returned at most. If the limit is not specified, it should be treated + * as infinite. + * + * If the limit (infinite or not) is higher than you're willing to return, + * you should throw a Sabre\DAV\Exception\TooMuchMatches() exception. + * + * If the syncToken is expired (due to data cleanup) or unknown, you must + * return null. + * + * The limit is 'suggestive'. You are free to ignore it. + * + * @param string $calendarId + * @param string $syncToken + * @param int $syncLevel + * @param int|null $limit + * @param int $calendarType + * @return array + */ + public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null, $calendarType = self::CALENDAR_TYPE_CALENDAR) + { + } + + /** + * Returns a list of subscriptions for a principal. + * + * Every subscription is an array with the following keys: + * * id, a unique id that will be used by other functions to modify the + * subscription. This can be the same as the uri or a database key. + * * uri. This is just the 'base uri' or 'filename' of the subscription. + * * principaluri. The owner of the subscription. Almost always the same as + * principalUri passed to this method. + * + * Furthermore, all the subscription info must be returned too: + * + * 1. {DAV:}displayname + * 2. {http://apple.com/ns/ical/}refreshrate + * 3. {http://calendarserver.org/ns/}subscribed-strip-todos (omit if todos + * should not be stripped). + * 4. {http://calendarserver.org/ns/}subscribed-strip-alarms (omit if alarms + * should not be stripped). + * 5. {http://calendarserver.org/ns/}subscribed-strip-attachments (omit if + * attachments should not be stripped). + * 6. {http://calendarserver.org/ns/}source (Must be a + * Sabre\DAV\Property\Href). + * 7. {http://apple.com/ns/ical/}calendar-color + * 8. {http://apple.com/ns/ical/}calendar-order + * 9. {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set + * (should just be an instance of + * Sabre\CalDAV\Property\SupportedCalendarComponentSet, with a bunch of + * default components). + * + * @param string $principalUri + * @return array + */ + public function getSubscriptionsForUser($principalUri) + { + } + + /** + * Creates a new subscription for a principal. + * + * If the creation was a success, an id must be returned that can be used to reference + * this subscription in other methods, such as updateSubscription. + * + * @param string $principalUri + * @param string $uri + * @param array $properties + * @return mixed + */ + public function createSubscription($principalUri, $uri, array $properties) + { + } + + /** + * Updates a subscription + * + * The list of mutations is stored in a Sabre\DAV\PropPatch object. + * To do the actual updates, you must tell this object which properties + * you're going to process with the handle() method. + * + * Calling the handle method is like telling the PropPatch object "I + * promise I can handle updating this property". + * + * Read the PropPatch documentation for more info and examples. + * + * @param mixed $subscriptionId + * @param PropPatch $propPatch + * @return void + */ + public function updateSubscription($subscriptionId, \Sabre\DAV\PropPatch $propPatch) + { + } + + /** + * Deletes a subscription. + * + * @param mixed $subscriptionId + * @return void + */ + public function deleteSubscription($subscriptionId) + { + } + + /** + * Returns a single scheduling object for the inbox collection. + * + * The returned array should contain the following elements: + * * uri - A unique basename for the object. This will be used to + * construct a full uri. + * * calendardata - The iCalendar object + * * lastmodified - The last modification date. Can be an int for a unix + * timestamp, or a PHP DateTime object. + * * etag - A unique token that must change if the object changed. + * * size - The size of the object, in bytes. + * + * @param string $principalUri + * @param string $objectUri + * @return array + */ + public function getSchedulingObject($principalUri, $objectUri) + { + } + + /** + * Returns all scheduling objects for the inbox collection. + * + * These objects should be returned as an array. Every item in the array + * should follow the same structure as returned from getSchedulingObject. + * + * The main difference is that 'calendardata' is optional. + * + * @param string $principalUri + * @return array + */ + public function getSchedulingObjects($principalUri) + { + } + + /** + * Deletes a scheduling object from the inbox collection. + * + * @param string $principalUri + * @param string $objectUri + * @return void + */ + public function deleteSchedulingObject($principalUri, $objectUri) + { + } + + /** + * Creates a new scheduling object. This should land in a users' inbox. + * + * @param string $principalUri + * @param string $objectUri + * @param string $objectData + * @return void + */ + public function createSchedulingObject($principalUri, $objectUri, $objectData) + { + } + + /** + * Adds a change record to the calendarchanges table. + * + * @param mixed $calendarId + * @param string $objectUri + * @param int $operation 1 = add, 2 = modify, 3 = delete. + * @param int $calendarType + * @return void + */ + protected function addChange(int $calendarId, string $objectUri, int $operation, int $calendarType = self::CALENDAR_TYPE_CALENDAR): void + { + } + + /** + * Parses some information from calendar objects, used for optimized + * calendar-queries. + * + * Returns an array with the following keys: + * * etag - An md5 checksum of the object without the quotes. + * * size - Size of the object in bytes + * * componentType - VEVENT, VTODO or VJOURNAL + * * firstOccurence + * * lastOccurence + * * uid - value of the UID property + * + * @param string $calendarData + * @return array + */ + public function getDenormalizedData($calendarData) + { + } + + /** + * @param list $add + * @param list $remove + */ + public function updateShares(\OCA\DAV\DAV\Sharing\IShareable $shareable, array $add, array $remove): void + { + } + + /** + * @return list + */ + public function getShares(int $resourceId): array + { + } + + /** + * @param boolean $value + * @param \OCA\DAV\CalDAV\Calendar $calendar + * @return string|null + */ + public function setPublishStatus($value, $calendar) + { + } + + /** + * @param \OCA\DAV\CalDAV\Calendar $calendar + * @return mixed + */ + public function getPublishStatus($calendar) + { + } + + /** + * @param int $resourceId + * @param list $acl + * @return list + */ + public function applyShareAcl(int $resourceId, array $acl): array + { + } + + /** + * update properties table + * + * @param int $calendarId + * @param string $objectUri + * @param string $calendarData + * @param int $calendarType + */ + public function updateProperties($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) + { + } + + /** + * deletes all birthday calendars + */ + public function deleteAllBirthdayCalendars() + { + } + + /** + * @param $subscriptionId + */ + public function purgeAllCachedEventsForSubscription($subscriptionId) + { + } + + /** + * Move a calendar from one user to another + * + * @param string $uriName + * @param string $uriOrigin + * @param string $uriDestination + * @param string $newUriName (optional) the new uriName + */ + public function moveCalendar($uriName, $uriOrigin, $uriDestination, $newUriName = null) + { + } + + /** + * read VCalendar data into a VCalendar object + * + * @param string $objectData + * @return VCalendar + */ + protected function readCalendarData($objectData) + { + } + + /** + * delete all properties from a given calendar object + * + * @param int $calendarId + * @param int $objectId + */ + protected function purgeProperties($calendarId, $objectId) + { + } + + /** + * get ID from a given calendar object + * + * @param int $calendarId + * @param string $uri + * @param int $calendarType + * @return int + */ + protected function getCalendarObjectId($calendarId, $uri, $calendarType): int + { + } + + /** + * @throws \InvalidArgumentException + */ + public function pruneOutdatedSyncTokens(int $keep = 10000): int + { + } + } + +} + +namespace Sabre\CalDAV\Backend { + + /** + * Abstract Calendaring backend. Extend this class to create your own backends. + * + * Checkout the BackendInterface for all the methods that must be implemented. + * + * @copyright Copyright (C) fruux GmbH (https://fruux.com/) + * @author Evert Pot (http://evertpot.com/) + * @license http://sabre.io/license/ Modified BSD License + */ + abstract class AbstractBackend implements \Sabre\CalDAV\Backend\BackendInterface + { + /** + * Updates properties for a calendar. + * + * The list of mutations is stored in a Sabre\DAV\PropPatch object. + * To do the actual updates, you must tell this object which properties + * you're going to process with the handle() method. + * + * Calling the handle method is like telling the PropPatch object "I + * promise I can handle updating this property". + * + * Read the PropPatch documentation for more info and examples. + * + * @param mixed $calendarId + */ + public function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch) + { + } + + /** + * Returns a list of calendar objects. + * + * This method should work identical to getCalendarObject, but instead + * return all the calendar objects in the list as an array. + * + * If the backend supports this, it may allow for some speed-ups. + * + * @param mixed $calendarId + * + * @return array + */ + public function getMultipleCalendarObjects($calendarId, array $uris) + { + } + + /** + * Performs a calendar-query on the contents of this calendar. + * + * The calendar-query is defined in RFC4791 : CalDAV. Using the + * calendar-query it is possible for a client to request a specific set of + * object, based on contents of iCalendar properties, date-ranges and + * iCalendar component types (VTODO, VEVENT). + * + * This method should just return a list of (relative) urls that match this + * query. + * + * The list of filters are specified as an array. The exact array is + * documented by \Sabre\CalDAV\CalendarQueryParser. + * + * Note that it is extremely likely that getCalendarObject for every path + * returned from this method will be called almost immediately after. You + * may want to anticipate this to speed up these requests. + * + * This method provides a default implementation, which parses *all* the + * iCalendar objects in the specified calendar. + * + * This default may well be good enough for personal use, and calendars + * that aren't very large. But if you anticipate high usage, big calendars + * or high loads, you are strongly adviced to optimize certain paths. + * + * The best way to do so is override this method and to optimize + * specifically for 'common filters'. + * + * Requests that are extremely common are: + * * requests for just VEVENTS + * * requests for just VTODO + * * requests with a time-range-filter on either VEVENT or VTODO. + * + * ..and combinations of these requests. It may not be worth it to try to + * handle every possible situation and just rely on the (relatively + * easy to use) CalendarQueryValidator to handle the rest. + * + * Note that especially time-range-filters may be difficult to parse. A + * time-range filter specified on a VEVENT must for instance also handle + * recurrence rules correctly. + * A good example of how to interprete all these filters can also simply + * be found in \Sabre\CalDAV\CalendarQueryFilter. This class is as correct + * as possible, so it gives you a good idea on what type of stuff you need + * to think of. + * + * @param mixed $calendarId + * + * @return array + */ + public function calendarQuery($calendarId, array $filters) + { + } + + /** + * This method validates if a filter (as passed to calendarQuery) matches + * the given object. + * + * @return bool + */ + protected function validateFilterForObject(array $object, array $filters) + { + } + + /** + * Searches through all of a users calendars and calendar objects to find + * an object with a specific UID. + * + * This method should return the path to this object, relative to the + * calendar home, so this path usually only contains two parts: + * + * calendarpath/objectpath.ics + * + * If the uid is not found, return null. + * + * This method should only consider * objects that the principal owns, so + * any calendars owned by other principals that also appear in this + * collection should be ignored. + * + * @param string $principalUri + * @param string $uid + * + * @return string|null + */ + public function getCalendarObjectByUID($principalUri, $uid) + { + } + } +} \ No newline at end of file diff --git a/socialsharing_email/.php-cs-fixer.dist.php b/socialsharing_email/.php-cs-fixer.dist.php new file mode 100644 index 0000000..31a73f5 --- /dev/null +++ b/socialsharing_email/.php-cs-fixer.dist.php @@ -0,0 +1,12 @@ +getFinder() + ->in(__DIR__ . '/lib'); +return $config; diff --git a/socialsharing_email/appinfo/info.xml b/socialsharing_email/appinfo/info.xml index 4ef64d2..a8b40f1 100644 --- a/socialsharing_email/appinfo/info.xml +++ b/socialsharing_email/appinfo/info.xml @@ -10,7 +10,7 @@ https://raw.githubusercontent.com/nextcloud/socialsharing/master/socialsharing_email/screenshots/preview.png SocialSharingEmail - + https://github.com/nextcloud/socialsharing https://github.com/nextcloud/socialsharing diff --git a/socialsharing_email/composer.json b/socialsharing_email/composer.json new file mode 100644 index 0000000..506da24 --- /dev/null +++ b/socialsharing_email/composer.json @@ -0,0 +1,24 @@ +{ + "require": { + "php": ">=8.0" + }, + "scripts": { + "lint": "find . -name \\*.php -not -path './vendor/*' -print0 | xargs -0 -n1 php -l", + "cs:check": "php-cs-fixer fix --dry-run --diff", + "cs:fix": "php-cs-fixer fix", + "psalm": "psalm.phar --no-cache", + "psalm:update-baseline": "psalm.phar --threads=1 --update-baseline", + "psalm:update-baseline:force": "psalm.phar --threads=1 --update-baseline --set-baseline=tests/psalm-baseline.xml" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3", + "nextcloud/coding-standard": "^1", + "psalm/phar": "^5.26", + "nextcloud/ocp": "dev-master" + }, + "config": { + "platform": { + "php": "8.0" + } + } +} \ No newline at end of file diff --git a/socialsharing_email/composer.lock b/socialsharing_email/composer.lock new file mode 100644 index 0000000..2e43667 --- /dev/null +++ b/socialsharing_email/composer.lock @@ -0,0 +1,447 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "79e6391b32591471039a4ff999b31230", + "packages": [], + "packages-dev": [ + { + "name": "kubawerlos/php-cs-fixer-custom-fixers", + "version": "v3.22.0", + "source": { + "type": "git", + "url": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers.git", + "reference": "8701394f0c7cd450ac4fa577d24589122c1d5d5e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kubawerlos/php-cs-fixer-custom-fixers/zipball/8701394f0c7cd450ac4fa577d24589122c1d5d5e", + "reference": "8701394f0c7cd450ac4fa577d24589122c1d5d5e", + "shasum": "" + }, + "require": { + "ext-filter": "*", + "ext-tokenizer": "*", + "friendsofphp/php-cs-fixer": "^3.61.1", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.6.4 || ^10.5.29" + }, + "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": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers/issues", + "source": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers/tree/v3.22.0" + }, + "time": "2024-08-16T20:44:35+00:00" + }, + { + "name": "nextcloud/coding-standard", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/nextcloud/coding-standard.git", + "reference": "e88acb0df6217b808d1632286ddfec9267a102e4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/e88acb0df6217b808d1632286ddfec9267a102e4", + "reference": "e88acb0df6217b808d1632286ddfec9267a102e4", + "shasum": "" + }, + "require": { + "kubawerlos/php-cs-fixer-custom-fixers": "^3.22", + "php": "^7.3|^8.0", + "php-cs-fixer/shim": "^3.17" + }, + "type": "library", + "autoload": { + "psr-4": { + "Nextcloud\\CodingStandard\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christoph Wurst", + "email": "christoph@winzerhof-wurst.at" + } + ], + "description": "Nextcloud coding standards for the php cs fixer", + "support": { + "issues": "https://github.com/nextcloud/coding-standard/issues", + "source": "https://github.com/nextcloud/coding-standard/tree/v1.3.1" + }, + "time": "2024-09-19T09:07:10+00:00" + }, + { + "name": "nextcloud/ocp", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/nextcloud-deps/ocp.git", + "reference": "8076405cf21b59fe1b935562041f96393abf6d8e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/8076405cf21b59fe1b935562041f96393abf6d8e", + "reference": "8076405cf21b59fe1b935562041f96393abf6d8e", + "shasum": "" + }, + "require": { + "php": "~8.0 || ~8.1 || ~8.2 || ~8.3", + "psr/clock": "^1.0", + "psr/container": "^2.0.2", + "psr/event-dispatcher": "^1.0", + "psr/log": "^1.1.4" + }, + "default-branch": true, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "31.0.0-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "AGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Christoph Wurst", + "email": "christoph@winzerhof-wurst.at" + } + ], + "description": "Composer package containing Nextcloud's public API (classes, interfaces)", + "support": { + "issues": "https://github.com/nextcloud-deps/ocp/issues", + "source": "https://github.com/nextcloud-deps/ocp/tree/master" + }, + "time": "2024-09-23T14:11:16+00:00" + }, + { + "name": "php-cs-fixer/shim", + "version": "v3.64.0", + "source": { + "type": "git", + "url": "https://github.com/PHP-CS-Fixer/shim.git", + "reference": "81ccfd24baf3a10810dab1152c403981a790b837" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/81ccfd24baf3a10810dab1152c403981a790b837", + "reference": "81ccfd24baf3a10810dab1152c403981a790b837", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-tokenizer": "*", + "php": "^7.4 || ^8.0" + }, + "replace": { + "friendsofphp/php-cs-fixer": "self.version" + }, + "suggest": { + "ext-dom": "For handling output formats in XML", + "ext-mbstring": "For handling non-UTF8 characters." + }, + "bin": [ + "php-cs-fixer", + "php-cs-fixer.phar" + ], + "type": "application", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Dariusz Rumiński", + "email": "dariusz.ruminski@gmail.com" + } + ], + "description": "A tool to automatically fix PHP code style", + "support": { + "issues": "https://github.com/PHP-CS-Fixer/shim/issues", + "source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.64.0" + }, + "time": "2024-08-30T23:10:11+00:00" + }, + { + "name": "psalm/phar", + "version": "5.26.1", + "source": { + "type": "git", + "url": "https://github.com/psalm/phar.git", + "reference": "8a38e7ad04499a0ccd2c506fd1da6fc01fff4547" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/psalm/phar/zipball/8a38e7ad04499a0ccd2c506fd1da6fc01fff4547", + "reference": "8a38e7ad04499a0ccd2c506fd1da6fc01fff4547", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "vimeo/psalm": "*" + }, + "bin": [ + "psalm.phar" + ], + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Composer-based Psalm Phar", + "support": { + "issues": "https://github.com/psalm/phar/issues", + "source": "https://github.com/psalm/phar/tree/5.26.1" + }, + "time": "2024-09-09T16:22:43+00:00" + }, + { + "name": "psr/clock", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/clock.git", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Clock\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for reading the clock.", + "homepage": "https://github.com/php-fig/clock", + "keywords": [ + "clock", + "now", + "psr", + "psr-20", + "time" + ], + "support": { + "issues": "https://github.com/php-fig/clock/issues", + "source": "https://github.com/php-fig/clock/tree/1.0.0" + }, + "time": "2022-11-25T14:36:26+00:00" + }, + { + "name": "psr/container", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/2.0.2" + }, + "time": "2021-11-05T16:47:00+00:00" + }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00" + }, + { + "name": "psr/log", + "version": "1.1.4", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/1.1.4" + }, + "time": "2021-05-03T11:20:27+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": { + "nextcloud/ocp": 20 + }, + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=8.0" + }, + "platform-dev": [], + "platform-overrides": { + "php": "8.0" + }, + "plugin-api-version": "2.6.0" +} diff --git a/socialsharing_email/lib/AppInfo/Application.php b/socialsharing_email/lib/AppInfo/Application.php index 7d3985c..01e9ee8 100644 --- a/socialsharing_email/lib/AppInfo/Application.php +++ b/socialsharing_email/lib/AppInfo/Application.php @@ -27,26 +27,29 @@ use OCP\AppFramework\Bootstrap\IBootstrap; use OCP\AppFramework\Bootstrap\IRegistrationContext; use OCP\EventDispatcher\Event; -use OCP\EventDispatcher\IEventDispatcher; +use OCP\EventDispatcher\IEventListener; use OCP\Util; -class Application extends App implements IBootstrap { +/** + * @implements IEventListener<\OCA\Files\Event\LoadSidebar|\OCA\Files\Event\LoadAdditionalScriptsEvent> + */ +class Application extends App implements IBootstrap, IEventListener { - public const APP_ID = 'socialsharing_email'; + public const APP_ID = 'socialsharing_email'; - public function __construct() { - parent::__construct(self::APP_ID); - } + public function __construct() { + parent::__construct(self::APP_ID); + } - public function register(IRegistrationContext $context): void { - $context->registerEventListener(\OCA\Files\Event\LoadSidebar::class, self::class); - $context->registerEventListener(\OCA\Files\Event\LoadAdditionalScriptsEvent::class, self::class); - } + public function register(IRegistrationContext $context): void { + $context->registerEventListener(\OCA\Files\Event\LoadSidebar::class, self::class); + $context->registerEventListener(\OCA\Files\Event\LoadAdditionalScriptsEvent::class, self::class); + } - public function boot(IBootContext $context): void { - } + public function boot(IBootContext $context): void { + } - public function handle(Event $event): void { - Util::addScript(self::APP_ID, self::APP_ID); - } + public function handle(Event $event): void { + Util::addScript(self::APP_ID, self::APP_ID); + } } diff --git a/socialsharing_email/psalm.xml b/socialsharing_email/psalm.xml new file mode 100644 index 0000000..ae047bd --- /dev/null +++ b/socialsharing_email/psalm.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/socialsharing_email/tests/psalm-baseline.xml b/socialsharing_email/tests/psalm-baseline.xml new file mode 100644 index 0000000..5a96be5 --- /dev/null +++ b/socialsharing_email/tests/psalm-baseline.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/socialsharing_email/tests/stub.phpstub b/socialsharing_email/tests/stub.phpstub new file mode 100644 index 0000000..35d9dc8 --- /dev/null +++ b/socialsharing_email/tests/stub.phpstub @@ -0,0 +1,1116 @@ + + */ + public array $propertyMap = ['{DAV:}displayname' => ['displayname', 'string'], '{urn:ietf:params:xml:ns:caldav}calendar-description' => ['description', 'string'], '{urn:ietf:params:xml:ns:caldav}calendar-timezone' => ['timezone', 'string'], '{http://apple.com/ns/ical/}calendar-order' => ['calendarorder', 'int'], '{http://apple.com/ns/ical/}calendar-color' => ['calendarcolor', 'string'], '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => ['deleted_at', 'int']]; + /** + * List of subscription properties, and how they map to database field names. + * + * @var array + */ + public array $subscriptionPropertyMap = ['{DAV:}displayname' => ['displayname', 'string'], '{http://apple.com/ns/ical/}refreshrate' => ['refreshrate', 'string'], '{http://apple.com/ns/ical/}calendar-order' => ['calendarorder', 'int'], '{http://apple.com/ns/ical/}calendar-color' => ['calendarcolor', 'string'], '{http://calendarserver.org/ns/}subscribed-strip-todos' => ['striptodos', 'bool'], '{http://calendarserver.org/ns/}subscribed-strip-alarms' => ['stripalarms', 'string'], '{http://calendarserver.org/ns/}subscribed-strip-attachments' => ['stripattachments', 'string']]; + /** @var array parameters to index */ + public static array $indexParameters = ['ATTENDEE' => ['CN'], 'ORGANIZER' => ['CN']]; + /** + * @var string[] Map of uid => display name + */ + protected array $userDisplayNames; + + public function __construct(\OCP\IDBConnection $db, \OCA\DAV\Connector\Sabre\Principal $principalBackend, \OCP\IUserManager $userManager, \OCP\IGroupManager $groupManager, \OCP\Security\ISecureRandom $random, \Psr\Log\LoggerInterface $logger, \OCP\EventDispatcher\IEventDispatcher $dispatcher, \OCP\IConfig $config, bool $legacyEndpoint = false) + { + } + + /** + * Return the number of calendars for a principal + * + * By default this excludes the automatically generated birthday calendar + * + * @param $principalUri + * @param bool $excludeBirthday + * @return int + */ + public function getCalendarsForUserCount($principalUri, $excludeBirthday = true) + { + } + + /** + * @return array{id: int, deleted_at: int}[] + */ + public function getDeletedCalendars(int $deletedBefore): array + { + } + + /** + * Returns a list of calendars for a principal. + * + * Every project is an array with the following keys: + * * id, a unique id that will be used by other functions to modify the + * calendar. This can be the same as the uri or a database key. + * * uri, which the basename of the uri with which the calendar is + * accessed. + * * principaluri. The owner of the calendar. Almost always the same as + * principalUri passed to this method. + * + * Furthermore it can contain webdav properties in clark notation. A very + * common one is '{DAV:}displayname'. + * + * Many clients also require: + * {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set + * For this property, you can just return an instance of + * Sabre\CalDAV\Property\SupportedCalendarComponentSet. + * + * If you return {http://sabredav.org/ns}read-only and set the value to 1, + * ACL will automatically be put in read-only mode. + * + * @param string $principalUri + * @return array + */ + public function getCalendarsForUser($principalUri) + { + } + + /** + * @param $principalUri + * @return array + */ + public function getUsersOwnCalendars($principalUri) + { + } + + /** + * @return array + */ + public function getPublicCalendars() + { + } + + /** + * @param string $uri + * @return array + * @throws NotFound + */ + public function getPublicCalendar($uri) + { + } + + /** + * @param string $principal + * @param string $uri + * @return array|null + */ + public function getCalendarByUri($principal, $uri) + { + } + + /** + * @return array{id: int, uri: string, '{http://calendarserver.org/ns/}getctag': string, '{http://sabredav.org/ns}sync-token': int, '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set': SupportedCalendarComponentSet, '{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp': ScheduleCalendarTransp, '{urn:ietf:params:xml:ns:caldav}calendar-timezone': ?string }|null + */ + public function getCalendarById(int $calendarId): ?array + { + } + + /** + * @param $subscriptionId + */ + public function getSubscriptionById($subscriptionId) + { + } + + /** + * Creates a new calendar for a principal. + * + * If the creation was a success, an id must be returned that can be used to reference + * this calendar in other methods, such as updateCalendar. + * + * @param string $principalUri + * @param string $calendarUri + * @param array $properties + * @return int + * + * @throws CalendarException + */ + public function createCalendar($principalUri, $calendarUri, array $properties) + { + } + + /** + * Updates properties for a calendar. + * + * The list of mutations is stored in a Sabre\DAV\PropPatch object. + * To do the actual updates, you must tell this object which properties + * you're going to process with the handle() method. + * + * Calling the handle method is like telling the PropPatch object "I + * promise I can handle updating this property". + * + * Read the PropPatch documentation for more info and examples. + * + * @param mixed $calendarId + * @param PropPatch $propPatch + * @return void + */ + public function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch) + { + } + + /** + * Delete a calendar and all it's objects + * + * @param mixed $calendarId + * @return void + */ + public function deleteCalendar($calendarId, bool $forceDeletePermanently = false) + { + } + + public function restoreCalendar(int $id): void + { + } + + /** + * Delete all of an user's shares + * + * @param string $principaluri + * @return void + */ + public function deleteAllSharesByUser($principaluri) + { + } + + /** + * Returns all calendar objects within a calendar. + * + * Every item contains an array with the following keys: + * * calendardata - The iCalendar-compatible calendar data + * * uri - a unique key which will be used to construct the uri. This can + * be any arbitrary string, but making sure it ends with '.ics' is a + * good idea. This is only the basename, or filename, not the full + * path. + * * lastmodified - a timestamp of the last modification time + * * etag - An arbitrary string, surrounded by double-quotes. (e.g.: + * '"abcdef"') + * * size - The size of the calendar objects, in bytes. + * * component - optional, a string containing the type of object, such + * as 'vevent' or 'vtodo'. If specified, this will be used to populate + * the Content-Type header. + * + * Note that the etag is optional, but it's highly encouraged to return for + * speed reasons. + * + * The calendardata is also optional. If it's not returned + * 'getCalendarObject' will be called later, which *is* expected to return + * calendardata. + * + * If neither etag or size are specified, the calendardata will be + * used/fetched to determine these numbers. If both are specified the + * amount of times this is needed is reduced by a great degree. + * + * @param mixed $calendarId + * @param int $calendarType + * @return array + */ + public function getCalendarObjects($calendarId, $calendarType = self::CALENDAR_TYPE_CALENDAR): array + { + } + + public function getDeletedCalendarObjects(int $deletedBefore): array + { + } + + /** + * Return all deleted calendar objects by the given principal that are not + * in deleted calendars. + * + * @param string $principalUri + * @return array + * @throws Exception + */ + public function getDeletedCalendarObjectsByPrincipal(string $principalUri): array + { + } + + /** + * Returns information from a single calendar object, based on it's object + * uri. + * + * The object uri is only the basename, or filename and not a full path. + * + * The returned array must have the same keys as getCalendarObjects. The + * 'calendardata' object is required here though, while it's not required + * for getCalendarObjects. + * + * This method must return null if the object did not exist. + * + * @param mixed $calendarId + * @param string $objectUri + * @param int $calendarType + * @return array|null + */ + public function getCalendarObject($calendarId, $objectUri, int $calendarType = self::CALENDAR_TYPE_CALENDAR) + { + } + + /** + * Returns a list of calendar objects. + * + * This method should work identical to getCalendarObject, but instead + * return all the calendar objects in the list as an array. + * + * If the backend supports this, it may allow for some speed-ups. + * + * @param mixed $calendarId + * @param string[] $uris + * @param int $calendarType + * @return array + */ + public function getMultipleCalendarObjects($calendarId, array $uris, $calendarType = self::CALENDAR_TYPE_CALENDAR): array + { + } + + /** + * Creates a new calendar object. + * + * The object uri is only the basename, or filename and not a full path. + * + * It is possible return an etag from this function, which will be used in + * the response to this PUT request. Note that the ETag must be surrounded + * by double-quotes. + * + * However, you should only really return this ETag if you don't mangle the + * calendar-data. If the result of a subsequent GET to this object is not + * the exact same as this request body, you should omit the ETag. + * + * @param mixed $calendarId + * @param string $objectUri + * @param string $calendarData + * @param int $calendarType + * @return string + */ + public function createCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) + { + } + + /** + * Updates an existing calendarobject, based on it's uri. + * + * The object uri is only the basename, or filename and not a full path. + * + * It is possible return an etag from this function, which will be used in + * the response to this PUT request. Note that the ETag must be surrounded + * by double-quotes. + * + * However, you should only really return this ETag if you don't mangle the + * calendar-data. If the result of a subsequent GET to this object is not + * the exact same as this request body, you should omit the ETag. + * + * @param mixed $calendarId + * @param string $objectUri + * @param string $calendarData + * @param int $calendarType + * @return string + */ + public function updateCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) + { + } + + /** + * Moves a calendar object from calendar to calendar. + * + * @param int $sourceCalendarId + * @param int $targetCalendarId + * @param int $objectId + * @param string $oldPrincipalUri + * @param string $newPrincipalUri + * @param int $calendarType + * @return bool + * @throws Exception + */ + public function moveCalendarObject(int $sourceCalendarId, int $targetCalendarId, int $objectId, string $oldPrincipalUri, string $newPrincipalUri, int $calendarType = self::CALENDAR_TYPE_CALENDAR): bool + { + } + + /** + * @param int $calendarObjectId + * @param int $classification + */ + public function setClassification($calendarObjectId, $classification) + { + } + + /** + * Deletes an existing calendar object. + * + * The object uri is only the basename, or filename and not a full path. + * + * @param mixed $calendarId + * @param string $objectUri + * @param int $calendarType + * @param bool $forceDeletePermanently + * @return void + */ + public function deleteCalendarObject($calendarId, $objectUri, $calendarType = self::CALENDAR_TYPE_CALENDAR, bool $forceDeletePermanently = false) + { + } + + /** + * @param mixed $objectData + * + * @throws Forbidden + */ + public function restoreCalendarObject(array $objectData): void + { + } + + /** + * Performs a calendar-query on the contents of this calendar. + * + * The calendar-query is defined in RFC4791 : CalDAV. Using the + * calendar-query it is possible for a client to request a specific set of + * object, based on contents of iCalendar properties, date-ranges and + * iCalendar component types (VTODO, VEVENT). + * + * This method should just return a list of (relative) urls that match this + * query. + * + * The list of filters are specified as an array. The exact array is + * documented by Sabre\CalDAV\CalendarQueryParser. + * + * Note that it is extremely likely that getCalendarObject for every path + * returned from this method will be called almost immediately after. You + * may want to anticipate this to speed up these requests. + * + * This method provides a default implementation, which parses *all* the + * iCalendar objects in the specified calendar. + * + * This default may well be good enough for personal use, and calendars + * that aren't very large. But if you anticipate high usage, big calendars + * or high loads, you are strongly advised to optimize certain paths. + * + * The best way to do so is override this method and to optimize + * specifically for 'common filters'. + * + * Requests that are extremely common are: + * * requests for just VEVENTS + * * requests for just VTODO + * * requests with a time-range-filter on either VEVENT or VTODO. + * + * ..and combinations of these requests. It may not be worth it to try to + * handle every possible situation and just rely on the (relatively + * easy to use) CalendarQueryValidator to handle the rest. + * + * Note that especially time-range-filters may be difficult to parse. A + * time-range filter specified on a VEVENT must for instance also handle + * recurrence rules correctly. + * A good example of how to interpret all these filters can also simply + * be found in Sabre\CalDAV\CalendarQueryFilter. This class is as correct + * as possible, so it gives you a good idea on what type of stuff you need + * to think of. + * + * @param mixed $calendarId + * @param array $filters + * @param int $calendarType + * @return array + */ + public function calendarQuery($calendarId, array $filters, $calendarType = self::CALENDAR_TYPE_CALENDAR): array + { + } + + /** + * custom Nextcloud search extension for CalDAV + * + * TODO - this should optionally cover cached calendar objects as well + * + * @param string $principalUri + * @param array $filters + * @param integer|null $limit + * @param integer|null $offset + * @return array + */ + public function calendarSearch($principalUri, array $filters, $limit = null, $offset = null) + { + } + + /** + * used for Nextcloud's calendar API + * + * @param array $calendarInfo + * @param string $pattern + * @param array $searchProperties + * @param array $options + * @param integer|null $limit + * @param integer|null $offset + * + * @return array + */ + public function search(array $calendarInfo, $pattern, array $searchProperties, array $options, $limit, $offset) + { + } + + /** + * @param string $principalUri + * @param string $pattern + * @param array $componentTypes + * @param array $searchProperties + * @param array $searchParameters + * @param array $options + * @return array + */ + public function searchPrincipalUri(string $principalUri, string $pattern, array $componentTypes, array $searchProperties, array $searchParameters, array $options = []): array + { + } + + /** + * Searches through all of a users calendars and calendar objects to find + * an object with a specific UID. + * + * This method should return the path to this object, relative to the + * calendar home, so this path usually only contains two parts: + * + * calendarpath/objectpath.ics + * + * If the uid is not found, return null. + * + * This method should only consider * objects that the principal owns, so + * any calendars owned by other principals that also appear in this + * collection should be ignored. + * + * @param string $principalUri + * @param string $uid + * @return string|null + */ + public function getCalendarObjectByUID($principalUri, $uid) + { + } + + public function getCalendarObjectById(string $principalUri, int $id): ?array + { + } + + /** + * The getChanges method returns all the changes that have happened, since + * the specified syncToken in the specified calendar. + * + * This function should return an array, such as the following: + * + * [ + * 'syncToken' => 'The current synctoken', + * 'added' => [ + * 'new.txt', + * ], + * 'modified' => [ + * 'modified.txt', + * ], + * 'deleted' => [ + * 'foo.php.bak', + * 'old.txt' + * ] + * ); + * + * The returned syncToken property should reflect the *current* syncToken + * of the calendar, as reported in the {http://sabredav.org/ns}sync-token + * property This is * needed here too, to ensure the operation is atomic. + * + * If the $syncToken argument is specified as null, this is an initial + * sync, and all members should be reported. + * + * The modified property is an array of nodenames that have changed since + * the last token. + * + * The deleted property is an array with nodenames, that have been deleted + * from collection. + * + * The $syncLevel argument is basically the 'depth' of the report. If it's + * 1, you only have to report changes that happened only directly in + * immediate descendants. If it's 2, it should also include changes from + * the nodes below the child collections. (grandchildren) + * + * The $limit argument allows a client to specify how many results should + * be returned at most. If the limit is not specified, it should be treated + * as infinite. + * + * If the limit (infinite or not) is higher than you're willing to return, + * you should throw a Sabre\DAV\Exception\TooMuchMatches() exception. + * + * If the syncToken is expired (due to data cleanup) or unknown, you must + * return null. + * + * The limit is 'suggestive'. You are free to ignore it. + * + * @param string $calendarId + * @param string $syncToken + * @param int $syncLevel + * @param int|null $limit + * @param int $calendarType + * @return array + */ + public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null, $calendarType = self::CALENDAR_TYPE_CALENDAR) + { + } + + /** + * Returns a list of subscriptions for a principal. + * + * Every subscription is an array with the following keys: + * * id, a unique id that will be used by other functions to modify the + * subscription. This can be the same as the uri or a database key. + * * uri. This is just the 'base uri' or 'filename' of the subscription. + * * principaluri. The owner of the subscription. Almost always the same as + * principalUri passed to this method. + * + * Furthermore, all the subscription info must be returned too: + * + * 1. {DAV:}displayname + * 2. {http://apple.com/ns/ical/}refreshrate + * 3. {http://calendarserver.org/ns/}subscribed-strip-todos (omit if todos + * should not be stripped). + * 4. {http://calendarserver.org/ns/}subscribed-strip-alarms (omit if alarms + * should not be stripped). + * 5. {http://calendarserver.org/ns/}subscribed-strip-attachments (omit if + * attachments should not be stripped). + * 6. {http://calendarserver.org/ns/}source (Must be a + * Sabre\DAV\Property\Href). + * 7. {http://apple.com/ns/ical/}calendar-color + * 8. {http://apple.com/ns/ical/}calendar-order + * 9. {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set + * (should just be an instance of + * Sabre\CalDAV\Property\SupportedCalendarComponentSet, with a bunch of + * default components). + * + * @param string $principalUri + * @return array + */ + public function getSubscriptionsForUser($principalUri) + { + } + + /** + * Creates a new subscription for a principal. + * + * If the creation was a success, an id must be returned that can be used to reference + * this subscription in other methods, such as updateSubscription. + * + * @param string $principalUri + * @param string $uri + * @param array $properties + * @return mixed + */ + public function createSubscription($principalUri, $uri, array $properties) + { + } + + /** + * Updates a subscription + * + * The list of mutations is stored in a Sabre\DAV\PropPatch object. + * To do the actual updates, you must tell this object which properties + * you're going to process with the handle() method. + * + * Calling the handle method is like telling the PropPatch object "I + * promise I can handle updating this property". + * + * Read the PropPatch documentation for more info and examples. + * + * @param mixed $subscriptionId + * @param PropPatch $propPatch + * @return void + */ + public function updateSubscription($subscriptionId, \Sabre\DAV\PropPatch $propPatch) + { + } + + /** + * Deletes a subscription. + * + * @param mixed $subscriptionId + * @return void + */ + public function deleteSubscription($subscriptionId) + { + } + + /** + * Returns a single scheduling object for the inbox collection. + * + * The returned array should contain the following elements: + * * uri - A unique basename for the object. This will be used to + * construct a full uri. + * * calendardata - The iCalendar object + * * lastmodified - The last modification date. Can be an int for a unix + * timestamp, or a PHP DateTime object. + * * etag - A unique token that must change if the object changed. + * * size - The size of the object, in bytes. + * + * @param string $principalUri + * @param string $objectUri + * @return array + */ + public function getSchedulingObject($principalUri, $objectUri) + { + } + + /** + * Returns all scheduling objects for the inbox collection. + * + * These objects should be returned as an array. Every item in the array + * should follow the same structure as returned from getSchedulingObject. + * + * The main difference is that 'calendardata' is optional. + * + * @param string $principalUri + * @return array + */ + public function getSchedulingObjects($principalUri) + { + } + + /** + * Deletes a scheduling object from the inbox collection. + * + * @param string $principalUri + * @param string $objectUri + * @return void + */ + public function deleteSchedulingObject($principalUri, $objectUri) + { + } + + /** + * Creates a new scheduling object. This should land in a users' inbox. + * + * @param string $principalUri + * @param string $objectUri + * @param string $objectData + * @return void + */ + public function createSchedulingObject($principalUri, $objectUri, $objectData) + { + } + + /** + * Adds a change record to the calendarchanges table. + * + * @param mixed $calendarId + * @param string $objectUri + * @param int $operation 1 = add, 2 = modify, 3 = delete. + * @param int $calendarType + * @return void + */ + protected function addChange(int $calendarId, string $objectUri, int $operation, int $calendarType = self::CALENDAR_TYPE_CALENDAR): void + { + } + + /** + * Parses some information from calendar objects, used for optimized + * calendar-queries. + * + * Returns an array with the following keys: + * * etag - An md5 checksum of the object without the quotes. + * * size - Size of the object in bytes + * * componentType - VEVENT, VTODO or VJOURNAL + * * firstOccurence + * * lastOccurence + * * uid - value of the UID property + * + * @param string $calendarData + * @return array + */ + public function getDenormalizedData($calendarData) + { + } + + /** + * @param list $add + * @param list $remove + */ + public function updateShares(\OCA\DAV\DAV\Sharing\IShareable $shareable, array $add, array $remove): void + { + } + + /** + * @return list + */ + public function getShares(int $resourceId): array + { + } + + /** + * @param boolean $value + * @param \OCA\DAV\CalDAV\Calendar $calendar + * @return string|null + */ + public function setPublishStatus($value, $calendar) + { + } + + /** + * @param \OCA\DAV\CalDAV\Calendar $calendar + * @return mixed + */ + public function getPublishStatus($calendar) + { + } + + /** + * @param int $resourceId + * @param list $acl + * @return list + */ + public function applyShareAcl(int $resourceId, array $acl): array + { + } + + /** + * update properties table + * + * @param int $calendarId + * @param string $objectUri + * @param string $calendarData + * @param int $calendarType + */ + public function updateProperties($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) + { + } + + /** + * deletes all birthday calendars + */ + public function deleteAllBirthdayCalendars() + { + } + + /** + * @param $subscriptionId + */ + public function purgeAllCachedEventsForSubscription($subscriptionId) + { + } + + /** + * Move a calendar from one user to another + * + * @param string $uriName + * @param string $uriOrigin + * @param string $uriDestination + * @param string $newUriName (optional) the new uriName + */ + public function moveCalendar($uriName, $uriOrigin, $uriDestination, $newUriName = null) + { + } + + /** + * read VCalendar data into a VCalendar object + * + * @param string $objectData + * @return VCalendar + */ + protected function readCalendarData($objectData) + { + } + + /** + * delete all properties from a given calendar object + * + * @param int $calendarId + * @param int $objectId + */ + protected function purgeProperties($calendarId, $objectId) + { + } + + /** + * get ID from a given calendar object + * + * @param int $calendarId + * @param string $uri + * @param int $calendarType + * @return int + */ + protected function getCalendarObjectId($calendarId, $uri, $calendarType): int + { + } + + /** + * @throws \InvalidArgumentException + */ + public function pruneOutdatedSyncTokens(int $keep = 10000): int + { + } + } + +} + +namespace Sabre\CalDAV\Backend { + + /** + * Abstract Calendaring backend. Extend this class to create your own backends. + * + * Checkout the BackendInterface for all the methods that must be implemented. + * + * @copyright Copyright (C) fruux GmbH (https://fruux.com/) + * @author Evert Pot (http://evertpot.com/) + * @license http://sabre.io/license/ Modified BSD License + */ + abstract class AbstractBackend implements \Sabre\CalDAV\Backend\BackendInterface + { + /** + * Updates properties for a calendar. + * + * The list of mutations is stored in a Sabre\DAV\PropPatch object. + * To do the actual updates, you must tell this object which properties + * you're going to process with the handle() method. + * + * Calling the handle method is like telling the PropPatch object "I + * promise I can handle updating this property". + * + * Read the PropPatch documentation for more info and examples. + * + * @param mixed $calendarId + */ + public function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch) + { + } + + /** + * Returns a list of calendar objects. + * + * This method should work identical to getCalendarObject, but instead + * return all the calendar objects in the list as an array. + * + * If the backend supports this, it may allow for some speed-ups. + * + * @param mixed $calendarId + * + * @return array + */ + public function getMultipleCalendarObjects($calendarId, array $uris) + { + } + + /** + * Performs a calendar-query on the contents of this calendar. + * + * The calendar-query is defined in RFC4791 : CalDAV. Using the + * calendar-query it is possible for a client to request a specific set of + * object, based on contents of iCalendar properties, date-ranges and + * iCalendar component types (VTODO, VEVENT). + * + * This method should just return a list of (relative) urls that match this + * query. + * + * The list of filters are specified as an array. The exact array is + * documented by \Sabre\CalDAV\CalendarQueryParser. + * + * Note that it is extremely likely that getCalendarObject for every path + * returned from this method will be called almost immediately after. You + * may want to anticipate this to speed up these requests. + * + * This method provides a default implementation, which parses *all* the + * iCalendar objects in the specified calendar. + * + * This default may well be good enough for personal use, and calendars + * that aren't very large. But if you anticipate high usage, big calendars + * or high loads, you are strongly adviced to optimize certain paths. + * + * The best way to do so is override this method and to optimize + * specifically for 'common filters'. + * + * Requests that are extremely common are: + * * requests for just VEVENTS + * * requests for just VTODO + * * requests with a time-range-filter on either VEVENT or VTODO. + * + * ..and combinations of these requests. It may not be worth it to try to + * handle every possible situation and just rely on the (relatively + * easy to use) CalendarQueryValidator to handle the rest. + * + * Note that especially time-range-filters may be difficult to parse. A + * time-range filter specified on a VEVENT must for instance also handle + * recurrence rules correctly. + * A good example of how to interprete all these filters can also simply + * be found in \Sabre\CalDAV\CalendarQueryFilter. This class is as correct + * as possible, so it gives you a good idea on what type of stuff you need + * to think of. + * + * @param mixed $calendarId + * + * @return array + */ + public function calendarQuery($calendarId, array $filters) + { + } + + /** + * This method validates if a filter (as passed to calendarQuery) matches + * the given object. + * + * @return bool + */ + protected function validateFilterForObject(array $object, array $filters) + { + } + + /** + * Searches through all of a users calendars and calendar objects to find + * an object with a specific UID. + * + * This method should return the path to this object, relative to the + * calendar home, so this path usually only contains two parts: + * + * calendarpath/objectpath.ics + * + * If the uid is not found, return null. + * + * This method should only consider * objects that the principal owns, so + * any calendars owned by other principals that also appear in this + * collection should be ignored. + * + * @param string $principalUri + * @param string $uid + * + * @return string|null + */ + public function getCalendarObjectByUID($principalUri, $uid) + { + } + } +} \ No newline at end of file diff --git a/socialsharing_facebook/.php-cs-fixer.dist.php b/socialsharing_facebook/.php-cs-fixer.dist.php new file mode 100644 index 0000000..31a73f5 --- /dev/null +++ b/socialsharing_facebook/.php-cs-fixer.dist.php @@ -0,0 +1,12 @@ +getFinder() + ->in(__DIR__ . '/lib'); +return $config; diff --git a/socialsharing_facebook/appinfo/info.xml b/socialsharing_facebook/appinfo/info.xml index c76c547..b5e79cd 100644 --- a/socialsharing_facebook/appinfo/info.xml +++ b/socialsharing_facebook/appinfo/info.xml @@ -10,7 +10,7 @@ https://raw.githubusercontent.com/nextcloud/socialsharing/master/socialsharing_facebook/screenshots/preview.png SocialSharingFacebook - + https://github.com/nextcloud/socialsharing https://github.com/nextcloud/socialsharing diff --git a/socialsharing_facebook/composer.json b/socialsharing_facebook/composer.json new file mode 100644 index 0000000..506da24 --- /dev/null +++ b/socialsharing_facebook/composer.json @@ -0,0 +1,24 @@ +{ + "require": { + "php": ">=8.0" + }, + "scripts": { + "lint": "find . -name \\*.php -not -path './vendor/*' -print0 | xargs -0 -n1 php -l", + "cs:check": "php-cs-fixer fix --dry-run --diff", + "cs:fix": "php-cs-fixer fix", + "psalm": "psalm.phar --no-cache", + "psalm:update-baseline": "psalm.phar --threads=1 --update-baseline", + "psalm:update-baseline:force": "psalm.phar --threads=1 --update-baseline --set-baseline=tests/psalm-baseline.xml" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3", + "nextcloud/coding-standard": "^1", + "psalm/phar": "^5.26", + "nextcloud/ocp": "dev-master" + }, + "config": { + "platform": { + "php": "8.0" + } + } +} \ No newline at end of file diff --git a/socialsharing_facebook/composer.lock b/socialsharing_facebook/composer.lock new file mode 100644 index 0000000..2e43667 --- /dev/null +++ b/socialsharing_facebook/composer.lock @@ -0,0 +1,447 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "79e6391b32591471039a4ff999b31230", + "packages": [], + "packages-dev": [ + { + "name": "kubawerlos/php-cs-fixer-custom-fixers", + "version": "v3.22.0", + "source": { + "type": "git", + "url": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers.git", + "reference": "8701394f0c7cd450ac4fa577d24589122c1d5d5e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kubawerlos/php-cs-fixer-custom-fixers/zipball/8701394f0c7cd450ac4fa577d24589122c1d5d5e", + "reference": "8701394f0c7cd450ac4fa577d24589122c1d5d5e", + "shasum": "" + }, + "require": { + "ext-filter": "*", + "ext-tokenizer": "*", + "friendsofphp/php-cs-fixer": "^3.61.1", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.6.4 || ^10.5.29" + }, + "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": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers/issues", + "source": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers/tree/v3.22.0" + }, + "time": "2024-08-16T20:44:35+00:00" + }, + { + "name": "nextcloud/coding-standard", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/nextcloud/coding-standard.git", + "reference": "e88acb0df6217b808d1632286ddfec9267a102e4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/e88acb0df6217b808d1632286ddfec9267a102e4", + "reference": "e88acb0df6217b808d1632286ddfec9267a102e4", + "shasum": "" + }, + "require": { + "kubawerlos/php-cs-fixer-custom-fixers": "^3.22", + "php": "^7.3|^8.0", + "php-cs-fixer/shim": "^3.17" + }, + "type": "library", + "autoload": { + "psr-4": { + "Nextcloud\\CodingStandard\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christoph Wurst", + "email": "christoph@winzerhof-wurst.at" + } + ], + "description": "Nextcloud coding standards for the php cs fixer", + "support": { + "issues": "https://github.com/nextcloud/coding-standard/issues", + "source": "https://github.com/nextcloud/coding-standard/tree/v1.3.1" + }, + "time": "2024-09-19T09:07:10+00:00" + }, + { + "name": "nextcloud/ocp", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/nextcloud-deps/ocp.git", + "reference": "8076405cf21b59fe1b935562041f96393abf6d8e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/8076405cf21b59fe1b935562041f96393abf6d8e", + "reference": "8076405cf21b59fe1b935562041f96393abf6d8e", + "shasum": "" + }, + "require": { + "php": "~8.0 || ~8.1 || ~8.2 || ~8.3", + "psr/clock": "^1.0", + "psr/container": "^2.0.2", + "psr/event-dispatcher": "^1.0", + "psr/log": "^1.1.4" + }, + "default-branch": true, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "31.0.0-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "AGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Christoph Wurst", + "email": "christoph@winzerhof-wurst.at" + } + ], + "description": "Composer package containing Nextcloud's public API (classes, interfaces)", + "support": { + "issues": "https://github.com/nextcloud-deps/ocp/issues", + "source": "https://github.com/nextcloud-deps/ocp/tree/master" + }, + "time": "2024-09-23T14:11:16+00:00" + }, + { + "name": "php-cs-fixer/shim", + "version": "v3.64.0", + "source": { + "type": "git", + "url": "https://github.com/PHP-CS-Fixer/shim.git", + "reference": "81ccfd24baf3a10810dab1152c403981a790b837" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/81ccfd24baf3a10810dab1152c403981a790b837", + "reference": "81ccfd24baf3a10810dab1152c403981a790b837", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-tokenizer": "*", + "php": "^7.4 || ^8.0" + }, + "replace": { + "friendsofphp/php-cs-fixer": "self.version" + }, + "suggest": { + "ext-dom": "For handling output formats in XML", + "ext-mbstring": "For handling non-UTF8 characters." + }, + "bin": [ + "php-cs-fixer", + "php-cs-fixer.phar" + ], + "type": "application", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Dariusz Rumiński", + "email": "dariusz.ruminski@gmail.com" + } + ], + "description": "A tool to automatically fix PHP code style", + "support": { + "issues": "https://github.com/PHP-CS-Fixer/shim/issues", + "source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.64.0" + }, + "time": "2024-08-30T23:10:11+00:00" + }, + { + "name": "psalm/phar", + "version": "5.26.1", + "source": { + "type": "git", + "url": "https://github.com/psalm/phar.git", + "reference": "8a38e7ad04499a0ccd2c506fd1da6fc01fff4547" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/psalm/phar/zipball/8a38e7ad04499a0ccd2c506fd1da6fc01fff4547", + "reference": "8a38e7ad04499a0ccd2c506fd1da6fc01fff4547", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "vimeo/psalm": "*" + }, + "bin": [ + "psalm.phar" + ], + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Composer-based Psalm Phar", + "support": { + "issues": "https://github.com/psalm/phar/issues", + "source": "https://github.com/psalm/phar/tree/5.26.1" + }, + "time": "2024-09-09T16:22:43+00:00" + }, + { + "name": "psr/clock", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/clock.git", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Clock\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for reading the clock.", + "homepage": "https://github.com/php-fig/clock", + "keywords": [ + "clock", + "now", + "psr", + "psr-20", + "time" + ], + "support": { + "issues": "https://github.com/php-fig/clock/issues", + "source": "https://github.com/php-fig/clock/tree/1.0.0" + }, + "time": "2022-11-25T14:36:26+00:00" + }, + { + "name": "psr/container", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/2.0.2" + }, + "time": "2021-11-05T16:47:00+00:00" + }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00" + }, + { + "name": "psr/log", + "version": "1.1.4", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/1.1.4" + }, + "time": "2021-05-03T11:20:27+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": { + "nextcloud/ocp": 20 + }, + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=8.0" + }, + "platform-dev": [], + "platform-overrides": { + "php": "8.0" + }, + "plugin-api-version": "2.6.0" +} diff --git a/socialsharing_facebook/lib/AppInfo/Application.php b/socialsharing_facebook/lib/AppInfo/Application.php index 129fbca..633b14c 100644 --- a/socialsharing_facebook/lib/AppInfo/Application.php +++ b/socialsharing_facebook/lib/AppInfo/Application.php @@ -27,27 +27,30 @@ use OCP\AppFramework\Bootstrap\IBootstrap; use OCP\AppFramework\Bootstrap\IRegistrationContext; use OCP\EventDispatcher\Event; -use OCP\EventDispatcher\IEventDispatcher; +use OCP\EventDispatcher\IEventListener; use OCP\Util; -class Application extends App implements IBootstrap { +/** + * @implements IEventListener<\OCA\Files\Event\LoadAdditionalScriptsEvent|\OCA\Files\Event\LoadSidebar> + */ +class Application extends App implements IBootstrap, IEventListener { - public const APP_ID = 'socialsharing_facebook'; + public const APP_ID = 'socialsharing_facebook'; - public function __construct() { - parent::__construct(self::APP_ID); - } + public function __construct() { + parent::__construct(self::APP_ID); + } - public function register(IRegistrationContext $context): void { - $context->registerEventListener(\OCA\Files\Event\LoadSidebar::class, self::class); - $context->registerEventListener(\OCA\Files\Event\LoadAdditionalScriptsEvent::class, self::class); - } + public function register(IRegistrationContext $context): void { + $context->registerEventListener(\OCA\Files\Event\LoadSidebar::class, self::class); + $context->registerEventListener(\OCA\Files\Event\LoadAdditionalScriptsEvent::class, self::class); + } - public function boot(IBootContext $context): void { - } + public function boot(IBootContext $context): void { + } - public function handle(Event $event): void { - Util::addScript(self::APP_ID, self::APP_ID); - Util::addStyle(self::APP_ID, self::APP_ID); - } + public function handle(Event $event): void { + Util::addScript(self::APP_ID, self::APP_ID); + Util::addStyle(self::APP_ID, self::APP_ID); + } } diff --git a/socialsharing_facebook/psalm.xml b/socialsharing_facebook/psalm.xml new file mode 100644 index 0000000..ae047bd --- /dev/null +++ b/socialsharing_facebook/psalm.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/socialsharing_facebook/tests/psalm-baseline.xml b/socialsharing_facebook/tests/psalm-baseline.xml new file mode 100644 index 0000000..5a96be5 --- /dev/null +++ b/socialsharing_facebook/tests/psalm-baseline.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/socialsharing_facebook/tests/stub.phpstub b/socialsharing_facebook/tests/stub.phpstub new file mode 100644 index 0000000..35d9dc8 --- /dev/null +++ b/socialsharing_facebook/tests/stub.phpstub @@ -0,0 +1,1116 @@ + + */ + public array $propertyMap = ['{DAV:}displayname' => ['displayname', 'string'], '{urn:ietf:params:xml:ns:caldav}calendar-description' => ['description', 'string'], '{urn:ietf:params:xml:ns:caldav}calendar-timezone' => ['timezone', 'string'], '{http://apple.com/ns/ical/}calendar-order' => ['calendarorder', 'int'], '{http://apple.com/ns/ical/}calendar-color' => ['calendarcolor', 'string'], '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => ['deleted_at', 'int']]; + /** + * List of subscription properties, and how they map to database field names. + * + * @var array + */ + public array $subscriptionPropertyMap = ['{DAV:}displayname' => ['displayname', 'string'], '{http://apple.com/ns/ical/}refreshrate' => ['refreshrate', 'string'], '{http://apple.com/ns/ical/}calendar-order' => ['calendarorder', 'int'], '{http://apple.com/ns/ical/}calendar-color' => ['calendarcolor', 'string'], '{http://calendarserver.org/ns/}subscribed-strip-todos' => ['striptodos', 'bool'], '{http://calendarserver.org/ns/}subscribed-strip-alarms' => ['stripalarms', 'string'], '{http://calendarserver.org/ns/}subscribed-strip-attachments' => ['stripattachments', 'string']]; + /** @var array parameters to index */ + public static array $indexParameters = ['ATTENDEE' => ['CN'], 'ORGANIZER' => ['CN']]; + /** + * @var string[] Map of uid => display name + */ + protected array $userDisplayNames; + + public function __construct(\OCP\IDBConnection $db, \OCA\DAV\Connector\Sabre\Principal $principalBackend, \OCP\IUserManager $userManager, \OCP\IGroupManager $groupManager, \OCP\Security\ISecureRandom $random, \Psr\Log\LoggerInterface $logger, \OCP\EventDispatcher\IEventDispatcher $dispatcher, \OCP\IConfig $config, bool $legacyEndpoint = false) + { + } + + /** + * Return the number of calendars for a principal + * + * By default this excludes the automatically generated birthday calendar + * + * @param $principalUri + * @param bool $excludeBirthday + * @return int + */ + public function getCalendarsForUserCount($principalUri, $excludeBirthday = true) + { + } + + /** + * @return array{id: int, deleted_at: int}[] + */ + public function getDeletedCalendars(int $deletedBefore): array + { + } + + /** + * Returns a list of calendars for a principal. + * + * Every project is an array with the following keys: + * * id, a unique id that will be used by other functions to modify the + * calendar. This can be the same as the uri or a database key. + * * uri, which the basename of the uri with which the calendar is + * accessed. + * * principaluri. The owner of the calendar. Almost always the same as + * principalUri passed to this method. + * + * Furthermore it can contain webdav properties in clark notation. A very + * common one is '{DAV:}displayname'. + * + * Many clients also require: + * {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set + * For this property, you can just return an instance of + * Sabre\CalDAV\Property\SupportedCalendarComponentSet. + * + * If you return {http://sabredav.org/ns}read-only and set the value to 1, + * ACL will automatically be put in read-only mode. + * + * @param string $principalUri + * @return array + */ + public function getCalendarsForUser($principalUri) + { + } + + /** + * @param $principalUri + * @return array + */ + public function getUsersOwnCalendars($principalUri) + { + } + + /** + * @return array + */ + public function getPublicCalendars() + { + } + + /** + * @param string $uri + * @return array + * @throws NotFound + */ + public function getPublicCalendar($uri) + { + } + + /** + * @param string $principal + * @param string $uri + * @return array|null + */ + public function getCalendarByUri($principal, $uri) + { + } + + /** + * @return array{id: int, uri: string, '{http://calendarserver.org/ns/}getctag': string, '{http://sabredav.org/ns}sync-token': int, '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set': SupportedCalendarComponentSet, '{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp': ScheduleCalendarTransp, '{urn:ietf:params:xml:ns:caldav}calendar-timezone': ?string }|null + */ + public function getCalendarById(int $calendarId): ?array + { + } + + /** + * @param $subscriptionId + */ + public function getSubscriptionById($subscriptionId) + { + } + + /** + * Creates a new calendar for a principal. + * + * If the creation was a success, an id must be returned that can be used to reference + * this calendar in other methods, such as updateCalendar. + * + * @param string $principalUri + * @param string $calendarUri + * @param array $properties + * @return int + * + * @throws CalendarException + */ + public function createCalendar($principalUri, $calendarUri, array $properties) + { + } + + /** + * Updates properties for a calendar. + * + * The list of mutations is stored in a Sabre\DAV\PropPatch object. + * To do the actual updates, you must tell this object which properties + * you're going to process with the handle() method. + * + * Calling the handle method is like telling the PropPatch object "I + * promise I can handle updating this property". + * + * Read the PropPatch documentation for more info and examples. + * + * @param mixed $calendarId + * @param PropPatch $propPatch + * @return void + */ + public function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch) + { + } + + /** + * Delete a calendar and all it's objects + * + * @param mixed $calendarId + * @return void + */ + public function deleteCalendar($calendarId, bool $forceDeletePermanently = false) + { + } + + public function restoreCalendar(int $id): void + { + } + + /** + * Delete all of an user's shares + * + * @param string $principaluri + * @return void + */ + public function deleteAllSharesByUser($principaluri) + { + } + + /** + * Returns all calendar objects within a calendar. + * + * Every item contains an array with the following keys: + * * calendardata - The iCalendar-compatible calendar data + * * uri - a unique key which will be used to construct the uri. This can + * be any arbitrary string, but making sure it ends with '.ics' is a + * good idea. This is only the basename, or filename, not the full + * path. + * * lastmodified - a timestamp of the last modification time + * * etag - An arbitrary string, surrounded by double-quotes. (e.g.: + * '"abcdef"') + * * size - The size of the calendar objects, in bytes. + * * component - optional, a string containing the type of object, such + * as 'vevent' or 'vtodo'. If specified, this will be used to populate + * the Content-Type header. + * + * Note that the etag is optional, but it's highly encouraged to return for + * speed reasons. + * + * The calendardata is also optional. If it's not returned + * 'getCalendarObject' will be called later, which *is* expected to return + * calendardata. + * + * If neither etag or size are specified, the calendardata will be + * used/fetched to determine these numbers. If both are specified the + * amount of times this is needed is reduced by a great degree. + * + * @param mixed $calendarId + * @param int $calendarType + * @return array + */ + public function getCalendarObjects($calendarId, $calendarType = self::CALENDAR_TYPE_CALENDAR): array + { + } + + public function getDeletedCalendarObjects(int $deletedBefore): array + { + } + + /** + * Return all deleted calendar objects by the given principal that are not + * in deleted calendars. + * + * @param string $principalUri + * @return array + * @throws Exception + */ + public function getDeletedCalendarObjectsByPrincipal(string $principalUri): array + { + } + + /** + * Returns information from a single calendar object, based on it's object + * uri. + * + * The object uri is only the basename, or filename and not a full path. + * + * The returned array must have the same keys as getCalendarObjects. The + * 'calendardata' object is required here though, while it's not required + * for getCalendarObjects. + * + * This method must return null if the object did not exist. + * + * @param mixed $calendarId + * @param string $objectUri + * @param int $calendarType + * @return array|null + */ + public function getCalendarObject($calendarId, $objectUri, int $calendarType = self::CALENDAR_TYPE_CALENDAR) + { + } + + /** + * Returns a list of calendar objects. + * + * This method should work identical to getCalendarObject, but instead + * return all the calendar objects in the list as an array. + * + * If the backend supports this, it may allow for some speed-ups. + * + * @param mixed $calendarId + * @param string[] $uris + * @param int $calendarType + * @return array + */ + public function getMultipleCalendarObjects($calendarId, array $uris, $calendarType = self::CALENDAR_TYPE_CALENDAR): array + { + } + + /** + * Creates a new calendar object. + * + * The object uri is only the basename, or filename and not a full path. + * + * It is possible return an etag from this function, which will be used in + * the response to this PUT request. Note that the ETag must be surrounded + * by double-quotes. + * + * However, you should only really return this ETag if you don't mangle the + * calendar-data. If the result of a subsequent GET to this object is not + * the exact same as this request body, you should omit the ETag. + * + * @param mixed $calendarId + * @param string $objectUri + * @param string $calendarData + * @param int $calendarType + * @return string + */ + public function createCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) + { + } + + /** + * Updates an existing calendarobject, based on it's uri. + * + * The object uri is only the basename, or filename and not a full path. + * + * It is possible return an etag from this function, which will be used in + * the response to this PUT request. Note that the ETag must be surrounded + * by double-quotes. + * + * However, you should only really return this ETag if you don't mangle the + * calendar-data. If the result of a subsequent GET to this object is not + * the exact same as this request body, you should omit the ETag. + * + * @param mixed $calendarId + * @param string $objectUri + * @param string $calendarData + * @param int $calendarType + * @return string + */ + public function updateCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) + { + } + + /** + * Moves a calendar object from calendar to calendar. + * + * @param int $sourceCalendarId + * @param int $targetCalendarId + * @param int $objectId + * @param string $oldPrincipalUri + * @param string $newPrincipalUri + * @param int $calendarType + * @return bool + * @throws Exception + */ + public function moveCalendarObject(int $sourceCalendarId, int $targetCalendarId, int $objectId, string $oldPrincipalUri, string $newPrincipalUri, int $calendarType = self::CALENDAR_TYPE_CALENDAR): bool + { + } + + /** + * @param int $calendarObjectId + * @param int $classification + */ + public function setClassification($calendarObjectId, $classification) + { + } + + /** + * Deletes an existing calendar object. + * + * The object uri is only the basename, or filename and not a full path. + * + * @param mixed $calendarId + * @param string $objectUri + * @param int $calendarType + * @param bool $forceDeletePermanently + * @return void + */ + public function deleteCalendarObject($calendarId, $objectUri, $calendarType = self::CALENDAR_TYPE_CALENDAR, bool $forceDeletePermanently = false) + { + } + + /** + * @param mixed $objectData + * + * @throws Forbidden + */ + public function restoreCalendarObject(array $objectData): void + { + } + + /** + * Performs a calendar-query on the contents of this calendar. + * + * The calendar-query is defined in RFC4791 : CalDAV. Using the + * calendar-query it is possible for a client to request a specific set of + * object, based on contents of iCalendar properties, date-ranges and + * iCalendar component types (VTODO, VEVENT). + * + * This method should just return a list of (relative) urls that match this + * query. + * + * The list of filters are specified as an array. The exact array is + * documented by Sabre\CalDAV\CalendarQueryParser. + * + * Note that it is extremely likely that getCalendarObject for every path + * returned from this method will be called almost immediately after. You + * may want to anticipate this to speed up these requests. + * + * This method provides a default implementation, which parses *all* the + * iCalendar objects in the specified calendar. + * + * This default may well be good enough for personal use, and calendars + * that aren't very large. But if you anticipate high usage, big calendars + * or high loads, you are strongly advised to optimize certain paths. + * + * The best way to do so is override this method and to optimize + * specifically for 'common filters'. + * + * Requests that are extremely common are: + * * requests for just VEVENTS + * * requests for just VTODO + * * requests with a time-range-filter on either VEVENT or VTODO. + * + * ..and combinations of these requests. It may not be worth it to try to + * handle every possible situation and just rely on the (relatively + * easy to use) CalendarQueryValidator to handle the rest. + * + * Note that especially time-range-filters may be difficult to parse. A + * time-range filter specified on a VEVENT must for instance also handle + * recurrence rules correctly. + * A good example of how to interpret all these filters can also simply + * be found in Sabre\CalDAV\CalendarQueryFilter. This class is as correct + * as possible, so it gives you a good idea on what type of stuff you need + * to think of. + * + * @param mixed $calendarId + * @param array $filters + * @param int $calendarType + * @return array + */ + public function calendarQuery($calendarId, array $filters, $calendarType = self::CALENDAR_TYPE_CALENDAR): array + { + } + + /** + * custom Nextcloud search extension for CalDAV + * + * TODO - this should optionally cover cached calendar objects as well + * + * @param string $principalUri + * @param array $filters + * @param integer|null $limit + * @param integer|null $offset + * @return array + */ + public function calendarSearch($principalUri, array $filters, $limit = null, $offset = null) + { + } + + /** + * used for Nextcloud's calendar API + * + * @param array $calendarInfo + * @param string $pattern + * @param array $searchProperties + * @param array $options + * @param integer|null $limit + * @param integer|null $offset + * + * @return array + */ + public function search(array $calendarInfo, $pattern, array $searchProperties, array $options, $limit, $offset) + { + } + + /** + * @param string $principalUri + * @param string $pattern + * @param array $componentTypes + * @param array $searchProperties + * @param array $searchParameters + * @param array $options + * @return array + */ + public function searchPrincipalUri(string $principalUri, string $pattern, array $componentTypes, array $searchProperties, array $searchParameters, array $options = []): array + { + } + + /** + * Searches through all of a users calendars and calendar objects to find + * an object with a specific UID. + * + * This method should return the path to this object, relative to the + * calendar home, so this path usually only contains two parts: + * + * calendarpath/objectpath.ics + * + * If the uid is not found, return null. + * + * This method should only consider * objects that the principal owns, so + * any calendars owned by other principals that also appear in this + * collection should be ignored. + * + * @param string $principalUri + * @param string $uid + * @return string|null + */ + public function getCalendarObjectByUID($principalUri, $uid) + { + } + + public function getCalendarObjectById(string $principalUri, int $id): ?array + { + } + + /** + * The getChanges method returns all the changes that have happened, since + * the specified syncToken in the specified calendar. + * + * This function should return an array, such as the following: + * + * [ + * 'syncToken' => 'The current synctoken', + * 'added' => [ + * 'new.txt', + * ], + * 'modified' => [ + * 'modified.txt', + * ], + * 'deleted' => [ + * 'foo.php.bak', + * 'old.txt' + * ] + * ); + * + * The returned syncToken property should reflect the *current* syncToken + * of the calendar, as reported in the {http://sabredav.org/ns}sync-token + * property This is * needed here too, to ensure the operation is atomic. + * + * If the $syncToken argument is specified as null, this is an initial + * sync, and all members should be reported. + * + * The modified property is an array of nodenames that have changed since + * the last token. + * + * The deleted property is an array with nodenames, that have been deleted + * from collection. + * + * The $syncLevel argument is basically the 'depth' of the report. If it's + * 1, you only have to report changes that happened only directly in + * immediate descendants. If it's 2, it should also include changes from + * the nodes below the child collections. (grandchildren) + * + * The $limit argument allows a client to specify how many results should + * be returned at most. If the limit is not specified, it should be treated + * as infinite. + * + * If the limit (infinite or not) is higher than you're willing to return, + * you should throw a Sabre\DAV\Exception\TooMuchMatches() exception. + * + * If the syncToken is expired (due to data cleanup) or unknown, you must + * return null. + * + * The limit is 'suggestive'. You are free to ignore it. + * + * @param string $calendarId + * @param string $syncToken + * @param int $syncLevel + * @param int|null $limit + * @param int $calendarType + * @return array + */ + public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null, $calendarType = self::CALENDAR_TYPE_CALENDAR) + { + } + + /** + * Returns a list of subscriptions for a principal. + * + * Every subscription is an array with the following keys: + * * id, a unique id that will be used by other functions to modify the + * subscription. This can be the same as the uri or a database key. + * * uri. This is just the 'base uri' or 'filename' of the subscription. + * * principaluri. The owner of the subscription. Almost always the same as + * principalUri passed to this method. + * + * Furthermore, all the subscription info must be returned too: + * + * 1. {DAV:}displayname + * 2. {http://apple.com/ns/ical/}refreshrate + * 3. {http://calendarserver.org/ns/}subscribed-strip-todos (omit if todos + * should not be stripped). + * 4. {http://calendarserver.org/ns/}subscribed-strip-alarms (omit if alarms + * should not be stripped). + * 5. {http://calendarserver.org/ns/}subscribed-strip-attachments (omit if + * attachments should not be stripped). + * 6. {http://calendarserver.org/ns/}source (Must be a + * Sabre\DAV\Property\Href). + * 7. {http://apple.com/ns/ical/}calendar-color + * 8. {http://apple.com/ns/ical/}calendar-order + * 9. {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set + * (should just be an instance of + * Sabre\CalDAV\Property\SupportedCalendarComponentSet, with a bunch of + * default components). + * + * @param string $principalUri + * @return array + */ + public function getSubscriptionsForUser($principalUri) + { + } + + /** + * Creates a new subscription for a principal. + * + * If the creation was a success, an id must be returned that can be used to reference + * this subscription in other methods, such as updateSubscription. + * + * @param string $principalUri + * @param string $uri + * @param array $properties + * @return mixed + */ + public function createSubscription($principalUri, $uri, array $properties) + { + } + + /** + * Updates a subscription + * + * The list of mutations is stored in a Sabre\DAV\PropPatch object. + * To do the actual updates, you must tell this object which properties + * you're going to process with the handle() method. + * + * Calling the handle method is like telling the PropPatch object "I + * promise I can handle updating this property". + * + * Read the PropPatch documentation for more info and examples. + * + * @param mixed $subscriptionId + * @param PropPatch $propPatch + * @return void + */ + public function updateSubscription($subscriptionId, \Sabre\DAV\PropPatch $propPatch) + { + } + + /** + * Deletes a subscription. + * + * @param mixed $subscriptionId + * @return void + */ + public function deleteSubscription($subscriptionId) + { + } + + /** + * Returns a single scheduling object for the inbox collection. + * + * The returned array should contain the following elements: + * * uri - A unique basename for the object. This will be used to + * construct a full uri. + * * calendardata - The iCalendar object + * * lastmodified - The last modification date. Can be an int for a unix + * timestamp, or a PHP DateTime object. + * * etag - A unique token that must change if the object changed. + * * size - The size of the object, in bytes. + * + * @param string $principalUri + * @param string $objectUri + * @return array + */ + public function getSchedulingObject($principalUri, $objectUri) + { + } + + /** + * Returns all scheduling objects for the inbox collection. + * + * These objects should be returned as an array. Every item in the array + * should follow the same structure as returned from getSchedulingObject. + * + * The main difference is that 'calendardata' is optional. + * + * @param string $principalUri + * @return array + */ + public function getSchedulingObjects($principalUri) + { + } + + /** + * Deletes a scheduling object from the inbox collection. + * + * @param string $principalUri + * @param string $objectUri + * @return void + */ + public function deleteSchedulingObject($principalUri, $objectUri) + { + } + + /** + * Creates a new scheduling object. This should land in a users' inbox. + * + * @param string $principalUri + * @param string $objectUri + * @param string $objectData + * @return void + */ + public function createSchedulingObject($principalUri, $objectUri, $objectData) + { + } + + /** + * Adds a change record to the calendarchanges table. + * + * @param mixed $calendarId + * @param string $objectUri + * @param int $operation 1 = add, 2 = modify, 3 = delete. + * @param int $calendarType + * @return void + */ + protected function addChange(int $calendarId, string $objectUri, int $operation, int $calendarType = self::CALENDAR_TYPE_CALENDAR): void + { + } + + /** + * Parses some information from calendar objects, used for optimized + * calendar-queries. + * + * Returns an array with the following keys: + * * etag - An md5 checksum of the object without the quotes. + * * size - Size of the object in bytes + * * componentType - VEVENT, VTODO or VJOURNAL + * * firstOccurence + * * lastOccurence + * * uid - value of the UID property + * + * @param string $calendarData + * @return array + */ + public function getDenormalizedData($calendarData) + { + } + + /** + * @param list $add + * @param list $remove + */ + public function updateShares(\OCA\DAV\DAV\Sharing\IShareable $shareable, array $add, array $remove): void + { + } + + /** + * @return list + */ + public function getShares(int $resourceId): array + { + } + + /** + * @param boolean $value + * @param \OCA\DAV\CalDAV\Calendar $calendar + * @return string|null + */ + public function setPublishStatus($value, $calendar) + { + } + + /** + * @param \OCA\DAV\CalDAV\Calendar $calendar + * @return mixed + */ + public function getPublishStatus($calendar) + { + } + + /** + * @param int $resourceId + * @param list $acl + * @return list + */ + public function applyShareAcl(int $resourceId, array $acl): array + { + } + + /** + * update properties table + * + * @param int $calendarId + * @param string $objectUri + * @param string $calendarData + * @param int $calendarType + */ + public function updateProperties($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) + { + } + + /** + * deletes all birthday calendars + */ + public function deleteAllBirthdayCalendars() + { + } + + /** + * @param $subscriptionId + */ + public function purgeAllCachedEventsForSubscription($subscriptionId) + { + } + + /** + * Move a calendar from one user to another + * + * @param string $uriName + * @param string $uriOrigin + * @param string $uriDestination + * @param string $newUriName (optional) the new uriName + */ + public function moveCalendar($uriName, $uriOrigin, $uriDestination, $newUriName = null) + { + } + + /** + * read VCalendar data into a VCalendar object + * + * @param string $objectData + * @return VCalendar + */ + protected function readCalendarData($objectData) + { + } + + /** + * delete all properties from a given calendar object + * + * @param int $calendarId + * @param int $objectId + */ + protected function purgeProperties($calendarId, $objectId) + { + } + + /** + * get ID from a given calendar object + * + * @param int $calendarId + * @param string $uri + * @param int $calendarType + * @return int + */ + protected function getCalendarObjectId($calendarId, $uri, $calendarType): int + { + } + + /** + * @throws \InvalidArgumentException + */ + public function pruneOutdatedSyncTokens(int $keep = 10000): int + { + } + } + +} + +namespace Sabre\CalDAV\Backend { + + /** + * Abstract Calendaring backend. Extend this class to create your own backends. + * + * Checkout the BackendInterface for all the methods that must be implemented. + * + * @copyright Copyright (C) fruux GmbH (https://fruux.com/) + * @author Evert Pot (http://evertpot.com/) + * @license http://sabre.io/license/ Modified BSD License + */ + abstract class AbstractBackend implements \Sabre\CalDAV\Backend\BackendInterface + { + /** + * Updates properties for a calendar. + * + * The list of mutations is stored in a Sabre\DAV\PropPatch object. + * To do the actual updates, you must tell this object which properties + * you're going to process with the handle() method. + * + * Calling the handle method is like telling the PropPatch object "I + * promise I can handle updating this property". + * + * Read the PropPatch documentation for more info and examples. + * + * @param mixed $calendarId + */ + public function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch) + { + } + + /** + * Returns a list of calendar objects. + * + * This method should work identical to getCalendarObject, but instead + * return all the calendar objects in the list as an array. + * + * If the backend supports this, it may allow for some speed-ups. + * + * @param mixed $calendarId + * + * @return array + */ + public function getMultipleCalendarObjects($calendarId, array $uris) + { + } + + /** + * Performs a calendar-query on the contents of this calendar. + * + * The calendar-query is defined in RFC4791 : CalDAV. Using the + * calendar-query it is possible for a client to request a specific set of + * object, based on contents of iCalendar properties, date-ranges and + * iCalendar component types (VTODO, VEVENT). + * + * This method should just return a list of (relative) urls that match this + * query. + * + * The list of filters are specified as an array. The exact array is + * documented by \Sabre\CalDAV\CalendarQueryParser. + * + * Note that it is extremely likely that getCalendarObject for every path + * returned from this method will be called almost immediately after. You + * may want to anticipate this to speed up these requests. + * + * This method provides a default implementation, which parses *all* the + * iCalendar objects in the specified calendar. + * + * This default may well be good enough for personal use, and calendars + * that aren't very large. But if you anticipate high usage, big calendars + * or high loads, you are strongly adviced to optimize certain paths. + * + * The best way to do so is override this method and to optimize + * specifically for 'common filters'. + * + * Requests that are extremely common are: + * * requests for just VEVENTS + * * requests for just VTODO + * * requests with a time-range-filter on either VEVENT or VTODO. + * + * ..and combinations of these requests. It may not be worth it to try to + * handle every possible situation and just rely on the (relatively + * easy to use) CalendarQueryValidator to handle the rest. + * + * Note that especially time-range-filters may be difficult to parse. A + * time-range filter specified on a VEVENT must for instance also handle + * recurrence rules correctly. + * A good example of how to interprete all these filters can also simply + * be found in \Sabre\CalDAV\CalendarQueryFilter. This class is as correct + * as possible, so it gives you a good idea on what type of stuff you need + * to think of. + * + * @param mixed $calendarId + * + * @return array + */ + public function calendarQuery($calendarId, array $filters) + { + } + + /** + * This method validates if a filter (as passed to calendarQuery) matches + * the given object. + * + * @return bool + */ + protected function validateFilterForObject(array $object, array $filters) + { + } + + /** + * Searches through all of a users calendars and calendar objects to find + * an object with a specific UID. + * + * This method should return the path to this object, relative to the + * calendar home, so this path usually only contains two parts: + * + * calendarpath/objectpath.ics + * + * If the uid is not found, return null. + * + * This method should only consider * objects that the principal owns, so + * any calendars owned by other principals that also appear in this + * collection should be ignored. + * + * @param string $principalUri + * @param string $uid + * + * @return string|null + */ + public function getCalendarObjectByUID($principalUri, $uid) + { + } + } +} \ No newline at end of file diff --git a/socialsharing_telegram/.php-cs-fixer.dist.php b/socialsharing_telegram/.php-cs-fixer.dist.php new file mode 100644 index 0000000..31a73f5 --- /dev/null +++ b/socialsharing_telegram/.php-cs-fixer.dist.php @@ -0,0 +1,12 @@ +getFinder() + ->in(__DIR__ . '/lib'); +return $config; diff --git a/socialsharing_telegram/appinfo/info.xml b/socialsharing_telegram/appinfo/info.xml index b30ee38..ff4572e 100644 --- a/socialsharing_telegram/appinfo/info.xml +++ b/socialsharing_telegram/appinfo/info.xml @@ -10,7 +10,7 @@ https://raw.githubusercontent.com/nextcloud/socialsharing/master/socialsharing_telegram/screenshots/preview.png SocialSharingTelegram - + https://github.com/nextcloud/socialsharing https://github.com/nextcloud/socialsharing diff --git a/socialsharing_telegram/composer.json b/socialsharing_telegram/composer.json new file mode 100644 index 0000000..506da24 --- /dev/null +++ b/socialsharing_telegram/composer.json @@ -0,0 +1,24 @@ +{ + "require": { + "php": ">=8.0" + }, + "scripts": { + "lint": "find . -name \\*.php -not -path './vendor/*' -print0 | xargs -0 -n1 php -l", + "cs:check": "php-cs-fixer fix --dry-run --diff", + "cs:fix": "php-cs-fixer fix", + "psalm": "psalm.phar --no-cache", + "psalm:update-baseline": "psalm.phar --threads=1 --update-baseline", + "psalm:update-baseline:force": "psalm.phar --threads=1 --update-baseline --set-baseline=tests/psalm-baseline.xml" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3", + "nextcloud/coding-standard": "^1", + "psalm/phar": "^5.26", + "nextcloud/ocp": "dev-master" + }, + "config": { + "platform": { + "php": "8.0" + } + } +} \ No newline at end of file diff --git a/socialsharing_telegram/composer.lock b/socialsharing_telegram/composer.lock new file mode 100644 index 0000000..2e43667 --- /dev/null +++ b/socialsharing_telegram/composer.lock @@ -0,0 +1,447 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "79e6391b32591471039a4ff999b31230", + "packages": [], + "packages-dev": [ + { + "name": "kubawerlos/php-cs-fixer-custom-fixers", + "version": "v3.22.0", + "source": { + "type": "git", + "url": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers.git", + "reference": "8701394f0c7cd450ac4fa577d24589122c1d5d5e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kubawerlos/php-cs-fixer-custom-fixers/zipball/8701394f0c7cd450ac4fa577d24589122c1d5d5e", + "reference": "8701394f0c7cd450ac4fa577d24589122c1d5d5e", + "shasum": "" + }, + "require": { + "ext-filter": "*", + "ext-tokenizer": "*", + "friendsofphp/php-cs-fixer": "^3.61.1", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.6.4 || ^10.5.29" + }, + "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": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers/issues", + "source": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers/tree/v3.22.0" + }, + "time": "2024-08-16T20:44:35+00:00" + }, + { + "name": "nextcloud/coding-standard", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/nextcloud/coding-standard.git", + "reference": "e88acb0df6217b808d1632286ddfec9267a102e4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/e88acb0df6217b808d1632286ddfec9267a102e4", + "reference": "e88acb0df6217b808d1632286ddfec9267a102e4", + "shasum": "" + }, + "require": { + "kubawerlos/php-cs-fixer-custom-fixers": "^3.22", + "php": "^7.3|^8.0", + "php-cs-fixer/shim": "^3.17" + }, + "type": "library", + "autoload": { + "psr-4": { + "Nextcloud\\CodingStandard\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christoph Wurst", + "email": "christoph@winzerhof-wurst.at" + } + ], + "description": "Nextcloud coding standards for the php cs fixer", + "support": { + "issues": "https://github.com/nextcloud/coding-standard/issues", + "source": "https://github.com/nextcloud/coding-standard/tree/v1.3.1" + }, + "time": "2024-09-19T09:07:10+00:00" + }, + { + "name": "nextcloud/ocp", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/nextcloud-deps/ocp.git", + "reference": "8076405cf21b59fe1b935562041f96393abf6d8e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/8076405cf21b59fe1b935562041f96393abf6d8e", + "reference": "8076405cf21b59fe1b935562041f96393abf6d8e", + "shasum": "" + }, + "require": { + "php": "~8.0 || ~8.1 || ~8.2 || ~8.3", + "psr/clock": "^1.0", + "psr/container": "^2.0.2", + "psr/event-dispatcher": "^1.0", + "psr/log": "^1.1.4" + }, + "default-branch": true, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "31.0.0-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "AGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Christoph Wurst", + "email": "christoph@winzerhof-wurst.at" + } + ], + "description": "Composer package containing Nextcloud's public API (classes, interfaces)", + "support": { + "issues": "https://github.com/nextcloud-deps/ocp/issues", + "source": "https://github.com/nextcloud-deps/ocp/tree/master" + }, + "time": "2024-09-23T14:11:16+00:00" + }, + { + "name": "php-cs-fixer/shim", + "version": "v3.64.0", + "source": { + "type": "git", + "url": "https://github.com/PHP-CS-Fixer/shim.git", + "reference": "81ccfd24baf3a10810dab1152c403981a790b837" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/81ccfd24baf3a10810dab1152c403981a790b837", + "reference": "81ccfd24baf3a10810dab1152c403981a790b837", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-tokenizer": "*", + "php": "^7.4 || ^8.0" + }, + "replace": { + "friendsofphp/php-cs-fixer": "self.version" + }, + "suggest": { + "ext-dom": "For handling output formats in XML", + "ext-mbstring": "For handling non-UTF8 characters." + }, + "bin": [ + "php-cs-fixer", + "php-cs-fixer.phar" + ], + "type": "application", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Dariusz Rumiński", + "email": "dariusz.ruminski@gmail.com" + } + ], + "description": "A tool to automatically fix PHP code style", + "support": { + "issues": "https://github.com/PHP-CS-Fixer/shim/issues", + "source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.64.0" + }, + "time": "2024-08-30T23:10:11+00:00" + }, + { + "name": "psalm/phar", + "version": "5.26.1", + "source": { + "type": "git", + "url": "https://github.com/psalm/phar.git", + "reference": "8a38e7ad04499a0ccd2c506fd1da6fc01fff4547" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/psalm/phar/zipball/8a38e7ad04499a0ccd2c506fd1da6fc01fff4547", + "reference": "8a38e7ad04499a0ccd2c506fd1da6fc01fff4547", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "vimeo/psalm": "*" + }, + "bin": [ + "psalm.phar" + ], + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Composer-based Psalm Phar", + "support": { + "issues": "https://github.com/psalm/phar/issues", + "source": "https://github.com/psalm/phar/tree/5.26.1" + }, + "time": "2024-09-09T16:22:43+00:00" + }, + { + "name": "psr/clock", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/clock.git", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Clock\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for reading the clock.", + "homepage": "https://github.com/php-fig/clock", + "keywords": [ + "clock", + "now", + "psr", + "psr-20", + "time" + ], + "support": { + "issues": "https://github.com/php-fig/clock/issues", + "source": "https://github.com/php-fig/clock/tree/1.0.0" + }, + "time": "2022-11-25T14:36:26+00:00" + }, + { + "name": "psr/container", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/2.0.2" + }, + "time": "2021-11-05T16:47:00+00:00" + }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00" + }, + { + "name": "psr/log", + "version": "1.1.4", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/1.1.4" + }, + "time": "2021-05-03T11:20:27+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": { + "nextcloud/ocp": 20 + }, + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=8.0" + }, + "platform-dev": [], + "platform-overrides": { + "php": "8.0" + }, + "plugin-api-version": "2.6.0" +} diff --git a/socialsharing_telegram/lib/AppInfo/Application.php b/socialsharing_telegram/lib/AppInfo/Application.php index 4aa1b5b..01d9f48 100644 --- a/socialsharing_telegram/lib/AppInfo/Application.php +++ b/socialsharing_telegram/lib/AppInfo/Application.php @@ -27,27 +27,30 @@ use OCP\AppFramework\Bootstrap\IBootstrap; use OCP\AppFramework\Bootstrap\IRegistrationContext; use OCP\EventDispatcher\Event; -use OCP\EventDispatcher\IEventDispatcher; +use OCP\EventDispatcher\IEventListener; use OCP\Util; -class Application extends App implements IBootstrap { +/** + * @implements IEventListener<\OCA\Files\Event\LoadSidebar|\OCA\Files\Event\LoadAdditionalScriptsEvent> + */ +class Application extends App implements IBootstrap, IEventListener { - public const APP_ID = 'socialsharing_telegram'; + public const APP_ID = 'socialsharing_telegram'; - public function __construct() { - parent::__construct(self::APP_ID); - } + public function __construct() { + parent::__construct(self::APP_ID); + } - public function register(IRegistrationContext $context): void { - $context->registerEventListener(\OCA\Files\Event\LoadSidebar::class, self::class); - $context->registerEventListener(\OCA\Files\Event\LoadAdditionalScriptsEvent::class, self::class); - } + public function register(IRegistrationContext $context): void { + $context->registerEventListener(\OCA\Files\Event\LoadSidebar::class, self::class); + $context->registerEventListener(\OCA\Files\Event\LoadAdditionalScriptsEvent::class, self::class); + } - public function boot(IBootContext $context): void { - } + public function boot(IBootContext $context): void { + } - public function handle(Event $event): void { - Util::addScript(self::APP_ID, self::APP_ID); - Util::addStyle(self::APP_ID, self::APP_ID); - } + public function handle(Event $event): void { + Util::addScript(self::APP_ID, self::APP_ID); + Util::addStyle(self::APP_ID, self::APP_ID); + } } diff --git a/socialsharing_telegram/psalm.xml b/socialsharing_telegram/psalm.xml new file mode 100644 index 0000000..ae047bd --- /dev/null +++ b/socialsharing_telegram/psalm.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/socialsharing_telegram/tests/psalm-baseline.xml b/socialsharing_telegram/tests/psalm-baseline.xml new file mode 100644 index 0000000..5a96be5 --- /dev/null +++ b/socialsharing_telegram/tests/psalm-baseline.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/socialsharing_telegram/tests/stub.phpstub b/socialsharing_telegram/tests/stub.phpstub new file mode 100644 index 0000000..35d9dc8 --- /dev/null +++ b/socialsharing_telegram/tests/stub.phpstub @@ -0,0 +1,1116 @@ + + */ + public array $propertyMap = ['{DAV:}displayname' => ['displayname', 'string'], '{urn:ietf:params:xml:ns:caldav}calendar-description' => ['description', 'string'], '{urn:ietf:params:xml:ns:caldav}calendar-timezone' => ['timezone', 'string'], '{http://apple.com/ns/ical/}calendar-order' => ['calendarorder', 'int'], '{http://apple.com/ns/ical/}calendar-color' => ['calendarcolor', 'string'], '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => ['deleted_at', 'int']]; + /** + * List of subscription properties, and how they map to database field names. + * + * @var array + */ + public array $subscriptionPropertyMap = ['{DAV:}displayname' => ['displayname', 'string'], '{http://apple.com/ns/ical/}refreshrate' => ['refreshrate', 'string'], '{http://apple.com/ns/ical/}calendar-order' => ['calendarorder', 'int'], '{http://apple.com/ns/ical/}calendar-color' => ['calendarcolor', 'string'], '{http://calendarserver.org/ns/}subscribed-strip-todos' => ['striptodos', 'bool'], '{http://calendarserver.org/ns/}subscribed-strip-alarms' => ['stripalarms', 'string'], '{http://calendarserver.org/ns/}subscribed-strip-attachments' => ['stripattachments', 'string']]; + /** @var array parameters to index */ + public static array $indexParameters = ['ATTENDEE' => ['CN'], 'ORGANIZER' => ['CN']]; + /** + * @var string[] Map of uid => display name + */ + protected array $userDisplayNames; + + public function __construct(\OCP\IDBConnection $db, \OCA\DAV\Connector\Sabre\Principal $principalBackend, \OCP\IUserManager $userManager, \OCP\IGroupManager $groupManager, \OCP\Security\ISecureRandom $random, \Psr\Log\LoggerInterface $logger, \OCP\EventDispatcher\IEventDispatcher $dispatcher, \OCP\IConfig $config, bool $legacyEndpoint = false) + { + } + + /** + * Return the number of calendars for a principal + * + * By default this excludes the automatically generated birthday calendar + * + * @param $principalUri + * @param bool $excludeBirthday + * @return int + */ + public function getCalendarsForUserCount($principalUri, $excludeBirthday = true) + { + } + + /** + * @return array{id: int, deleted_at: int}[] + */ + public function getDeletedCalendars(int $deletedBefore): array + { + } + + /** + * Returns a list of calendars for a principal. + * + * Every project is an array with the following keys: + * * id, a unique id that will be used by other functions to modify the + * calendar. This can be the same as the uri or a database key. + * * uri, which the basename of the uri with which the calendar is + * accessed. + * * principaluri. The owner of the calendar. Almost always the same as + * principalUri passed to this method. + * + * Furthermore it can contain webdav properties in clark notation. A very + * common one is '{DAV:}displayname'. + * + * Many clients also require: + * {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set + * For this property, you can just return an instance of + * Sabre\CalDAV\Property\SupportedCalendarComponentSet. + * + * If you return {http://sabredav.org/ns}read-only and set the value to 1, + * ACL will automatically be put in read-only mode. + * + * @param string $principalUri + * @return array + */ + public function getCalendarsForUser($principalUri) + { + } + + /** + * @param $principalUri + * @return array + */ + public function getUsersOwnCalendars($principalUri) + { + } + + /** + * @return array + */ + public function getPublicCalendars() + { + } + + /** + * @param string $uri + * @return array + * @throws NotFound + */ + public function getPublicCalendar($uri) + { + } + + /** + * @param string $principal + * @param string $uri + * @return array|null + */ + public function getCalendarByUri($principal, $uri) + { + } + + /** + * @return array{id: int, uri: string, '{http://calendarserver.org/ns/}getctag': string, '{http://sabredav.org/ns}sync-token': int, '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set': SupportedCalendarComponentSet, '{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp': ScheduleCalendarTransp, '{urn:ietf:params:xml:ns:caldav}calendar-timezone': ?string }|null + */ + public function getCalendarById(int $calendarId): ?array + { + } + + /** + * @param $subscriptionId + */ + public function getSubscriptionById($subscriptionId) + { + } + + /** + * Creates a new calendar for a principal. + * + * If the creation was a success, an id must be returned that can be used to reference + * this calendar in other methods, such as updateCalendar. + * + * @param string $principalUri + * @param string $calendarUri + * @param array $properties + * @return int + * + * @throws CalendarException + */ + public function createCalendar($principalUri, $calendarUri, array $properties) + { + } + + /** + * Updates properties for a calendar. + * + * The list of mutations is stored in a Sabre\DAV\PropPatch object. + * To do the actual updates, you must tell this object which properties + * you're going to process with the handle() method. + * + * Calling the handle method is like telling the PropPatch object "I + * promise I can handle updating this property". + * + * Read the PropPatch documentation for more info and examples. + * + * @param mixed $calendarId + * @param PropPatch $propPatch + * @return void + */ + public function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch) + { + } + + /** + * Delete a calendar and all it's objects + * + * @param mixed $calendarId + * @return void + */ + public function deleteCalendar($calendarId, bool $forceDeletePermanently = false) + { + } + + public function restoreCalendar(int $id): void + { + } + + /** + * Delete all of an user's shares + * + * @param string $principaluri + * @return void + */ + public function deleteAllSharesByUser($principaluri) + { + } + + /** + * Returns all calendar objects within a calendar. + * + * Every item contains an array with the following keys: + * * calendardata - The iCalendar-compatible calendar data + * * uri - a unique key which will be used to construct the uri. This can + * be any arbitrary string, but making sure it ends with '.ics' is a + * good idea. This is only the basename, or filename, not the full + * path. + * * lastmodified - a timestamp of the last modification time + * * etag - An arbitrary string, surrounded by double-quotes. (e.g.: + * '"abcdef"') + * * size - The size of the calendar objects, in bytes. + * * component - optional, a string containing the type of object, such + * as 'vevent' or 'vtodo'. If specified, this will be used to populate + * the Content-Type header. + * + * Note that the etag is optional, but it's highly encouraged to return for + * speed reasons. + * + * The calendardata is also optional. If it's not returned + * 'getCalendarObject' will be called later, which *is* expected to return + * calendardata. + * + * If neither etag or size are specified, the calendardata will be + * used/fetched to determine these numbers. If both are specified the + * amount of times this is needed is reduced by a great degree. + * + * @param mixed $calendarId + * @param int $calendarType + * @return array + */ + public function getCalendarObjects($calendarId, $calendarType = self::CALENDAR_TYPE_CALENDAR): array + { + } + + public function getDeletedCalendarObjects(int $deletedBefore): array + { + } + + /** + * Return all deleted calendar objects by the given principal that are not + * in deleted calendars. + * + * @param string $principalUri + * @return array + * @throws Exception + */ + public function getDeletedCalendarObjectsByPrincipal(string $principalUri): array + { + } + + /** + * Returns information from a single calendar object, based on it's object + * uri. + * + * The object uri is only the basename, or filename and not a full path. + * + * The returned array must have the same keys as getCalendarObjects. The + * 'calendardata' object is required here though, while it's not required + * for getCalendarObjects. + * + * This method must return null if the object did not exist. + * + * @param mixed $calendarId + * @param string $objectUri + * @param int $calendarType + * @return array|null + */ + public function getCalendarObject($calendarId, $objectUri, int $calendarType = self::CALENDAR_TYPE_CALENDAR) + { + } + + /** + * Returns a list of calendar objects. + * + * This method should work identical to getCalendarObject, but instead + * return all the calendar objects in the list as an array. + * + * If the backend supports this, it may allow for some speed-ups. + * + * @param mixed $calendarId + * @param string[] $uris + * @param int $calendarType + * @return array + */ + public function getMultipleCalendarObjects($calendarId, array $uris, $calendarType = self::CALENDAR_TYPE_CALENDAR): array + { + } + + /** + * Creates a new calendar object. + * + * The object uri is only the basename, or filename and not a full path. + * + * It is possible return an etag from this function, which will be used in + * the response to this PUT request. Note that the ETag must be surrounded + * by double-quotes. + * + * However, you should only really return this ETag if you don't mangle the + * calendar-data. If the result of a subsequent GET to this object is not + * the exact same as this request body, you should omit the ETag. + * + * @param mixed $calendarId + * @param string $objectUri + * @param string $calendarData + * @param int $calendarType + * @return string + */ + public function createCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) + { + } + + /** + * Updates an existing calendarobject, based on it's uri. + * + * The object uri is only the basename, or filename and not a full path. + * + * It is possible return an etag from this function, which will be used in + * the response to this PUT request. Note that the ETag must be surrounded + * by double-quotes. + * + * However, you should only really return this ETag if you don't mangle the + * calendar-data. If the result of a subsequent GET to this object is not + * the exact same as this request body, you should omit the ETag. + * + * @param mixed $calendarId + * @param string $objectUri + * @param string $calendarData + * @param int $calendarType + * @return string + */ + public function updateCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) + { + } + + /** + * Moves a calendar object from calendar to calendar. + * + * @param int $sourceCalendarId + * @param int $targetCalendarId + * @param int $objectId + * @param string $oldPrincipalUri + * @param string $newPrincipalUri + * @param int $calendarType + * @return bool + * @throws Exception + */ + public function moveCalendarObject(int $sourceCalendarId, int $targetCalendarId, int $objectId, string $oldPrincipalUri, string $newPrincipalUri, int $calendarType = self::CALENDAR_TYPE_CALENDAR): bool + { + } + + /** + * @param int $calendarObjectId + * @param int $classification + */ + public function setClassification($calendarObjectId, $classification) + { + } + + /** + * Deletes an existing calendar object. + * + * The object uri is only the basename, or filename and not a full path. + * + * @param mixed $calendarId + * @param string $objectUri + * @param int $calendarType + * @param bool $forceDeletePermanently + * @return void + */ + public function deleteCalendarObject($calendarId, $objectUri, $calendarType = self::CALENDAR_TYPE_CALENDAR, bool $forceDeletePermanently = false) + { + } + + /** + * @param mixed $objectData + * + * @throws Forbidden + */ + public function restoreCalendarObject(array $objectData): void + { + } + + /** + * Performs a calendar-query on the contents of this calendar. + * + * The calendar-query is defined in RFC4791 : CalDAV. Using the + * calendar-query it is possible for a client to request a specific set of + * object, based on contents of iCalendar properties, date-ranges and + * iCalendar component types (VTODO, VEVENT). + * + * This method should just return a list of (relative) urls that match this + * query. + * + * The list of filters are specified as an array. The exact array is + * documented by Sabre\CalDAV\CalendarQueryParser. + * + * Note that it is extremely likely that getCalendarObject for every path + * returned from this method will be called almost immediately after. You + * may want to anticipate this to speed up these requests. + * + * This method provides a default implementation, which parses *all* the + * iCalendar objects in the specified calendar. + * + * This default may well be good enough for personal use, and calendars + * that aren't very large. But if you anticipate high usage, big calendars + * or high loads, you are strongly advised to optimize certain paths. + * + * The best way to do so is override this method and to optimize + * specifically for 'common filters'. + * + * Requests that are extremely common are: + * * requests for just VEVENTS + * * requests for just VTODO + * * requests with a time-range-filter on either VEVENT or VTODO. + * + * ..and combinations of these requests. It may not be worth it to try to + * handle every possible situation and just rely on the (relatively + * easy to use) CalendarQueryValidator to handle the rest. + * + * Note that especially time-range-filters may be difficult to parse. A + * time-range filter specified on a VEVENT must for instance also handle + * recurrence rules correctly. + * A good example of how to interpret all these filters can also simply + * be found in Sabre\CalDAV\CalendarQueryFilter. This class is as correct + * as possible, so it gives you a good idea on what type of stuff you need + * to think of. + * + * @param mixed $calendarId + * @param array $filters + * @param int $calendarType + * @return array + */ + public function calendarQuery($calendarId, array $filters, $calendarType = self::CALENDAR_TYPE_CALENDAR): array + { + } + + /** + * custom Nextcloud search extension for CalDAV + * + * TODO - this should optionally cover cached calendar objects as well + * + * @param string $principalUri + * @param array $filters + * @param integer|null $limit + * @param integer|null $offset + * @return array + */ + public function calendarSearch($principalUri, array $filters, $limit = null, $offset = null) + { + } + + /** + * used for Nextcloud's calendar API + * + * @param array $calendarInfo + * @param string $pattern + * @param array $searchProperties + * @param array $options + * @param integer|null $limit + * @param integer|null $offset + * + * @return array + */ + public function search(array $calendarInfo, $pattern, array $searchProperties, array $options, $limit, $offset) + { + } + + /** + * @param string $principalUri + * @param string $pattern + * @param array $componentTypes + * @param array $searchProperties + * @param array $searchParameters + * @param array $options + * @return array + */ + public function searchPrincipalUri(string $principalUri, string $pattern, array $componentTypes, array $searchProperties, array $searchParameters, array $options = []): array + { + } + + /** + * Searches through all of a users calendars and calendar objects to find + * an object with a specific UID. + * + * This method should return the path to this object, relative to the + * calendar home, so this path usually only contains two parts: + * + * calendarpath/objectpath.ics + * + * If the uid is not found, return null. + * + * This method should only consider * objects that the principal owns, so + * any calendars owned by other principals that also appear in this + * collection should be ignored. + * + * @param string $principalUri + * @param string $uid + * @return string|null + */ + public function getCalendarObjectByUID($principalUri, $uid) + { + } + + public function getCalendarObjectById(string $principalUri, int $id): ?array + { + } + + /** + * The getChanges method returns all the changes that have happened, since + * the specified syncToken in the specified calendar. + * + * This function should return an array, such as the following: + * + * [ + * 'syncToken' => 'The current synctoken', + * 'added' => [ + * 'new.txt', + * ], + * 'modified' => [ + * 'modified.txt', + * ], + * 'deleted' => [ + * 'foo.php.bak', + * 'old.txt' + * ] + * ); + * + * The returned syncToken property should reflect the *current* syncToken + * of the calendar, as reported in the {http://sabredav.org/ns}sync-token + * property This is * needed here too, to ensure the operation is atomic. + * + * If the $syncToken argument is specified as null, this is an initial + * sync, and all members should be reported. + * + * The modified property is an array of nodenames that have changed since + * the last token. + * + * The deleted property is an array with nodenames, that have been deleted + * from collection. + * + * The $syncLevel argument is basically the 'depth' of the report. If it's + * 1, you only have to report changes that happened only directly in + * immediate descendants. If it's 2, it should also include changes from + * the nodes below the child collections. (grandchildren) + * + * The $limit argument allows a client to specify how many results should + * be returned at most. If the limit is not specified, it should be treated + * as infinite. + * + * If the limit (infinite or not) is higher than you're willing to return, + * you should throw a Sabre\DAV\Exception\TooMuchMatches() exception. + * + * If the syncToken is expired (due to data cleanup) or unknown, you must + * return null. + * + * The limit is 'suggestive'. You are free to ignore it. + * + * @param string $calendarId + * @param string $syncToken + * @param int $syncLevel + * @param int|null $limit + * @param int $calendarType + * @return array + */ + public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null, $calendarType = self::CALENDAR_TYPE_CALENDAR) + { + } + + /** + * Returns a list of subscriptions for a principal. + * + * Every subscription is an array with the following keys: + * * id, a unique id that will be used by other functions to modify the + * subscription. This can be the same as the uri or a database key. + * * uri. This is just the 'base uri' or 'filename' of the subscription. + * * principaluri. The owner of the subscription. Almost always the same as + * principalUri passed to this method. + * + * Furthermore, all the subscription info must be returned too: + * + * 1. {DAV:}displayname + * 2. {http://apple.com/ns/ical/}refreshrate + * 3. {http://calendarserver.org/ns/}subscribed-strip-todos (omit if todos + * should not be stripped). + * 4. {http://calendarserver.org/ns/}subscribed-strip-alarms (omit if alarms + * should not be stripped). + * 5. {http://calendarserver.org/ns/}subscribed-strip-attachments (omit if + * attachments should not be stripped). + * 6. {http://calendarserver.org/ns/}source (Must be a + * Sabre\DAV\Property\Href). + * 7. {http://apple.com/ns/ical/}calendar-color + * 8. {http://apple.com/ns/ical/}calendar-order + * 9. {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set + * (should just be an instance of + * Sabre\CalDAV\Property\SupportedCalendarComponentSet, with a bunch of + * default components). + * + * @param string $principalUri + * @return array + */ + public function getSubscriptionsForUser($principalUri) + { + } + + /** + * Creates a new subscription for a principal. + * + * If the creation was a success, an id must be returned that can be used to reference + * this subscription in other methods, such as updateSubscription. + * + * @param string $principalUri + * @param string $uri + * @param array $properties + * @return mixed + */ + public function createSubscription($principalUri, $uri, array $properties) + { + } + + /** + * Updates a subscription + * + * The list of mutations is stored in a Sabre\DAV\PropPatch object. + * To do the actual updates, you must tell this object which properties + * you're going to process with the handle() method. + * + * Calling the handle method is like telling the PropPatch object "I + * promise I can handle updating this property". + * + * Read the PropPatch documentation for more info and examples. + * + * @param mixed $subscriptionId + * @param PropPatch $propPatch + * @return void + */ + public function updateSubscription($subscriptionId, \Sabre\DAV\PropPatch $propPatch) + { + } + + /** + * Deletes a subscription. + * + * @param mixed $subscriptionId + * @return void + */ + public function deleteSubscription($subscriptionId) + { + } + + /** + * Returns a single scheduling object for the inbox collection. + * + * The returned array should contain the following elements: + * * uri - A unique basename for the object. This will be used to + * construct a full uri. + * * calendardata - The iCalendar object + * * lastmodified - The last modification date. Can be an int for a unix + * timestamp, or a PHP DateTime object. + * * etag - A unique token that must change if the object changed. + * * size - The size of the object, in bytes. + * + * @param string $principalUri + * @param string $objectUri + * @return array + */ + public function getSchedulingObject($principalUri, $objectUri) + { + } + + /** + * Returns all scheduling objects for the inbox collection. + * + * These objects should be returned as an array. Every item in the array + * should follow the same structure as returned from getSchedulingObject. + * + * The main difference is that 'calendardata' is optional. + * + * @param string $principalUri + * @return array + */ + public function getSchedulingObjects($principalUri) + { + } + + /** + * Deletes a scheduling object from the inbox collection. + * + * @param string $principalUri + * @param string $objectUri + * @return void + */ + public function deleteSchedulingObject($principalUri, $objectUri) + { + } + + /** + * Creates a new scheduling object. This should land in a users' inbox. + * + * @param string $principalUri + * @param string $objectUri + * @param string $objectData + * @return void + */ + public function createSchedulingObject($principalUri, $objectUri, $objectData) + { + } + + /** + * Adds a change record to the calendarchanges table. + * + * @param mixed $calendarId + * @param string $objectUri + * @param int $operation 1 = add, 2 = modify, 3 = delete. + * @param int $calendarType + * @return void + */ + protected function addChange(int $calendarId, string $objectUri, int $operation, int $calendarType = self::CALENDAR_TYPE_CALENDAR): void + { + } + + /** + * Parses some information from calendar objects, used for optimized + * calendar-queries. + * + * Returns an array with the following keys: + * * etag - An md5 checksum of the object without the quotes. + * * size - Size of the object in bytes + * * componentType - VEVENT, VTODO or VJOURNAL + * * firstOccurence + * * lastOccurence + * * uid - value of the UID property + * + * @param string $calendarData + * @return array + */ + public function getDenormalizedData($calendarData) + { + } + + /** + * @param list $add + * @param list $remove + */ + public function updateShares(\OCA\DAV\DAV\Sharing\IShareable $shareable, array $add, array $remove): void + { + } + + /** + * @return list + */ + public function getShares(int $resourceId): array + { + } + + /** + * @param boolean $value + * @param \OCA\DAV\CalDAV\Calendar $calendar + * @return string|null + */ + public function setPublishStatus($value, $calendar) + { + } + + /** + * @param \OCA\DAV\CalDAV\Calendar $calendar + * @return mixed + */ + public function getPublishStatus($calendar) + { + } + + /** + * @param int $resourceId + * @param list $acl + * @return list + */ + public function applyShareAcl(int $resourceId, array $acl): array + { + } + + /** + * update properties table + * + * @param int $calendarId + * @param string $objectUri + * @param string $calendarData + * @param int $calendarType + */ + public function updateProperties($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) + { + } + + /** + * deletes all birthday calendars + */ + public function deleteAllBirthdayCalendars() + { + } + + /** + * @param $subscriptionId + */ + public function purgeAllCachedEventsForSubscription($subscriptionId) + { + } + + /** + * Move a calendar from one user to another + * + * @param string $uriName + * @param string $uriOrigin + * @param string $uriDestination + * @param string $newUriName (optional) the new uriName + */ + public function moveCalendar($uriName, $uriOrigin, $uriDestination, $newUriName = null) + { + } + + /** + * read VCalendar data into a VCalendar object + * + * @param string $objectData + * @return VCalendar + */ + protected function readCalendarData($objectData) + { + } + + /** + * delete all properties from a given calendar object + * + * @param int $calendarId + * @param int $objectId + */ + protected function purgeProperties($calendarId, $objectId) + { + } + + /** + * get ID from a given calendar object + * + * @param int $calendarId + * @param string $uri + * @param int $calendarType + * @return int + */ + protected function getCalendarObjectId($calendarId, $uri, $calendarType): int + { + } + + /** + * @throws \InvalidArgumentException + */ + public function pruneOutdatedSyncTokens(int $keep = 10000): int + { + } + } + +} + +namespace Sabre\CalDAV\Backend { + + /** + * Abstract Calendaring backend. Extend this class to create your own backends. + * + * Checkout the BackendInterface for all the methods that must be implemented. + * + * @copyright Copyright (C) fruux GmbH (https://fruux.com/) + * @author Evert Pot (http://evertpot.com/) + * @license http://sabre.io/license/ Modified BSD License + */ + abstract class AbstractBackend implements \Sabre\CalDAV\Backend\BackendInterface + { + /** + * Updates properties for a calendar. + * + * The list of mutations is stored in a Sabre\DAV\PropPatch object. + * To do the actual updates, you must tell this object which properties + * you're going to process with the handle() method. + * + * Calling the handle method is like telling the PropPatch object "I + * promise I can handle updating this property". + * + * Read the PropPatch documentation for more info and examples. + * + * @param mixed $calendarId + */ + public function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch) + { + } + + /** + * Returns a list of calendar objects. + * + * This method should work identical to getCalendarObject, but instead + * return all the calendar objects in the list as an array. + * + * If the backend supports this, it may allow for some speed-ups. + * + * @param mixed $calendarId + * + * @return array + */ + public function getMultipleCalendarObjects($calendarId, array $uris) + { + } + + /** + * Performs a calendar-query on the contents of this calendar. + * + * The calendar-query is defined in RFC4791 : CalDAV. Using the + * calendar-query it is possible for a client to request a specific set of + * object, based on contents of iCalendar properties, date-ranges and + * iCalendar component types (VTODO, VEVENT). + * + * This method should just return a list of (relative) urls that match this + * query. + * + * The list of filters are specified as an array. The exact array is + * documented by \Sabre\CalDAV\CalendarQueryParser. + * + * Note that it is extremely likely that getCalendarObject for every path + * returned from this method will be called almost immediately after. You + * may want to anticipate this to speed up these requests. + * + * This method provides a default implementation, which parses *all* the + * iCalendar objects in the specified calendar. + * + * This default may well be good enough for personal use, and calendars + * that aren't very large. But if you anticipate high usage, big calendars + * or high loads, you are strongly adviced to optimize certain paths. + * + * The best way to do so is override this method and to optimize + * specifically for 'common filters'. + * + * Requests that are extremely common are: + * * requests for just VEVENTS + * * requests for just VTODO + * * requests with a time-range-filter on either VEVENT or VTODO. + * + * ..and combinations of these requests. It may not be worth it to try to + * handle every possible situation and just rely on the (relatively + * easy to use) CalendarQueryValidator to handle the rest. + * + * Note that especially time-range-filters may be difficult to parse. A + * time-range filter specified on a VEVENT must for instance also handle + * recurrence rules correctly. + * A good example of how to interprete all these filters can also simply + * be found in \Sabre\CalDAV\CalendarQueryFilter. This class is as correct + * as possible, so it gives you a good idea on what type of stuff you need + * to think of. + * + * @param mixed $calendarId + * + * @return array + */ + public function calendarQuery($calendarId, array $filters) + { + } + + /** + * This method validates if a filter (as passed to calendarQuery) matches + * the given object. + * + * @return bool + */ + protected function validateFilterForObject(array $object, array $filters) + { + } + + /** + * Searches through all of a users calendars and calendar objects to find + * an object with a specific UID. + * + * This method should return the path to this object, relative to the + * calendar home, so this path usually only contains two parts: + * + * calendarpath/objectpath.ics + * + * If the uid is not found, return null. + * + * This method should only consider * objects that the principal owns, so + * any calendars owned by other principals that also appear in this + * collection should be ignored. + * + * @param string $principalUri + * @param string $uid + * + * @return string|null + */ + public function getCalendarObjectByUID($principalUri, $uid) + { + } + } +} \ No newline at end of file diff --git a/socialsharing_twitter/.php-cs-fixer.dist.php b/socialsharing_twitter/.php-cs-fixer.dist.php new file mode 100644 index 0000000..31a73f5 --- /dev/null +++ b/socialsharing_twitter/.php-cs-fixer.dist.php @@ -0,0 +1,12 @@ +getFinder() + ->in(__DIR__ . '/lib'); +return $config; diff --git a/socialsharing_twitter/appinfo/info.xml b/socialsharing_twitter/appinfo/info.xml index 79b753d..16decc6 100644 --- a/socialsharing_twitter/appinfo/info.xml +++ b/socialsharing_twitter/appinfo/info.xml @@ -10,7 +10,7 @@ https://raw.githubusercontent.com/nextcloud/socialsharing/master/socialsharing_twitter/screenshots/preview.png SocialSharingTwitter - + https://github.com/nextcloud/socialsharing https://github.com/nextcloud/socialsharing diff --git a/socialsharing_twitter/composer.json b/socialsharing_twitter/composer.json new file mode 100644 index 0000000..506da24 --- /dev/null +++ b/socialsharing_twitter/composer.json @@ -0,0 +1,24 @@ +{ + "require": { + "php": ">=8.0" + }, + "scripts": { + "lint": "find . -name \\*.php -not -path './vendor/*' -print0 | xargs -0 -n1 php -l", + "cs:check": "php-cs-fixer fix --dry-run --diff", + "cs:fix": "php-cs-fixer fix", + "psalm": "psalm.phar --no-cache", + "psalm:update-baseline": "psalm.phar --threads=1 --update-baseline", + "psalm:update-baseline:force": "psalm.phar --threads=1 --update-baseline --set-baseline=tests/psalm-baseline.xml" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3", + "nextcloud/coding-standard": "^1", + "psalm/phar": "^5.26", + "nextcloud/ocp": "dev-master" + }, + "config": { + "platform": { + "php": "8.0" + } + } +} \ No newline at end of file diff --git a/socialsharing_twitter/composer.lock b/socialsharing_twitter/composer.lock new file mode 100644 index 0000000..2e43667 --- /dev/null +++ b/socialsharing_twitter/composer.lock @@ -0,0 +1,447 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "79e6391b32591471039a4ff999b31230", + "packages": [], + "packages-dev": [ + { + "name": "kubawerlos/php-cs-fixer-custom-fixers", + "version": "v3.22.0", + "source": { + "type": "git", + "url": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers.git", + "reference": "8701394f0c7cd450ac4fa577d24589122c1d5d5e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kubawerlos/php-cs-fixer-custom-fixers/zipball/8701394f0c7cd450ac4fa577d24589122c1d5d5e", + "reference": "8701394f0c7cd450ac4fa577d24589122c1d5d5e", + "shasum": "" + }, + "require": { + "ext-filter": "*", + "ext-tokenizer": "*", + "friendsofphp/php-cs-fixer": "^3.61.1", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.6.4 || ^10.5.29" + }, + "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": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers/issues", + "source": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers/tree/v3.22.0" + }, + "time": "2024-08-16T20:44:35+00:00" + }, + { + "name": "nextcloud/coding-standard", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/nextcloud/coding-standard.git", + "reference": "e88acb0df6217b808d1632286ddfec9267a102e4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/e88acb0df6217b808d1632286ddfec9267a102e4", + "reference": "e88acb0df6217b808d1632286ddfec9267a102e4", + "shasum": "" + }, + "require": { + "kubawerlos/php-cs-fixer-custom-fixers": "^3.22", + "php": "^7.3|^8.0", + "php-cs-fixer/shim": "^3.17" + }, + "type": "library", + "autoload": { + "psr-4": { + "Nextcloud\\CodingStandard\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christoph Wurst", + "email": "christoph@winzerhof-wurst.at" + } + ], + "description": "Nextcloud coding standards for the php cs fixer", + "support": { + "issues": "https://github.com/nextcloud/coding-standard/issues", + "source": "https://github.com/nextcloud/coding-standard/tree/v1.3.1" + }, + "time": "2024-09-19T09:07:10+00:00" + }, + { + "name": "nextcloud/ocp", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/nextcloud-deps/ocp.git", + "reference": "8076405cf21b59fe1b935562041f96393abf6d8e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/8076405cf21b59fe1b935562041f96393abf6d8e", + "reference": "8076405cf21b59fe1b935562041f96393abf6d8e", + "shasum": "" + }, + "require": { + "php": "~8.0 || ~8.1 || ~8.2 || ~8.3", + "psr/clock": "^1.0", + "psr/container": "^2.0.2", + "psr/event-dispatcher": "^1.0", + "psr/log": "^1.1.4" + }, + "default-branch": true, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "31.0.0-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "AGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Christoph Wurst", + "email": "christoph@winzerhof-wurst.at" + } + ], + "description": "Composer package containing Nextcloud's public API (classes, interfaces)", + "support": { + "issues": "https://github.com/nextcloud-deps/ocp/issues", + "source": "https://github.com/nextcloud-deps/ocp/tree/master" + }, + "time": "2024-09-23T14:11:16+00:00" + }, + { + "name": "php-cs-fixer/shim", + "version": "v3.64.0", + "source": { + "type": "git", + "url": "https://github.com/PHP-CS-Fixer/shim.git", + "reference": "81ccfd24baf3a10810dab1152c403981a790b837" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/81ccfd24baf3a10810dab1152c403981a790b837", + "reference": "81ccfd24baf3a10810dab1152c403981a790b837", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-tokenizer": "*", + "php": "^7.4 || ^8.0" + }, + "replace": { + "friendsofphp/php-cs-fixer": "self.version" + }, + "suggest": { + "ext-dom": "For handling output formats in XML", + "ext-mbstring": "For handling non-UTF8 characters." + }, + "bin": [ + "php-cs-fixer", + "php-cs-fixer.phar" + ], + "type": "application", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Dariusz Rumiński", + "email": "dariusz.ruminski@gmail.com" + } + ], + "description": "A tool to automatically fix PHP code style", + "support": { + "issues": "https://github.com/PHP-CS-Fixer/shim/issues", + "source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.64.0" + }, + "time": "2024-08-30T23:10:11+00:00" + }, + { + "name": "psalm/phar", + "version": "5.26.1", + "source": { + "type": "git", + "url": "https://github.com/psalm/phar.git", + "reference": "8a38e7ad04499a0ccd2c506fd1da6fc01fff4547" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/psalm/phar/zipball/8a38e7ad04499a0ccd2c506fd1da6fc01fff4547", + "reference": "8a38e7ad04499a0ccd2c506fd1da6fc01fff4547", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "vimeo/psalm": "*" + }, + "bin": [ + "psalm.phar" + ], + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Composer-based Psalm Phar", + "support": { + "issues": "https://github.com/psalm/phar/issues", + "source": "https://github.com/psalm/phar/tree/5.26.1" + }, + "time": "2024-09-09T16:22:43+00:00" + }, + { + "name": "psr/clock", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/clock.git", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Clock\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for reading the clock.", + "homepage": "https://github.com/php-fig/clock", + "keywords": [ + "clock", + "now", + "psr", + "psr-20", + "time" + ], + "support": { + "issues": "https://github.com/php-fig/clock/issues", + "source": "https://github.com/php-fig/clock/tree/1.0.0" + }, + "time": "2022-11-25T14:36:26+00:00" + }, + { + "name": "psr/container", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/2.0.2" + }, + "time": "2021-11-05T16:47:00+00:00" + }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00" + }, + { + "name": "psr/log", + "version": "1.1.4", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/1.1.4" + }, + "time": "2021-05-03T11:20:27+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": { + "nextcloud/ocp": 20 + }, + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=8.0" + }, + "platform-dev": [], + "platform-overrides": { + "php": "8.0" + }, + "plugin-api-version": "2.6.0" +} diff --git a/socialsharing_twitter/lib/AppInfo/Application.php b/socialsharing_twitter/lib/AppInfo/Application.php index c488b32..671ca77 100644 --- a/socialsharing_twitter/lib/AppInfo/Application.php +++ b/socialsharing_twitter/lib/AppInfo/Application.php @@ -27,27 +27,30 @@ use OCP\AppFramework\Bootstrap\IBootstrap; use OCP\AppFramework\Bootstrap\IRegistrationContext; use OCP\EventDispatcher\Event; -use OCP\EventDispatcher\IEventDispatcher; +use OCP\EventDispatcher\IEventListener; use OCP\Util; -class Application extends App implements IBootstrap { +/** + * @implements IEventListener<\OCA\Files\Event\LoadSidebar|\OCA\Files\Event\LoadAdditionalScriptsEvent> + */ +class Application extends App implements IBootstrap, IEventListener { - public const APP_ID = 'socialsharing_twitter'; + public const APP_ID = 'socialsharing_twitter'; - public function __construct() { - parent::__construct(self::APP_ID); - } + public function __construct() { + parent::__construct(self::APP_ID); + } - public function register(IRegistrationContext $context): void { - $context->registerEventListener(\OCA\Files\Event\LoadSidebar::class, self::class); - $context->registerEventListener(\OCA\Files\Event\LoadAdditionalScriptsEvent::class, self::class); - } + public function register(IRegistrationContext $context): void { + $context->registerEventListener(\OCA\Files\Event\LoadSidebar::class, self::class); + $context->registerEventListener(\OCA\Files\Event\LoadAdditionalScriptsEvent::class, self::class); + } - public function boot(IBootContext $context): void { - } + public function boot(IBootContext $context): void { + } - public function handle(Event $event): void { - Util::addScript(self::APP_ID, self::APP_ID); - Util::addStyle(self::APP_ID, self::APP_ID); - } + public function handle(Event $event): void { + Util::addScript(self::APP_ID, self::APP_ID); + Util::addStyle(self::APP_ID, self::APP_ID); + } } diff --git a/socialsharing_twitter/psalm.xml b/socialsharing_twitter/psalm.xml new file mode 100644 index 0000000..ae047bd --- /dev/null +++ b/socialsharing_twitter/psalm.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/socialsharing_twitter/tests/psalm-baseline.xml b/socialsharing_twitter/tests/psalm-baseline.xml new file mode 100644 index 0000000..5a96be5 --- /dev/null +++ b/socialsharing_twitter/tests/psalm-baseline.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/socialsharing_twitter/tests/stub.phpstub b/socialsharing_twitter/tests/stub.phpstub new file mode 100644 index 0000000..35d9dc8 --- /dev/null +++ b/socialsharing_twitter/tests/stub.phpstub @@ -0,0 +1,1116 @@ + + */ + public array $propertyMap = ['{DAV:}displayname' => ['displayname', 'string'], '{urn:ietf:params:xml:ns:caldav}calendar-description' => ['description', 'string'], '{urn:ietf:params:xml:ns:caldav}calendar-timezone' => ['timezone', 'string'], '{http://apple.com/ns/ical/}calendar-order' => ['calendarorder', 'int'], '{http://apple.com/ns/ical/}calendar-color' => ['calendarcolor', 'string'], '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => ['deleted_at', 'int']]; + /** + * List of subscription properties, and how they map to database field names. + * + * @var array + */ + public array $subscriptionPropertyMap = ['{DAV:}displayname' => ['displayname', 'string'], '{http://apple.com/ns/ical/}refreshrate' => ['refreshrate', 'string'], '{http://apple.com/ns/ical/}calendar-order' => ['calendarorder', 'int'], '{http://apple.com/ns/ical/}calendar-color' => ['calendarcolor', 'string'], '{http://calendarserver.org/ns/}subscribed-strip-todos' => ['striptodos', 'bool'], '{http://calendarserver.org/ns/}subscribed-strip-alarms' => ['stripalarms', 'string'], '{http://calendarserver.org/ns/}subscribed-strip-attachments' => ['stripattachments', 'string']]; + /** @var array parameters to index */ + public static array $indexParameters = ['ATTENDEE' => ['CN'], 'ORGANIZER' => ['CN']]; + /** + * @var string[] Map of uid => display name + */ + protected array $userDisplayNames; + + public function __construct(\OCP\IDBConnection $db, \OCA\DAV\Connector\Sabre\Principal $principalBackend, \OCP\IUserManager $userManager, \OCP\IGroupManager $groupManager, \OCP\Security\ISecureRandom $random, \Psr\Log\LoggerInterface $logger, \OCP\EventDispatcher\IEventDispatcher $dispatcher, \OCP\IConfig $config, bool $legacyEndpoint = false) + { + } + + /** + * Return the number of calendars for a principal + * + * By default this excludes the automatically generated birthday calendar + * + * @param $principalUri + * @param bool $excludeBirthday + * @return int + */ + public function getCalendarsForUserCount($principalUri, $excludeBirthday = true) + { + } + + /** + * @return array{id: int, deleted_at: int}[] + */ + public function getDeletedCalendars(int $deletedBefore): array + { + } + + /** + * Returns a list of calendars for a principal. + * + * Every project is an array with the following keys: + * * id, a unique id that will be used by other functions to modify the + * calendar. This can be the same as the uri or a database key. + * * uri, which the basename of the uri with which the calendar is + * accessed. + * * principaluri. The owner of the calendar. Almost always the same as + * principalUri passed to this method. + * + * Furthermore it can contain webdav properties in clark notation. A very + * common one is '{DAV:}displayname'. + * + * Many clients also require: + * {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set + * For this property, you can just return an instance of + * Sabre\CalDAV\Property\SupportedCalendarComponentSet. + * + * If you return {http://sabredav.org/ns}read-only and set the value to 1, + * ACL will automatically be put in read-only mode. + * + * @param string $principalUri + * @return array + */ + public function getCalendarsForUser($principalUri) + { + } + + /** + * @param $principalUri + * @return array + */ + public function getUsersOwnCalendars($principalUri) + { + } + + /** + * @return array + */ + public function getPublicCalendars() + { + } + + /** + * @param string $uri + * @return array + * @throws NotFound + */ + public function getPublicCalendar($uri) + { + } + + /** + * @param string $principal + * @param string $uri + * @return array|null + */ + public function getCalendarByUri($principal, $uri) + { + } + + /** + * @return array{id: int, uri: string, '{http://calendarserver.org/ns/}getctag': string, '{http://sabredav.org/ns}sync-token': int, '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set': SupportedCalendarComponentSet, '{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp': ScheduleCalendarTransp, '{urn:ietf:params:xml:ns:caldav}calendar-timezone': ?string }|null + */ + public function getCalendarById(int $calendarId): ?array + { + } + + /** + * @param $subscriptionId + */ + public function getSubscriptionById($subscriptionId) + { + } + + /** + * Creates a new calendar for a principal. + * + * If the creation was a success, an id must be returned that can be used to reference + * this calendar in other methods, such as updateCalendar. + * + * @param string $principalUri + * @param string $calendarUri + * @param array $properties + * @return int + * + * @throws CalendarException + */ + public function createCalendar($principalUri, $calendarUri, array $properties) + { + } + + /** + * Updates properties for a calendar. + * + * The list of mutations is stored in a Sabre\DAV\PropPatch object. + * To do the actual updates, you must tell this object which properties + * you're going to process with the handle() method. + * + * Calling the handle method is like telling the PropPatch object "I + * promise I can handle updating this property". + * + * Read the PropPatch documentation for more info and examples. + * + * @param mixed $calendarId + * @param PropPatch $propPatch + * @return void + */ + public function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch) + { + } + + /** + * Delete a calendar and all it's objects + * + * @param mixed $calendarId + * @return void + */ + public function deleteCalendar($calendarId, bool $forceDeletePermanently = false) + { + } + + public function restoreCalendar(int $id): void + { + } + + /** + * Delete all of an user's shares + * + * @param string $principaluri + * @return void + */ + public function deleteAllSharesByUser($principaluri) + { + } + + /** + * Returns all calendar objects within a calendar. + * + * Every item contains an array with the following keys: + * * calendardata - The iCalendar-compatible calendar data + * * uri - a unique key which will be used to construct the uri. This can + * be any arbitrary string, but making sure it ends with '.ics' is a + * good idea. This is only the basename, or filename, not the full + * path. + * * lastmodified - a timestamp of the last modification time + * * etag - An arbitrary string, surrounded by double-quotes. (e.g.: + * '"abcdef"') + * * size - The size of the calendar objects, in bytes. + * * component - optional, a string containing the type of object, such + * as 'vevent' or 'vtodo'. If specified, this will be used to populate + * the Content-Type header. + * + * Note that the etag is optional, but it's highly encouraged to return for + * speed reasons. + * + * The calendardata is also optional. If it's not returned + * 'getCalendarObject' will be called later, which *is* expected to return + * calendardata. + * + * If neither etag or size are specified, the calendardata will be + * used/fetched to determine these numbers. If both are specified the + * amount of times this is needed is reduced by a great degree. + * + * @param mixed $calendarId + * @param int $calendarType + * @return array + */ + public function getCalendarObjects($calendarId, $calendarType = self::CALENDAR_TYPE_CALENDAR): array + { + } + + public function getDeletedCalendarObjects(int $deletedBefore): array + { + } + + /** + * Return all deleted calendar objects by the given principal that are not + * in deleted calendars. + * + * @param string $principalUri + * @return array + * @throws Exception + */ + public function getDeletedCalendarObjectsByPrincipal(string $principalUri): array + { + } + + /** + * Returns information from a single calendar object, based on it's object + * uri. + * + * The object uri is only the basename, or filename and not a full path. + * + * The returned array must have the same keys as getCalendarObjects. The + * 'calendardata' object is required here though, while it's not required + * for getCalendarObjects. + * + * This method must return null if the object did not exist. + * + * @param mixed $calendarId + * @param string $objectUri + * @param int $calendarType + * @return array|null + */ + public function getCalendarObject($calendarId, $objectUri, int $calendarType = self::CALENDAR_TYPE_CALENDAR) + { + } + + /** + * Returns a list of calendar objects. + * + * This method should work identical to getCalendarObject, but instead + * return all the calendar objects in the list as an array. + * + * If the backend supports this, it may allow for some speed-ups. + * + * @param mixed $calendarId + * @param string[] $uris + * @param int $calendarType + * @return array + */ + public function getMultipleCalendarObjects($calendarId, array $uris, $calendarType = self::CALENDAR_TYPE_CALENDAR): array + { + } + + /** + * Creates a new calendar object. + * + * The object uri is only the basename, or filename and not a full path. + * + * It is possible return an etag from this function, which will be used in + * the response to this PUT request. Note that the ETag must be surrounded + * by double-quotes. + * + * However, you should only really return this ETag if you don't mangle the + * calendar-data. If the result of a subsequent GET to this object is not + * the exact same as this request body, you should omit the ETag. + * + * @param mixed $calendarId + * @param string $objectUri + * @param string $calendarData + * @param int $calendarType + * @return string + */ + public function createCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) + { + } + + /** + * Updates an existing calendarobject, based on it's uri. + * + * The object uri is only the basename, or filename and not a full path. + * + * It is possible return an etag from this function, which will be used in + * the response to this PUT request. Note that the ETag must be surrounded + * by double-quotes. + * + * However, you should only really return this ETag if you don't mangle the + * calendar-data. If the result of a subsequent GET to this object is not + * the exact same as this request body, you should omit the ETag. + * + * @param mixed $calendarId + * @param string $objectUri + * @param string $calendarData + * @param int $calendarType + * @return string + */ + public function updateCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) + { + } + + /** + * Moves a calendar object from calendar to calendar. + * + * @param int $sourceCalendarId + * @param int $targetCalendarId + * @param int $objectId + * @param string $oldPrincipalUri + * @param string $newPrincipalUri + * @param int $calendarType + * @return bool + * @throws Exception + */ + public function moveCalendarObject(int $sourceCalendarId, int $targetCalendarId, int $objectId, string $oldPrincipalUri, string $newPrincipalUri, int $calendarType = self::CALENDAR_TYPE_CALENDAR): bool + { + } + + /** + * @param int $calendarObjectId + * @param int $classification + */ + public function setClassification($calendarObjectId, $classification) + { + } + + /** + * Deletes an existing calendar object. + * + * The object uri is only the basename, or filename and not a full path. + * + * @param mixed $calendarId + * @param string $objectUri + * @param int $calendarType + * @param bool $forceDeletePermanently + * @return void + */ + public function deleteCalendarObject($calendarId, $objectUri, $calendarType = self::CALENDAR_TYPE_CALENDAR, bool $forceDeletePermanently = false) + { + } + + /** + * @param mixed $objectData + * + * @throws Forbidden + */ + public function restoreCalendarObject(array $objectData): void + { + } + + /** + * Performs a calendar-query on the contents of this calendar. + * + * The calendar-query is defined in RFC4791 : CalDAV. Using the + * calendar-query it is possible for a client to request a specific set of + * object, based on contents of iCalendar properties, date-ranges and + * iCalendar component types (VTODO, VEVENT). + * + * This method should just return a list of (relative) urls that match this + * query. + * + * The list of filters are specified as an array. The exact array is + * documented by Sabre\CalDAV\CalendarQueryParser. + * + * Note that it is extremely likely that getCalendarObject for every path + * returned from this method will be called almost immediately after. You + * may want to anticipate this to speed up these requests. + * + * This method provides a default implementation, which parses *all* the + * iCalendar objects in the specified calendar. + * + * This default may well be good enough for personal use, and calendars + * that aren't very large. But if you anticipate high usage, big calendars + * or high loads, you are strongly advised to optimize certain paths. + * + * The best way to do so is override this method and to optimize + * specifically for 'common filters'. + * + * Requests that are extremely common are: + * * requests for just VEVENTS + * * requests for just VTODO + * * requests with a time-range-filter on either VEVENT or VTODO. + * + * ..and combinations of these requests. It may not be worth it to try to + * handle every possible situation and just rely on the (relatively + * easy to use) CalendarQueryValidator to handle the rest. + * + * Note that especially time-range-filters may be difficult to parse. A + * time-range filter specified on a VEVENT must for instance also handle + * recurrence rules correctly. + * A good example of how to interpret all these filters can also simply + * be found in Sabre\CalDAV\CalendarQueryFilter. This class is as correct + * as possible, so it gives you a good idea on what type of stuff you need + * to think of. + * + * @param mixed $calendarId + * @param array $filters + * @param int $calendarType + * @return array + */ + public function calendarQuery($calendarId, array $filters, $calendarType = self::CALENDAR_TYPE_CALENDAR): array + { + } + + /** + * custom Nextcloud search extension for CalDAV + * + * TODO - this should optionally cover cached calendar objects as well + * + * @param string $principalUri + * @param array $filters + * @param integer|null $limit + * @param integer|null $offset + * @return array + */ + public function calendarSearch($principalUri, array $filters, $limit = null, $offset = null) + { + } + + /** + * used for Nextcloud's calendar API + * + * @param array $calendarInfo + * @param string $pattern + * @param array $searchProperties + * @param array $options + * @param integer|null $limit + * @param integer|null $offset + * + * @return array + */ + public function search(array $calendarInfo, $pattern, array $searchProperties, array $options, $limit, $offset) + { + } + + /** + * @param string $principalUri + * @param string $pattern + * @param array $componentTypes + * @param array $searchProperties + * @param array $searchParameters + * @param array $options + * @return array + */ + public function searchPrincipalUri(string $principalUri, string $pattern, array $componentTypes, array $searchProperties, array $searchParameters, array $options = []): array + { + } + + /** + * Searches through all of a users calendars and calendar objects to find + * an object with a specific UID. + * + * This method should return the path to this object, relative to the + * calendar home, so this path usually only contains two parts: + * + * calendarpath/objectpath.ics + * + * If the uid is not found, return null. + * + * This method should only consider * objects that the principal owns, so + * any calendars owned by other principals that also appear in this + * collection should be ignored. + * + * @param string $principalUri + * @param string $uid + * @return string|null + */ + public function getCalendarObjectByUID($principalUri, $uid) + { + } + + public function getCalendarObjectById(string $principalUri, int $id): ?array + { + } + + /** + * The getChanges method returns all the changes that have happened, since + * the specified syncToken in the specified calendar. + * + * This function should return an array, such as the following: + * + * [ + * 'syncToken' => 'The current synctoken', + * 'added' => [ + * 'new.txt', + * ], + * 'modified' => [ + * 'modified.txt', + * ], + * 'deleted' => [ + * 'foo.php.bak', + * 'old.txt' + * ] + * ); + * + * The returned syncToken property should reflect the *current* syncToken + * of the calendar, as reported in the {http://sabredav.org/ns}sync-token + * property This is * needed here too, to ensure the operation is atomic. + * + * If the $syncToken argument is specified as null, this is an initial + * sync, and all members should be reported. + * + * The modified property is an array of nodenames that have changed since + * the last token. + * + * The deleted property is an array with nodenames, that have been deleted + * from collection. + * + * The $syncLevel argument is basically the 'depth' of the report. If it's + * 1, you only have to report changes that happened only directly in + * immediate descendants. If it's 2, it should also include changes from + * the nodes below the child collections. (grandchildren) + * + * The $limit argument allows a client to specify how many results should + * be returned at most. If the limit is not specified, it should be treated + * as infinite. + * + * If the limit (infinite or not) is higher than you're willing to return, + * you should throw a Sabre\DAV\Exception\TooMuchMatches() exception. + * + * If the syncToken is expired (due to data cleanup) or unknown, you must + * return null. + * + * The limit is 'suggestive'. You are free to ignore it. + * + * @param string $calendarId + * @param string $syncToken + * @param int $syncLevel + * @param int|null $limit + * @param int $calendarType + * @return array + */ + public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null, $calendarType = self::CALENDAR_TYPE_CALENDAR) + { + } + + /** + * Returns a list of subscriptions for a principal. + * + * Every subscription is an array with the following keys: + * * id, a unique id that will be used by other functions to modify the + * subscription. This can be the same as the uri or a database key. + * * uri. This is just the 'base uri' or 'filename' of the subscription. + * * principaluri. The owner of the subscription. Almost always the same as + * principalUri passed to this method. + * + * Furthermore, all the subscription info must be returned too: + * + * 1. {DAV:}displayname + * 2. {http://apple.com/ns/ical/}refreshrate + * 3. {http://calendarserver.org/ns/}subscribed-strip-todos (omit if todos + * should not be stripped). + * 4. {http://calendarserver.org/ns/}subscribed-strip-alarms (omit if alarms + * should not be stripped). + * 5. {http://calendarserver.org/ns/}subscribed-strip-attachments (omit if + * attachments should not be stripped). + * 6. {http://calendarserver.org/ns/}source (Must be a + * Sabre\DAV\Property\Href). + * 7. {http://apple.com/ns/ical/}calendar-color + * 8. {http://apple.com/ns/ical/}calendar-order + * 9. {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set + * (should just be an instance of + * Sabre\CalDAV\Property\SupportedCalendarComponentSet, with a bunch of + * default components). + * + * @param string $principalUri + * @return array + */ + public function getSubscriptionsForUser($principalUri) + { + } + + /** + * Creates a new subscription for a principal. + * + * If the creation was a success, an id must be returned that can be used to reference + * this subscription in other methods, such as updateSubscription. + * + * @param string $principalUri + * @param string $uri + * @param array $properties + * @return mixed + */ + public function createSubscription($principalUri, $uri, array $properties) + { + } + + /** + * Updates a subscription + * + * The list of mutations is stored in a Sabre\DAV\PropPatch object. + * To do the actual updates, you must tell this object which properties + * you're going to process with the handle() method. + * + * Calling the handle method is like telling the PropPatch object "I + * promise I can handle updating this property". + * + * Read the PropPatch documentation for more info and examples. + * + * @param mixed $subscriptionId + * @param PropPatch $propPatch + * @return void + */ + public function updateSubscription($subscriptionId, \Sabre\DAV\PropPatch $propPatch) + { + } + + /** + * Deletes a subscription. + * + * @param mixed $subscriptionId + * @return void + */ + public function deleteSubscription($subscriptionId) + { + } + + /** + * Returns a single scheduling object for the inbox collection. + * + * The returned array should contain the following elements: + * * uri - A unique basename for the object. This will be used to + * construct a full uri. + * * calendardata - The iCalendar object + * * lastmodified - The last modification date. Can be an int for a unix + * timestamp, or a PHP DateTime object. + * * etag - A unique token that must change if the object changed. + * * size - The size of the object, in bytes. + * + * @param string $principalUri + * @param string $objectUri + * @return array + */ + public function getSchedulingObject($principalUri, $objectUri) + { + } + + /** + * Returns all scheduling objects for the inbox collection. + * + * These objects should be returned as an array. Every item in the array + * should follow the same structure as returned from getSchedulingObject. + * + * The main difference is that 'calendardata' is optional. + * + * @param string $principalUri + * @return array + */ + public function getSchedulingObjects($principalUri) + { + } + + /** + * Deletes a scheduling object from the inbox collection. + * + * @param string $principalUri + * @param string $objectUri + * @return void + */ + public function deleteSchedulingObject($principalUri, $objectUri) + { + } + + /** + * Creates a new scheduling object. This should land in a users' inbox. + * + * @param string $principalUri + * @param string $objectUri + * @param string $objectData + * @return void + */ + public function createSchedulingObject($principalUri, $objectUri, $objectData) + { + } + + /** + * Adds a change record to the calendarchanges table. + * + * @param mixed $calendarId + * @param string $objectUri + * @param int $operation 1 = add, 2 = modify, 3 = delete. + * @param int $calendarType + * @return void + */ + protected function addChange(int $calendarId, string $objectUri, int $operation, int $calendarType = self::CALENDAR_TYPE_CALENDAR): void + { + } + + /** + * Parses some information from calendar objects, used for optimized + * calendar-queries. + * + * Returns an array with the following keys: + * * etag - An md5 checksum of the object without the quotes. + * * size - Size of the object in bytes + * * componentType - VEVENT, VTODO or VJOURNAL + * * firstOccurence + * * lastOccurence + * * uid - value of the UID property + * + * @param string $calendarData + * @return array + */ + public function getDenormalizedData($calendarData) + { + } + + /** + * @param list $add + * @param list $remove + */ + public function updateShares(\OCA\DAV\DAV\Sharing\IShareable $shareable, array $add, array $remove): void + { + } + + /** + * @return list + */ + public function getShares(int $resourceId): array + { + } + + /** + * @param boolean $value + * @param \OCA\DAV\CalDAV\Calendar $calendar + * @return string|null + */ + public function setPublishStatus($value, $calendar) + { + } + + /** + * @param \OCA\DAV\CalDAV\Calendar $calendar + * @return mixed + */ + public function getPublishStatus($calendar) + { + } + + /** + * @param int $resourceId + * @param list $acl + * @return list + */ + public function applyShareAcl(int $resourceId, array $acl): array + { + } + + /** + * update properties table + * + * @param int $calendarId + * @param string $objectUri + * @param string $calendarData + * @param int $calendarType + */ + public function updateProperties($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) + { + } + + /** + * deletes all birthday calendars + */ + public function deleteAllBirthdayCalendars() + { + } + + /** + * @param $subscriptionId + */ + public function purgeAllCachedEventsForSubscription($subscriptionId) + { + } + + /** + * Move a calendar from one user to another + * + * @param string $uriName + * @param string $uriOrigin + * @param string $uriDestination + * @param string $newUriName (optional) the new uriName + */ + public function moveCalendar($uriName, $uriOrigin, $uriDestination, $newUriName = null) + { + } + + /** + * read VCalendar data into a VCalendar object + * + * @param string $objectData + * @return VCalendar + */ + protected function readCalendarData($objectData) + { + } + + /** + * delete all properties from a given calendar object + * + * @param int $calendarId + * @param int $objectId + */ + protected function purgeProperties($calendarId, $objectId) + { + } + + /** + * get ID from a given calendar object + * + * @param int $calendarId + * @param string $uri + * @param int $calendarType + * @return int + */ + protected function getCalendarObjectId($calendarId, $uri, $calendarType): int + { + } + + /** + * @throws \InvalidArgumentException + */ + public function pruneOutdatedSyncTokens(int $keep = 10000): int + { + } + } + +} + +namespace Sabre\CalDAV\Backend { + + /** + * Abstract Calendaring backend. Extend this class to create your own backends. + * + * Checkout the BackendInterface for all the methods that must be implemented. + * + * @copyright Copyright (C) fruux GmbH (https://fruux.com/) + * @author Evert Pot (http://evertpot.com/) + * @license http://sabre.io/license/ Modified BSD License + */ + abstract class AbstractBackend implements \Sabre\CalDAV\Backend\BackendInterface + { + /** + * Updates properties for a calendar. + * + * The list of mutations is stored in a Sabre\DAV\PropPatch object. + * To do the actual updates, you must tell this object which properties + * you're going to process with the handle() method. + * + * Calling the handle method is like telling the PropPatch object "I + * promise I can handle updating this property". + * + * Read the PropPatch documentation for more info and examples. + * + * @param mixed $calendarId + */ + public function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch) + { + } + + /** + * Returns a list of calendar objects. + * + * This method should work identical to getCalendarObject, but instead + * return all the calendar objects in the list as an array. + * + * If the backend supports this, it may allow for some speed-ups. + * + * @param mixed $calendarId + * + * @return array + */ + public function getMultipleCalendarObjects($calendarId, array $uris) + { + } + + /** + * Performs a calendar-query on the contents of this calendar. + * + * The calendar-query is defined in RFC4791 : CalDAV. Using the + * calendar-query it is possible for a client to request a specific set of + * object, based on contents of iCalendar properties, date-ranges and + * iCalendar component types (VTODO, VEVENT). + * + * This method should just return a list of (relative) urls that match this + * query. + * + * The list of filters are specified as an array. The exact array is + * documented by \Sabre\CalDAV\CalendarQueryParser. + * + * Note that it is extremely likely that getCalendarObject for every path + * returned from this method will be called almost immediately after. You + * may want to anticipate this to speed up these requests. + * + * This method provides a default implementation, which parses *all* the + * iCalendar objects in the specified calendar. + * + * This default may well be good enough for personal use, and calendars + * that aren't very large. But if you anticipate high usage, big calendars + * or high loads, you are strongly adviced to optimize certain paths. + * + * The best way to do so is override this method and to optimize + * specifically for 'common filters'. + * + * Requests that are extremely common are: + * * requests for just VEVENTS + * * requests for just VTODO + * * requests with a time-range-filter on either VEVENT or VTODO. + * + * ..and combinations of these requests. It may not be worth it to try to + * handle every possible situation and just rely on the (relatively + * easy to use) CalendarQueryValidator to handle the rest. + * + * Note that especially time-range-filters may be difficult to parse. A + * time-range filter specified on a VEVENT must for instance also handle + * recurrence rules correctly. + * A good example of how to interprete all these filters can also simply + * be found in \Sabre\CalDAV\CalendarQueryFilter. This class is as correct + * as possible, so it gives you a good idea on what type of stuff you need + * to think of. + * + * @param mixed $calendarId + * + * @return array + */ + public function calendarQuery($calendarId, array $filters) + { + } + + /** + * This method validates if a filter (as passed to calendarQuery) matches + * the given object. + * + * @return bool + */ + protected function validateFilterForObject(array $object, array $filters) + { + } + + /** + * Searches through all of a users calendars and calendar objects to find + * an object with a specific UID. + * + * This method should return the path to this object, relative to the + * calendar home, so this path usually only contains two parts: + * + * calendarpath/objectpath.ics + * + * If the uid is not found, return null. + * + * This method should only consider * objects that the principal owns, so + * any calendars owned by other principals that also appear in this + * collection should be ignored. + * + * @param string $principalUri + * @param string $uid + * + * @return string|null + */ + public function getCalendarObjectByUID($principalUri, $uid) + { + } + } +} \ No newline at end of file