fix: skip all postflight actions on uninstall, add install warnings
Generic: Repo Health / Scripts governance (push) Has been cancelled
Generic: Repo Health / Repository health (push) Has been cancelled
Generic: Repo Health / Report Issues (push) Has been cancelled
Generic: Repo Health / Site Health (push) Has been cancelled
Generic: Repo Health / Access control (push) Has been cancelled
Universal: Auto Version Bump / Version Bump (push) Has been cancelled
Generic: Repo Health / Scripts governance (push) Has been cancelled
Generic: Repo Health / Repository health (push) Has been cancelled
Generic: Repo Health / Report Issues (push) Has been cancelled
Generic: Repo Health / Site Health (push) Has been cancelled
Generic: Repo Health / Access control (push) Has been cancelled
Universal: Auto Version Bump / Version Bump (push) Has been cancelled
- Early return on uninstall to prevent license warning, menu sync, and default-dir check from running during package removal - Add warnDefaultBackupDir() — warns on install/update if any profile uses the default web-root backup directory - Add profile review reminder on fresh install with link to profiles view
This commit is contained in:
+51
-3
@@ -213,12 +213,60 @@ class Pkg_MokoJoomBackupInstallerScript
|
||||
}
|
||||
}
|
||||
|
||||
if ($type === 'uninstall') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Sync submenu icons in #__menu (Joomla doesn't update icons on upgrades)
|
||||
$this->syncMenuIcons();
|
||||
|
||||
// Warn if no license key configured (skip on uninstall)
|
||||
if ($type !== 'uninstall') {
|
||||
$this->warnMissingLicenseKey();
|
||||
// Warn if no license key configured
|
||||
$this->warnMissingLicenseKey();
|
||||
|
||||
// Warn if any profile still uses the default backup directory
|
||||
$this->warnDefaultBackupDir();
|
||||
|
||||
// Remind user to review backup profile settings
|
||||
if ($type === 'install') {
|
||||
$profileUrl = Route::_('index.php?option=com_mokojoombackup&view=profiles');
|
||||
|
||||
Factory::getApplication()->enqueueMessage(
|
||||
'<strong>Review Your Backup Settings</strong> — '
|
||||
. 'A default backup profile has been created. Review the profile settings to configure '
|
||||
. 'backup type, schedule, storage location, and notifications. '
|
||||
. '<a href="' . $profileUrl . '" class="btn btn-sm btn-primary ms-2">Review Profiles</a>',
|
||||
'info'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private function warnDefaultBackupDir(): void
|
||||
{
|
||||
try {
|
||||
$db = Factory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('COUNT(*)')
|
||||
->from($db->quoteName('#__mokojoombackup_profiles'))
|
||||
->where($db->quoteName('published') . ' = 1')
|
||||
->where('(' . $db->quoteName('backup_dir') . ' = ' . $db->quote('administrator/components/com_mokojoombackup/backups')
|
||||
. ' OR ' . $db->quoteName('backup_dir') . ' = ' . $db->quote('[DEFAULT_DIR]')
|
||||
. ' OR ' . $db->quoteName('backup_dir') . ' = ' . $db->quote('')
|
||||
. ' OR ' . $db->quoteName('backup_dir') . ' IS NULL)');
|
||||
$db->setQuery($query);
|
||||
|
||||
if ((int) $db->loadResult() > 0) {
|
||||
$profileUrl = Route::_('index.php?option=com_mokojoombackup&view=profiles');
|
||||
|
||||
Factory::getApplication()->enqueueMessage(
|
||||
'<strong>Backup Directory Warning</strong> — '
|
||||
. 'One or more profiles store backups in the default directory inside the web root. '
|
||||
. 'For better security, configure a backup directory outside the web root. '
|
||||
. '<a href="' . $profileUrl . '" class="btn btn-sm btn-warning ms-2">Edit Profiles</a>',
|
||||
'warning'
|
||||
);
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
error_log('MokoJoomBackup: warnDefaultBackupDir() failed: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user