mirror of
https://github.com/joomla/joomla-cms.git
synced 2024-06-26 07:13:21 +00:00
[com_actionlogs] - log checkin actions (#23526)
* [com_ajax] - need to be protected postgresql update * log checkin * udpate * old one * update fixes
This commit is contained in:
parent
e0193e959e
commit
6933bb16b8
|
@ -29,7 +29,7 @@
|
|||
label="COM_ACTIONLOGS_LOG_EXTENSIONS_LABEL"
|
||||
description="COM_ACTIONLOGS_LOG_EXTENSIONS_DESC"
|
||||
multiple="true"
|
||||
default="com_banners,com_cache,com_categories,com_config,com_contact,com_content,com_installer,com_media,com_menus,com_messages,com_modules,com_newsfeeds,com_plugins,com_redirect,com_tags,com_templates,com_users"
|
||||
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_tags,com_templates,com_users"
|
||||
/>
|
||||
</fieldset>
|
||||
</config>
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
UPDATE `#__extensions`
|
||||
SET `params` = REPLACE(`params`, '"com_categories",', '"com_categories","com_checkin",')
|
||||
WHERE `name` = 'com_actionlogs';
|
||||
|
||||
INSERT INTO `#__action_logs_extensions` (`extension`) VALUES
|
||||
('com_checkin');
|
|
@ -0,0 +1,8 @@
|
|||
UPDATE "#__extensions"
|
||||
SET "params" = REPLACE("params", '"com_categories",', '"com_categories","com_checkin",')
|
||||
WHERE "name" = 'com_actionlogs';
|
||||
|
||||
INSERT INTO "#__action_logs_extensions" ("extension") VALUES
|
||||
('com_checkin');
|
||||
|
||||
SELECT setval('#__action_logs_extensions_id_seq', max(id)) FROM "#__action_logs_extensions";
|
|
@ -0,0 +1,10 @@
|
|||
UPDATE "#__extensions"
|
||||
SET "params" = REPLACE("params", '"com_categories",', '"com_categories","com_checkin",')
|
||||
WHERE "name" = 'com_actionlogs';
|
||||
|
||||
SET IDENTITY_INSERT #__extensions ON;
|
||||
|
||||
INSERT INTO "#__action_logs_extensions" ("extension") VALUES
|
||||
('com_checkin');
|
||||
|
||||
SET IDENTITY_INSERT #__extensions OFF;
|
|
@ -94,6 +94,8 @@ class CheckinModelCheckin extends JModelList
|
|||
// This int will hold the checked item count.
|
||||
$results = 0;
|
||||
|
||||
$dispatcher = \JEventDispatcher::getInstance();
|
||||
|
||||
foreach ($ids as $tn)
|
||||
{
|
||||
// Make sure we get the right tables based on prefix.
|
||||
|
@ -111,15 +113,16 @@ class CheckinModelCheckin extends JModelList
|
|||
|
||||
$query = $db->getQuery(true)
|
||||
->update($db->quoteName($tn))
|
||||
->set('checked_out = DEFAULT')
|
||||
->set('checked_out_time = ' . $db->quote($nullDate))
|
||||
->where('checked_out > 0');
|
||||
->set($db->quoteName('checked_out') . ' = DEFAULT')
|
||||
->set($db->quoteName('checked_out_time') . ' = ' . $db->quote($nullDate))
|
||||
->where($db->quoteName('checked_out') . ' > 0');
|
||||
|
||||
$db->setQuery($query);
|
||||
|
||||
if ($db->execute())
|
||||
{
|
||||
$results = $results + $db->getAffectedRows();
|
||||
$dispatcher->trigger('onAfterCheckin', array($tn));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ PLG_ACTIONLOG_JOOMLA_TYPE_TEMPLATE="template"
|
|||
PLG_ACTIONLOG_JOOMLA_TYPE_USER="user"
|
||||
PLG_ACTIONLOG_JOOMLA_TYPE_USER_GROUP="user group"
|
||||
PLG_ACTIONLOG_JOOMLA_TYPE_USER_NOTE="user note"
|
||||
PLG_ACTIONLOG_JOOMLA_USER_CHECKIN="User <a href='{accountlink}'>{username}</a> performed a check in to table {table}"
|
||||
PLG_ACTIONLOG_JOOMLA_USER_LOGGED_IN="User <a href='{accountlink}'>{username}</a> logged in to {app}"
|
||||
PLG_ACTIONLOG_JOOMLA_USER_LOGGED_OUT="User <a href='{accountlink}'>{username}</a> logged out from {app}"
|
||||
PLG_ACTIONLOG_JOOMLA_USER_LOGIN_FAILED="User <a href='{accountlink}'>{username}</a> tried to login to {app}"
|
||||
|
|
|
@ -526,7 +526,7 @@ INSERT INTO `#__extensions` (`extension_id`, `package_id`, `name`, `type`, `elem
|
|||
(33, 0, 'com_fields', 'component', 'com_fields', '', 1, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0),
|
||||
(34, 0, 'com_associations', 'component', 'com_associations', '', 1, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0),
|
||||
(35, 0, 'com_privacy', 'component', 'com_privacy', '', 1, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0),
|
||||
(36, 0, 'com_actionlogs', 'component', 'com_actionlogs', '', 1, 1, 1, 1, '', '{"ip_logging":0,"csv_delimiter":",","loggable_extensions":["com_banners","com_cache","com_categories","com_config","com_contact","com_content","com_installer","com_media","com_menus","com_messages","com_modules","com_newsfeeds","com_plugins","com_redirect","com_tags","com_templates","com_users"]}', '', '', 0, '0000-00-00 00:00:00', 0, 0),
|
||||
(36, 0, 'com_actionlogs', 'component', 'com_actionlogs', '', 1, 1, 1, 1, '', '{"ip_logging":0,"csv_delimiter":",","loggable_extensions":["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_tags","com_templates","com_users"]}', '', '', 0, '0000-00-00 00:00:00', 0, 0),
|
||||
(102, 0, 'phputf8', 'library', 'phputf8', '', 0, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0),
|
||||
(103, 0, 'Joomla! Platform', 'library', 'joomla', '', 0, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0),
|
||||
(104, 0, 'IDNA Convert', 'library', 'idna_convert', '', 0, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0),
|
||||
|
@ -2195,7 +2195,8 @@ INSERT INTO `#__action_logs_extensions` (`id`, `extension`) VALUES
|
|||
(14, 'com_redirect'),
|
||||
(15, 'com_tags'),
|
||||
(16, 'com_templates'),
|
||||
(17, 'com_users');
|
||||
(17, 'com_users'),
|
||||
(18, 'com_checkin');
|
||||
|
||||
--
|
||||
-- Table structure for table `#__action_log_config`
|
||||
|
|
|
@ -539,7 +539,7 @@ INSERT INTO "#__extensions" ("extension_id", "package_id", "name", "type", "elem
|
|||
(33, 0, 'com_fields', 'component', 'com_fields', '', 1, 1, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0),
|
||||
(34, 0, 'com_associations', 'component', 'com_associations', '', 1, 1, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0),
|
||||
(35, 0, 'com_privacy', 'component', 'com_privacy', '', 1, 1, 1, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0),
|
||||
(36, 0, 'com_actionlogs', 'component', 'com_actionlogs', '', 1, 1, 1, 1, '', '{"ip_logging":0,"csv_delimiter":",","loggable_extensions":["com_banners","com_cache","com_categories","com_config","com_contact","com_content","com_installer","com_media","com_menus","com_messages","com_modules","com_newsfeeds","com_plugins","com_redirect","com_tags","com_templates","com_users"]}', '', '', 0, '1970-01-01 00:00:00', 0, 0),
|
||||
(36, 0, 'com_actionlogs', 'component', 'com_actionlogs', '', 1, 1, 1, 1, '', '{"ip_logging":0,"csv_delimiter":",","loggable_extensions":["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_tags","com_templates","com_users"]}', '', '', 0, '1970-01-01 00:00:00', 0, 0),
|
||||
(102, 0, 'phputf8', 'library', 'phputf8', '', 0, 1, 1, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0),
|
||||
(103, 0, 'Joomla! Platform', 'library', 'joomla', '', 0, 1, 1, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0),
|
||||
(104, 0, 'IDNA Convert', 'library', 'idna_convert', '', 0, 1, 1, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0),
|
||||
|
@ -2176,9 +2176,10 @@ INSERT INTO "#__action_logs_extensions" ("id", "extension") VALUES
|
|||
(14, 'com_redirect'),
|
||||
(15, 'com_tags'),
|
||||
(16, 'com_templates'),
|
||||
(17, 'com_users');
|
||||
(17, 'com_users'),
|
||||
(18, 'com_checkin');
|
||||
|
||||
SELECT setval('#__action_logs_extensions_id_seq', 18, false);
|
||||
SELECT setval('#__action_logs_extensions_id_seq', 19, false);
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
|
|
|
@ -754,7 +754,7 @@ INSERT INTO "#__extensions" ("extension_id", "package_id", "name", "type", "elem
|
|||
(33, 0, 'com_fields', 'component', 'com_fields', '', 1, 1, 1, 0, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0),
|
||||
(34, 0, 'com_associations', 'component', 'com_associations', '', 1, 1, 1, 0, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0),
|
||||
(35, 0, 'com_privacy', 'component', 'com_privacy', '', 1, 1, 1, 1, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0),
|
||||
(36, 0, 'com_actionlogs', 'component', 'com_actionlogs', '', 1, 1, 1, 1, '', '{"ip_logging":0,"csv_delimiter":",","loggable_extensions":["com_banners","com_cache","com_categories","com_config","com_contact","com_content","com_installer","com_media","com_menus","com_messages","com_modules","com_newsfeeds","com_plugins","com_redirect","com_tags","com_templates","com_users"]}', '', '', 0, '1900-01-01 00:00:00', 0, 0),
|
||||
(36, 0, 'com_actionlogs', 'component', 'com_actionlogs', '', 1, 1, 1, 1, '', '{"ip_logging":0,"csv_delimiter":",","loggable_extensions":["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_tags","com_templates","com_users"]}', '', '', 0, '1900-01-01 00:00:00', 0, 0),
|
||||
(102, 0, 'phputf8', 'library', 'phputf8', '', 0, 1, 1, 1, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0),
|
||||
(103, 0, 'Joomla! Platform', 'library', 'joomla', '', 0, 1, 1, 1, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0),
|
||||
(104, 0, 'IDNA Convert', 'library', 'idna_convert', '', 0, 1, 1, 1, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0),
|
||||
|
@ -3139,7 +3139,9 @@ SELECT 15, 'com_tags'
|
|||
UNION ALL
|
||||
SELECT 16, 'com_templates'
|
||||
UNION ALL
|
||||
SELECT 17, 'com_users';
|
||||
SELECT 17, 'com_users'
|
||||
UNION ALL
|
||||
SELECT 18, 'com_checkin';
|
||||
|
||||
SET IDENTITY_INSERT [#__action_logs_extensions] OFF;
|
||||
/****** Object: Table [#__action_log_config] ******/
|
||||
|
|
|
@ -1145,6 +1145,9 @@ abstract class Table extends \JObject implements \JObservableInterface, \JTableI
|
|||
$this->$checkedOutField = 0;
|
||||
$this->$checkedOutTimeField = '';
|
||||
|
||||
$dispatcher = \JEventDispatcher::getInstance();
|
||||
$dispatcher->trigger('onAfterCheckin', array($this->_tbl));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -909,4 +909,40 @@ class PlgActionlogJoomla extends ActionLogPlugin
|
|||
|
||||
$this->addLog(array($message), 'PLG_ACTIONLOG_JOOMLA_USER_REMIND', $context, $user->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* On after Check-in request
|
||||
*
|
||||
* Method is called after user request to check-in items.
|
||||
*
|
||||
* @param array $table Holds the table name.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since __DEPLOY_VERSION__
|
||||
*/
|
||||
public function onAfterCheckin($table)
|
||||
{
|
||||
$context = $this->app->input->get('option');
|
||||
$user = Factory::getUser();
|
||||
|
||||
if (!$this->checkLoggable($context))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$message = array(
|
||||
'action' => 'checkin',
|
||||
'type' => 'PLG_ACTIONLOG_JOOMLA_TYPE_USER',
|
||||
'id' => $user->id,
|
||||
'title' => $user->name,
|
||||
'itemlink' => 'index.php?option=com_users&task=user.edit&id=' . $user->id,
|
||||
'userid' => $user->id,
|
||||
'username' => $user->name,
|
||||
'accountlink' => 'index.php?option=com_users&task=user.edit&id=' . $user->id,
|
||||
'table' => $table,
|
||||
);
|
||||
|
||||
$this->addLog(array($message), 'PLG_ACTIONLOG_JOOMLA_USER_CHECKIN', $context, $user->id);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user