Skip to content

Commit e7f5252

Browse files
authored
Merge pull request #13 from cakephp/5x-upgrade
5x upgrade
2 parents 4e0b34d + 302cfb6 commit e7f5252

26 files changed

+1255
-821
lines changed

composer.json

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,20 @@
55
"type": "project",
66
"license": "MIT",
77
"require": {
8-
"php": ">=7.2",
9-
"cakephp/cakephp": "^4.0",
10-
"cakephp/migrations": "~3.0",
11-
"cakephp/authorization": "~2.0",
12-
"cakephp/authentication": "~2.0",
13-
"cakephp/plugin-installer": "~1.0",
8+
"php": ">=8.1",
9+
"cakephp/cakephp": "^5.0",
10+
"cakephp/migrations": "~4.0",
11+
"cakephp/authorization": "~3.0",
12+
"cakephp/authentication": "~3.0",
13+
"cakephp/plugin-installer": "~2.0",
1414
"josegonzalez/dotenv": "2.*"
1515
},
1616
"require-dev": {
1717
"psy/psysh": "@stable",
18-
"cakephp/debug_kit": "^4.0",
19-
"cakephp/bake": "^2.0",
20-
"cakephp/cakephp-codesniffer": "^4.0"
18+
"cakephp/debug_kit": "^5.0",
19+
"cakephp/bake": "^3.0",
20+
"cakephp/repl": "^2.0",
21+
"cakephp/cakephp-codesniffer": "^5.0"
2122
},
2223
"suggest": {
2324
"markstory/asset_compress": "An asset compression plugin which provides file concatenation and a flexible filter system for preprocessing and minification.",
@@ -39,7 +40,6 @@
3940
"scripts": {
4041
"post-install-cmd": "App\\Console\\Installer::postInstall",
4142
"post-create-project-cmd": "App\\Console\\Installer::postInstall",
42-
"post-autoload-dump": "Cake\\Composer\\Installer\\PluginInstaller::postAutoloadDump",
4343
"check": [
4444
"@test",
4545
"@cs-check"
@@ -50,5 +50,11 @@
5050
"test": "phpunit --colors=always"
5151
},
5252
"minimum-stability": "dev",
53-
"prefer-stable": true
53+
"prefer-stable": true,
54+
"config": {
55+
"allow-plugins": {
56+
"dealerdirect/phpcodesniffer-composer-installer": true,
57+
"cakephp/plugin-installer": true
58+
}
59+
}
5460
}

composer.lock

Lines changed: 786 additions & 663 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/app.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
<?php
2+
declare(strict_types=1);
23

34
use Cake\Cache\Engine\FileEngine;
45
use Cake\Database\Connection;
56
use Cake\Database\Driver\Mysql;
67
use Cake\Error\ExceptionRenderer;
78
use Cake\Log\Engine\FileLog;
89
use Cake\Mailer\Transport\MailTransport;
10+
use function Cake\Core\env;
911

1012
return [
1113
/*
@@ -17,7 +19,7 @@
1719
* Development Mode:
1820
* true: Errors and warnings shown.
1921
*/
20-
'debug' => filter_var(env('DEBUG', false), FILTER_VALIDATE_BOOLEAN),
22+
'debug' => true, //filter_var(env('DEBUG', false), FILTER_VALIDATE_BOOLEAN),
2123

2224
/*
2325
* Configure basic information about the application.

config/bootstrap.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@
4444
use Cake\Routing\Router;
4545
use Cake\Utility\Security;
4646

47+
require_once CAKE . 'Core/functions_global.php';
48+
require_once CAKE . 'I18n/functions_global.php';
49+
4750
/*
4851
* See https://github.com/josegonzalez/php-dotenv for API details.
4952
*

src/Application.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ public function bootstrap(): void
6464
}
6565
$this->addPlugin('Authentication');
6666
$this->addPlugin('Authorization');
67-
68-
// Load more plugins here
6967
}
7068

7169
/**
@@ -114,13 +112,7 @@ public function middleware($middlewareQueue): \Cake\Http\MiddlewareQueue
114112
->add(new AuthorizationMiddleware($this));
115113

116114
if (Configure::read('debug')) {
117-
// Disable authz for debugkit
118-
$middlewareQueue->add(function ($req, $res, $next) {
119-
if ($req->getParam('plugin') === 'DebugKit') {
120-
$req->getAttribute('authorization')->skipAuthorization();
121-
}
122-
return $next($req, $res);
123-
});
115+
Configure::write('DebugKit.ignoreAuthorization', true);
124116
}
125117

126118
return $middlewareQueue;

src/Command/ConsoleCommand.php

Lines changed: 0 additions & 86 deletions
This file was deleted.

src/Controller/AppController.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ class AppController extends Controller
4040
public function initialize(): void
4141
{
4242
parent::initialize();
43-
$this->loadComponent('RequestHandler');
4443
$this->loadComponent('Flash');
4544
$this->loadComponent('Authentication.Authentication');
4645
$this->loadComponent('Authorization.Authorization');

src/Controller/ArticlesController.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,12 @@ public function delete($slug)
8585
}
8686
}
8787

88-
public function tags()
88+
public function tags(array $tags = [])
8989
{
9090
$this->Authorization->skipAuthorization();
9191

92-
// The 'pass' key is provided by CakePHP and contains all
93-
// the passed URL path segments in the request.
94-
$tags = $this->request->getParam('pass');
95-
9692
// Use the ArticlesTable to find tagged articles.
97-
$articles = $this->Articles->find('tagged', [
98-
'tags' => $tags
99-
]);
93+
$articles = $this->Articles->find('tagged', tags: $tags);
10094

10195
// Pass variables into the view template context.
10296
$this->set([

src/Controller/ErrorController.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,6 @@
2323
*/
2424
class ErrorController extends AppController
2525
{
26-
/**
27-
* Initialization hook method.
28-
*
29-
* @return void
30-
*/
31-
public function initialize(): void
32-
{
33-
$this->loadComponent('RequestHandler');
34-
}
35-
3626
/**
3727
* beforeFilter callback.
3828
*

src/Controller/PagesController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
namespace App\Controller;
1616

1717
use Cake\Core\Configure;
18-
use Cake\Network\Exception\ForbiddenException;
19-
use Cake\Network\Exception\NotFoundException;
18+
use Cake\Http\Exception\ForbiddenException;
19+
use Cake\Http\Exception\NotFoundException;
2020
use Cake\View\Exception\MissingTemplateException;
2121

2222
/**

0 commit comments

Comments
 (0)