Merge pull request 'Plugin protection: Only 1984-hosting-support and Patchstack when latter is active' (#3) from update/protect-plugins-2026a into main
Reviewed-on: #3 Reviewed-by: Sævar Bergur Sigurgeirsson <saevar@1984.is>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
/*
|
||||
* Plugin Name: 1984 Hosting Support
|
||||
* Version: 1.1.0
|
||||
* Version: 1.1.1
|
||||
* Author: 1984 ehf.
|
||||
* Author URI: https://1984.hosting
|
||||
* Description: Support plugin for 1984 Hosting customers.
|
||||
@@ -272,18 +272,21 @@ class HostingSupport1984 {
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
private function get_protected_plugins(): array {
|
||||
// Always protect this plugin from deactivation/deletion.
|
||||
$own = plugin_basename( __FILE__ );
|
||||
$protected = array( $own );
|
||||
|
||||
// Additionally protect Patchstack - but only while it is active.
|
||||
if ( $this->is_patchstack_active() ) {
|
||||
$protected[] = 'patchstack/patchstack.php';
|
||||
private function get_protected_plugins(): array {
|
||||
if ( ! $this->is_patchstack_active() ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user