feat(workspace): add logManagerAction for package install/upgrade/remove#16901
feat(workspace): add logManagerAction for package install/upgrade/remove#16901Ibochkarev wants to merge 2 commits intomodxcms:3.xfrom
Conversation
- Install: log package_install or package_upgrade after successful save
- Remove: log package_remove before removing package
- Uninstall, Update, Version/Remove: use getPrimaryKey() instead of get('id')
- Fix Uninstall: use lexicon() instead of incorrect sprintf()
- Fix PHPCS: formatting, line length, ELSEIF
730771a to
26cacfa
Compare
Code ReviewSummaryAdds Issues
public function logManagerAction()
{
$action = $this->package->previousVersionInstalled() ? 'package_upgrade' : 'package_install';
$this->modx->logManagerAction($action, modTransportPackage::class, $this->package->getPrimaryKey());
}
Suggestions
AssessmentGood targeted fixes. The VerdictApprove — consistency and ordering remarks are optional. |
What does it do?
Adds
logManagerAction()calls to Package Installer processors so that install, upgrade, remove, uninstall, and version remove actions are recorded in the Manager Log.package_installorpackage_upgradeafter successful savepackage_removebefore removing the packagegetPrimaryKey()instead ofget('id')for correct primary key (signature)lexicon()with placeholder array instead of incorrectsprintf()Why is it needed?
Manager Log did not record package install/upgrade/remove actions, making it difficult to audit package management operations.
How to test
package_installpackage_upgradepackage_removeRelated issue(s)/PR(s)
Resolves #16453