Plugin protection: Only 1984-hosting-support and Patchstack when latter is active #3

Merged
gdh merged 2 commits from update/protect-plugins-2026a into main 2026-01-06 14:52:39 +00:00
Showing only changes of commit 477b87b5a4 - Show all commits

View File

@@ -272,18 +272,21 @@ class HostingSupport1984 {
* *
* @return string[] * @return string[]
*/ */
private function get_protected_plugins(): array { private function get_protected_plugins(): array {
// Always protect this plugin from deactivation/deletion. if ( ! $this->is_patchstack_active() ) {
$own = plugin_basename( __FILE__ ); return array();
$protected = array( $own );
// Additionally protect Patchstack - but only while it is active.
if ( $this->is_patchstack_active() ) {
$protected[] = 'patchstack/patchstack.php';
} }
return $protected; // Protect this plugin.
} $own = plugin_basename( __FILE__ );
$protected = array( $own );
// Also protect Patchstack.
$protected[] = 'patchstack/patchstack.php';
return $protected;
}
/** /**
* Intercept admin actions attempting to deactivate or delete protected plugins and block them. * Intercept admin actions attempting to deactivate or delete protected plugins and block them.