Skip to content

Commit ae922dc

Browse files
committed
Merge tag 'psr12final' into psr12/merge/35678
2 parents e4b51a4 + 09d14c6 commit ae922dc

File tree

2,581 files changed

+335970
-358308
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,581 files changed

+335970
-358308
lines changed

.drone.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ steps:
1919
depends_on: [ composer ]
2020
commands:
2121
- echo $(date)
22-
- ./libraries/vendor/bin/phpcs --extensions=php -p --standard=libraries/vendor/joomla/cms-coding-standards/lib/Joomla-CMS .
22+
- ./libraries/vendor/bin/phpcs --extensions=php -p --standard=ruleset.xml .
2323
- echo $(date)
2424

2525
- name: npm
@@ -475,6 +475,6 @@ trigger:
475475

476476
---
477477
kind: signature
478-
hmac: d5db8148323f0205a8c0cd165da3934f5a77b25f73862d09ead95d3c42f1df01
478+
hmac: 783273e5140ae315f2403b13eb12f4773b77995a3d44a38551b55c89b9d40350
479479

480480
...

.editorconfig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
# top-most EditorConfig file
44
root = true
55

6-
# Unix-style newlines with a newline ending every file
6+
# Unix-style end of lines and a blank line at the end of the file
77
[*]
8-
indent_style = tab
8+
indent_style = space
9+
indent_size = 4
910
end_of_line = lf
1011
charset = utf-8
1112
trim_trailing_whitespace = true
1213
insert_final_newline = true
1314

1415
[*.{js,json,scss,css,vue}]
15-
indent_style = space
1616
indent_size = 2
Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* @package Joomla.Administrator
45
* @subpackage com_actionlogs
@@ -25,30 +26,29 @@
2526
*/
2627
return new class implements ServiceProviderInterface
2728
{
28-
/**
29-
* Registers the service provider with a DI container.
30-
*
31-
* @param Container $container The DI container.
32-
*
33-
* @return void
34-
*
35-
* @since 4.0.0
36-
*/
37-
public function register(Container $container)
38-
{
39-
$container->registerServiceProvider(new MVCFactory('\\Joomla\\Component\\Actionlogs'));
40-
$container->registerServiceProvider(new ComponentDispatcherFactory('\\Joomla\\Component\\Actionlogs'));
29+
/**
30+
* Registers the service provider with a DI container.
31+
*
32+
* @param Container $container The DI container.
33+
*
34+
* @return void
35+
*
36+
* @since 4.0.0
37+
*/
38+
public function register(Container $container)
39+
{
40+
$container->registerServiceProvider(new MVCFactory('\\Joomla\\Component\\Actionlogs'));
41+
$container->registerServiceProvider(new ComponentDispatcherFactory('\\Joomla\\Component\\Actionlogs'));
4142

42-
$container->set(
43-
ComponentInterface::class,
44-
function (Container $container)
45-
{
46-
$component = new MVCComponent($container->get(ComponentDispatcherFactoryInterface::class));
43+
$container->set(
44+
ComponentInterface::class,
45+
function (Container $container) {
46+
$component = new MVCComponent($container->get(ComponentDispatcherFactoryInterface::class));
4747

48-
$component->setMVCFactory($container->get(MVCFactoryInterface::class));
48+
$component->setMVCFactory($container->get(MVCFactoryInterface::class));
4949

50-
return $component;
51-
}
52-
);
53-
}
50+
return $component;
51+
}
52+
);
53+
}
5454
};
Lines changed: 128 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* @package Joomla.Administrator
45
* @subpackage com_actionlogs
@@ -9,8 +10,6 @@
910

1011
namespace Joomla\Component\Actionlogs\Administrator\Controller;
1112

12-
\defined('_JEXEC') or die;
13-
1413
use DateTimeZone;
1514
use Exception;
1615
use InvalidArgumentException;
@@ -33,142 +32,131 @@
3332
*/
3433
class ActionlogsController extends AdminController
3534
{
36-
/**
37-
* Constructor.
38-
*
39-
* @param array $config An optional associative array of configuration settings.
40-
* Recognized key values include 'name', 'default_task', 'model_path', and
41-
* 'view_path' (this list is not meant to be comprehensive).
42-
* @param MVCFactoryInterface $factory The factory.
43-
* @param CMSApplication $app The Application for the dispatcher
44-
* @param Input $input Input
45-
*
46-
* @since 3.9.0
47-
*
48-
* @throws Exception
49-
*/
50-
public function __construct($config = [], MVCFactoryInterface $factory = null, $app = null, $input = null)
51-
{
52-
parent::__construct($config, $factory, $app, $input);
53-
54-
$this->registerTask('exportSelectedLogs', 'exportLogs');
55-
}
56-
57-
/**
58-
* Method to export logs
59-
*
60-
* @return void
61-
*
62-
* @since 3.9.0
63-
*
64-
* @throws Exception
65-
*/
66-
public function exportLogs()
67-
{
68-
// Check for request forgeries.
69-
$this->checkToken();
70-
71-
$task = $this->getTask();
72-
73-
$pks = array();
74-
75-
if ($task == 'exportSelectedLogs')
76-
{
77-
// Get selected logs
78-
$pks = ArrayHelper::toInteger(explode(',', $this->input->post->getString('cids')));
79-
}
80-
81-
/** @var ActionlogsModel $model */
82-
$model = $this->getModel();
83-
84-
// Get the logs data
85-
$data = $model->getLogDataAsIterator($pks);
86-
87-
if (\count($data))
88-
{
89-
try
90-
{
91-
$rows = ActionlogsHelper::getCsvData($data);
92-
}
93-
catch (InvalidArgumentException $exception)
94-
{
95-
$this->setMessage(Text::_('COM_ACTIONLOGS_ERROR_COULD_NOT_EXPORT_DATA'), 'error');
96-
$this->setRedirect(Route::_('index.php?option=com_actionlogs&view=actionlogs', false));
97-
98-
return;
99-
}
100-
101-
// Destroy the iterator now
102-
unset($data);
103-
104-
$date = new Date('now', new DateTimeZone('UTC'));
105-
$filename = 'logs_' . $date->format('Y-m-d_His_T');
106-
107-
$csvDelimiter = ComponentHelper::getComponent('com_actionlogs')->getParams()->get('csv_delimiter', ',');
108-
109-
$this->app->setHeader('Content-Type', 'application/csv', true)
110-
->setHeader('Content-Disposition', 'attachment; filename="' . $filename . '.csv"', true)
111-
->setHeader('Cache-Control', 'must-revalidate', true)
112-
->sendHeaders();
113-
114-
$output = fopen("php://output", "w");
115-
116-
foreach ($rows as $row)
117-
{
118-
fputcsv($output, $row, $csvDelimiter);
119-
}
120-
121-
fclose($output);
122-
$this->app->triggerEvent('onAfterLogExport', array());
123-
$this->app->close();
124-
}
125-
else
126-
{
127-
$this->setMessage(Text::_('COM_ACTIONLOGS_NO_LOGS_TO_EXPORT'));
128-
$this->setRedirect(Route::_('index.php?option=com_actionlogs&view=actionlogs', false));
129-
}
130-
}
131-
132-
/**
133-
* Method to get a model object, loading it if required.
134-
*
135-
* @param string $name The model name. Optional.
136-
* @param string $prefix The class prefix. Optional.
137-
* @param array $config Configuration array for model. Optional.
138-
*
139-
* @return object The model.
140-
*
141-
* @since 3.9.0
142-
*/
143-
public function getModel($name = 'Actionlogs', $prefix = 'Administrator', $config = ['ignore_request' => true])
144-
{
145-
// Return the model
146-
return parent::getModel($name, $prefix, $config);
147-
}
148-
149-
/**
150-
* Clean out the logs
151-
*
152-
* @return void
153-
*
154-
* @since 3.9.0
155-
*/
156-
public function purge()
157-
{
158-
// Check for request forgeries.
159-
$this->checkToken();
160-
161-
$model = $this->getModel();
162-
163-
if ($model->purge())
164-
{
165-
$message = Text::_('COM_ACTIONLOGS_PURGE_SUCCESS');
166-
}
167-
else
168-
{
169-
$message = Text::_('COM_ACTIONLOGS_PURGE_FAIL');
170-
}
171-
172-
$this->setRedirect(Route::_('index.php?option=com_actionlogs&view=actionlogs', false), $message);
173-
}
35+
/**
36+
* Constructor.
37+
*
38+
* @param array $config An optional associative array of configuration settings.
39+
* Recognized key values include 'name', 'default_task', 'model_path', and
40+
* 'view_path' (this list is not meant to be comprehensive).
41+
* @param MVCFactoryInterface $factory The factory.
42+
* @param CMSApplication $app The Application for the dispatcher
43+
* @param Input $input Input
44+
*
45+
* @since 3.9.0
46+
*
47+
* @throws Exception
48+
*/
49+
public function __construct($config = [], MVCFactoryInterface $factory = null, $app = null, $input = null)
50+
{
51+
parent::__construct($config, $factory, $app, $input);
52+
53+
$this->registerTask('exportSelectedLogs', 'exportLogs');
54+
}
55+
56+
/**
57+
* Method to export logs
58+
*
59+
* @return void
60+
*
61+
* @since 3.9.0
62+
*
63+
* @throws Exception
64+
*/
65+
public function exportLogs()
66+
{
67+
// Check for request forgeries.
68+
$this->checkToken();
69+
70+
$task = $this->getTask();
71+
72+
$pks = array();
73+
74+
if ($task == 'exportSelectedLogs') {
75+
// Get selected logs
76+
$pks = ArrayHelper::toInteger(explode(',', $this->input->post->getString('cids')));
77+
}
78+
79+
/** @var ActionlogsModel $model */
80+
$model = $this->getModel();
81+
82+
// Get the logs data
83+
$data = $model->getLogDataAsIterator($pks);
84+
85+
if (\count($data)) {
86+
try {
87+
$rows = ActionlogsHelper::getCsvData($data);
88+
} catch (InvalidArgumentException $exception) {
89+
$this->setMessage(Text::_('COM_ACTIONLOGS_ERROR_COULD_NOT_EXPORT_DATA'), 'error');
90+
$this->setRedirect(Route::_('index.php?option=com_actionlogs&view=actionlogs', false));
91+
92+
return;
93+
}
94+
95+
// Destroy the iterator now
96+
unset($data);
97+
98+
$date = new Date('now', new DateTimeZone('UTC'));
99+
$filename = 'logs_' . $date->format('Y-m-d_His_T');
100+
101+
$csvDelimiter = ComponentHelper::getComponent('com_actionlogs')->getParams()->get('csv_delimiter', ',');
102+
103+
$this->app->setHeader('Content-Type', 'application/csv', true)
104+
->setHeader('Content-Disposition', 'attachment; filename="' . $filename . '.csv"', true)
105+
->setHeader('Cache-Control', 'must-revalidate', true)
106+
->sendHeaders();
107+
108+
$output = fopen("php://output", "w");
109+
110+
foreach ($rows as $row) {
111+
fputcsv($output, $row, $csvDelimiter);
112+
}
113+
114+
fclose($output);
115+
$this->app->triggerEvent('onAfterLogExport', array());
116+
$this->app->close();
117+
} else {
118+
$this->setMessage(Text::_('COM_ACTIONLOGS_NO_LOGS_TO_EXPORT'));
119+
$this->setRedirect(Route::_('index.php?option=com_actionlogs&view=actionlogs', false));
120+
}
121+
}
122+
123+
/**
124+
* Method to get a model object, loading it if required.
125+
*
126+
* @param string $name The model name. Optional.
127+
* @param string $prefix The class prefix. Optional.
128+
* @param array $config Configuration array for model. Optional.
129+
*
130+
* @return object The model.
131+
*
132+
* @since 3.9.0
133+
*/
134+
public function getModel($name = 'Actionlogs', $prefix = 'Administrator', $config = ['ignore_request' => true])
135+
{
136+
// Return the model
137+
return parent::getModel($name, $prefix, $config);
138+
}
139+
140+
/**
141+
* Clean out the logs
142+
*
143+
* @return void
144+
*
145+
* @since 3.9.0
146+
*/
147+
public function purge()
148+
{
149+
// Check for request forgeries.
150+
$this->checkToken();
151+
152+
$model = $this->getModel();
153+
154+
if ($model->purge()) {
155+
$message = Text::_('COM_ACTIONLOGS_PURGE_SUCCESS');
156+
} else {
157+
$message = Text::_('COM_ACTIONLOGS_PURGE_FAIL');
158+
}
159+
160+
$this->setRedirect(Route::_('index.php?option=com_actionlogs&view=actionlogs', false), $message);
161+
}
174162
}

0 commit comments

Comments
 (0)