Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 4 additions & 0 deletions administrator/logs/joomla_update.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@
#Fields: datetime priority clientip category message
2022-10-19T12:56:39+00:00 INFO 127.0.0.1 update Starting installation of new version.
2022-10-19T12:57:49+00:00 INFO 127.0.0.1 update Starting installation of new version.
2022-10-19T13:14:08+00:00 INFO 127.0.0.1 update Update started by user Tejashree (3). Old version is 4.1.5.
2022-10-19T13:14:11+00:00 INFO 127.0.0.1 update Downloading update file from https://s3-us-west-2.amazonaws.com/joomla-official-downloads/joomladownloads/joomla4/Joomla_4.2.3-Stable-Update_Package.zip?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIA6LXDJLNUINX2AVMH%2F20221019%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20221019T131404Z&X-Amz-Expires=60&X-Amz-SignedHeaders=host&X-Amz-Signature=c41c1152f5c9c47f27f397297419879e50192b1870b55828b62a232bb8a9e290.
2022-10-19T13:16:12+00:00 INFO 127.0.0.1 update Starting installation of new version.
2022-10-19T13:16:45+00:00 INFO 127.0.0.1 update File Joomla_4.2.3-Stable-Update_Package.zip downloaded.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<extension type="component" method="upgrade">
<name>com_actionlogs</name>
<author>Joomla! Project</author>
<creationDate>May 2018</creationDate>
<creationDate>2018-05</creationDate>
<copyright>(C) 2018 Open Source Matters, Inc.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
Expand Down
1 change: 1 addition & 0 deletions code/administrator/components/com_actionlogs/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
type="logtype"
label="COM_ACTIONLOGS_LOG_EXTENSIONS_LABEL"
multiple="true"
layout="joomla.form.field.list-fancy-select"
default="com_banners,com_cache,com_categories,com_checkin,com_config,com_contact,com_content,com_installer,com_media,com_menus,com_messages,com_modules,com_newsfeeds,com_plugins,com_redirect,com_scheduler,com_tags,com_templates,com_users"
/>
<field
Expand Down
46 changes: 23 additions & 23 deletions code/administrator/components/com_actionlogs/services/provider.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Joomla.Administrator
* @subpackage com_actionlogs
Expand All @@ -25,30 +26,29 @@
*/
return new class implements ServiceProviderInterface
{
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.0.0
*/
public function register(Container $container)
{
$container->registerServiceProvider(new MVCFactory('\\Joomla\\Component\\Actionlogs'));
$container->registerServiceProvider(new ComponentDispatcherFactory('\\Joomla\\Component\\Actionlogs'));
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.0.0
*/
public function register(Container $container)
{
$container->registerServiceProvider(new MVCFactory('\\Joomla\\Component\\Actionlogs'));
$container->registerServiceProvider(new ComponentDispatcherFactory('\\Joomla\\Component\\Actionlogs'));

$container->set(
ComponentInterface::class,
function (Container $container)
{
$component = new MVCComponent($container->get(ComponentDispatcherFactoryInterface::class));
$container->set(
ComponentInterface::class,
function (Container $container) {
$component = new MVCComponent($container->get(ComponentDispatcherFactoryInterface::class));

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

return $component;
}
);
}
return $component;
}
);
}
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Joomla.Administrator
* @subpackage com_actionlogs
Expand All @@ -9,8 +10,6 @@

namespace Joomla\Component\Actionlogs\Administrator\Controller;

\defined('_JEXEC') or die;

use DateTimeZone;
use Exception;
use InvalidArgumentException;
Expand All @@ -26,149 +25,142 @@
use Joomla\Component\Actionlogs\Administrator\Model\ActionlogsModel;
use Joomla\Utilities\ArrayHelper;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
* Actionlogs list controller class.
*
* @since 3.9.0
*/
class ActionlogsController extends AdminController
{
/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
* Recognized key values include 'name', 'default_task', 'model_path', and
* 'view_path' (this list is not meant to be comprehensive).
* @param MVCFactoryInterface $factory The factory.
* @param CMSApplication $app The Application for the dispatcher
* @param Input $input Input
*
* @since 3.9.0
*
* @throws Exception
*/
public function __construct($config = [], MVCFactoryInterface $factory = null, $app = null, $input = null)
{
parent::__construct($config, $factory, $app, $input);

$this->registerTask('exportSelectedLogs', 'exportLogs');
}

/**
* Method to export logs
*
* @return void
*
* @since 3.9.0
*
* @throws Exception
*/
public function exportLogs()
{
// Check for request forgeries.
$this->checkToken();

$task = $this->getTask();

$pks = array();

if ($task == 'exportSelectedLogs')
{
// Get selected logs
$pks = ArrayHelper::toInteger(explode(',', $this->input->post->getString('cids')));
}

/** @var ActionlogsModel $model */
$model = $this->getModel();

// Get the logs data
$data = $model->getLogDataAsIterator($pks);

if (\count($data))
{
try
{
$rows = ActionlogsHelper::getCsvData($data);
}
catch (InvalidArgumentException $exception)
{
$this->setMessage(Text::_('COM_ACTIONLOGS_ERROR_COULD_NOT_EXPORT_DATA'), 'error');
$this->setRedirect(Route::_('index.php?option=com_actionlogs&view=actionlogs', false));

return;
}

// Destroy the iterator now
unset($data);

$date = new Date('now', new DateTimeZone('UTC'));
$filename = 'logs_' . $date->format('Y-m-d_His_T');

$csvDelimiter = ComponentHelper::getComponent('com_actionlogs')->getParams()->get('csv_delimiter', ',');

$this->app->setHeader('Content-Type', 'application/csv', true)
->setHeader('Content-Disposition', 'attachment; filename="' . $filename . '.csv"', true)
->setHeader('Cache-Control', 'must-revalidate', true)
->sendHeaders();

$output = fopen("php://output", "w");

foreach ($rows as $row)
{
fputcsv($output, $row, $csvDelimiter);
}

fclose($output);
$this->app->triggerEvent('onAfterLogExport', array());
$this->app->close();
}
else
{
$this->setMessage(Text::_('COM_ACTIONLOGS_NO_LOGS_TO_EXPORT'));
$this->setRedirect(Route::_('index.php?option=com_actionlogs&view=actionlogs', false));
}
}

/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return object The model.
*
* @since 3.9.0
*/
public function getModel($name = 'Actionlogs', $prefix = 'Administrator', $config = ['ignore_request' => true])
{
// Return the model
return parent::getModel($name, $prefix, $config);
}

/**
* Clean out the logs
*
* @return void
*
* @since 3.9.0
*/
public function purge()
{
// Check for request forgeries.
$this->checkToken();

$model = $this->getModel();

if ($model->purge())
{
$message = Text::_('COM_ACTIONLOGS_PURGE_SUCCESS');
}
else
{
$message = Text::_('COM_ACTIONLOGS_PURGE_FAIL');
}

$this->setRedirect(Route::_('index.php?option=com_actionlogs&view=actionlogs', false), $message);
}
/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
* Recognized key values include 'name', 'default_task', 'model_path', and
* 'view_path' (this list is not meant to be comprehensive).
* @param MVCFactoryInterface $factory The factory.
* @param CMSApplication $app The Application for the dispatcher
* @param Input $input Input
*
* @since 3.9.0
*
* @throws Exception
*/
public function __construct($config = [], MVCFactoryInterface $factory = null, $app = null, $input = null)
{
parent::__construct($config, $factory, $app, $input);

$this->registerTask('exportSelectedLogs', 'exportLogs');
}

/**
* Method to export logs
*
* @return void
*
* @since 3.9.0
*
* @throws Exception
*/
public function exportLogs()
{
// Check for request forgeries.
$this->checkToken();

$task = $this->getTask();

$pks = array();

if ($task == 'exportSelectedLogs') {
// Get selected logs
$pks = ArrayHelper::toInteger(explode(',', $this->input->post->getString('cids')));
}

/** @var ActionlogsModel $model */
$model = $this->getModel();

// Get the logs data
$data = $model->getLogDataAsIterator($pks);

if (\count($data)) {
try {
$rows = ActionlogsHelper::getCsvData($data);
} catch (InvalidArgumentException $exception) {
$this->setMessage(Text::_('COM_ACTIONLOGS_ERROR_COULD_NOT_EXPORT_DATA'), 'error');
$this->setRedirect(Route::_('index.php?option=com_actionlogs&view=actionlogs', false));

return;
}

// Destroy the iterator now
unset($data);

$date = new Date('now', new DateTimeZone('UTC'));
$filename = 'logs_' . $date->format('Y-m-d_His_T');

$csvDelimiter = ComponentHelper::getComponent('com_actionlogs')->getParams()->get('csv_delimiter', ',');

$this->app->setHeader('Content-Type', 'application/csv', true)
->setHeader('Content-Disposition', 'attachment; filename="' . $filename . '.csv"', true)
->setHeader('Cache-Control', 'must-revalidate', true)
->sendHeaders();

$output = fopen("php://output", "w");

foreach ($rows as $row) {
fputcsv($output, $row, $csvDelimiter);
}

fclose($output);
$this->app->triggerEvent('onAfterLogExport', array());
$this->app->close();
} else {
$this->setMessage(Text::_('COM_ACTIONLOGS_NO_LOGS_TO_EXPORT'));
$this->setRedirect(Route::_('index.php?option=com_actionlogs&view=actionlogs', false));
}
}

/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return object The model.
*
* @since 3.9.0
*/
public function getModel($name = 'Actionlogs', $prefix = 'Administrator', $config = ['ignore_request' => true])
{
// Return the model
return parent::getModel($name, $prefix, $config);
}

/**
* Clean out the logs
*
* @return void
*
* @since 3.9.0
*/
public function purge()
{
// Check for request forgeries.
$this->checkToken();

$model = $this->getModel();

if ($model->purge()) {
$message = Text::_('COM_ACTIONLOGS_PURGE_SUCCESS');
} else {
$message = Text::_('COM_ACTIONLOGS_PURGE_FAIL');
}

$this->setRedirect(Route::_('index.php?option=com_actionlogs&view=actionlogs', false), $message);
}
}
Loading