chore: update CodeIgniter to v4.5.6

+ update php dependencies to latest
This commit is contained in:
Yassine Doghri 2024-12-29 16:02:08 +00:00
parent fc2e7a0d83
commit f295e9aa4c
31 changed files with 85 additions and 116 deletions

View File

@ -50,11 +50,12 @@ Events::on('pre_system', static function (): void {
*/ */
if (CI_DEBUG && ! is_cli()) { if (CI_DEBUG && ! is_cli()) {
Events::on('DBQuery', Database::class . '::collect'); Events::on('DBQuery', Database::class . '::collect');
Services::toolbar()->respond(); service('toolbar')
->respond();
// Hot Reload route - for framework use on the hot reloader. // Hot Reload route - for framework use on the hot reloader.
if (ENVIRONMENT === 'development') { if (ENVIRONMENT === 'development') {
Services::routes()->get('__hot-reload', static function (): void { service('routes')->get('__hot-reload', static function (): void {
(new HotReloader())->run(); (new HotReloader())->run();
}); });
} }

View File

@ -74,6 +74,6 @@ class Format extends BaseConfig
*/ */
public function getFormatter(string $mime): FormatterInterface public function getFormatter(string $mime): FormatterInterface
{ {
return Services::format()->getFormatter($mime); return service('format')->getFormatter($mime);
} }
} }

View File

@ -70,7 +70,7 @@ class Paths
* This variable must contain the name of the directory that * This variable must contain the name of the directory that
* contains the view files used by your application. By * contains the view files used by your application. By
* default this is in `app/Views`. This value * default this is in `app/Views`. This value
* is used when no value is provided to `Services::renderer()`. * is used when no value is provided to `service('renderer')`.
*/ */
public string $viewDirectory = __DIR__ . '/../Views'; public string $viewDirectory = __DIR__ . '/../Views';
} }

View File

@ -20,7 +20,6 @@ use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\HTTP\URI; use CodeIgniter\HTTP\URI;
use Config\Services;
use Modules\Analytics\Config\Analytics; use Modules\Analytics\Config\Analytics;
use Modules\PremiumPodcasts\Entities\Subscription; use Modules\PremiumPodcasts\Entities\Subscription;
use Modules\PremiumPodcasts\Models\SubscriptionModel; use Modules\PremiumPodcasts\Models\SubscriptionModel;
@ -124,7 +123,7 @@ class EpisodeAudioController extends Controller
} }
} }
$session = Services::session(); $session = service('session');
$serviceName = ''; $serviceName = '';
if ($this->request->getGet('_from')) { if ($this->request->getGet('_from')) {

View File

@ -20,7 +20,6 @@ use CodeIgniter\Database\BaseBuilder;
use CodeIgniter\Exceptions\PageNotFoundException; use CodeIgniter\Exceptions\PageNotFoundException;
use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\HTTP\ResponseInterface;
use Config\Embed; use Config\Embed;
use Config\Services;
use Modules\Analytics\AnalyticsTrait; use Modules\Analytics\AnalyticsTrait;
use Modules\Fediverse\Objects\OrderedCollectionObject; use Modules\Fediverse\Objects\OrderedCollectionObject;
use Modules\Fediverse\Objects\OrderedCollectionPage; use Modules\Fediverse\Objects\OrderedCollectionPage;
@ -277,7 +276,7 @@ class EpisodeController extends BaseController
$this->registerPodcastWebpageHit($this->episode->podcast_id); $this->registerPodcastWebpageHit($this->episode->podcast_id);
$session = Services::session(); $session = service('session');
if (service('superglobals')->server('HTTP_REFERER') !== null) { if (service('superglobals')->server('HTTP_REFERER') !== null) {
$session->set('embed_domain', parse_url(service('superglobals')->server('HTTP_REFERER'), PHP_URL_HOST)); $session->set('embed_domain', parse_url(service('superglobals')->server('HTTP_REFERER'), PHP_URL_HOST));

View File

@ -11,7 +11,6 @@ declare(strict_types=1);
namespace App\Entities; namespace App\Entities;
use CodeIgniter\Entity\Entity; use CodeIgniter\Entity\Entity;
use Config\Services;
/** /**
* @property string $url * @property string $url
@ -85,7 +84,7 @@ class Location extends Entity
*/ */
public function fetchOsmLocation(): static public function fetchOsmLocation(): static
{ {
$client = Services::curlrequest(); $client = service('curlrequest');
$response = $client->request( $response = $client->request(
'GET', 'GET',

View File

@ -2,14 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
/**
* @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
* @link https://castopod.org/
*/
use Config\Services;
if (! function_exists('render_breadcrumb')) { if (! function_exists('render_breadcrumb')) {
/** /**
* Renders the breadcrumb navigation through the Breadcrumb service * Renders the breadcrumb navigation through the Breadcrumb service
@ -19,8 +11,7 @@ if (! function_exists('render_breadcrumb')) {
*/ */
function render_breadcrumb(string $class = null): string function render_breadcrumb(string $class = null): string
{ {
$breadcrumb = Services::breadcrumb(); return service('breadcrumb')->render($class);
return $breadcrumb->render($class);
} }
} }
@ -30,7 +21,6 @@ if (! function_exists('replace_breadcrumb_params')) {
*/ */
function replace_breadcrumb_params(array $newParams): void function replace_breadcrumb_params(array $newParams): void
{ {
$breadcrumb = Services::breadcrumb(); service('breadcrumb')->replaceParams($newParams);
$breadcrumb->replaceParams($newParams);
} }
} }

View File

@ -18,7 +18,6 @@ use CodeIgniter\Exceptions\PageNotFoundException;
use CodeIgniter\Router\Exceptions\RedirectException; use CodeIgniter\Router\Exceptions\RedirectException;
use CodeIgniter\Router\Exceptions\RouterException; use CodeIgniter\Router\Exceptions\RouterException;
use CodeIgniter\Router\Router as CodeIgniterRouter; use CodeIgniter\Router\Router as CodeIgniterRouter;
use Config\Services;
use Override; use Override;
class Router extends CodeIgniterRouter class Router extends CodeIgniterRouter
@ -117,8 +116,8 @@ class Router extends CodeIgniterRouter
array_key_exists('alternate-content', $this->matchedRouteOptions) && array_key_exists('alternate-content', $this->matchedRouteOptions) &&
is_array($this->matchedRouteOptions['alternate-content']) is_array($this->matchedRouteOptions['alternate-content'])
) { ) {
$request = Services::request(); $request = service('request');
$negotiate = Services::negotiator(); $negotiate = service('negotiator');
// Accept header is mandatory // Accept header is mandatory
if ($request->header('Accept') === null) { if ($request->header('Accept') === null) {

View File

@ -54,7 +54,7 @@ if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE) {
$args = implode(', ', array_map(static fn ($value) => match (true) { $args = implode(', ', array_map(static fn ($value) => match (true) {
is_object($value) => 'Object(' . $value::class . ')', is_object($value) => 'Object(' . $value::class . ')',
is_array($value) => count($value) ? '[...]' : '[]', is_array($value) => $value !== [] ? '[...]' : '[]',
$value === null => 'null', // return the lowercased version $value === null => 'null', // return the lowercased version
default => var_export($value, true), default => var_export($value, true),
}, array_values($error['args'] ?? []))); }, array_values($error['args'] ?? [])));

View File

@ -4,7 +4,6 @@ declare(strict_types=1);
use CodeIgniter\CodeIgniter; use CodeIgniter\CodeIgniter;
use CodeIgniter\HTTP\Header; use CodeIgniter\HTTP\Header;
use Config\Services;
$errorId = uniqid('error', true); $errorId = uniqid('error', true);
?> ?>
@ -228,7 +227,7 @@ while ($prevException = $last->getPrevious()) {
<!-- Request --> <!-- Request -->
<div class="content" id="request"> <div class="content" id="request">
<?php $request = Services::request(); ?> <?php $request = service('request'); ?>
<table> <table>
<tbody> <tbody>
@ -346,7 +345,7 @@ while ($prevException = $last->getPrevious()) {
<!-- Response --> <!-- Response -->
<?php <?php
$response = Services::response(); $response = service('response');
$response->setStatusCode(http_response_code()); $response->setStatusCode(http_response_code());
?> ?>
<div class="content" id="response"> <div class="content" id="response">

View File

@ -9,16 +9,16 @@
"php": "^8.3", "php": "^8.3",
"adaures/ipcat-php": "^v1.0.0", "adaures/ipcat-php": "^v1.0.0",
"adaures/podcast-persons-taxonomy": "^v1.0.1", "adaures/podcast-persons-taxonomy": "^v1.0.1",
"aws/aws-sdk-php": "^3.336.2", "aws/aws-sdk-php": "^3.336.6",
"chrisjean/php-ico": "^1.0.4", "chrisjean/php-ico": "^1.0.4",
"cocur/slugify": "^v4.6.0", "cocur/slugify": "^v4.6.0",
"codeigniter4/framework": "v4.5.5", "codeigniter4/framework": "v4.5.6",
"codeigniter4/settings": "v2.2.0", "codeigniter4/settings": "v2.2.0",
"codeigniter4/shield": "v1.1.0", "codeigniter4/shield": "v1.1.0",
"codeigniter4/tasks": "dev-develop", "codeigniter4/tasks": "dev-develop",
"geoip2/geoip2": "v3.1.0", "geoip2/geoip2": "v3.1.0",
"james-heinrich/getid3": "^2.0.0-beta6", "james-heinrich/getid3": "^2.0.0-beta6",
"league/commonmark": "^2.6.0", "league/commonmark": "^2.6.1",
"league/html-to-markdown": "5.1.1", "league/html-to-markdown": "5.1.1",
"melbahja/seo": "^v2.1.1", "melbahja/seo": "^v2.1.1",
"michalsn/codeigniter4-uuid": "v1.1.0", "michalsn/codeigniter4-uuid": "v1.1.0",
@ -37,7 +37,7 @@
"phpstan/extension-installer": "^1.4.3", "phpstan/extension-installer": "^1.4.3",
"phpstan/phpstan": "^2.0.4", "phpstan/phpstan": "^2.0.4",
"phpunit/phpunit": "^11.5.2", "phpunit/phpunit": "^11.5.2",
"rector/rector": "^2.0.3", "rector/rector": "^2.0.4",
"symplify/coding-standard": "^12.2.3", "symplify/coding-standard": "^12.2.3",
"symplify/easy-coding-standard": "^12.5.4" "symplify/easy-coding-standard": "^12.5.4"
}, },

78
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "f95311413c714e2dcef9364da4348b30", "content-hash": "6b99aa0bcdbc76f94b529ba8c5ff0ee7",
"packages": [ "packages": [
{ {
"name": "adaures/ipcat-php", "name": "adaures/ipcat-php",
@ -189,16 +189,16 @@
}, },
{ {
"name": "aws/aws-sdk-php", "name": "aws/aws-sdk-php",
"version": "3.336.2", "version": "3.336.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/aws/aws-sdk-php.git", "url": "https://github.com/aws/aws-sdk-php.git",
"reference": "954bfdfc048840ca34afe2a2e1cbcff6681989c4" "reference": "0a99dab427f0a1c082775301141aeac3558691ad"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/954bfdfc048840ca34afe2a2e1cbcff6681989c4", "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/0a99dab427f0a1c082775301141aeac3558691ad",
"reference": "954bfdfc048840ca34afe2a2e1cbcff6681989c4", "reference": "0a99dab427f0a1c082775301141aeac3558691ad",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -275,9 +275,9 @@
"support": { "support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"issues": "https://github.com/aws/aws-sdk-php/issues", "issues": "https://github.com/aws/aws-sdk-php/issues",
"source": "https://github.com/aws/aws-sdk-php/tree/3.336.2" "source": "https://github.com/aws/aws-sdk-php/tree/3.336.6"
}, },
"time": "2024-12-20T19:05:10+00:00" "time": "2024-12-28T04:16:13+00:00"
}, },
{ {
"name": "brick/math", "name": "brick/math",
@ -448,16 +448,16 @@
}, },
{ {
"name": "codeigniter4/framework", "name": "codeigniter4/framework",
"version": "v4.5.5", "version": "v4.5.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/codeigniter4/framework.git", "url": "https://github.com/codeigniter4/framework.git",
"reference": "2849e7ff36b4c4aa1376d990a9a1e3f0c393b8d0" "reference": "7822476e6c672387b0ca1d64a74040ed28c42d9f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/codeigniter4/framework/zipball/2849e7ff36b4c4aa1376d990a9a1e3f0c393b8d0", "url": "https://api.github.com/repos/codeigniter4/framework/zipball/7822476e6c672387b0ca1d64a74040ed28c42d9f",
"reference": "2849e7ff36b4c4aa1376d990a9a1e3f0c393b8d0", "reference": "7822476e6c672387b0ca1d64a74040ed28c42d9f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -514,7 +514,7 @@
"slack": "https://codeigniterchat.slack.com", "slack": "https://codeigniterchat.slack.com",
"source": "https://github.com/codeigniter4/CodeIgniter4" "source": "https://github.com/codeigniter4/CodeIgniter4"
}, },
"time": "2024-09-07T08:49:38+00:00" "time": "2024-12-28T18:27:37+00:00"
}, },
{ {
"name": "codeigniter4/settings", "name": "codeigniter4/settings",
@ -1411,16 +1411,16 @@
}, },
{ {
"name": "league/commonmark", "name": "league/commonmark",
"version": "2.6.0", "version": "2.6.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/thephpleague/commonmark.git", "url": "https://github.com/thephpleague/commonmark.git",
"reference": "d150f911e0079e90ae3c106734c93137c184f932" "reference": "d990688c91cedfb69753ffc2512727ec646df2ad"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/d150f911e0079e90ae3c106734c93137c184f932", "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/d990688c91cedfb69753ffc2512727ec646df2ad",
"reference": "d150f911e0079e90ae3c106734c93137c184f932", "reference": "d990688c91cedfb69753ffc2512727ec646df2ad",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1512,7 +1512,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-12-07T15:34:16+00:00" "time": "2024-12-29T14:10:59+00:00"
}, },
{ {
"name": "league/config", "name": "league/config",
@ -2857,12 +2857,12 @@
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"thanks": {
"url": "https://github.com/symfony/contracts",
"name": "symfony/contracts"
},
"branch-alias": { "branch-alias": {
"dev-main": "3.5-dev" "dev-main": "3.5-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
} }
}, },
"autoload": { "autoload": {
@ -3383,11 +3383,11 @@
"bin": ["bin/captainhook"], "bin": ["bin/captainhook"],
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": {
"dev-main": "6.0.x-dev"
},
"captainhook": { "captainhook": {
"config": "captainhook.json" "config": "captainhook.json"
},
"branch-alias": {
"dev-main": "6.0.x-dev"
} }
}, },
"autoload": { "autoload": {
@ -5282,21 +5282,21 @@
}, },
{ {
"name": "rector/rector", "name": "rector/rector",
"version": "2.0.3", "version": "2.0.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/rectorphp/rector.git", "url": "https://github.com/rectorphp/rector.git",
"reference": "3f27091368bd935dbbaa8387099792fb20f65f68" "reference": "df5de7b80deced1ea7f719a0b4d02e4aee87dd21"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/rectorphp/rector/zipball/3f27091368bd935dbbaa8387099792fb20f65f68", "url": "https://api.github.com/repos/rectorphp/rector/zipball/df5de7b80deced1ea7f719a0b4d02e4aee87dd21",
"reference": "3f27091368bd935dbbaa8387099792fb20f65f68", "reference": "df5de7b80deced1ea7f719a0b4d02e4aee87dd21",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.4|^8.0", "php": "^7.4|^8.0",
"phpstan/phpstan": "^2.0.1" "phpstan/phpstan": "^2.0.4"
}, },
"conflict": { "conflict": {
"rector/rector-doctrine": "*", "rector/rector-doctrine": "*",
@ -5318,7 +5318,7 @@
"keywords": ["automation", "dev", "migration", "refactoring"], "keywords": ["automation", "dev", "migration", "refactoring"],
"support": { "support": {
"issues": "https://github.com/rectorphp/rector/issues", "issues": "https://github.com/rectorphp/rector/issues",
"source": "https://github.com/rectorphp/rector/tree/2.0.3" "source": "https://github.com/rectorphp/rector/tree/2.0.4"
}, },
"funding": [ "funding": [
{ {
@ -5326,7 +5326,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2024-12-12T15:22:19+00:00" "time": "2024-12-26T23:06:19+00:00"
}, },
{ {
"name": "sebastian/cli-parser", "name": "sebastian/cli-parser",
@ -6562,12 +6562,12 @@
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"thanks": {
"url": "https://github.com/symfony/contracts",
"name": "symfony/contracts"
},
"branch-alias": { "branch-alias": {
"dev-main": "3.5-dev" "dev-main": "3.5-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
} }
}, },
"autoload": { "autoload": {
@ -7092,12 +7092,12 @@
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"thanks": {
"url": "https://github.com/symfony/contracts",
"name": "symfony/contracts"
},
"branch-alias": { "branch-alias": {
"dev-main": "3.5-dev" "dev-main": "3.5-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
} }
}, },
"autoload": { "autoload": {

View File

@ -11,7 +11,6 @@ declare(strict_types=1);
namespace Modules\Admin\Controllers; namespace Modules\Admin\Controllers;
use CodeIgniter\HTTP\RedirectResponse; use CodeIgniter\HTTP\RedirectResponse;
use Config\Services;
class AboutController extends BaseController class AboutController extends BaseController
{ {
@ -43,7 +42,7 @@ class AboutController extends BaseController
public function migrateDatabase(): RedirectResponse public function migrateDatabase(): RedirectResponse
{ {
$migrate = Services::migrations(); $migrate = service('migrations');
$migrate->setNamespace(null) $migrate->setNamespace(null)
->latest(); ->latest();

View File

@ -10,8 +10,6 @@ declare(strict_types=1);
namespace Modules\Analytics; namespace Modules\Analytics;
use Config\Services;
trait AnalyticsTrait trait AnalyticsTrait
{ {
protected function registerPodcastWebpageHit(int $podcastId): void protected function registerPodcastWebpageHit(int $podcastId): void
@ -28,7 +26,7 @@ trait AnalyticsTrait
set_user_session_referer(); set_user_session_referer();
set_user_session_entry_page(); set_user_session_entry_page();
$session = Services::session(); $session = service('session');
if (! $session->get('denyListIp')) { if (! $session->get('denyListIp')) {
$db = db_connect(); $db = db_connect();

View File

@ -9,7 +9,6 @@ declare(strict_types=1);
*/ */
use AdAures\Ipcat\IpDb; use AdAures\Ipcat\IpDb;
use Config\Services;
use GeoIp2\Database\Reader; use GeoIp2\Database\Reader;
use Opawg\UserAgentsV2Php\UserAgents; use Opawg\UserAgentsV2Php\UserAgents;
use WhichBrowser\Parser; use WhichBrowser\Parser;
@ -55,7 +54,7 @@ if (! function_exists('set_user_session_deny_list_ip')) {
*/ */
function set_user_session_deny_list_ip(): void function set_user_session_deny_list_ip(): void
{ {
$session = Services::session(); $session = service('session');
if (! $session->has('denyListIp')) { if (! $session->has('denyListIp')) {
$session->set('denyListIp', IpDb::find(client_ip()) !== null); $session->set('denyListIp', IpDb::find(client_ip()) !== null);
@ -69,7 +68,7 @@ if (! function_exists('set_user_session_location')) {
*/ */
function set_user_session_location(): void function set_user_session_location(): void
{ {
$session = Services::session(); $session = service('session');
$location = [ $location = [
'countryCode' => 'N/A', 'countryCode' => 'N/A',
@ -105,7 +104,7 @@ if (! function_exists('set_user_session_player')) {
*/ */
function set_user_session_player(): void function set_user_session_player(): void
{ {
$session = Services::session(); $session = service('session');
if (! $session->has('player')) { if (! $session->has('player')) {
$playerFound = null; $playerFound = null;
@ -148,7 +147,7 @@ if (! function_exists('set_user_session_browser')) {
*/ */
function set_user_session_browser(): void function set_user_session_browser(): void
{ {
$session = Services::session(); $session = service('session');
if (! $session->has('browser')) { if (! $session->has('browser')) {
$browserName = '- Other -'; $browserName = '- Other -';
@ -174,7 +173,7 @@ if (! function_exists('set_user_session_referer')) {
*/ */
function set_user_session_referer(): void function set_user_session_referer(): void
{ {
$session = Services::session(); $session = service('session');
$newreferer = service('superglobals') $newreferer = service('superglobals')
->server('HTTP_REFERER') ?? '- Direct -'; ->server('HTTP_REFERER') ?? '- Direct -';
@ -195,7 +194,7 @@ if (! function_exists('set_user_session_entry_page')) {
*/ */
function set_user_session_entry_page(): void function set_user_session_entry_page(): void
{ {
$session = Services::session(); $session = service('session');
$entryPage = service('superglobals') $entryPage = service('superglobals')
->server('REQUEST_URI'); ->server('REQUEST_URI');
@ -238,7 +237,7 @@ if (! function_exists('podcast_hit')) {
string $serviceName, string $serviceName,
?int $subscriptionId, ?int $subscriptionId,
): void { ): void {
$session = Services::session(); $session = service('session');
$clientIp = client_ip(); $clientIp = client_ip();

View File

@ -15,7 +15,6 @@ use CodeIgniter\API\ResponseTrait;
use CodeIgniter\Controller; use CodeIgniter\Controller;
use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\I18n\Time; use CodeIgniter\I18n\Time;
use Modules\Api\Rest\V1\Config\Services;
use Modules\Auth\Models\UserModel; use Modules\Auth\Models\UserModel;
class EpisodeController extends Controller class EpisodeController extends Controller
@ -24,7 +23,7 @@ class EpisodeController extends Controller
public function __construct() public function __construct()
{ {
Services::restApiExceptions()->initialize(); service('restApiExceptions')->initialize();
} }
public function list(): ResponseInterface public function list(): ResponseInterface

View File

@ -9,7 +9,6 @@ use App\Models\PodcastModel;
use CodeIgniter\API\ResponseTrait; use CodeIgniter\API\ResponseTrait;
use CodeIgniter\Controller; use CodeIgniter\Controller;
use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\HTTP\ResponseInterface;
use Modules\Api\Rest\V1\Config\Services;
class PodcastController extends Controller class PodcastController extends Controller
{ {
@ -17,7 +16,7 @@ class PodcastController extends Controller
public function __construct() public function __construct()
{ {
Services::restApiExceptions()->initialize(); service('restApiExceptions')->initialize();
} }
public function list(): ResponseInterface public function list(): ResponseInterface

View File

@ -8,7 +8,6 @@ use Closure;
use CodeIgniter\CLI\BaseCommand; use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\CLI; use CodeIgniter\CLI\CLI;
use CodeIgniter\View\Table; use CodeIgniter\View\Table;
use Config\Services;
use League\HTMLToMarkdown\Converter\TableConverter; use League\HTMLToMarkdown\Converter\TableConverter;
use League\HTMLToMarkdown\HtmlConverter; use League\HTMLToMarkdown\HtmlConverter;
use Modules\Auth\Config\AuthGroups; use Modules\Auth\Config\AuthGroups;
@ -59,8 +58,8 @@ class RolesDoc extends BaseCommand
foreach ($files as $file) { foreach ($files as $file) {
$locale = $this->detectLocaleFromPath($file); $locale = $this->detectLocaleFromPath($file);
$language = Services::language(); service('language')
$language->setLocale($locale); ->setLocale($locale);
$authGroups = new AuthGroups(); $authGroups = new AuthGroups();

View File

@ -9,7 +9,6 @@ use App\Models\PodcastModel;
use CodeIgniter\Filters\FilterInterface; use CodeIgniter\Filters\FilterInterface;
use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\HTTP\ResponseInterface;
use Config\Services;
use Override; use Override;
use RuntimeException; use RuntimeException;
@ -62,7 +61,7 @@ class PermissionFilter implements FilterInterface
foreach ($arguments as $permission) { foreach ($arguments as $permission) {
// is permission specific to a podcast? // is permission specific to a podcast?
if (str_contains($permission, '$')) { if (str_contains($permission, '$')) {
$router = Services::router(); $router = service('router');
$routerParams = $router->params(); $routerParams = $router->params();
if (! preg_match('/\$(\d+)\./', $permission, $match)) { if (! preg_match('/\$(\d+)\./', $permission, $match)) {

View File

@ -14,7 +14,6 @@ use CodeIgniter\HTTP\CURLRequest;
use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\HTTP\URI; use CodeIgniter\HTTP\URI;
use CodeIgniter\I18n\Time; use CodeIgniter\I18n\Time;
use Config\Services;
use Modules\Fediverse\Core\Activity; use Modules\Fediverse\Core\Activity;
use phpseclib\Crypt\RSA; use phpseclib\Crypt\RSA;
@ -33,7 +32,7 @@ class ActivityRequest
public function __construct(string $uri, ?string $activityPayload = null) public function __construct(string $uri, ?string $activityPayload = null)
{ {
$this->request = Services::curlrequest(); $this->request = service('curlrequest');
if ($activityPayload !== null) { if ($activityPayload !== null) {
$this->request->setBody($activityPayload); $this->request->setBody($activityPayload);

View File

@ -9,7 +9,6 @@ use CodeIgniter\Filters\FilterInterface;
use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\HTTP\URI; use CodeIgniter\HTTP\URI;
use Config\Services;
use Exception; use Exception;
use Modules\Fediverse\HttpSignature; use Modules\Fediverse\HttpSignature;
use Override; use Override;
@ -33,7 +32,7 @@ class FediverseFilter implements FilterInterface
} }
if (in_array('verify-activitystream', $params, true)) { if (in_array('verify-activitystream', $params, true)) {
$negotiate = Services::negotiator(); $negotiate = service('negotiator');
$allowedContentTypes = [ $allowedContentTypes = [
'application/ld+json; profile="https://www.w3.org/ns/activitystreams', 'application/ld+json; profile="https://www.w3.org/ns/activitystreams',

View File

@ -16,7 +16,6 @@ namespace Modules\Fediverse;
use CodeIgniter\HTTP\IncomingRequest; use CodeIgniter\HTTP\IncomingRequest;
use CodeIgniter\I18n\Time; use CodeIgniter\I18n\Time;
use Config\Services;
use Exception; use Exception;
use phpseclib\Crypt\RSA; use phpseclib\Crypt\RSA;
@ -40,7 +39,7 @@ class HttpSignature
public function __construct(IncomingRequest $request = null) public function __construct(IncomingRequest $request = null)
{ {
if (! $request instanceof IncomingRequest) { if (! $request instanceof IncomingRequest) {
$request = Services::request(); $request = service('request');
} }
$this->request = $request; $this->request = $request;

View File

@ -6,7 +6,6 @@ namespace Modules\Install\Commands;
use CodeIgniter\CLI\BaseCommand; use CodeIgniter\CLI\BaseCommand;
use Config\Database; use Config\Database;
use Config\Services;
use Override; use Override;
class InitDatabase extends BaseCommand class InitDatabase extends BaseCommand
@ -30,7 +29,7 @@ class InitDatabase extends BaseCommand
public function run(array $params): void public function run(array $params): void
{ {
// Run all migrations // Run all migrations
$migrate = Services::migrations(); $migrate = service('migrations');
$migrate->setNamespace(null) $migrate->setNamespace(null)
->latest(); ->latest();

View File

@ -19,7 +19,6 @@ use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\Shield\Entities\User; use CodeIgniter\Shield\Entities\User;
use CodeIgniter\Shield\Exceptions\ValidationException as ShieldValidationException; use CodeIgniter\Shield\Exceptions\ValidationException as ShieldValidationException;
use Config\Database; use Config\Database;
use Config\Services;
use Dotenv\Dotenv; use Dotenv\Dotenv;
use Dotenv\Exception\ValidationException; use Dotenv\Exception\ValidationException;
use Modules\Auth\Models\UserModel; use Modules\Auth\Models\UserModel;
@ -247,7 +246,7 @@ class InstallController extends Controller
*/ */
public function migrate(): void public function migrate(): void
{ {
$migrate = Services::migrations(); $migrate = service('migrations');
$migrate->setNamespace(null) $migrate->setNamespace(null)
->latest(); ->latest();

View File

@ -11,7 +11,6 @@ declare(strict_types=1);
namespace Modules\Media\Entities; namespace Modules\Media\Entities;
use CodeIgniter\Files\File; use CodeIgniter\Files\File;
use Config\Services;
use GdImage; use GdImage;
use Override; use Override;
@ -140,7 +139,7 @@ class Image extends BaseMedia
} }
// save derived sizes // save derived sizes
$imageService = Services::image(); $imageService = service('image');
foreach ($this->sizes as $name => $size) { foreach ($this->sizes as $name => $size) {
$tempFilePath = tempnam(WRITEPATH . 'temp', 'img_'); $tempFilePath = tempnam(WRITEPATH . 'temp', 'img_');

View File

@ -14,7 +14,6 @@ use App\Entities\Podcast;
use App\Models\PodcastModel; use App\Models\PodcastModel;
use CodeIgniter\Exceptions\PageNotFoundException; use CodeIgniter\Exceptions\PageNotFoundException;
use CodeIgniter\HTTP\RedirectResponse; use CodeIgniter\HTTP\RedirectResponse;
use Config\Services;
use Modules\Admin\Controllers\BaseController; use Modules\Admin\Controllers\BaseController;
use Modules\Platforms\Models\PlatformModel; use Modules\Platforms\Models\PlatformModel;
@ -65,7 +64,7 @@ class PlatformController extends BaseController
public function updateAction(string $platformType): RedirectResponse public function updateAction(string $platformType): RedirectResponse
{ {
$platformModel = new PlatformModel(); $platformModel = new PlatformModel();
$validation = Services::validation(); $validation = service('validation');
$platformsData = []; $platformsData = [];
foreach ( foreach (

View File

@ -16,7 +16,6 @@ use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\CLI; use CodeIgniter\CLI\CLI;
use CodeIgniter\I18n\Time; use CodeIgniter\I18n\Time;
use CodeIgniter\Shield\Entities\User; use CodeIgniter\Shield\Entities\User;
use Config\Services;
use Exception; use Exception;
use League\HTMLToMarkdown\HtmlConverter; use League\HTMLToMarkdown\HtmlConverter;
use Modules\Auth\Models\UserModel; use Modules\Auth\Models\UserModel;
@ -96,7 +95,8 @@ class PodcastImport extends BaseCommand
public function run(array $params): void public function run(array $params): void
{ {
// FIXME: getting named routes doesn't work from v4.3 anymore, so loading all routes before importing // FIXME: getting named routes doesn't work from v4.3 anymore, so loading all routes before importing
Services::routes()->loadRoutes(); service('routes')
->loadRoutes();
try { try {
$this->init(); $this->init();

View File

@ -5,7 +5,6 @@ declare(strict_types=1);
namespace Modules\Update\Commands; namespace Modules\Update\Commands;
use CodeIgniter\CLI\BaseCommand; use CodeIgniter\CLI\BaseCommand;
use Config\Services;
use Override; use Override;
class DatabaseUpdate extends BaseCommand class DatabaseUpdate extends BaseCommand
@ -28,7 +27,7 @@ class DatabaseUpdate extends BaseCommand
#[Override] #[Override]
public function run(array $params): void public function run(array $params): void
{ {
$migrate = Services::migrations(); $migrate = service('migrations');
$migrate->setNamespace(null) $migrate->setNamespace(null)
->latest(); ->latest();

View File

@ -47,6 +47,7 @@ parameters:
- Modules\Platforms\Config\Services - Modules\Platforms\Config\Services
- Modules\Plugins\Config\Services - Modules\Plugins\Config\Services
- Modules\PremiumPodcasts\Config\Services - Modules\PremiumPodcasts\Config\Services
- Modules\Api\Rest\V1\Config\Services
ignoreErrors: ignoreErrors:
- '#^Call to an undefined method CodeIgniter\\Cache\\CacheInterface\:\:deleteMatching\(\)#' - '#^Call to an undefined method CodeIgniter\\Cache\\CacheInterface\:\:deleteMatching\(\)#'
- identifier: missingType.generics - identifier: missingType.generics

View File

@ -5,13 +5,12 @@ declare(strict_types=1);
namespace Tests\Session; namespace Tests\Session;
use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\CIUnitTestCase;
use Config\Services;
class ExampleSessionTest extends CIUnitTestCase class ExampleSessionTest extends CIUnitTestCase
{ {
public function testSessionSimple(): void public function testSessionSimple(): void
{ {
$session = Services::session(); $session = service('session');
$session->set('logged_in', 123); $session->set('logged_in', 123);
$this->assertSame(123, $session->get('logged_in')); $this->assertSame(123, $session->get('logged_in'));

View File

@ -4,7 +4,6 @@ declare(strict_types=1);
use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\CIUnitTestCase;
use Config\App; use Config\App;
use Config\Services;
use Tests\Support\Libraries\ConfigReader; use Tests\Support\Libraries\ConfigReader;
/** /**
@ -19,7 +18,7 @@ final class HealthTest extends CIUnitTestCase
public function testBaseUrlHasBeenSet(): void public function testBaseUrlHasBeenSet(): void
{ {
$validation = Services::validation(); $validation = service('validation');
$env = false; $env = false;