Permalink
Browse files

Add support for User Actions Log (!)

  • Loading branch information...
sebastienheraud committed Dec 14, 2018
1 parent 4b31af1 commit 9d0ead661c1c659534e77d406c8e4a430a737ab7
@@ -1700,9 +1700,3 @@ CREATE TABLE IF NOT EXISTS `#__cck_store_item_users` (
`company_vat_id` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;


-- --------------------------------------------------------


INSERT IGNORE INTO `#__action_logs_extensions` (`extension`) VALUES ('com_cck');

This file was deleted.

Oops, something went wrong.
@@ -327,6 +327,10 @@ public function postflight( $type, $parent )
$db->setQuery( 'UPDATE #__extensions SET params = "'.$db->escape( $params ).'" WHERE name = "com_cck"' );
$db->execute();
// Set User Actions Log
self::_setUserActionsLog();
// Set Utf8mb4 flag
self::_setUtf8mb4( $params );
} else {
@@ -629,6 +633,9 @@ public function postflight( $type, $parent )
}
}
// Set User Actions Log
self::_setUserActionsLog();
// Convert Tables To Utf8mb4
self::_convertTablesToUtf8mb4();
@@ -859,6 +866,25 @@ protected function _forceAutoIncrements()
}
}
// _setUserActionsLog
protected function _setUserActionsLog()
{
$db = JFactory::getDbo();
$db_prefix = JFactory::getConfig()->get( 'dbprefix' );
$table_name = $db_prefix.'action_logs_extensions';
$tables = $db->getTableList();
$tables = array_flip( $tables );
if ( isset( $tables[$table_name] ) ) {
$db->setQuery( 'SELECT COUNT(id) FROM `#__action_logs_extensions` WHERE extension = "com_cck"' );
if ( (int)$db->loadResult() == 0 ) {
$db->setQuery( 'INSERT IGNORE INTO `#__action_logs_extensions` (`extension`) VALUES ("com_cck")' );
$db->execute();
}
}
}
// _setUtf8mb4
protected function _setUtf8mb4( $params )
{

0 comments on commit 9d0ead6

Please sign in to comment.