Skip to content

Commit 2b1b326

Browse files
authored
[5.1] Deprecate app/db properties in ActionLogPlugin (#42090)
1 parent 32d4bf1 commit 2b1b326

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

administrator/components/com_actionlogs/src/Plugin/ActionLogPlugin.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ abstract class ActionLogPlugin extends CMSPlugin
2828
*
2929
* @var \Joomla\CMS\Application\CMSApplication
3030
* @since 3.9.0
31+
*
32+
* @deprecated __DEPLOY_VERSION__ will be removed in 7.0 use $this->getApplication() instead
3133
*/
3234
protected $app;
3335

@@ -36,6 +38,8 @@ abstract class ActionLogPlugin extends CMSPlugin
3638
*
3739
* @var \Joomla\Database\DatabaseDriver
3840
* @since 3.9.0
41+
*
42+
* @deprecated __DEPLOY_VERSION__ will be removed in 7.0 use $this->getDatabase() instead
3943
*/
4044
protected $db;
4145

@@ -63,7 +67,8 @@ abstract class ActionLogPlugin extends CMSPlugin
6367
*/
6468
protected function addLog($messages, $messageLanguageKey, $context, $userId = null)
6569
{
66-
$user = $this->app->getIdentity();
70+
$app = $this->getApplication() ?: $this->app;
71+
$user = $app->getIdentity();
6772

6873
foreach ($messages as $index => $message) {
6974
if (!\array_key_exists('userid', $message)) {
@@ -90,7 +95,7 @@ protected function addLog($messages, $messageLanguageKey, $context, $userId = nu
9095
}
9196

9297
/** @var \Joomla\Component\Actionlogs\Administrator\Model\ActionlogModel $model */
93-
$model = $this->app->bootComponent('com_actionlogs')
98+
$model = $app->bootComponent('com_actionlogs')
9499
->getMVCFactory()->createModel('Actionlog', 'Administrator', ['ignore_request' => true]);
95100

96101
$model->addLog($messages, strtoupper($messageLanguageKey), $context, $userId);

0 commit comments

Comments
 (0)