Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.2] Rework how URLs are injected into applications #38544

Open
wants to merge 4 commits into
base: 5.2-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove container references
  • Loading branch information
wilsonge committed Aug 25, 2022
commit ba2e0781f239ad3878090856fc3ad6a22fa533b0
3 changes: 1 addition & 2 deletions administrator/includes/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@
->alias('JSession', 'session.web.administrator')
->alias(\Joomla\CMS\Session\Session::class, 'session.web.administrator')
->alias(\Joomla\Session\Session::class, 'session.web.administrator')
->alias(\Joomla\Session\SessionInterface::class, 'session.web.administrator')
->alias('application.active', 'JApplicationAdministrator');
->alias(\Joomla\Session\SessionInterface::class, 'session.web.administrator');

// Instantiate the application.
$app = $container->get(\Joomla\CMS\Application\AdministratorApplication::class);
Expand Down
3 changes: 1 addition & 2 deletions api/includes/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@
->alias('JSession', 'session.cli')
->alias(\Joomla\CMS\Session\Session::class, 'session.cli')
->alias(\Joomla\Session\Session::class, 'session.cli')
->alias(\Joomla\Session\SessionInterface::class, 'session.cli')
->alias('application.active', 'JApplicationApi');
->alias(\Joomla\Session\SessionInterface::class, 'session.cli');

// Instantiate the application.
$app = $container->get(\Joomla\CMS\Application\ApiApplication::class);
Expand Down
3 changes: 1 addition & 2 deletions cli/joomla.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@
->alias('JSession', 'session.cli')
->alias(\Joomla\CMS\Session\Session::class, 'session.cli')
->alias(\Joomla\Session\Session::class, 'session.cli')
->alias(\Joomla\Session\SessionInterface::class, 'session.cli')
->alias(\Joomla\Console\Application::class, 'application.active');
->alias(\Joomla\Session\SessionInterface::class, 'session.cli');

$app = \Joomla\CMS\Factory::getContainer()->get(\Joomla\Console\Application::class);
\Joomla\CMS\Factory::$application = $app;
Expand Down
3 changes: 1 addition & 2 deletions includes/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@
->alias('JSession', 'session.web.site')
->alias(\Joomla\CMS\Session\Session::class, 'session.web.site')
->alias(\Joomla\Session\Session::class, 'session.web.site')
->alias(\Joomla\Session\SessionInterface::class, 'session.web.site')
->alias('application.active', 'JApplicationSite');
->alias(\Joomla\Session\SessionInterface::class, 'session.web.site');

// Instantiate the application.
$app = $container->get(\Joomla\CMS\Application\SiteApplication::class);
Expand Down
3 changes: 1 addition & 2 deletions installation/includes/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@

// Get the dependency injection container
$container = \Joomla\CMS\Factory::getContainer();
$container->alias('application.active', \Joomla\CMS\Installation\Application\InstallationApplication::class)
->registerServiceProvider(new \Joomla\CMS\Installation\Service\Provider\Application());
$container->registerServiceProvider(new \Joomla\CMS\Installation\Service\Provider\Application());

/*
* Alias the session service keys to the web session service as that is the primary session backend for this application
Expand Down
8 changes: 3 additions & 5 deletions libraries/src/Uri/Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
namespace Joomla\CMS\Uri;

use Joomla\CMS\Factory;
use Psr\Container\NotFoundExceptionInterface;

/**
* Uri Class
Expand Down Expand Up @@ -62,16 +61,15 @@ public static function getInstance($uri = 'SERVER')
// Are we obtaining the URI from the server?
if ($uri === 'SERVER') {
try {
$applicationUriRequest = Factory::getContainer()->get('application.active')->get('uri.request');
$applicationUriRequest = Factory::getApplication()->get('uri.request');

if ($applicationUriRequest !== null) {
static::$instances[$uri] = new static($applicationUriRequest);

return static::$instances[$uri];
}
} catch (NotFoundExceptionInterface $e) {
@trigger_error('The application should have an alias \'application.active\' for the ' .
'running application from Joomla 5.0.0', E_USER_DEPRECATED);
} catch (\Exception $e) {
@trigger_error('The application should be set into Factory', E_USER_DEPRECATED);
}

@trigger_error('The application should provide the request URI from Joomla 5.0.0', E_USER_DEPRECATED);
Expand Down