diff --git a/.github/workflows/lint-php-cs.yml b/.github/workflows/lint-php-cs.yml new file mode 100644 index 0000000..025fd0b --- /dev/null +++ b/.github/workflows/lint-php-cs.yml @@ -0,0 +1,88 @@ +# 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: + changes: + runs-on: ubuntu-latest + outputs: + src: ${{ steps.changes.outputs.src}} + steps: + - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 + id: changes + continue-on-error: true + with: + filters: | + src: + - '.github/workflows/**' + - 'configs/**' + - '.php-cs-fixer.dist.php' + - 'composer.json' + - 'composer.lock' + - '**.php' + + lint: + runs-on: ubuntu-latest + + name: PHP CS fixer lint + + steps: + - name: Checkout + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Set up php8.1 + uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 #v2.31.1 + with: + php-version: 8.1 + 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 + + - name: Install dependencies + run: composer i + + - name: Install PHP CS fixer + run: composer require --dev friendsofphp/php-cs-fixer + + - name: Lint + run: composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 ) + + summary: + permissions: + contents: none + runs-on: ubuntu-latest + needs: [changes, lint] + + if: always() + + # This is the summary, we just avoid to rename it so that branch protection rules still match + name: PHP CS Summary + + steps: + - name: Summary status + run: | + if [[ "${{ needs.changes.outputs.src }}" == "false" ]]; then + echo "No relevant changes detected. Nothing to lint." + elif [[ "${{ needs.lint.result }}" != "success" ]]; then + echo "Check the logs for details of 'PHP CS fixer lint' job." + echo "Linting failed. Please run \`composer run cs:fix\` to fix the issues." + exit 1 + else + echo "All checks passed successfully." + fi diff --git a/.github/workflows/lint-php.yml b/.github/workflows/lint-php.yml new file mode 100644 index 0000000..942551d --- /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: + changes: + runs-on: ubuntu-latest + outputs: + src: ${{ steps.changes.outputs.src}} + steps: + - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 + id: changes + continue-on-error: true + with: + filters: | + src: + - '.github/workflows/**' + - 'configs/**' + - 'composer.json' + - 'composer.lock' + - '**.php' + + lint: + runs-on: ubuntu-latest + + needs: changes + if: needs.changes.outputs.src != 'false' + + strategy: + matrix: + php-versions: [ '8.1', '8.2', '8.3' ] + + 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 }} + coverage: none + ini-file: development + + - name: Lint + run: composer run lint + + summary: + permissions: + contents: none + runs-on: ubuntu-latest + needs: [changes, lint] + + if: always() + + name: php-lint Summary + + steps: + - name: Summary status + run: if ${{ needs.changes.outputs.src != 'false' && needs.lint.result != 'success' }}; then exit 1; fi diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5ddfd7f --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +### PHP-CS-Fixer template +# Covers PHP CS Fixer +# Reference: https://cs.symfony.com/ + +# Generated files +.php-cs-fixer.cache + +# Local config See: https://cs.symfony.com/doc/config.html +.php-cs-fixer.php + +# Composer related files +composer.phar +composer.lock +/vendor/ diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 0000000..de8b167 --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,20 @@ +setParallelConfig(ParallelConfigFactory::detect()) + ->getFinder() + ->ignoreVCSIgnored(true) + ->notPath('composer') + ->notPath('node_modules') + ->notPath('vendor') + ->in('configs') + ->in(__DIR__); + +return $config; diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..91b3f2e --- /dev/null +++ b/composer.json @@ -0,0 +1,13 @@ +{ + "name": "ionos-productivity/nc-config", + "description": "HiDrive Next config partials and configuration scripts", + "scripts": { + "cs:fix": "./vendor/bin/php-cs-fixer fix", + "cs:check": "./vendor/bin/php-cs-fixer fix --dry-run --diff", + "lint": "find . -name \\*.php -print0 | xargs -0 -n1 php -l" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.75", + "nextcloud/coding-standard": "^1.3" + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..a859733 --- /dev/null +++ b/composer.lock @@ -0,0 +1,159 @@ +{ + "_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": "9097266222e2e8c4ba5444c36f6fee29", + "packages": [], + "packages-dev": [ + { + "name": "kubawerlos/php-cs-fixer-custom-fixers", + "version": "v3.24.0", + "source": { + "type": "git", + "url": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers.git", + "reference": "93222100a91399314c3726857e249e76c4a7d760" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kubawerlos/php-cs-fixer-custom-fixers/zipball/93222100a91399314c3726857e249e76c4a7d760", + "reference": "93222100a91399314c3726857e249e76c4a7d760", + "shasum": "" + }, + "require": { + "ext-filter": "*", + "ext-tokenizer": "*", + "friendsofphp/php-cs-fixer": "^3.61.1", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.6.22 || 10.5.45 || ^11.5.7" + }, + "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.24.0" + }, + "time": "2025-03-22T16:51:39+00:00" + }, + { + "name": "nextcloud/coding-standard", + "version": "v1.3.2", + "source": { + "type": "git", + "url": "https://github.com/nextcloud/coding-standard.git", + "reference": "9c719c4747fa26efc12f2e8b21c14a9a75c6ba6d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/9c719c4747fa26efc12f2e8b21c14a9a75c6ba6d", + "reference": "9c719c4747fa26efc12f2e8b21c14a9a75c6ba6d", + "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.2" + }, + "time": "2024-10-14T16:49:05+00:00" + }, + { + "name": "php-cs-fixer/shim", + "version": "v3.75.0", + "source": { + "type": "git", + "url": "https://github.com/PHP-CS-Fixer/shim.git", + "reference": "eea219a577085bd13ff0cb644a422c20798316c7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/eea219a577085bd13ff0cb644a422c20798316c7", + "reference": "eea219a577085bd13ff0cb644a422c20798316c7", + "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.75.0" + }, + "time": "2025-03-31T18:45:02+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [], + "plugin-api-version": "2.2.0" +} diff --git a/configs/admin_audit.config.php b/configs/admin_audit.config.php index 4ffe790..b2d539c 100644 --- a/configs/admin_audit.config.php +++ b/configs/admin_audit.config.php @@ -4,7 +4,7 @@ 'log.condition' => [ 'apps' => ['admin_audit'], ], - "log_type_audit" => "errorlog", - "syslog_tag_audit" => "nextcloud", - "logfile_audit" => "", + 'log_type_audit' => 'errorlog', + 'syslog_tag_audit' => 'nextcloud', + 'logfile_audit' => '', ]; diff --git a/configs/app-paths.config.php b/configs/app-paths.config.php index 1e7455f..d3b6116 100644 --- a/configs/app-paths.config.php +++ b/configs/app-paths.config.php @@ -1,20 +1,21 @@ [ - [ - 'path' => '/var/www/html/apps', - 'url' => '/apps', - 'writable' => true, - ], - [ - 'path' => '/var/www/html/apps-custom', - 'url' => '/apps-custom', - 'writable' => true, - ], - [ - 'path' => '/var/www/html/apps-external', - 'url' => '/apps-external', - 'writable' => true, - ], - ], + 'apps_paths' => [ + [ + 'path' => '/var/www/html/apps', + 'url' => '/apps', + 'writable' => true, + ], + [ + 'path' => '/var/www/html/apps-custom', + 'url' => '/apps-custom', + 'writable' => true, + ], + [ + 'path' => '/var/www/html/apps-external', + 'url' => '/apps-external', + 'writable' => true, + ], + ], ]; diff --git a/configs/defaultapp.config.php b/configs/defaultapp.config.php index 7c0375b..34eb200 100644 --- a/configs/defaultapp.config.php +++ b/configs/defaultapp.config.php @@ -1,4 +1,5 @@ 'files', ]; diff --git a/configs/disable-automatic-updates.config.php b/configs/disable-automatic-updates.config.php index ba0908d..8ed6246 100644 --- a/configs/disable-automatic-updates.config.php +++ b/configs/disable-automatic-updates.config.php @@ -1,4 +1,5 @@ false, ]; diff --git a/configs/enable-theme.config.php b/configs/enable-theme.config.php index 20b1982..3c295b3 100644 --- a/configs/enable-theme.config.php +++ b/configs/enable-theme.config.php @@ -1,4 +1,5 @@ 'nc-ionos-theme', ]; diff --git a/configs/ionos-apps-user-agents.config.php b/configs/ionos-apps-user-agents.config.php index 54aedb0..23196fb 100644 --- a/configs/ionos-apps-user-agents.config.php +++ b/configs/ionos-apps-user-agents.config.php @@ -1,4 +1,5 @@ [ // Use regex to match the user agent string diff --git a/configs/ionos-links.config.php b/configs/ionos-links.config.php index 07e4dd2..ac85f17 100644 --- a/configs/ionos-links.config.php +++ b/configs/ionos-links.config.php @@ -1,14 +1,15 @@ [ - 'ionos_webmail_target_link' => 'https://email.ionos.fr/', - ], - 'ionos_help_target_link' => 'https://wl.hidrive.com/easy/0027', - 'ionos_customclient_windows' => 'https://wl.hidrive.com/easy/0003', - 'ionos_customclient_macos' => 'https://wl.hidrive.com/easy/1003', - 'ionos_customclient_android' => 'https://wl.hidrive.com/easy/0022', - 'ionos_customclient_ios' => 'https://wl.hidrive.com/easy/0021', - 'ionos_customclient_ios_appid' => '6738140194', - 'ionos_homepage' => 'https://ionos.fr/', - 'simpleSignUpLink.shown' => false, + 'ionos_peer_products' => [ + 'ionos_webmail_target_link' => 'https://email.ionos.fr/', + ], + 'ionos_help_target_link' => 'https://wl.hidrive.com/easy/0027', + 'ionos_customclient_windows' => 'https://wl.hidrive.com/easy/0003', + 'ionos_customclient_macos' => 'https://wl.hidrive.com/easy/1003', + 'ionos_customclient_android' => 'https://wl.hidrive.com/easy/0022', + 'ionos_customclient_ios' => 'https://wl.hidrive.com/easy/0021', + 'ionos_customclient_ios_appid' => '6738140194', + 'ionos_homepage' => 'https://ionos.fr/', + 'simpleSignUpLink.shown' => false, ]; diff --git a/configs/oidc.config.php b/configs/oidc.config.php index e463dbd..2fd87be 100644 --- a/configs/oidc.config.php +++ b/configs/oidc.config.php @@ -1,4 +1,5 @@ [ 'enable_default_claims' => false, diff --git a/configs/redirects.config.php b/configs/redirects.config.php index 6defd94..d63e649 100644 --- a/configs/redirects.config.php +++ b/configs/redirects.config.php @@ -1,14 +1,15 @@ [ - // Request path without /index.php/ maps to a controller path in the form - // ... + 'redirects' => [ + // Request path without /index.php/ maps to a controller path in the form + // ... - // - For a FooController.php the controller name is "foo" (lowercase) - // - A handler would be a method in FooController that was annotated with - // - either #[FrontpageRoute] attribute - // - or configured in routes.php - '^\/settings(\/.*)?' => 'simplesettings.page.index', - '^\/u\/[a-zA-Z0-9]+' => 'apps/files' - ], + // - For a FooController.php the controller name is "foo" (lowercase) + // - A handler would be a method in FooController that was annotated with + // - either #[FrontpageRoute] attribute + // - or configured in routes.php + '^\/settings(\/.*)?' => 'simplesettings.page.index', + '^\/u\/[a-zA-Z0-9]+' => 'apps/files' + ], ]; diff --git a/configs/reduce-langs.config.php b/configs/reduce-langs.config.php index 91fef73..c1d0f43 100644 --- a/configs/reduce-langs.config.php +++ b/configs/reduce-langs.config.php @@ -1,12 +1,13 @@ [ - 'en', - 'de_DE', - 'es', - 'fr', - 'it', - 'nl', - 'sv', - ], + 'reduce_to_languages' => [ + 'en', + 'de_DE', + 'es', + 'fr', + 'it', + 'nl', + 'sv', + ], ]; diff --git a/configs/share-by-mail.config.php b/configs/share-by-mail.config.php index 0510367..c52ef3f 100644 --- a/configs/share-by-mail.config.php +++ b/configs/share-by-mail.config.php @@ -1,5 +1,6 @@ true, + // Enable creating and sending sharelinks via e-mail + 'sharing.enable_share_mail' => true, ]; diff --git a/configs/upgrade.config.php b/configs/upgrade.config.php index ff4f09b..3c076d9 100644 --- a/configs/upgrade.config.php +++ b/configs/upgrade.config.php @@ -1,4 +1,5 @@ true, ];