diff --git a/.github/workflows/subsplit.yml b/.github/workflows/subsplit.yml new file mode 100644 index 0000000000..bc4b3aed71 --- /dev/null +++ b/.github/workflows/subsplit.yml @@ -0,0 +1,27 @@ +name: Module sub-split + +on: + push: + create: + delete: + +jobs: + split: + name: Sub-split + runs-on: ubuntu-latest + container: wintercms/cli:0.3.4 + env: + WINTER_CLI_GITHUB_TOKEN: ${{ secrets.WINTER_SPLIT_TOKEN }} + steps: + - name: Create tag + if: github.event_name == 'create' && github.ref_type == 'tag' + run: winter split -a "${{ github.ref_name }}" + - name: Delete branch + if: github.event_name == 'delete' && github.ref_type == 'branch' + run: winter split --remove-branch="${{ github.event.ref }}" + - name: Delete tag + if: github.event_name == 'delete' && github.ref_type == 'tag' + run: winter split --remove-tag="${{ github.event.ref }}" + - name: Push + if: github.event_name == 'push' + run: winter split -b "${{ github.ref_name }}" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6dfd3f074f..a64cdaff0d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,34 +3,96 @@ name: Tests on: push: branches: - - 1.0 - - 1.1 - - 1.2 + - '1.2' - develop pull_request: jobs: frontendTests: - runs-on: ubuntu-latest - name: JavaScript + strategy: + max-parallel: 2 + matrix: + operatingSystem: [ubuntu-latest, windows-latest] + fail-fast: false + runs-on: ${{ matrix.operatingSystem }} + name: ${{ matrix.operatingSystem }} / JavaScript + env: + nodeVersion: 16 + phpVersion: '8.0' + extensions: curl, fileinfo, gd, mbstring, openssl, pdo, pdo_sqlite, sqlite3, xml, zip + key: winter-cms-cache-develop steps: + - name: Cancel previous incomplete runs + uses: styfle/cancel-workflow-action@0.8.0 + with: + access_token: ${{ github.token }} + - name: Checkout changes - uses: actions/checkout@v2 + uses: actions/checkout@v3 + + - name: Setup extension cache + id: extcache + uses: shivammathur/cache-extensions@v1 + with: + php-version: ${{ env.phpVersion }} + extensions: ${{ env.extensions }} + key: ${{ env.key }} + + - name: Cache extensions + uses: actions/cache@v3 with: - fetch-depth: 0 + path: ${{ steps.extcache.outputs.dir }} + key: ${{ steps.extcache.outputs.key }} + restore-keys: ${{ steps.extcache.outputs.key }} + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ env.phpVersion }} + extensions: ${{ env.extensions }} - name: Install Node - uses: actions/setup-node@v1 + uses: actions/setup-node@v3 with: - node-version: 12 + node-version: ${{ env.nodeVersion }} - - name: Install Node dependencies - working-directory: ./modules/system/tests/js - run: npm install + - name: Echo branches + run: echo "${{ github.ref }} | ${{ github.head_ref }} | ${{ github.ref_name }} | ${{ github.base_ref }}" + + - name: Switch library dependency (develop) + if: github.ref == 'refs/heads/develop' || github.base_ref == 'develop' + run: php ./.github/workflows/utilities/library-switcher "dev-develop as 1.2" + + - name: Switch library dependency (1.2) + if: github.head_ref == '1.2' || github.ref == 'refs/heads/1.2' || github.base_ref == '1.2' + run: php ./.github/workflows/utilities/library-switcher "1.2.x-dev as 1.2" + + - name: Setup dependency cache + id: composercache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: ${{ steps.composercache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install Composer dependencies + run: composer install --no-interaction --no-progress --no-scripts + + - name: Reset modules + run: | + git reset --hard + git clean -fd + + - name: Run post-update Composer scripts + run: php artisan package:discover - name: Run tests - working-directory: ./modules/system/tests/js - run: npm run test + run: | + php artisan mix:install + php artisan mix:run module-system test phpUnitTests: strategy: @@ -108,7 +170,9 @@ jobs: run: composer install --no-interaction --no-progress --no-scripts - name: Reset modules - run: git reset --hard + run: | + git reset --hard + git clean -fd - name: Run post-update Composer scripts run: php artisan package:discover @@ -120,4 +184,4 @@ jobs: - name: Run Linting and Tests run: | composer lint - ./vendor/bin/phpunit + php artisan winter:test -m system -m backend -m cms diff --git a/README.md b/README.md index 1185b210f3..ca0fce5259 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,24 @@ Please follow the following guides and code standards: In order to ensure that the Winter community is welcoming to all, please review and abide by the [Code of Conduct](https://github.com/wintercms/.github/blob/master/CODE_OF_CONDUCT.md). +## Sponsors + +Winter CMS development is financially supported by the generosity of the following sponsors: + +### Organizations + +[![Spatial Media logo](https://cdn.ca.spatialmedia.io/media/images/sm-logo-dark-full.svg)](https://spatialmedia.io) +Spatial Media employs two of the core contributors (Luke Towers & Jack Wilkinson) and contributes to the ongoing development of Winter. + +[![Froala logo](https://froala.com/wp-content/uploads/2019/10/froala.svg)](https://froala.com/wysiwyg-editor/) + +Froala provides a perpetual, Enterprise license to Winter CMS which allows us and our users to use the Froala WYSIWYG Editor in Winter CMS powered projects. + +### Individuals +- Orville + +If you would like to have your name, company and link added to this list and support open-source development, feel free to make a donation to our [Open Collective](https://opencollective.com/wintercms). + ## License The Winter platform is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT). diff --git a/composer.json b/composer.json index ad352e7e69..da09aae0e3 100644 --- a/composer.json +++ b/composer.json @@ -68,7 +68,7 @@ "extra": { "merge-plugin": { "include": [ - "plugins/*/*/composer.json" + "plugins/myauthor/*/composer.json" ], "recurse": true, "replace": false, diff --git a/config/app.php b/config/app.php index c4d3537fc2..1520e862cc 100644 --- a/config/app.php +++ b/config/app.php @@ -59,6 +59,19 @@ */ 'asset_url' => env('ASSET_URL', null), + + /* + |-------------------------------------------------------------------------- + | Temporary Path + |-------------------------------------------------------------------------- + | + | This is used to set the application's temporary path. Normally this value + | is set automatically by the application, however on some systems you + | may need to change it (Laravel Vapor / read-only systems: /tmp). + | + */ + + 'tempPath' => env('APP_TEMP_PATH', null), /* |-------------------------------------------------------------------------- @@ -106,14 +119,18 @@ | - array: An array of proxies to trust | | Examples: - | - To trust all proxies: + | - To trust any proxy (i.e. a single proxy with an unknown IP address): + | + | 'trustedProxies' => '*', + | + | - To trust all proxies (i.e. AWS ELB behind CloudFront): | - | 'trustedProxies' => '*' + | 'trustedProxies' => '**', | | - To trust two IP addresses as proxies | - | 'trustedProxies' => '192.168.1.1, 192.168.1.2' - | 'trustedProxies' => ['192.168.1.1', '192.168.1.2'] + | 'trustedProxies' => '192.168.1.1, 192.168.1.2', + | 'trustedProxies' => ['192.168.1.1', '192.168.1.2'], */ 'trustedProxies' => null, diff --git a/config/filesystems.php b/config/filesystems.php index 98904ecd94..64cd1768b6 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -26,6 +26,9 @@ | | Supported Drivers: "local", "ftp", "sftp", "s3" | + | NOTE: s3's stream_uploads option requires the Winter.DriverAWS plugin + | to be installed and enabled. + | */ 'disks' => [ @@ -42,6 +45,7 @@ 'key' => env('AWS_ACCESS_KEY_ID'), 'region' => env('AWS_DEFAULT_REGION'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'stream_uploads' => env('AWS_S3_STREAM_UPLOADS', false), 'url' => env('AWS_URL'), 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), ], diff --git a/modules/backend/LICENSE b/modules/backend/LICENSE new file mode 100644 index 0000000000..7b47a3b139 --- /dev/null +++ b/modules/backend/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2013-2021.03.01 October CMS +Copyright (c) 2021 Winter CMS + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/modules/backend/README.md b/modules/backend/README.md new file mode 100644 index 0000000000..bce0dcf1e6 --- /dev/null +++ b/modules/backend/README.md @@ -0,0 +1,5 @@ +# Winter CMS - Backend Module + +This repository is a read-only sub-split of the Winter CMS `Backend` module for use in Composer. Please note that we do not accept any pull requests to this repository. + +If you wish to make changes to this module, please submit them to the [main repository](https://github.com/wintercms/winter). diff --git a/modules/backend/assets/less/controls/filelist.less b/modules/backend/assets/less/controls/filelist.less index 07e4a8ab21..37ba76cb62 100644 --- a/modules/backend/assets/less/controls/filelist.less +++ b/modules/backend/assets/less/controls/filelist.less @@ -284,7 +284,8 @@ .list-icon { position: absolute; left: 14px; - top: 15px; + top: 50%; + transform: translateY(-50%); font-size: 22px; color: #b7c0c2; } diff --git a/modules/backend/behaviors/FormController.php b/modules/backend/behaviors/FormController.php index 28d58c4157..25660de317 100644 --- a/modules/backend/behaviors/FormController.php +++ b/modules/backend/behaviors/FormController.php @@ -33,7 +33,7 @@ * values as either a YAML file, located in the controller view directory, * or directly as a PHP array. * - * @see http://wintercms.com/docs/backend/forms Back-end form documentation + * @see https://wintercms.com/docs/backend/forms Back-end form documentation * @package winter\wn-backend-module * @author Alexey Bobkov, Samuel Georges */ diff --git a/modules/backend/behaviors/ImportExportController.php b/modules/backend/behaviors/ImportExportController.php index d93683dea4..057a0758a3 100644 --- a/modules/backend/behaviors/ImportExportController.php +++ b/modules/backend/behaviors/ImportExportController.php @@ -12,6 +12,7 @@ use League\Csv\Reader as CsvReader; use League\Csv\Writer as CsvWriter; use League\Csv\EscapeFormula as CsvEscapeFormula; +use League\Csv\Statement as CsvStatement; use ApplicationException; use SplTempFileObject; use Exception; @@ -250,10 +251,10 @@ public function onImportLoadColumnSampleForm() $reader = $this->createCsvReader($path); if (post('first_row_titles')) { - $reader->setOffset(1); + $reader->setHeaderOffset(1); } - $result = $reader->setLimit(50)->fetchColumn((int) $columnId); + $result = (new CsvStatement())->limit(50)->process($reader)->fetchColumn((int) $columnId); $data = iterator_to_array($result, false); /* diff --git a/modules/backend/console/WinterPasswd.php b/modules/backend/console/WinterPasswd.php index 25bad1da84..ecaf088067 100644 --- a/modules/backend/console/WinterPasswd.php +++ b/modules/backend/console/WinterPasswd.php @@ -31,6 +31,13 @@ class WinterPasswd extends Command * @var string The console command description. */ protected $description = 'Change the password of a Backend user.'; + + /** + * @var array List of commands that this command replaces (aliases) + */ + protected $replaces = [ + 'winter:password', + ]; /** * @var bool Was the password automatically generated? diff --git a/modules/backend/console/scaffold/controller/create.stub b/modules/backend/console/scaffold/controller/create.stub index e981d2ad82..8836705591 100644 --- a/modules/backend/console/scaffold/controller/create.stub +++ b/modules/backend/console/scaffold/controller/create.stub @@ -16,7 +16,7 @@