Skip to content

Commit

Permalink
Merge branch 'master' into fix-psalm
Browse files Browse the repository at this point in the history
  • Loading branch information
xepozz authored Oct 4, 2023
2 parents 77ca8a8 + 45e8379 commit 7ffef8a
Show file tree
Hide file tree
Showing 109 changed files with 499 additions and 426 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/blog-api_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
name: PHP ${{ matrix.php }}-${{ matrix.os }}

env:
extensions: fileinfo, pdo, pdo_sqlite, intl
extensions: fileinfo, pdo, pdo_sqlite, intl, pcntl
key: cache-v1
YII_C3: true
working_directory: blog-api
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/blog_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
extensions: fileinfo, pdo, pdo_sqlite, intl
key: cache-v1
YII_C3: true
working_directory: blog-api
working_directory: blog

runs-on: ${{ matrix.os }}

Expand Down
9 changes: 7 additions & 2 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
preset: psr12
risky: true

version: 8
version: 8.1

finder:
exclude:
Expand Down Expand Up @@ -60,7 +60,6 @@ enabled:
- phpdoc_order
- phpdoc_property
- phpdoc_scalar
- phpdoc_separation
- phpdoc_singular_inheritdoc
- phpdoc_trim
- phpdoc_trim_consecutive_blank_line_separation
Expand All @@ -82,3 +81,9 @@ enabled:
- trailing_comma_in_multiline_array
- unalign_double_arrow
- unalign_equals
- empty_loop_body_braces
- integer_literal_case
- union_type_without_spaces

disabled:
- function_declaration
20 changes: 20 additions & 0 deletions ansible/roles/certbot/tasks/update_certificates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,23 @@
args:
chdir: /home/deploy/demo.yiiframework.com
shell: docker-compose -f docker-compose.yml exec gateway nginx -t && docker-compose -f docker-compose.yml exec gateway nginx -s reload

# Crontab file location is /var/spool/cron/crontabs/deploy
# Every 2nd month on 15th day of month
# See https://crontab.guru/#0_0_15_*/2_*
- name: Set periodic certificates update
cron:
name: certbot-renew
user: deploy
minute: '0'
hour: '0'
day: '15'
month: '*/2'
job: >
/bin/bash -c "
cd /home/deploy/demo.yiiframework.com &&
docker-compose -f docker-compose.yml up certbot &&
sleep 180 &&
docker-compose -f docker-compose.yml exec -T gateway nginx -t &&
docker-compose -f docker-compose.yml exec -T gateway nginx -s reload
"
1 change: 1 addition & 0 deletions blog-api/.env.test
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
YII_ENV=test
YII_DEBUG=true
BASE_URL=/
113 changes: 21 additions & 92 deletions blog-api/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"issues": "https://github.com/yiisoft/demo-api/issues?state=open",
"forum": "https://www.yiiframework.com/forum/",
"wiki": "https://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"irc": "ircs://irc.libera.chat:6697/yii",
"source": "https://github.com/yiisoft/demo-api"
},
"minimum-stability": "dev",
Expand All @@ -27,50 +27,50 @@
"cycle/entity-behavior": "^1.0",
"cycle/orm": "^2.0",
"doctrine/collections": "^2.0",
"httpsoft/http-message": "^1.0.5",
"httpsoft/http-message": "^1.1",
"myclabs/php-enum": "^1.7",
"psr/container": "^1.0|^2.0",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0",
"psr/http-message": "^1.1|^2.0",
"psr/http-server-handler": "^1.0",
"psr/http-server-middleware": "^1.0",
"psr/log": "^3.0",
"vlucas/phpdotenv": "^5.3",
"yiisoft/access": "^1.0",
"yiisoft/auth": "^3.0",
"yiisoft/cache": "^2.0",
"yiisoft/cache-file": "^2.0",
"yiisoft/cache": "^3.0",
"yiisoft/cache-file": "^3.0",
"yiisoft/config": "^1.0",
"yiisoft/data": "^1.0",
"yiisoft/data-response": "^1.0",
"yiisoft/data-response": "^2.0",
"yiisoft/definitions": "^3.0",
"yiisoft/di": "^1.0",
"yiisoft/error-handler": "^2.0",
"yiisoft/error-handler": "^3.0",
"yiisoft/factory": "^1.0",
"yiisoft/files": "^2.0",
"yiisoft/http": "^1.2",
"yiisoft/injector": "^1.0",
"yiisoft/log": "^2.0",
"yiisoft/log-target-file": "^2.0",
"yiisoft/log-target-file": "^3.0",
"yiisoft/request-body-parser": "^1.1",
"yiisoft/request-model": "dev-master",
"yiisoft/router": "^2.1",
"yiisoft/router-fastroute": "^2.1",
"yiisoft/router": "^3.0",
"yiisoft/router-fastroute": "^3.0",
"yiisoft/security": "^1.0",
"yiisoft/translator": "^2.0",
"yiisoft/translator": "^3.0",
"yiisoft/translator-message-php": "^1.1",
"yiisoft/user": "^1.0",
"yiisoft/validator": "^3.0@dev",
"yiisoft/yii-console": "^1.0",
"yiisoft/yii-cycle": "^3.0@dev",
"yiisoft/user": "^2.0",
"yiisoft/validator": "^1.0",
"yiisoft/yii-console": "^2.0",
"yiisoft/yii-cycle": "dev-master",
"yiisoft/yii-debug": "^3.0@dev",
"yiisoft/yii-event": "^1.0",
"yiisoft/yii-event": "^2.0",
"yiisoft/yii-http": "^1.0",
"yiisoft/yii-middleware": "dev-master",
"yiisoft/yii-middleware": "^1.0",
"yiisoft/yii-queue": "3.0.x-dev",
"yiisoft/yii-runner-console": "^1.0",
"yiisoft/yii-runner-http": "^1.0",
"yiisoft/yii-swagger": "^1.0"
"yiisoft/yii-runner-console": "^2.0",
"yiisoft/yii-runner-http": "^2.0",
"yiisoft/yii-swagger": "^2.0"
},
"require-dev": {
"codeception/c3": "^2.6",
Expand Down Expand Up @@ -118,78 +118,7 @@
"branch-alias": {
"dev-master": "1.0.x-dev"
},
"config-plugin-options": {
"source-directory": "config"
},
"config-plugin-environments": {
"dev": {
"params": [
"test/params.php"
]
},
"prod": {
"params": [
"test/params.php"
]
},
"test": {
"params": [
"test/params.php"
]
}
},
"config-plugin": {
"common": "common/*.php",
"params": [
"params.php",
"?params-local.php"
],
"web": [
"$common",
"web/*.php"
],
"console": [
"$common",
"console/*.php"
],
"events": "events.php",
"events-web": [
"$events",
"events-web.php"
],
"events-console": [
"$events",
"events-console.php"
],
"providers": "providers.php",
"providers-web": [
"$providers",
"providers-web.php"
],
"providers-console": [
"$providers",
"providers-console.php"
],
"delegates": "delegates.php",
"delegates-web": [
"$delegates",
"delegates-web.php"
],
"delegates-console": [
"$delegates",
"delegates-console.php"
],
"routes": "routes.php",
"bootstrap": "bootstrap.php",
"bootstrap-web": [
"$bootstrap",
"bootstrap-web.php"
],
"bootstrap-console": [
"$bootstrap",
"bootstrap-console.php"
]
}
"config-plugin-file": "configuration.php"
},
"config": {
"sort-packages": true,
Expand Down
1 change: 0 additions & 1 deletion blog-api/config/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
.merge-plan.php
*-local.php
10 changes: 0 additions & 10 deletions blog-api/config/bootstrap.php

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
27 changes: 5 additions & 22 deletions blog-api/config/params.php → blog-api/config/common/params.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@
use Cycle\Database\Config\SQLiteDriverConfig;
use Yiisoft\ErrorHandler\Middleware\ErrorCatcher;
use Yiisoft\Router\Middleware\Router;
use Yiisoft\Yii\Cycle\Command\Migration;
use Yiisoft\Yii\Cycle\Command\Schema;
use Yiisoft\Yii\Cycle\Schema\Conveyor\AttributedSchemaConveyor;
use Yiisoft\Yii\Cycle\Schema\Provider\FromConveyorSchemaProvider;
use Yiisoft\Yii\Cycle\Schema\Provider\PhpFileSchemaProvider;
use Yiisoft\Yii\Cycle\Schema\SchemaProviderInterface;
use Yiisoft\Yii\Middleware\Locale;
use Yiisoft\Yii\Middleware\SubFolder;
use Yiisoft\Yii\Middleware\Subfolder;
use Yiisoft\Yii\Queue\Adapter\SynchronousAdapter;

return [
Expand All @@ -28,17 +26,17 @@
'supportEmail' => '[email protected]',
'middlewares' => [
ErrorCatcher::class,
SubFolder::class,
Subfolder::class,
Locale::class,
Router::class,
],

'yiisoft/aliases' => [
'aliases' => [
'@root' => dirname(__DIR__),
'@root' => dirname(__DIR__, 2),
'@assets' => '@public/assets',
'@assetsUrl' => '@baseUrl/assets',
'@baseUrl' => $_ENV['BASE_URL'],
'@baseUrl' => '',
'@data' => '@root/data',
'@messages' => '@resources/messages',
'@public' => '@root/public',
Expand All @@ -61,21 +59,6 @@
'defaultCategory' => 'app',
],

// Console commands
'yiisoft/yii-console' => [
'commands' => [
'cycle/schema' => Schema\SchemaCommand::class,
'cycle/schema/php' => Schema\SchemaPhpCommand::class,
'cycle/schema/clear' => Schema\SchemaClearCommand::class,
'cycle/schema/rebuild' => Schema\SchemaRebuildCommand::class,
'migrate/create' => Migration\CreateCommand::class,
'migrate/generate' => Migration\GenerateCommand::class,
'migrate/up' => Migration\UpCommand::class,
'migrate/down' => Migration\DownCommand::class,
'migrate/list' => Migration\ListCommand::class,
],
],

'yiisoft/yii-cycle' => [
// DBAL config
'dbal' => [
Expand All @@ -90,7 +73,7 @@
],
'connections' => [
'sqlite' => new SQLiteDriverConfig(
new FileConnectionConfig(dirname(__DIR__) . '/runtime/database.db')
new FileConnectionConfig(dirname(__DIR__, 2) . '/runtime/database.db')
),
],
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Yiisoft\Router\UrlGeneratorInterface;
use Yiisoft\Swagger\Middleware\SwaggerJson;
use Yiisoft\Swagger\Middleware\SwaggerUi;
use Yiisoft\Yii\Middleware\CorsAllowAll;

return [
Route::get('/')
Expand Down Expand Up @@ -61,6 +62,7 @@
}),
Route::get('/openapi.json')
->middleware(FormatDataResponseAsJson::class)
->action(SwaggerJson::class),
->middleware(CorsAllowAll::class)
->action([SwaggerJson::class, 'handle']),
),
];
Empty file removed blog-api/config/console/.gitkeep
Empty file.
18 changes: 18 additions & 0 deletions blog-api/config/console/commands.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);

use Yiisoft\Yii\Cycle\Command\Migration;
use Yiisoft\Yii\Cycle\Command\Schema;

return [
'cycle/schema' => Schema\SchemaCommand::class,
'cycle/schema/php' => Schema\SchemaPhpCommand::class,
'cycle/schema/clear' => Schema\SchemaClearCommand::class,
'cycle/schema/rebuild' => Schema\SchemaRebuildCommand::class,
'migrate/create' => Migration\CreateCommand::class,
'migrate/generate' => Migration\GenerateCommand::class,
'migrate/up' => Migration\UpCommand::class,
'migrate/down' => Migration\DownCommand::class,
'migrate/list' => Migration\ListCommand::class,
];
9 changes: 9 additions & 0 deletions blog-api/config/console/params.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);

return [
'yiisoft/yii-console' => [
'commands' => require __DIR__ . '/commands.php',
],
];
5 changes: 0 additions & 5 deletions blog-api/config/delegates-web.php

This file was deleted.

5 changes: 0 additions & 5 deletions blog-api/config/delegates.php

This file was deleted.

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
'dbal' => [
'connections' => [
'sqlite' => new SQLiteDriverConfig(
new FileConnectionConfig(dirname(__DIR__, 2) . '/tests/Support/Data/database.db')
new FileConnectionConfig(dirname(__DIR__, 3) . '/tests/Support/Data/database.db')
),
],
],
Expand Down
5 changes: 0 additions & 5 deletions blog-api/config/events-console.php

This file was deleted.

5 changes: 0 additions & 5 deletions blog-api/config/events-web.php

This file was deleted.

5 changes: 0 additions & 5 deletions blog-api/config/events.php

This file was deleted.

Loading

0 comments on commit 7ffef8a

Please sign in to comment.