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

[4.0] Sync app setup #16918

Closed
wants to merge 43 commits into from
Closed
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
1cd29cb
Add getLanguage function to interface
laoneo Jun 29, 2017
5d373d3
Deprecate getInstance function
laoneo Jun 29, 2017
4ace48b
Factory returns global application object
laoneo Jun 29, 2017
59dc9a5
Load the application trough the container
laoneo Jun 29, 2017
aa44db1
SiteRouter should load the app trough the container
laoneo Jun 29, 2017
7f03466
Load the database when required and not on construct
laoneo Jun 29, 2017
2603238
Get the container from the global application
laoneo Jun 29, 2017
b375ef2
Remove container code from the Factory
laoneo Jun 29, 2017
96c5cda
Change the getContainer from app
laoneo Jun 29, 2017
ce300b4
Change cli files
laoneo Jun 29, 2017
12b512a
Merge remote-tracking branch 'remotes/upstream/4.0-dev' into j4/remov…
laoneo Jun 29, 2017
fdd213a
fixing tests
laoneo Jun 29, 2017
6ef3e50
Stabilizing core
laoneo Jun 29, 2017
6708c8f
cs
laoneo Jun 29, 2017
2c04433
cleanup tests
laoneo Jun 30, 2017
2031eb6
cleanup tests
laoneo Jun 30, 2017
abaa348
harmonize front controller
laoneo Jun 30, 2017
d241488
simplify tests
laoneo Jun 30, 2017
fbefa18
mock the container
laoneo Jun 30, 2017
22e21ea
needs a CMS app
laoneo Jun 30, 2017
e5f6af5
getApplication has no arguments anymore
laoneo Jun 30, 2017
f5d11a3
cs
laoneo Jun 30, 2017
56c9270
better doc
laoneo Jun 30, 2017
4bdd7c5
deprecate the genInstance function on the applications
laoneo Jun 30, 2017
c4dfbf1
deprecated
laoneo Jun 30, 2017
7a5b8cb
Change to interface return type
laoneo Jun 30, 2017
99685e2
support alias in container for apps
laoneo Jun 30, 2017
4cbffc3
Should always be available
laoneo Jun 30, 2017
88bb57f
save and restore factory state in tests
laoneo Jun 30, 2017
001a1f6
fix tests
laoneo Jun 30, 2017
77ed3e6
remove not needed alias
laoneo Jun 30, 2017
0f6cb85
Remove the installer session service provider as it works with the de…
laoneo Jun 30, 2017
1911667
Merge remote-tracking branch 'remotes/upstream/4.0-dev' into j4/sync-…
laoneo Aug 17, 2017
bd4ca0a
Restore the Factory::getContainer function and deprecate it
laoneo Aug 17, 2017
f7c01b3
Revert tests
laoneo Aug 17, 2017
f15ffe8
Improve deprecated messages
laoneo Aug 17, 2017
f9afe1c
Set the global container in the factory in the front controller
laoneo Aug 17, 2017
af85a80
Merge remote-tracking branch 'remotes/upstream/4.0-dev' into j4/sync-…
laoneo Aug 18, 2017
2ea8166
Merge remote-tracking branch 'origin/j4/sync-app-setup' into j4/sync-…
laoneo Aug 18, 2017
aadb604
Revert test
laoneo Aug 18, 2017
5677848
Merge remote-tracking branch 'remotes/upstream/4.0-dev' into j4/sync-…
laoneo Aug 22, 2017
743fd56
Merge remote-tracking branch 'remotes/upstream/4.0-dev' into j4/sync-…
laoneo Aug 23, 2017
42d4279
Merge branch '4.0-dev' into j4/sync-app-setup
laoneo Feb 2, 2018
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
2 changes: 1 addition & 1 deletion administrator/components/com_banners/Model/Tracks.php
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ public function getContent()

if ($this->getState('compressed'))
{
$app = \JFactory::getApplication('administrator');
$app = \JFactory::getApplication();

$files = array(
'track' => array(
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_categories/Model/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public function getTable($type = 'Category', $prefix = 'Administrator', $config
*/
protected function populateState()
{
$app = \JFactory::getApplication('administrator');
$app = \JFactory::getApplication();

$parentId = $app->input->getInt('parent_id');
$this->setState('category.parent_id', $parentId);
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_fields/Model/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ protected function canEditState($record)
*/
protected function populateState()
{
$app = \JFactory::getApplication('administrator');
$app = \JFactory::getApplication();

// Load the User state.
$pk = $app->input->getInt('id');
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_installer/Model/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Install extends Model
*/
protected function populateState()
{
$app = \JFactory::getApplication('administrator');
$app = \JFactory::getApplication();

$this->setState('message', $app->getUserState('com_installer.message'));
$this->setState('extension_message', $app->getUserState('com_installer.extension_message'));
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_languages/Model/Language.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function getTable($name = '', $prefix = '', $options = array())
*/
protected function populateState()
{
$app = \JFactory::getApplication('administrator');
$app = \JFactory::getApplication();
$params = ComponentHelper::getParams('com_languages');

// Load the User state.
Expand Down
4 changes: 2 additions & 2 deletions administrator/components/com_menus/Model/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ public function getItem($pk = null)
{

// Check if we are changing away from the actual link type.
if (MenusHelper::getLinkKey($table->link) !== MenusHelper::getLinkKey($link) && (int) $table->id === (int) $this->getState('item.id'))
if (MenusHelper::getLinkKey($table->link) !== MenusHelper::getLinkKey($link) && (int) $table->id === (int) $this->getState('item.id'))
{
$table->link = $link;
}
Expand Down Expand Up @@ -942,7 +942,7 @@ protected function getReorderConditions($table)
*/
protected function populateState()
{
$app = \JFactory::getApplication('administrator');
$app = \JFactory::getApplication();

// Load the User state.
$pk = $app->input->getInt('id');
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_menus/Model/Items.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function __construct($config = array(), MvcFactoryInterface $factory = nu
*/
protected function populateState($ordering = 'a.lft', $direction = 'asc')
{
$app = \JFactory::getApplication('administrator');
$app = \JFactory::getApplication();

$forcedLanguage = $app->input->get('forcedLanguage', '', 'cmd');

Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_menus/Model/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function getTable($type = 'MenuType', $prefix = '\JTable', $config = arra
*/
protected function populateState()
{
$app = \JFactory::getApplication('administrator');
$app = \JFactory::getApplication();

// Load the User state.
$id = $app->input->getInt('id');
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_modules/Model/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function __construct($config = array())
*/
protected function populateState()
{
$app = \JFactory::getApplication('administrator');
$app = \JFactory::getApplication();

// Load the User state.
$pk = $app->input->getInt('id');
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_modules/Model/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Select extends ListModel
*/
protected function populateState($ordering = null, $direction = null)
{
$app = \JFactory::getApplication('administrator');
$app = \JFactory::getApplication();

// Load the filter state.
$clientId = $app->getUserState('com_modules.modules.client_id', 0);
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_plugins/Model/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ protected function populateState()
// Execute the parent method.
parent::populateState();

$app = \JFactory::getApplication('administrator');
$app = \JFactory::getApplication();

// Load the User state.
$pk = $app->input->getInt('extension_id');
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_tags/Model/Tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ protected function canEditState($record)
*/
protected function populateState()
{
$app = \JFactory::getApplication('administrator');
$app = \JFactory::getApplication();

$parentId = $app->input->getInt('parent_id');
$this->setState('tag.parent_id', $parentId);
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_templates/Model/Style.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function __construct($config = array(), MvcFactoryInterface $factory = nu
*/
protected function populateState()
{
$app = \JFactory::getApplication('administrator');
$app = \JFactory::getApplication();

// Load the User state.
$pk = $app->input->getInt('id');
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_templates/Model/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public function getDirectoryTree($dir)
protected function populateState()
{
jimport('joomla.filesystem.file');
$app = \JFactory::getApplication('administrator');
$app = \JFactory::getApplication();

// Load the User state.
$pk = $app->input->getInt('id');
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_users/Model/Debuggroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function getItems()
*/
protected function populateState($ordering = 'a.lft', $direction = 'asc')
{
$app = \JFactory::getApplication('administrator');
$app = \JFactory::getApplication();

// Adjust the context to support modal layouts.
$layout = $app->input->get('layout', 'default');
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_users/Model/Debuguser.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function getItems()
*/
protected function populateState($ordering = 'a.lft', $direction = 'asc')
{
$app = \JFactory::getApplication('administrator');
$app = \JFactory::getApplication();

// Adjust the context to support modal layouts.
$layout = $app->input->get('layout', 'default');
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_users/Model/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function __construct($config = array(), MvcFactoryInterface $factory = nu
*/
protected function populateState($ordering = 'a.name', $direction = 'asc')
{
$app = \JFactory::getApplication('administrator');
$app = \JFactory::getApplication();

// Adjust the context to support modal layouts.
if ($layout = $app->input->get('layout', 'default', 'cmd'))
Expand Down
7 changes: 5 additions & 2 deletions administrator/includes/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@

require_once JPATH_BASE . '/includes/framework.php';

/** @var \Joomla\DI\Container $container */
$container = require JPATH_LIBRARIES . '/container.php';

// Set profiler start time and memory usage and mark afterLoad in the profiler.
JDEBUG ? JProfiler::getInstance('Application')->setStart($startTime, $startMem)->mark('afterLoad') : null;

// Instantiate the application.
$app = JFactory::getApplication('administrator');
// Get the application from the container
$app = $container->get(\Joomla\CMS\Application\AdministratorApplication::class);

// Execute the application.
$app->execute();
17 changes: 13 additions & 4 deletions build/helpTOC.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,23 +200,32 @@ public function doExecute()
}
}

/** @var \Joomla\DI\Container $container */
$container = require JPATH_LIBRARIES . '/container.php';

// Set up the container
JFactory::getContainer()->share(
$container->share(
'MediawikiCli',
function (\Joomla\DI\Container $container)
{
return new MediawikiCli(
$app = new MediawikiCli(
null,
null,
null,
null,
$container->get(\Joomla\Event\DispatcherInterface::class),
$container
);

JFactory::$application = $app;

return $app;
},
true
);
$app = JFactory::getContainer()->get('MediawikiCli');
JFactory::$application = $app;

// Get the application from the container
$app = $container->get('MediawikiCli');

// Execute the application.
$app->execute();
18 changes: 14 additions & 4 deletions cli/deletefiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,32 @@ protected function doExecute()
}
}

/** @var \Joomla\DI\Container $container */
$container = require JPATH_LIBRARIES . '/container.php';

// Set up the container
JFactory::getContainer()->share(
$container->share(
'DeletefilesCli',
function (\Joomla\DI\Container $container)
{
return new DeletefilesCli(
$app = new DeletefilesCli(
null,
null,
null,
null,
$container->get(\Joomla\Event\DispatcherInterface::class),
$container
);

JFactory::$application = $app;

return $app;
},
true
);
$app = JFactory::getContainer()->get('DeletefilesCli');
JFactory::$application = $app;

// Get the application from the container
$app = $container->get('DeletefilesCli');

// Execute the application.
$app->execute();
18 changes: 14 additions & 4 deletions cli/finder_indexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -360,22 +360,32 @@ private function getFilters()
}
}

/** @var \Joomla\DI\Container $container */
$container = require JPATH_LIBRARIES . '/container.php';

// Set up the container
JFactory::getContainer()->share(
$container->share(
'FinderCli',
function (\Joomla\DI\Container $container)
{
return new FinderCli(
$app = new FinderCli(
null,
null,
null,
null,
$container->get(\Joomla\Event\DispatcherInterface::class),
$container
);

\Joomla\CMS\Factory::$application = $app;

return $app;
},
true
);
$app = JFactory::getContainer()->get('FinderCli');
JFactory::$application = $app;

// Get the application from the container
$app = $container->get('FinderCli');

// Execute the application.
$app->execute();
18 changes: 14 additions & 4 deletions cli/garbagecron.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,32 @@ protected function doExecute()
}
}

/** @var \Joomla\DI\Container $container */
$container = require JPATH_LIBRARIES . '/container.php';

// Set up the container
JFactory::getContainer()->share(
$container->share(
'GarbageCron',
function (\Joomla\DI\Container $container)
{
return new GarbageCron(
$app = new GarbageCron(
null,
null,
null,
null,
$container->get(\Joomla\Event\DispatcherInterface::class),
$container
);

\Joomla\CMS\Factory::$application = $app;

return $app;
},
true
);
$app = JFactory::getContainer()->get('GarbageCron');
JFactory::$application = $app;

// Get the application from the container
$app = $container->get('GarbageCron');

// Execute the application.
$app->execute();
18 changes: 14 additions & 4 deletions cli/update_cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,32 @@ protected function doExecute()
}
}

/** @var \Joomla\DI\Container $container */
$container = require JPATH_LIBRARIES . '/container.php';

// Set up the container
JFactory::getContainer()->share(
$container->share(
'Updatecron',
function (\Joomla\DI\Container $container)
{
return new Updatecron(
$app = new Updatecron(
null,
null,
null,
null,
$container->get(\Joomla\Event\DispatcherInterface::class),
$container
);

\Joomla\CMS\Factory::$application = $app;

return $app;
},
true
);
$app = JFactory::getContainer()->get('Updatecron');
JFactory::$application = $app;

// Get the application from the container
$app = $container->get('Updatecron');

// Execute the application.
$app->execute();
2 changes: 1 addition & 1 deletion components/com_config/Model/Modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Modules extends Form
*/
protected function populateState()
{
$app = \JFactory::getApplication('administrator');
$app = \JFactory::getApplication();

// Load the User state.
$pk = $app->input->getInt('id');
Expand Down
2 changes: 1 addition & 1 deletion components/com_contact/Model/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class Contact extends Form
protected function populateState()
{
/** @var SiteApplication $app */
$app = \JFactory::getApplication('site');
$app = \JFactory::getApplication();

$this->setState('contact.id', $app->input->getInt('id'));
$this->setState('params', $app->getParams());
Expand Down
2 changes: 1 addition & 1 deletion components/com_content/Model/Archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ protected function populateState($ordering = null, $direction = null)
protected function getListQuery()
{
$params = $this->state->params;
$app = JFactory::getApplication('site');
$app = JFactory::getApplication();
$catids = $app->input->getVar('catid', array());
$catids = array_values(array_diff($catids, array('')));
$articleOrderDate = $params->get('order_date');
Expand Down
2 changes: 1 addition & 1 deletion components/com_content/Model/Article.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Article extends Item
*/
protected function populateState()
{
$app = \JFactory::getApplication('site');
$app = \JFactory::getApplication();

// Load state from the request.
$pk = $app->input->getInt('id');
Expand Down
Loading