-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
We are getting a lot of errors in the log about MagicPreview because the extra is not installed.
- VersionX 3.2.1-pl
- Modx 3.1.2-pl
- PHP 8.3
[2025-07-10 13:59:18] (ERROR @ /var/web/public_html/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 667) Could not load class: MagicPreview from magicpreview
[2025-07-10 13:59:18] (ERROR @ /var/web/public_html/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 1273) Problem getting service magicpreview, instance of class MagicPreview, from path /var/web/public_html/core/components/magicpreview/model/magicpreview/
Our current workaround is to add an extra check if $path exists to the magicPreviewLoaded() function:
public function magicPreviewLoaded(): bool
{
$path = $this->modx->getOption(
'magicpreview.core_path',
[],
$this->modx->getOption('core_path') . 'components/magicpreview/'
) . 'model/magicpreview/';
if (!file_exists($path) || !$magicPreview = $this->modx->getService('magicpreview', 'MagicPreview', $path)) {
return false;
}
return version_compare($magicPreview::VERSION, '1.5.1-pl', '>=');
}
Copilot
Metadata
Metadata
Assignees
Labels
No labels