Skip to content

Commit

Permalink
Merge branch 'develop' into mediafinder-dimensions
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeTowers authored Aug 3, 2023
2 parents b3692e5 + 6cec80d commit c46415e
Show file tree
Hide file tree
Showing 159 changed files with 1,955 additions and 1,119 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4

[.github/workflows/**.{yml,yaml}]
indent_size = 2
43 changes: 43 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
APP_NAME="Winter CMS"
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
APP_LOCALE=en

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=database
DB_USERNAME=root
DB_PASSWORD=

CACHE_DRIVER=file

SESSION_DRIVER=file

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

QUEUE_CONNECTION=sync

MAIL_MAILER=log
MAIL_LOG_CHANNEL=null
MAIL_HOST=null
MAIL_PORT=null
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=[email protected]
MAIL_FROM_NAME="${APP_NAME}"

ROUTES_CACHE=false
ASSET_CACHE=false
LINK_POLICY=detect
ENABLE_CSRF=true
DATABASE_TEMPLATES=false

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
11 changes: 10 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
* text=auto
* text=auto

*.md diff=markdown
*.php diff=php

/.github export-ignore
/.gitpod export-ignore
.gitattributes export-ignore
.gitpod.yml export-ignore
CHANGELOG.md export-ignore
100 changes: 100 additions & 0 deletions .github/workflows/manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Manifest

on:
push:
tags:
- '*'
workflow_dispatch:

jobs:
updateManifest:
name: Update manifest
runs-on: ubuntu-latest
env:
phpVersion: '8.1'
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/[email protected]
with:
access_token: ${{ github.token }}

- name: Checkout changes
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:
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: Setup dependency cache
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.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: Download manifest
run: wget -O builds.json https://github.com/wintercms/meta/raw/master/manifest/builds.json

- name: Run manifest
run: php artisan winter:manifest builds.json

- name: Create artifact
uses: actions/upload-artifact@v3
with:
name: winter-manifest
path: builds.json
commitManifest:
name: Commit manifest
runs-on: ubuntu-latest
needs: updateManifest
steps:
- name: Cancel previous incomplete runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- name: Checkout changes
uses: actions/checkout@v3
with:
repository: wintercms/meta
ref: master
token: ${{ secrets.WINTER_BOT_TOKEN }}

- name: Download artifact
uses: actions/download-artifact@v3
with:
name: winter-manifest
path: manifest

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Update manifest
commit_user_name: Winter Bot
commit_user_email: [email protected]
8 changes: 1 addition & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ jobs:
with:
node-version: ${{ env.nodeVersion }}

- 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"
Expand Down Expand Up @@ -99,7 +96,7 @@ jobs:
max-parallel: 8
matrix:
operatingSystem: [ubuntu-latest, windows-latest]
phpVersion: ['8.0', '8.1']
phpVersion: ['8.0', '8.1', '8.2']
fail-fast: false
runs-on: ${{ matrix.operatingSystem }}
name: ${{ matrix.operatingSystem }} / PHP ${{ matrix.phpVersion }}
Expand Down Expand Up @@ -136,9 +133,6 @@ jobs:
php-version: ${{ matrix.phpVersion }}
extensions: ${{ env.extensions }}

- 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"
Expand Down
11 changes: 8 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"files.associations": {
"**/modules/*/behaviors/*/partials/*.htm": "php",
"**/modules/*/blocks/*.block": "wintercms",
"**/modules/*/blocks/*.block": "wintercms-block",
"**/modules/*/controllers/*/*.htm": "php",
"**/modules/*/formwidgets/*/partials/*.htm": "php",
"**/modules/*/layouts/*.htm": "php",
Expand All @@ -12,7 +12,7 @@
"**/modules/*/widgets/*/partials/*.htm": "php",

"**/plugins/*/*/behaviors/*/partials/*.htm": "php",
"**/plugins/*/*/blocks/*.block": "wintercms",
"**/plugins/*/*/blocks/*.block": "wintercms-block",
"**/plugins/*/*/components/**/*.htm": "wintercms-twig",
"**/plugins/*/*/controllers/*/*.htm": "php",
"**/plugins/*/*/formwidgets/*/partials/*.htm": "php",
Expand All @@ -23,12 +23,17 @@
"**/plugins/*/*/views/mail/*.htm": "wintercms",
"**/plugins/*/*/widgets/*/partials/*.htm": "php",

"**/themes/*/blocks/**/*.block": "wintercms",
"**/themes/*/blocks/**/*.block": "wintercms-block",
"**/themes/*/content/**/*.htm": "wintercms",
"**/themes/*/layouts/*.htm": "wintercms",
"**/themes/*/pages/**/*.htm": "wintercms",
"**/themes/*/partials/**/*.htm": "wintercms"
},
"emmet.includeLanguages": {
"wintercms": "html",
"wintercms-twig": "html",
"wintercms-block": "html"
},
"eslint.validate": [
"javascript",
"vue"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ No matter how large or small your project is, Winter provides a rich development
[![Tests](https://img.shields.io/github/actions/workflow/status/wintercms/winter/tests.yml?branch=develop&label=tests&style=flat-square)](https://github.com/wintercms/winter/actions)
[![License](https://img.shields.io/github/license/wintercms/winter?label=open%20source&style=flat-square)](https://packagist.org/packages/wintercms/winter)
[![Discord](https://img.shields.io/discord/816852513684193281?label=discord&style=flat-square)](https://discord.gg/D5MFSPH6Ux)
[![RINGER](https://www.ringerhq.com/images/get-support-on-ringer.svg)](https://www.ringerhq.com/i/wintercms/winter)

[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/wintercms/winter)

Expand Down
2 changes: 2 additions & 0 deletions bootstrap/cache/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"winter/wn-backend-module": "dev-develop",
"winter/wn-cms-module": "dev-develop",
"laravel/framework": "^9.1",
"wikimedia/composer-merge-plugin": "~2.0.1"
"wikimedia/composer-merge-plugin": "~2.1.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5.8",
Expand All @@ -46,6 +46,9 @@
"dms/phpunit-arraysubset-asserts": "^0.1.0|^0.2.1"
},
"scripts": {
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate"
],
Expand All @@ -72,6 +75,7 @@
],
"recurse": true,
"replace": false,
"merge-replace": false,
"merge-dev": false
}
},
Expand Down
9 changes: 9 additions & 0 deletions modules/backend/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@
"airbnb-base",
"plugin:vue/vue3-recommended"
],
"ignorePatterns": [
"assets/js",
"assets/vendor",
"behaviors/**/*.js",
"controllers/**/*.js",
"formwidgets/**/*.js",
"reportwidgets/**/*.js",
"widgets/**/*.js"
],
"rules": {
"class-methods-use-this": ["off"],
"indent": ["error", 4, {
Expand Down
2 changes: 1 addition & 1 deletion modules/backend/assets/js/winter-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion modules/backend/assets/ui/js/build/vendor.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion modules/backend/behaviors/UserPreferencesModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function instance()
/**
* Checks if the model has been set up previously, intended as a static method
*/
public function isConfigured()
public function isConfigured(): bool
{
return $this->getSettingsRecord() !== null;
}
Expand Down
50 changes: 35 additions & 15 deletions modules/backend/classes/BackendController.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?php namespace Backend\Classes;

use Str;
use App;
use File;
use View;
use Event;
use Closure;
use Config;
use Event;
use File;
use Illuminate\Routing\Controller as ControllerBase;
use Request;
use Response;
use Illuminate\Routing\Controller as ControllerBase;
use Winter\Storm\Router\Helper as RouterHelper;
use Str;
use System\Classes\PluginManager;
use Closure;
use View;
use Winter\Storm\Router\Helper as RouterHelper;

/**
* This is the master controller for all back-end pages.
Expand Down Expand Up @@ -103,14 +103,6 @@ public function __construct()
$this->extendableConstruct();
}

/**
* Extend this object properties upon construction.
*/
public static function extend(Closure $callback)
{
self::extendableExtendCallback($callback);
}

/**
* @inheritDoc
*/
Expand Down Expand Up @@ -307,4 +299,32 @@ protected static function methodExcludedByOptions($method, array $options)
return (isset($options['only']) && !in_array($method, (array) $options['only'])) ||
(!empty($options['except']) && in_array($method, (array) $options['except']));
}

public function __call($name, $params)
{
if ($name === 'extend') {
if (empty($params[0]) || !is_callable($params[0])) {
throw new \InvalidArgumentException('The extend() method requires a callback parameter or closure.');
}
if ($params[0] instanceof Closure) {
return $params[0]->call($this, $params[1] ?? $this);
}
return Closure::fromCallable($params[0])->call($this, $params[1] ?? $this);
}

return $this->extendableCall($name, $params);
}

public static function __callStatic($name, $params)
{
if ($name === 'extend') {
if (empty($params[0])) {
throw new \InvalidArgumentException('The extend() method requires a callback parameter or closure.');
}
self::extendableExtendCallback($params[0], $params[1] ?? false, $params[2] ?? null);
return;
}

return self::extendableCallStatic($name, $params);
}
}
Loading

0 comments on commit c46415e

Please sign in to comment.