Skip to content

Commit

Permalink
Merge branch '4.0-dev' into bugfix/fix-js-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rdeutz committed Feb 6, 2018
2 parents 5c2aa1e + 29ab9d7 commit b54a1b2
Show file tree
Hide file tree
Showing 6 changed files with 163 additions and 27 deletions.
33 changes: 8 additions & 25 deletions layouts/joomla/form/field/rules/tabs.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,32 +42,15 @@
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var integer $size Size attribute of the input.
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var array $checkedOptions Options that will be set as checked.
* @var boolean $hasValue Has this field a value assigned?
* @var array $options Options available for this field.
*
* Calendar Specific
* @var string $localesPath The relative path for the locale file
* @var string $helperPath The relative path for the helper file
* @var string $minYear The minimum year, that will be subtracted/added to current year
* @var string $maxYear The maximum year, that will be subtracted/added to current year
* @var integer $todaybutton The today button
* @var integer $weeknumbers The week numbers display
* @var integer $showtime The time selector display
* @var integer $filltable The previous/next month filling
* @var integer $timeformat The time format
* @var integer $singleheader Display different header row for month/year
* @var integer $direction The document direction
* @var array $groups Available user groups.
* @var array $actions Actions for the asset.
* @var integer $assetId Access parameters.
* @var string $section The section.
* @var boolean $isGlobalConfig Current view is global config?
* @var boolean $newItem The new item.
* @var object $assetRules Rules for asset.
* @var integer $parentAssetId To calculate permissions.
*/

// Add Javascript for permission change
Expand Down
89 changes: 89 additions & 0 deletions libraries/src/Console/SessionGcCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?php
/**
* Joomla! Content Management System
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

namespace Joomla\CMS\Console;

defined('JPATH_PLATFORM') or die;

use Joomla\Console\AbstractCommand;
use Joomla\Session\SessionInterface;

/**
* Console command for performing session garbage collection
*
* @since 4.0.0
*/
class SessionGcCommand extends AbstractCommand
{
/**
* The session object.
*
* @var SessionInterface
* @since 4.0.0
*/
private $session;

/**
* Instantiate the command.
*
* @param SessionInterface $session The session object.
*
* @since 4.0.0
*/
public function __construct(SessionInterface $session)
{
$this->session = $session;

parent::__construct();
}

/**
* Execute the command.
*
* @return integer The exit code for the command.
*
* @since 4.0.0
*/
public function execute(): int
{
$symfonyStyle = $this->createSymfonyStyle();

$symfonyStyle->title('Running Session Garbage Collection');

if ($this->session->gc() === false)
{
$symfonyStyle->error('Garbage collection was not completed. Either the operation failed or is not supported on your platform.');

return 1;
}

$symfonyStyle->success('Garbage collection completed.');

return 0;
}

/**
* Initialise the command.
*
* @return void
*
* @since 4.0.0
*/
protected function initialise()
{
$this->setName('session:gc');
$this->setDescription('Performs session garbage collection');
$this->setHelp(
<<<EOF
The <info>%command.name%</info> command runs PHP's garbage collection operation for session data
<info>php %command.full_name%</info>
EOF
);
}
}
1 change: 1 addition & 0 deletions libraries/src/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ protected static function createContainer(): Container
$container = (new Container)
->registerServiceProvider(new \Joomla\CMS\Service\Provider\Application)
->registerServiceProvider(new \Joomla\CMS\Service\Provider\Authentication)
->registerServiceProvider(new \Joomla\CMS\Service\Provider\Console)
->registerServiceProvider(new \Joomla\CMS\Service\Provider\Database)
->registerServiceProvider(new \Joomla\CMS\Service\Provider\Dispatcher)
->registerServiceProvider(new \Joomla\CMS\Service\Provider\Document)
Expand Down
4 changes: 2 additions & 2 deletions libraries/src/Form/Field/RulesField.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class RulesField extends FormField
* Name of the layout being used to render the field
*
* @var string
* @since 3.5
* @since __DEPLOY_VERSION__
*/
protected $layout = 'joomla.form.field.rules.tabs';

Expand Down Expand Up @@ -234,7 +234,7 @@ protected function getInput()
*
* @return array
*
* @since 3.5
* @since __DEPLOY_VERSION__
*/
protected function getLayoutData()
{
Expand Down
18 changes: 18 additions & 0 deletions libraries/src/Service/Provider/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@

defined('JPATH_PLATFORM') or die;

use Joomla\CMS\Console\SessionGcCommand;
use Joomla\Console\Application as BaseConsoleApplication;
use Joomla\CMS\Application\AdministratorApplication;
use Joomla\CMS\Application\ConsoleApplication;
use Joomla\CMS\Application\SiteApplication;
use Joomla\CMS\Factory;
use Joomla\CMS\Log\Log;
use Joomla\CMS\Session\Session;
use Joomla\Console\Loader\ContainerLoader;
use Joomla\Console\Loader\LoaderInterface;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Session\Storage\RuntimeStorage;
Expand Down Expand Up @@ -97,6 +100,7 @@ function (Container $container)
$session = new Session(new RuntimeStorage);
$session->setDispatcher($dispatcher);

$app->setCommandLoader($container->get(LoaderInterface::class));
$app->setContainer($container);
$app->setDispatcher($dispatcher);
$app->setLogger($container->get(LoggerInterface::class));
Expand All @@ -106,5 +110,19 @@ function (Container $container)
},
true
);

$container->alias(ContainerLoader::class, LoaderInterface::class)
->share(
LoaderInterface::class,
function (Container $container)
{
$mapping = [
'session:gc' => SessionGcCommand::class,
];

return new ContainerLoader($container, $mapping);
},
true
);
}
}
45 changes: 45 additions & 0 deletions libraries/src/Service/Provider/Console.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
/**
* @package Joomla.Libraries
* @subpackage Service
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/

namespace Joomla\CMS\Service\Provider;

defined('JPATH_PLATFORM') or die;

use Joomla\CMS\Console\SessionGcCommand;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;

/**
* Service provider for the application's console services
*
* @since 4.0
*/
class Console implements ServiceProviderInterface
{
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.0
*/
public function register(Container $container)
{
$container->share(
SessionGcCommand::class,
function (Container $container)
{
return new SessionGcCommand($container->get('session'));
},
true
);
}
}

0 comments on commit b54a1b2

Please sign in to comment.