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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion core/src/Revolution/Processors/Workspace/Packages/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,26 @@ public function process()
$this->modx->log(modX::LOG_LEVEL_WARN, $msg);
$this->modx->log(modX::LOG_LEVEL_INFO, 'COMPLETED');

$isUpgrade = $this->package->previousVersionInstalled();
$this->modx->invokeEvent('OnPackageInstall', [
'package' => $this->package,
'action' => $this->package->previousVersionInstalled() ? xPDOTransport::ACTION_UPGRADE : xPDOTransport::ACTION_INSTALL,
'action' => $isUpgrade ? xPDOTransport::ACTION_UPGRADE : xPDOTransport::ACTION_INSTALL,
]);

$this->logManagerAction();

return $this->success($msg);
}

/**
* Log package install or upgrade to Manager Log.
*/
public function logManagerAction()
{
$action = $this->package->previousVersionInstalled() ? 'package_upgrade' : 'package_install';
$this->modx->logManagerAction($action, modTransportPackage::class, $this->package->getPrimaryKey());
}

public function clearCache()
{
$this->modx->cacheManager->refresh([
Expand Down
11 changes: 11 additions & 0 deletions core/src/Revolution/Processors/Workspace/Packages/Remove.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* This file is part of MODX Revolution.
*
Expand Down Expand Up @@ -154,10 +155,20 @@ public function cleanup()
sleep(2);
$this->modx->log(modX::LOG_LEVEL_INFO, 'COMPLETED');

$this->logManagerAction();

$this->modx->invokeEvent('OnPackageRemove', [
'package' => $this->package,
]);

return $this->success();
}

/**
* Log package remove to Manager Log.
*/
public function logManagerAction()
{
$this->modx->logManagerAction('package_remove', modTransportPackage::class, $this->package->getPrimaryKey());
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* This file is part of MODX Revolution.
*
Expand Down Expand Up @@ -79,7 +80,9 @@ public function process()
];

if ($this->package->uninstall($options) === false) {
return $this->failure(sprintf($this->modx->lexicon('package_err_uninstall'), ['signature' => $this->package->get('signature')], $this->package->getPrimaryKey()));
return $this->failure($this->modx->lexicon('package_err_uninstall', [
'signature' => $this->package->get('signature'),
]));
}

$this->modx->log(modX::LOG_LEVEL_WARN,
Expand All @@ -100,7 +103,7 @@ public function process()

public function logManagerAction()
{
$this->modx->logManagerAction('package_uninstall', modTransportPackage::class, $this->package->get('id'));
$this->modx->logManagerAction('package_uninstall', modTransportPackage::class, $this->package->getPrimaryKey());
}

public function clearCache()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* This file is part of MODX Revolution.
*
Expand Down Expand Up @@ -82,6 +83,6 @@ public function process()

public function logManagerAction()
{
$this->modx->logManagerAction('package_update', modTransportPackage::class, $this->package->get('id'));
$this->modx->logManagerAction('package_update', modTransportPackage::class, $this->package->getPrimaryKey());
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* This file is part of MODX Revolution.
*
Expand Down Expand Up @@ -126,6 +127,6 @@ public function removeTransportDirectory()

public function logManagerAction()
{
$this->modx->logManagerAction('package_remove', modTransportPackage::class, $this->package->get('id'));
$this->modx->logManagerAction('package_remove', modTransportPackage::class, $this->package->getPrimaryKey());
}
}