← All changes
|
backend/src/Services/InstallActions/ActivationNewSiteMultisite.php
+4
-8
0.3
→
1.5
View file →
| @@ -5,12 +5,9 @@ | ||
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | 7 | namespace IvyForms\Services\InstallActions; |
| 8 | 8 | |
| 9 | -// phpcs:disable PSR1.Files.SideEffects | |
| 10 | -if (!defined('ABSPATH')) { | |
| 11 | - exit; // Exit if accessed directly | |
| 12 | -} | |
| 9 | +use IvyForms\Common\Exceptions\InvalidArgumentException; | |
| 13 | 10 | |
| 14 | 11 | /** |
| 15 | 12 | * Class ActivationNewSiteMultisite |
| 16 | 13 | * |
| @@ -21,8 +18,9 @@ | ||
| 21 | 18 | /** |
| 22 | 19 | * Activate the plugin for every newly created site if the plugin is network activated |
| 23 | 20 | * |
| 24 | 21 | * @param int $siteId |
| 22 | + * @throws InvalidArgumentException | |
| 25 | 23 | */ |
| 26 | 24 | public static function init(int $siteId): void |
| 27 | 25 | { |
| 28 | 26 | if (! function_exists('is_plugin_active_for_network')) { |
| @@ -30,15 +28,13 @@ | ||
| 30 | 28 | require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 31 | 29 | } |
| 32 | 30 | } |
| 33 | 31 | |
| 34 | - if ( | |
| 35 | - defined('IVYFORMS_PLUGIN_SLUG') && | |
| 36 | - is_plugin_active_for_network(IVYFORMS_PLUGIN_SLUG) // @phpstan-ignore argument.type | |
| 37 | - ) { | |
| 32 | + if (defined('IVYFORMS_PLUGIN_SLUG') && is_plugin_active_for_network(IVYFORMS_PLUGIN_SLUG)) { | |
| 38 | 33 | switch_to_blog($siteId); |
| 39 | 34 | //Create database table if not exists |
| 40 | 35 | ActivationDatabaseHook::init(); |
| 36 | + ActivationCapabilitiesHook::ensureAdministratorCaps(); | |
| 41 | 37 | restore_current_blog(); |
| 42 | 38 | } |
| 43 | 39 | } |
| 44 | 40 | } |